Commit cf3c3472 authored by Tobias Hunger's avatar Tobias Hunger

CodePaster: Modernize

* Use pragma once
* Make some slots private members

Change-Id: Iebc593f4cd6c690bedfcd1d4dfeb0882bf78ec74
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent c7a6221e
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef CODEPASTERSERVICE_H
#define CODEPASTERSERVICE_H
#pragma once
#include <QObject>
#include <QString>
......@@ -41,11 +40,8 @@ public:
virtual void postClipboard() = 0;
};
} // CodePaster
} // namespace CodePaster
QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(CodePaster::Service, "CodePaster::Service")
QT_END_NAMESPACE
#endif // CODEPASTERSERVICE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef COLUMNINDICATORTEXTEDIT_H
#define COLUMNINDICATORTEXTEDIT_H
#pragma once
#include <QTextEdit>
......@@ -45,6 +44,5 @@ private:
int m_columnIndicator = 0;
QFont m_columnIndicatorFont;
};
} // namespace CodePaster
#endif // COLUMNINDICATORTEXTEDIT_H
} // namespace CodePaster
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef CPASTERCONSTANTS_H
#define CPASTERCONSTANTS_H
#pragma once
#include <QtGlobal>
......@@ -37,5 +36,3 @@ const char SETTINGS_CATEGORY_CPASTER_ICON[] = ":/cpaster/images/category_cpaster
} // namespace Constants
} // namespace CodePaster
#endif // CPASTERCONSTANTS_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef CPASTERPLUGIN_H
#define CPASTERPLUGIN_H
#pragma once
#include "codepasterservice.h"
......@@ -40,7 +39,7 @@ QT_END_NAMESPACE
namespace CodePaster {
class CustomFetcher;
class CustomPoster;
struct Settings;
class Settings;
class Protocol;
class CodePasterServiceImpl : public QObject, public CodePaster::Service
......@@ -77,7 +76,10 @@ public:
static CodepasterPlugin *instance();
public slots:
void post(PasteSources pasteSources);
void post(QString data, const QString &mimeType);
private:
void pasteSnippet();
void fetch();
void finishPost(const QString &link);
......@@ -85,10 +87,7 @@ public slots:
const QString &content,
bool error);
void post(PasteSources pasteSources);
void post(QString data, const QString &mimeType);
void fetchUrl();
private:
static CodepasterPlugin *m_instance;
const QSharedPointer<Settings> m_settings;
......@@ -103,5 +102,3 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(CodepasterPlugin::PasteSources)
} // namespace CodePaster
#endif // CPASTERPLUGIN_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef FILESHAREPROTOCOL_H
#define FILESHAREPROTOCOL_H
#pragma once
#include "protocol.h"
......@@ -33,7 +32,7 @@
namespace CodePaster {
class FileShareProtocolSettingsPage;
struct FileShareProtocolSettings;
class FileShareProtocolSettings;
/* FileShareProtocol: Allows for pasting via a shared network
* drive by writing XML files. */
......@@ -66,5 +65,3 @@ private:
};
} // namespace CodePaster
#endif // FILESHAREPROTOCOL_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef FILESHAREPROTOCOLSETTINGSPAGE_H
#define FILESHAREPROTOCOLSETTINGSPAGE_H
#pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include "ui_fileshareprotocolsettingswidget.h"
......@@ -39,7 +38,8 @@ QT_END_NAMESPACE
namespace CodePaster {
struct FileShareProtocolSettings {
class FileShareProtocolSettings {
public:
FileShareProtocolSettings();
void toSettings(QSettings *) const;
void fromSettings(const QSettings *);
......@@ -74,14 +74,12 @@ public:
explicit FileShareProtocolSettingsPage(const QSharedPointer<FileShareProtocolSettings> &s,
QObject *parent = 0);
QWidget *widget();
void apply();
void finish() { }
QWidget *widget() override;
void apply() override;
void finish() override { }
private:
const QSharedPointer<FileShareProtocolSettings> m_settings;
QPointer<FileShareProtocolSettingsWidget> m_widget;
};
} // namespace CodePaster
#endif // FILESHAREPROTOCOLSETTINGSPAGE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef KDEPASTE_H
#define KDEPASTE_H
#pragma once
#include "protocol.h"
......@@ -50,15 +49,14 @@ public:
QString hostUrl() const { return m_hostUrl; }
void setHostUrl(const QString &hostUrl);
public slots:
void fetchFinished();
void pasteFinished();
void listFinished();
protected:
bool checkConfiguration(QString *errorMessage = 0) override;
private:
void fetchFinished();
void pasteFinished();
void listFinished();
QString m_hostUrl;
QNetworkReply *m_fetchReply = nullptr;
......@@ -78,10 +76,8 @@ public:
setHostUrl(QLatin1String("https://pastebin.kde.org/"));
}
QString name() const { return protocolName(); }
QString name() const override { return protocolName(); }
static QString protocolName();
};
} // namespace CodePaster
#endif // KDEPASTE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PASTEBINDOTCAPROTOCOL_H
#define PASTEBINDOTCAPROTOCOL_H
#pragma once
#include "protocol.h"
......@@ -48,15 +47,14 @@ public:
const QString &description = QString()) override;
void list() override;
public slots:
void fetchFinished();
void listFinished();
void pasteFinished();
protected:
bool checkConfiguration(QString *errorMessage) override;
private:
void fetchFinished();
void listFinished();
void pasteFinished();
QNetworkReply *m_fetchReply = nullptr;
QNetworkReply *m_listReply = nullptr;
QNetworkReply *m_pasteReply = nullptr;
......@@ -65,4 +63,3 @@ private:
};
} // namespace CodePaster
#endif // PASTEBINDOTCAPROTOCOL_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PASTEBINDOTCOMPROTOCOL_H
#define PASTEBINDOTCOMPROTOCOL_H
#pragma once
#include "protocol.h"
......@@ -48,12 +47,11 @@ public:
const QString &description = QString()) override;
void list() override;
public slots:
private:
void fetchFinished();
void pasteFinished();
void listFinished();
private:
QNetworkReply *m_fetchReply = nullptr;
QNetworkReply *m_pasteReply = nullptr;
QNetworkReply *m_listReply = nullptr;
......@@ -62,5 +60,5 @@ private:
int m_postId = -1;
bool m_hostChecked = false;
};
} // namespace CodePaster
#endif // PASTEBINDOTCOMPROTOCOL_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PASTESELECTDIALOG_H
#define PASTESELECTDIALOG_H
#pragma once
#include "ui_pasteselect.h"
......@@ -50,14 +49,11 @@ public:
int protocolIndex() const;
signals:
private slots:
private:
void protocolChanged(int);
void list();
void listDone(const QString &name, const QStringList &items);
private:
const QList<Protocol*> m_protocols;
Internal::Ui::PasteSelectDialog m_ui;
......@@ -65,5 +61,3 @@ private:
};
} // namespace CodePaster
#endif // PASTESELECTDIALOG_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PASTEVIEW_H
#define PASTEVIEW_H
#pragma once
#include "ui_pasteview.h"
......@@ -70,11 +69,10 @@ public:
void accept() override;
private slots:
private:
void contentChanged();
void protocolChanged(int);
private:
void setupDialog(const QString &user, const QString &description, const QString &comment);
int showDialog();
......@@ -86,5 +84,5 @@ private:
FileDataList m_parts;
Mode m_mode = DiffChunkMode;
};
} // namespace CodePaster
#endif // VIEW_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#pragma once
#include <QObject>
#include <QScopedPointer>
......@@ -55,7 +54,7 @@ public:
PostUserNameCapability = 0x8
};
virtual ~Protocol();
~Protocol() override;
virtual QString name() const = 0;
......@@ -108,7 +107,7 @@ class NetworkProtocol : public Protocol
Q_OBJECT
public:
virtual ~NetworkProtocol();
~NetworkProtocol() override;
protected:
QNetworkReply *httpGet(const QString &url);
......@@ -120,5 +119,3 @@ protected:
};
} //namespace CodePaster
#endif // PROTOCOL_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef SETTINGS_H
#define SETTINGS_H
#pragma once
#include <QString>
......@@ -34,7 +33,8 @@ QT_END_NAMESPACE
namespace CodePaster {
struct Settings {
class Settings {
public:
void toSettings(QSettings *s) const;
void fromSettings(const QSettings *s);
bool equals(const Settings &s) const;
......@@ -50,5 +50,3 @@ inline bool operator==(const Settings &s1, const Settings &s2) { return s1.equal
inline bool operator!=(const Settings &s1, const Settings &s2) { return !s1.equals(s2); }
} // namespace CodePaster
#endif // SETTINGS_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef SETTINGSPAGE_H
#define SETTINGSPAGE_H
#pragma once
#include "ui_settingspage.h"
......@@ -36,7 +35,7 @@
namespace CodePaster {
struct Settings;
class Settings;
class SettingsWidget : public QWidget
{
......@@ -74,5 +73,3 @@ private:
};
} // namespace CodePaster
#endif // SETTINGSPAGE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef URLOPENPROTOCOL_H
#define URLOPENPROTOCOL_H
#pragma once
#include "protocol.h"
......@@ -46,6 +45,4 @@ private:
QNetworkReply *m_fetchReply = nullptr;
};
}
#endif // URLOPENPROTOCOL_H
} // namespace CodePaster
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