diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-17 13:14:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-17 12:22:06 +0000 |
commit | c383535d5c3f5eb764cb341131b2cbd87ebfb327 (patch) | |
tree | d16c5cf9ba668cc2f5eaa178e295077a4ee1258b /src/plugins/cpaster | |
parent | 27384b8b6e77c7a098218d8428c7741acc9ebcb7 (diff) | |
download | qt-creator-c383535d5c3f5eb764cb341131b2cbd87ebfb327.tar.gz |
CPaster: Introduce member initialization.
Remove/simplify constructors accordingly.
Change-Id: I27ac0281a89dfadefb1f7837d99ce185745b7aae
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpaster')
-rw-r--r-- | src/plugins/cpaster/columnindicatortextedit.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/columnindicatortextedit.h | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/cpasterplugin.cpp | 3 | ||||
-rw-r--r-- | src/plugins/cpaster/cpasterplugin.h | 8 | ||||
-rw-r--r-- | src/plugins/cpaster/kdepasteprotocol.cpp | 9 | ||||
-rw-r--r-- | src/plugins/cpaster/kdepasteprotocol.h | 12 | ||||
-rw-r--r-- | src/plugins/cpaster/pastebindotcaprotocol.cpp | 7 | ||||
-rw-r--r-- | src/plugins/cpaster/pastebindotcaprotocol.h | 10 | ||||
-rw-r--r-- | src/plugins/cpaster/pastebindotcomprotocol.cpp | 9 | ||||
-rw-r--r-- | src/plugins/cpaster/pastebindotcomprotocol.h | 12 | ||||
-rw-r--r-- | src/plugins/cpaster/pasteview.cpp | 3 | ||||
-rw-r--r-- | src/plugins/cpaster/pasteview.h | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/settings.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cpaster/settings.h | 7 | ||||
-rw-r--r-- | src/plugins/cpaster/urlopenprotocol.cpp | 5 | ||||
-rw-r--r-- | src/plugins/cpaster/urlopenprotocol.h | 4 |
16 files changed, 27 insertions, 72 deletions
diff --git a/src/plugins/cpaster/columnindicatortextedit.cpp b/src/plugins/cpaster/columnindicatortextedit.cpp index a27159bbd6..2304e7bf34 100644 --- a/src/plugins/cpaster/columnindicatortextedit.cpp +++ b/src/plugins/cpaster/columnindicatortextedit.cpp @@ -36,7 +36,7 @@ namespace CodePaster { ColumnIndicatorTextEdit::ColumnIndicatorTextEdit(QWidget *parent) : - QTextEdit(parent), m_columnIndicator(0) + QTextEdit(parent) { QFont font; font.setFamily(QLatin1String("Courier New")); diff --git a/src/plugins/cpaster/columnindicatortextedit.h b/src/plugins/cpaster/columnindicatortextedit.h index d85695a7a8..93796d92fe 100644 --- a/src/plugins/cpaster/columnindicatortextedit.h +++ b/src/plugins/cpaster/columnindicatortextedit.h @@ -47,7 +47,7 @@ protected: virtual void paintEvent(QPaintEvent *event); private: - int m_columnIndicator; + int m_columnIndicator = 0; QFont m_columnIndicatorFont; }; } // namespace CodePaster diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 083394205e..462d949ea4 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -105,8 +105,7 @@ void CodePasterService::postClipboard() CodepasterPlugin *CodepasterPlugin::m_instance = 0; CodepasterPlugin::CodepasterPlugin() : - m_settings(new Settings), - m_postEditorAction(0), m_fetchAction(0) + m_settings(new Settings) { CodepasterPlugin::m_instance = this; } diff --git a/src/plugins/cpaster/cpasterplugin.h b/src/plugins/cpaster/cpasterplugin.h index a7ada6b001..3ac41a767e 100644 --- a/src/plugins/cpaster/cpasterplugin.h +++ b/src/plugins/cpaster/cpasterplugin.h @@ -94,12 +94,12 @@ private: static CodepasterPlugin *m_instance; const QSharedPointer<Settings> m_settings; - QAction *m_postEditorAction; - QAction *m_fetchAction; - QAction *m_fetchUrlAction; + QAction *m_postEditorAction = nullptr; + QAction *m_fetchAction = nullptr; + QAction *m_fetchUrlAction = nullptr; QList<Protocol*> m_protocols; QStringList m_fetchedSnippets; - Protocol *m_urlOpen; + Protocol *m_urlOpen = nullptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(CodepasterPlugin::PasteSources) diff --git a/src/plugins/cpaster/kdepasteprotocol.cpp b/src/plugins/cpaster/kdepasteprotocol.cpp index 498fb98125..0eaede1140 100644 --- a/src/plugins/cpaster/kdepasteprotocol.cpp +++ b/src/plugins/cpaster/kdepasteprotocol.cpp @@ -56,15 +56,6 @@ static inline QByteArray expiryParameter(int daysRequested) } namespace CodePaster { -StickyNotesPasteProtocol::StickyNotesPasteProtocol() : - m_fetchReply(0), - m_pasteReply(0), - m_listReply(0), - m_fetchId(-1), - m_postId(-1), - m_hostChecked(false) -{ -} void StickyNotesPasteProtocol::setHostUrl(const QString &hostUrl) { diff --git a/src/plugins/cpaster/kdepasteprotocol.h b/src/plugins/cpaster/kdepasteprotocol.h index df3621f875..76bff75c9d 100644 --- a/src/plugins/cpaster/kdepasteprotocol.h +++ b/src/plugins/cpaster/kdepasteprotocol.h @@ -39,8 +39,6 @@ class StickyNotesPasteProtocol : public NetworkProtocol { Q_OBJECT public: - StickyNotesPasteProtocol(); - virtual unsigned capabilities() const; virtual void fetch(const QString &id); @@ -68,13 +66,13 @@ protected: private: QString m_hostUrl; - QNetworkReply *m_fetchReply; - QNetworkReply *m_pasteReply; - QNetworkReply *m_listReply; + QNetworkReply *m_fetchReply = nullptr; + QNetworkReply *m_pasteReply = nullptr; + QNetworkReply *m_listReply = nullptr; QString m_fetchId; - int m_postId; - bool m_hostChecked; + int m_postId = -1; + bool m_hostChecked = false; }; class KdePasteProtocol : public StickyNotesPasteProtocol diff --git a/src/plugins/cpaster/pastebindotcaprotocol.cpp b/src/plugins/cpaster/pastebindotcaprotocol.cpp index 8e8a53db85..cada4df493 100644 --- a/src/plugins/cpaster/pastebindotcaprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcaprotocol.cpp @@ -63,13 +63,6 @@ static inline QByteArray expiryValue(int expiryDays) } namespace CodePaster { -PasteBinDotCaProtocol::PasteBinDotCaProtocol() : - m_fetchReply(0), - m_listReply(0), - m_pasteReply(0), - m_hostChecked(false) -{ -} QString PasteBinDotCaProtocol::protocolName() { diff --git a/src/plugins/cpaster/pastebindotcaprotocol.h b/src/plugins/cpaster/pastebindotcaprotocol.h index b5440da6f5..445afa710c 100644 --- a/src/plugins/cpaster/pastebindotcaprotocol.h +++ b/src/plugins/cpaster/pastebindotcaprotocol.h @@ -38,8 +38,6 @@ class PasteBinDotCaProtocol : public NetworkProtocol { Q_OBJECT public: - explicit PasteBinDotCaProtocol(); - static QString protocolName(); QString name() const { return protocolName(); } @@ -64,11 +62,11 @@ protected: virtual bool checkConfiguration(QString *errorMessage); private: - QNetworkReply *m_fetchReply; - QNetworkReply *m_listReply; - QNetworkReply *m_pasteReply; + QNetworkReply *m_fetchReply = nullptr; + QNetworkReply *m_listReply = nullptr; + QNetworkReply *m_pasteReply = nullptr; QString m_fetchId; - bool m_hostChecked; + bool m_hostChecked = false; }; } // namespace CodePaster diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp index e06ac4f6ae..d74855fe7d 100644 --- a/src/plugins/cpaster/pastebindotcomprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp @@ -52,15 +52,6 @@ static const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; // static const char PROTOCOL_NAME[] = "Pastebin.Com"; namespace CodePaster { -PasteBinDotComProtocol::PasteBinDotComProtocol() : - m_fetchReply(0), - m_pasteReply(0), - m_listReply(0), - m_fetchId(-1), - m_postId(-1), - m_hostChecked(false) -{ -} QString PasteBinDotComProtocol::protocolName() { diff --git a/src/plugins/cpaster/pastebindotcomprotocol.h b/src/plugins/cpaster/pastebindotcomprotocol.h index a310940808..f9000e10f5 100644 --- a/src/plugins/cpaster/pastebindotcomprotocol.h +++ b/src/plugins/cpaster/pastebindotcomprotocol.h @@ -39,8 +39,6 @@ class PasteBinDotComProtocol : public NetworkProtocol { Q_OBJECT public: - PasteBinDotComProtocol(); - static QString protocolName(); QString name() const { return protocolName(); } @@ -61,13 +59,13 @@ public slots: void listFinished(); private: - QNetworkReply *m_fetchReply; - QNetworkReply *m_pasteReply; - QNetworkReply *m_listReply; + QNetworkReply *m_fetchReply = nullptr; + QNetworkReply *m_pasteReply = nullptr; + QNetworkReply *m_listReply = nullptr; QString m_fetchId; - int m_postId; - bool m_hostChecked; + int m_postId = -1; + bool m_hostChecked = false; }; } // namespace CodePaster #endif // PASTEBINDOTCOMPROTOCOL_H diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp index 3bd9b7f4a4..033bfc8475 100644 --- a/src/plugins/cpaster/pasteview.cpp +++ b/src/plugins/cpaster/pasteview.cpp @@ -49,8 +49,7 @@ PasteView::PasteView(const QList<Protocol *> &protocols, QDialog(parent), m_protocols(protocols), m_commentPlaceHolder(tr("<Comment>")), - m_mimeType(mt), - m_mode(DiffChunkMode) + m_mimeType(mt) { m_ui.setupUi(this); diff --git a/src/plugins/cpaster/pasteview.h b/src/plugins/cpaster/pasteview.h index 13a1b3d324..dd0abb1321 100644 --- a/src/plugins/cpaster/pasteview.h +++ b/src/plugins/cpaster/pasteview.h @@ -89,7 +89,7 @@ private: Internal::Ui::ViewDialog m_ui; FileDataList m_parts; - Mode m_mode; + Mode m_mode = DiffChunkMode; }; } // namespace CodePaster #endif // VIEW_H diff --git a/src/plugins/cpaster/settings.cpp b/src/plugins/cpaster/settings.cpp index 8c045375f5..3dec2705bc 100644 --- a/src/plugins/cpaster/settings.cpp +++ b/src/plugins/cpaster/settings.cpp @@ -44,10 +44,6 @@ static const char displayOutputKeyC[] = "DisplayOutput"; namespace CodePaster { -Settings::Settings() : expiryDays(1), copyToClipboard(true), displayOutput(true) -{ -} - bool Settings::equals(const Settings &rhs) const { return copyToClipboard == rhs.copyToClipboard && displayOutput == rhs.displayOutput diff --git a/src/plugins/cpaster/settings.h b/src/plugins/cpaster/settings.h index d8a3f8e95b..ad2d6e8935 100644 --- a/src/plugins/cpaster/settings.h +++ b/src/plugins/cpaster/settings.h @@ -40,16 +40,15 @@ QT_END_NAMESPACE namespace CodePaster { struct Settings { - Settings(); void toSettings(QSettings *s) const; void fromSettings(const QSettings *s); bool equals(const Settings &s) const; QString username; QString protocol; - int expiryDays; - bool copyToClipboard; - bool displayOutput; + int expiryDays = 1; + bool copyToClipboard = true; + bool displayOutput = true; }; inline bool operator==(const Settings &s1, const Settings &s2) { return s1.equals(s2); } diff --git a/src/plugins/cpaster/urlopenprotocol.cpp b/src/plugins/cpaster/urlopenprotocol.cpp index 65eda4efe1..1d77569ff8 100644 --- a/src/plugins/cpaster/urlopenprotocol.cpp +++ b/src/plugins/cpaster/urlopenprotocol.cpp @@ -36,11 +36,6 @@ using namespace CodePaster; -UrlOpenProtocol::UrlOpenProtocol() - : m_fetchReply(0) -{ -} - QString UrlOpenProtocol::name() const { return QLatin1String("Open URL"); // unused diff --git a/src/plugins/cpaster/urlopenprotocol.h b/src/plugins/cpaster/urlopenprotocol.h index 397a9e3fdc..b0da855e65 100644 --- a/src/plugins/cpaster/urlopenprotocol.h +++ b/src/plugins/cpaster/urlopenprotocol.h @@ -39,8 +39,6 @@ class UrlOpenProtocol : public NetworkProtocol { Q_OBJECT public: - UrlOpenProtocol(); - QString name() const; unsigned capabilities() const; void fetch(const QString &url); @@ -50,7 +48,7 @@ private slots: void fetchFinished(); private: - QNetworkReply *m_fetchReply; + QNetworkReply *m_fetchReply = nullptr; }; } |