summaryrefslogtreecommitdiff
path: root/src/plugins/cpaster
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2018-11-04 23:43:17 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2018-11-08 10:22:59 +0000
commit26686c384fb950f6643a15400260c974e35a47a3 (patch)
tree9fac79bf6591a69749f9da75e13beecb9462639c /src/plugins/cpaster
parentbeda0205d1fd8b3c04ffdb0612679f20b06b1789 (diff)
downloadqt-creator-26686c384fb950f6643a15400260c974e35a47a3.tar.gz
CodePaster: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-equals-default Change-Id: I3d9fffef3bccc1a64e24acd0846da57b224ba801 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cpaster')
-rw-r--r--src/plugins/cpaster/codepasterservice.h2
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp4
-rw-r--r--src/plugins/cpaster/cpasterplugin.h2
-rw-r--r--src/plugins/cpaster/fileshareprotocol.cpp2
-rw-r--r--src/plugins/cpaster/fileshareprotocol.h2
-rw-r--r--src/plugins/cpaster/fileshareprotocolsettingspage.h4
-rw-r--r--src/plugins/cpaster/kdepasteprotocol.cpp4
-rw-r--r--src/plugins/cpaster/kdepasteprotocol.h2
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.cpp2
-rw-r--r--src/plugins/cpaster/pasteselectdialog.cpp4
-rw-r--r--src/plugins/cpaster/pasteselectdialog.h2
-rw-r--r--src/plugins/cpaster/pasteview.cpp6
-rw-r--r--src/plugins/cpaster/protocol.cpp10
-rw-r--r--src/plugins/cpaster/protocol.h6
-rw-r--r--src/plugins/cpaster/settingspage.cpp4
-rw-r--r--src/plugins/cpaster/settingspage.h2
16 files changed, 24 insertions, 34 deletions
diff --git a/src/plugins/cpaster/codepasterservice.h b/src/plugins/cpaster/codepasterservice.h
index 68f02f3bc8..dd2b1ba77c 100644
--- a/src/plugins/cpaster/codepasterservice.h
+++ b/src/plugins/cpaster/codepasterservice.h
@@ -33,7 +33,7 @@ namespace CodePaster {
class Service
{
public:
- virtual ~Service() {}
+ virtual ~Service() = default;
virtual void postText(const QString &text, const QString &mimeType) = 0;
virtual void postCurrentEditor() = 0;
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 1aad17f851..a101598e8b 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -116,7 +116,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
// Create the settings Page
m_settings->fromSettings(ICore::settings());
- SettingsPage *settingsPage = new SettingsPage(m_settings, this);
+ auto settingsPage = new SettingsPage(m_settings, this);
// Create the protocols and append them to the Settings
Protocol *protos[] = {new PasteBinDotComProtocol,
@@ -191,7 +191,7 @@ static inline void textFromCurrentEditor(QString *text, QString *mimeType)
return;
const IDocument *document = editor->document();
QString data;
- if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor))
+ if (auto textEditor = qobject_cast<const BaseTextEditor *>(editor))
data = textEditor->selectedText();
if (data.isEmpty()) {
if (auto textDocument = qobject_cast<const TextDocument *>(document)) {
diff --git a/src/plugins/cpaster/cpasterplugin.h b/src/plugins/cpaster/cpasterplugin.h
index 671fdbb71f..46207ca286 100644
--- a/src/plugins/cpaster/cpasterplugin.h
+++ b/src/plugins/cpaster/cpasterplugin.h
@@ -45,7 +45,7 @@ class CodePasterServiceImpl : public QObject, public CodePaster::Service
Q_OBJECT
Q_INTERFACES(CodePaster::Service)
public:
- explicit CodePasterServiceImpl(QObject *parent = 0);
+ explicit CodePasterServiceImpl(QObject *parent = nullptr);
void postText(const QString &text, const QString &mimeType) override;
void postCurrentEditor() override;
diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp
index 21a9796b74..3b821db4e3 100644
--- a/src/plugins/cpaster/fileshareprotocol.cpp
+++ b/src/plugins/cpaster/fileshareprotocol.cpp
@@ -143,7 +143,7 @@ void FileShareProtocol::fetch(const QString &id)
fi = QFileInfo(m_settings->path + QLatin1Char('/') + id);
QString errorMessage;
QString text;
- if (parse(fi.absoluteFilePath(), &errorMessage, 0, 0, &text))
+ if (parse(fi.absoluteFilePath(), &errorMessage, nullptr, nullptr, &text))
emit fetchDone(id, text, false);
else
emit fetchDone(id, errorMessage, true);
diff --git a/src/plugins/cpaster/fileshareprotocol.h b/src/plugins/cpaster/fileshareprotocol.h
index fb38901c0f..ea89e41f2a 100644
--- a/src/plugins/cpaster/fileshareprotocol.h
+++ b/src/plugins/cpaster/fileshareprotocol.h
@@ -50,7 +50,7 @@ public:
bool hasSettings() const override;
Core::IOptionsPage *settingsPage() const override;
- bool checkConfiguration(QString *errorMessage = 0) override;
+ bool checkConfiguration(QString *errorMessage = nullptr) override;
void fetch(const QString &id) override;
void list() override;
void paste(const QString &text,
diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.h b/src/plugins/cpaster/fileshareprotocolsettingspage.h
index 30e08716e6..491c4fe621 100644
--- a/src/plugins/cpaster/fileshareprotocolsettingspage.h
+++ b/src/plugins/cpaster/fileshareprotocolsettingspage.h
@@ -57,7 +57,7 @@ inline bool operator!=(const FileShareProtocolSettings &s1, const FileShareProto
class FileShareProtocolSettingsWidget : public QWidget {
Q_OBJECT
public:
- explicit FileShareProtocolSettingsWidget(QWidget *parent = 0);
+ explicit FileShareProtocolSettingsWidget(QWidget *parent = nullptr);
void setSettings(const FileShareProtocolSettings &);
FileShareProtocolSettings settings() const;
@@ -72,7 +72,7 @@ class FileShareProtocolSettingsPage : public Core::IOptionsPage
public:
explicit FileShareProtocolSettingsPage(const QSharedPointer<FileShareProtocolSettings> &s,
- QObject *parent = 0);
+ QObject *parent = nullptr);
QWidget *widget() override;
void apply() override;
diff --git a/src/plugins/cpaster/kdepasteprotocol.cpp b/src/plugins/cpaster/kdepasteprotocol.cpp
index 21c15897a0..030b30e0e5 100644
--- a/src/plugins/cpaster/kdepasteprotocol.cpp
+++ b/src/plugins/cpaster/kdepasteprotocol.cpp
@@ -169,7 +169,7 @@ void StickyNotesPasteProtocol::pasteFinished()
}
m_pasteReply->deleteLater();
- m_pasteReply = 0;
+ m_pasteReply = nullptr;
}
void StickyNotesPasteProtocol::fetch(const QString &id)
@@ -207,7 +207,7 @@ void StickyNotesPasteProtocol::fetchFinished()
content.remove(QLatin1Char('\r'));
}
m_fetchReply->deleteLater();
- m_fetchReply = 0;
+ m_fetchReply = nullptr;
emit fetchDone(title, content, error);
}
diff --git a/src/plugins/cpaster/kdepasteprotocol.h b/src/plugins/cpaster/kdepasteprotocol.h
index e7bbd1ba1d..c1875b1477 100644
--- a/src/plugins/cpaster/kdepasteprotocol.h
+++ b/src/plugins/cpaster/kdepasteprotocol.h
@@ -50,7 +50,7 @@ public:
void setHostUrl(const QString &hostUrl);
protected:
- bool checkConfiguration(QString *errorMessage = 0) override;
+ bool checkConfiguration(QString *errorMessage = nullptr) override;
private:
void fetchFinished();
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp
index 057e3cf8ea..86ae8f3f97 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp
@@ -135,7 +135,7 @@ void PasteBinDotComProtocol::pasteFinished()
emit pasteDone(QString::fromLatin1(m_pasteReply->readAll()));
m_pasteReply->deleteLater();
- m_pasteReply = 0;
+ m_pasteReply = nullptr;
}
void PasteBinDotComProtocol::fetch(const QString &id)
diff --git a/src/plugins/cpaster/pasteselectdialog.cpp b/src/plugins/cpaster/pasteselectdialog.cpp
index 48df0562fe..32337e48f0 100644
--- a/src/plugins/cpaster/pasteselectdialog.cpp
+++ b/src/plugins/cpaster/pasteselectdialog.cpp
@@ -60,9 +60,7 @@ PasteSelectDialog::PasteSelectDialog(const QList<Protocol*> &protocols,
m_ui.listWidget->setFont(listFont);
}
-PasteSelectDialog::~PasteSelectDialog()
-{
-}
+PasteSelectDialog::~PasteSelectDialog() = default;
QString PasteSelectDialog::pasteId() const
{
diff --git a/src/plugins/cpaster/pasteselectdialog.h b/src/plugins/cpaster/pasteselectdialog.h
index 94a84b1029..b6b57fae08 100644
--- a/src/plugins/cpaster/pasteselectdialog.h
+++ b/src/plugins/cpaster/pasteselectdialog.h
@@ -39,7 +39,7 @@ class PasteSelectDialog : public QDialog
Q_OBJECT
public:
explicit PasteSelectDialog(const QList<Protocol*> &protocols,
- QWidget *parent = 0);
+ QWidget *parent = nullptr);
~PasteSelectDialog() override;
QString pasteId() const;
diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp
index 7240359493..0035fe10d3 100644
--- a/src/plugins/cpaster/pasteview.cpp
+++ b/src/plugins/cpaster/pasteview.cpp
@@ -57,9 +57,7 @@ PasteView::PasteView(const QList<Protocol *> &protocols,
this, &PasteView::protocolChanged);
}
-PasteView::~PasteView()
-{
-}
+PasteView::~PasteView() = default;
QString PasteView::user() const
{
@@ -150,7 +148,7 @@ int PasteView::show(const QString &user, const QString &description,
m_mode = DiffChunkMode;
QString content;
foreach (const FileData &part, parts) {
- QListWidgetItem *itm = new QListWidgetItem(part.filename, m_ui.uiPatchList);
+ auto itm = new QListWidgetItem(part.filename, m_ui.uiPatchList);
itm->setCheckState(Qt::Checked);
itm->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
content += part.content;
diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp
index 61e9c2d91e..ba0b4b7ec3 100644
--- a/src/plugins/cpaster/protocol.cpp
+++ b/src/plugins/cpaster/protocol.cpp
@@ -59,9 +59,7 @@ Protocol::Protocol()
{
}
-Protocol::~Protocol()
-{
-}
+Protocol::~Protocol() = default;
bool Protocol::hasSettings() const
{
@@ -75,7 +73,7 @@ bool Protocol::checkConfiguration(QString *)
Core::IOptionsPage *Protocol::settingsPage() const
{
- return 0;
+ return nullptr;
}
void Protocol::list()
@@ -216,9 +214,7 @@ NetworkProtocol::NetworkProtocol()
this, &NetworkProtocol::authenticationRequired);
}
-NetworkProtocol::~NetworkProtocol()
-{
-}
+NetworkProtocol::~NetworkProtocol() = default;
void NetworkProtocol::requestAuthentication(const QUrl &url, QNetworkReply *reply, QAuthenticator *authenticator)
{
diff --git a/src/plugins/cpaster/protocol.h b/src/plugins/cpaster/protocol.h
index 20cad37612..0b1392656a 100644
--- a/src/plugins/cpaster/protocol.h
+++ b/src/plugins/cpaster/protocol.h
@@ -63,7 +63,7 @@ public:
virtual bool hasSettings() const;
virtual Core::IOptionsPage *settingsPage() const;
- virtual bool checkConfiguration(QString *errorMessage = 0);
+ virtual bool checkConfiguration(QString *errorMessage = nullptr);
virtual void fetch(const QString &id) = 0;
virtual void list();
virtual void paste(const QString &text,
@@ -80,11 +80,11 @@ public:
// Return true when settings changed.
static bool showConfigurationError(const Protocol *p,
const QString &message,
- QWidget *parent = 0,
+ QWidget *parent = nullptr,
bool showConfig = true);
// Ensure configuration is correct
static bool ensureConfiguration(Protocol *p,
- QWidget *parent = 0);
+ QWidget *parent = nullptr);
signals:
void pasteDone(const QString &link);
diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp
index 4f50ebda0f..1054b4500c 100644
--- a/src/plugins/cpaster/settingspage.cpp
+++ b/src/plugins/cpaster/settingspage.cpp
@@ -73,9 +73,7 @@ SettingsPage::SettingsPage(const QSharedPointer<Settings> &settings, QObject *pa
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
}
-SettingsPage::~SettingsPage()
-{
-}
+SettingsPage::~SettingsPage() = default;
QWidget *SettingsPage::widget()
{
diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h
index 3abfd0397a..e2b9715ead 100644
--- a/src/plugins/cpaster/settingspage.h
+++ b/src/plugins/cpaster/settingspage.h
@@ -42,7 +42,7 @@ class SettingsWidget : public QWidget
Q_OBJECT
public:
- explicit SettingsWidget(const QStringList &protocols, QWidget *parent = 0);
+ explicit SettingsWidget(const QStringList &protocols, QWidget *parent = nullptr);
void setSettings(const Settings &);
Settings settings();