Commit c383535d authored by Friedemann Kleint's avatar Friedemann Kleint

CPaster: Introduce member initialization.

Remove/simplify constructors accordingly.

Change-Id: I27ac0281a89dfadefb1f7837d99ce185745b7aae
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 27384b8b
......@@ -36,7 +36,7 @@
namespace CodePaster {
ColumnIndicatorTextEdit::ColumnIndicatorTextEdit(QWidget *parent) :
QTextEdit(parent), m_columnIndicator(0)
QTextEdit(parent)
{
QFont font;
font.setFamily(QLatin1String("Courier New"));
......
......@@ -47,7 +47,7 @@ protected:
virtual void paintEvent(QPaintEvent *event);
private:
int m_columnIndicator;
int m_columnIndicator = 0;
QFont m_columnIndicatorFont;
};
} // namespace CodePaster
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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)
{
......
......@@ -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
......
......@@ -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()
{
......
......@@ -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
......
......@@ -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()
{
......
......@@ -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
......@@ -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);
......
......@@ -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
......@@ -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
......
......@@ -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); }
......
......@@ -36,11 +36,6 @@
using namespace CodePaster;
UrlOpenProtocol::UrlOpenProtocol()
: m_fetchReply(0)
{
}
QString UrlOpenProtocol::name() const
{
return QLatin1String("Open URL"); // unused
......
......@@ -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;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment