forked from qt-creator/qt-creator
CPaster: Introduce member initialization.
Remove/simplify constructors accordingly. Change-Id: I27ac0281a89dfadefb1f7837d99ce185745b7aae Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
ColumnIndicatorTextEdit::ColumnIndicatorTextEdit(QWidget *parent) :
|
ColumnIndicatorTextEdit::ColumnIndicatorTextEdit(QWidget *parent) :
|
||||||
QTextEdit(parent), m_columnIndicator(0)
|
QTextEdit(parent)
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setFamily(QLatin1String("Courier New"));
|
font.setFamily(QLatin1String("Courier New"));
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ protected:
|
|||||||
virtual void paintEvent(QPaintEvent *event);
|
virtual void paintEvent(QPaintEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_columnIndicator;
|
int m_columnIndicator = 0;
|
||||||
QFont m_columnIndicatorFont;
|
QFont m_columnIndicatorFont;
|
||||||
};
|
};
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ void CodePasterService::postClipboard()
|
|||||||
CodepasterPlugin *CodepasterPlugin::m_instance = 0;
|
CodepasterPlugin *CodepasterPlugin::m_instance = 0;
|
||||||
|
|
||||||
CodepasterPlugin::CodepasterPlugin() :
|
CodepasterPlugin::CodepasterPlugin() :
|
||||||
m_settings(new Settings),
|
m_settings(new Settings)
|
||||||
m_postEditorAction(0), m_fetchAction(0)
|
|
||||||
{
|
{
|
||||||
CodepasterPlugin::m_instance = this;
|
CodepasterPlugin::m_instance = this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,12 +94,12 @@ private:
|
|||||||
|
|
||||||
static CodepasterPlugin *m_instance;
|
static CodepasterPlugin *m_instance;
|
||||||
const QSharedPointer<Settings> m_settings;
|
const QSharedPointer<Settings> m_settings;
|
||||||
QAction *m_postEditorAction;
|
QAction *m_postEditorAction = nullptr;
|
||||||
QAction *m_fetchAction;
|
QAction *m_fetchAction = nullptr;
|
||||||
QAction *m_fetchUrlAction;
|
QAction *m_fetchUrlAction = nullptr;
|
||||||
QList<Protocol*> m_protocols;
|
QList<Protocol*> m_protocols;
|
||||||
QStringList m_fetchedSnippets;
|
QStringList m_fetchedSnippets;
|
||||||
Protocol *m_urlOpen;
|
Protocol *m_urlOpen = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(CodepasterPlugin::PasteSources)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(CodepasterPlugin::PasteSources)
|
||||||
|
|||||||
@@ -56,15 +56,6 @@ static inline QByteArray expiryParameter(int daysRequested)
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CodePaster {
|
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)
|
void StickyNotesPasteProtocol::setHostUrl(const QString &hostUrl)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class StickyNotesPasteProtocol : public NetworkProtocol
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
StickyNotesPasteProtocol();
|
|
||||||
|
|
||||||
virtual unsigned capabilities() const;
|
virtual unsigned capabilities() const;
|
||||||
|
|
||||||
virtual void fetch(const QString &id);
|
virtual void fetch(const QString &id);
|
||||||
@@ -68,13 +66,13 @@ protected:
|
|||||||
private:
|
private:
|
||||||
QString m_hostUrl;
|
QString m_hostUrl;
|
||||||
|
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply = nullptr;
|
||||||
QNetworkReply *m_pasteReply;
|
QNetworkReply *m_pasteReply = nullptr;
|
||||||
QNetworkReply *m_listReply;
|
QNetworkReply *m_listReply = nullptr;
|
||||||
|
|
||||||
QString m_fetchId;
|
QString m_fetchId;
|
||||||
int m_postId;
|
int m_postId = -1;
|
||||||
bool m_hostChecked;
|
bool m_hostChecked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KdePasteProtocol : public StickyNotesPasteProtocol
|
class KdePasteProtocol : public StickyNotesPasteProtocol
|
||||||
|
|||||||
@@ -63,13 +63,6 @@ static inline QByteArray expiryValue(int expiryDays)
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
PasteBinDotCaProtocol::PasteBinDotCaProtocol() :
|
|
||||||
m_fetchReply(0),
|
|
||||||
m_listReply(0),
|
|
||||||
m_pasteReply(0),
|
|
||||||
m_hostChecked(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PasteBinDotCaProtocol::protocolName()
|
QString PasteBinDotCaProtocol::protocolName()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ class PasteBinDotCaProtocol : public NetworkProtocol
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PasteBinDotCaProtocol();
|
|
||||||
|
|
||||||
static QString protocolName();
|
static QString protocolName();
|
||||||
QString name() const { return protocolName(); }
|
QString name() const { return protocolName(); }
|
||||||
|
|
||||||
@@ -64,11 +62,11 @@ protected:
|
|||||||
virtual bool checkConfiguration(QString *errorMessage);
|
virtual bool checkConfiguration(QString *errorMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply = nullptr;
|
||||||
QNetworkReply *m_listReply;
|
QNetworkReply *m_listReply = nullptr;
|
||||||
QNetworkReply *m_pasteReply;
|
QNetworkReply *m_pasteReply = nullptr;
|
||||||
QString m_fetchId;
|
QString m_fetchId;
|
||||||
bool m_hostChecked;
|
bool m_hostChecked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
|
|||||||
@@ -52,15 +52,6 @@ static const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; //
|
|||||||
static const char PROTOCOL_NAME[] = "Pastebin.Com";
|
static const char PROTOCOL_NAME[] = "Pastebin.Com";
|
||||||
|
|
||||||
namespace CodePaster {
|
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()
|
QString PasteBinDotComProtocol::protocolName()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class PasteBinDotComProtocol : public NetworkProtocol
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PasteBinDotComProtocol();
|
|
||||||
|
|
||||||
static QString protocolName();
|
static QString protocolName();
|
||||||
QString name() const { return protocolName(); }
|
QString name() const { return protocolName(); }
|
||||||
|
|
||||||
@@ -61,13 +59,13 @@ public slots:
|
|||||||
void listFinished();
|
void listFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply = nullptr;
|
||||||
QNetworkReply *m_pasteReply;
|
QNetworkReply *m_pasteReply = nullptr;
|
||||||
QNetworkReply *m_listReply;
|
QNetworkReply *m_listReply = nullptr;
|
||||||
|
|
||||||
QString m_fetchId;
|
QString m_fetchId;
|
||||||
int m_postId;
|
int m_postId = -1;
|
||||||
bool m_hostChecked;
|
bool m_hostChecked = false;
|
||||||
};
|
};
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
#endif // PASTEBINDOTCOMPROTOCOL_H
|
#endif // PASTEBINDOTCOMPROTOCOL_H
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ PasteView::PasteView(const QList<Protocol *> &protocols,
|
|||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
m_protocols(protocols),
|
m_protocols(protocols),
|
||||||
m_commentPlaceHolder(tr("<Comment>")),
|
m_commentPlaceHolder(tr("<Comment>")),
|
||||||
m_mimeType(mt),
|
m_mimeType(mt)
|
||||||
m_mode(DiffChunkMode)
|
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ private:
|
|||||||
|
|
||||||
Internal::Ui::ViewDialog m_ui;
|
Internal::Ui::ViewDialog m_ui;
|
||||||
FileDataList m_parts;
|
FileDataList m_parts;
|
||||||
Mode m_mode;
|
Mode m_mode = DiffChunkMode;
|
||||||
};
|
};
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
#endif // VIEW_H
|
#endif // VIEW_H
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ static const char displayOutputKeyC[] = "DisplayOutput";
|
|||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
Settings::Settings() : expiryDays(1), copyToClipboard(true), displayOutput(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::equals(const Settings &rhs) const
|
bool Settings::equals(const Settings &rhs) const
|
||||||
{
|
{
|
||||||
return copyToClipboard == rhs.copyToClipboard && displayOutput == rhs.displayOutput
|
return copyToClipboard == rhs.copyToClipboard && displayOutput == rhs.displayOutput
|
||||||
|
|||||||
@@ -40,16 +40,15 @@ QT_END_NAMESPACE
|
|||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
Settings();
|
|
||||||
void toSettings(QSettings *s) const;
|
void toSettings(QSettings *s) const;
|
||||||
void fromSettings(const QSettings *s);
|
void fromSettings(const QSettings *s);
|
||||||
bool equals(const Settings &s) const;
|
bool equals(const Settings &s) const;
|
||||||
|
|
||||||
QString username;
|
QString username;
|
||||||
QString protocol;
|
QString protocol;
|
||||||
int expiryDays;
|
int expiryDays = 1;
|
||||||
bool copyToClipboard;
|
bool copyToClipboard = true;
|
||||||
bool displayOutput;
|
bool displayOutput = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const Settings &s1, const Settings &s2) { return s1.equals(s2); }
|
inline bool operator==(const Settings &s1, const Settings &s2) { return s1.equals(s2); }
|
||||||
|
|||||||
@@ -36,11 +36,6 @@
|
|||||||
|
|
||||||
using namespace CodePaster;
|
using namespace CodePaster;
|
||||||
|
|
||||||
UrlOpenProtocol::UrlOpenProtocol()
|
|
||||||
: m_fetchReply(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UrlOpenProtocol::name() const
|
QString UrlOpenProtocol::name() const
|
||||||
{
|
{
|
||||||
return QLatin1String("Open URL"); // unused
|
return QLatin1String("Open URL"); // unused
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class UrlOpenProtocol : public NetworkProtocol
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UrlOpenProtocol();
|
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
unsigned capabilities() const;
|
unsigned capabilities() const;
|
||||||
void fetch(const QString &url);
|
void fetch(const QString &url);
|
||||||
@@ -50,7 +48,7 @@ private slots:
|
|||||||
void fetchFinished();
|
void fetchFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user