diff options
author | hjk <hjk@qt.io> | 2020-01-24 18:34:57 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-27 08:25:04 +0000 |
commit | 461d278a35a8f65e81583475637bcf203481ab07 (patch) | |
tree | 2cc22e90a394a4375ca49dd7cbe645a31750aa87 /src/plugins/cpaster/cpasterplugin.h | |
parent | 37188ee3a1fce6f04432b0d6fd76559142de81f0 (diff) |
CPaster: Pimpl plugin
Change-Id: I595222c374be30bfc3f32897a6096a528188cfc5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cpaster/cpasterplugin.h')
-rw-r--r-- | src/plugins/cpaster/cpasterplugin.h | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/src/plugins/cpaster/cpasterplugin.h b/src/plugins/cpaster/cpasterplugin.h index 35342aa4315..c5dec40cc87 100644 --- a/src/plugins/cpaster/cpasterplugin.h +++ b/src/plugins/cpaster/cpasterplugin.h @@ -29,29 +29,27 @@ #include <extensionsystem/iplugin.h> -#include <QStringList> - -QT_BEGIN_NAMESPACE -class QAction; -QT_END_NAMESPACE - namespace CodePaster { -class Settings; -class Protocol; -class CodePasterServiceImpl : public QObject, public CodePaster::Service +class CodePasterPluginPrivate; + +class CodePasterServiceImpl final : public QObject, public CodePaster::Service { Q_OBJECT Q_INTERFACES(CodePaster::Service) + public: - explicit CodePasterServiceImpl(QObject *parent = nullptr); + explicit CodePasterServiceImpl(CodePasterPluginPrivate *d); + +private: + void postText(const QString &text, const QString &mimeType) final; + void postCurrentEditor() final; + void postClipboard() final; - void postText(const QString &text, const QString &mimeType) override; - void postCurrentEditor() override; - void postClipboard() override; + CodePasterPluginPrivate *d = nullptr; }; -class CodepasterPlugin : public ExtensionSystem::IPlugin +class CodePasterPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CodePaster.json") @@ -63,38 +61,17 @@ public: }; Q_DECLARE_FLAGS(PasteSources, PasteSource) - CodepasterPlugin(); - ~CodepasterPlugin() override; - - bool initialize(const QStringList &arguments, QString *errorMessage) override; - void extensionsInitialized() override; - ShutdownFlag aboutToShutdown() override; - - static CodepasterPlugin *instance(); - - void post(PasteSources pasteSources); - void post(QString data, const QString &mimeType); + CodePasterPlugin() = default; + ~CodePasterPlugin() final; private: - void pasteSnippet(); - void fetch(); - void finishPost(const QString &link); - void finishFetch(const QString &titleDescription, - const QString &content, - bool error); - - void fetchUrl(); - - static CodepasterPlugin *m_instance; - Settings *m_settings = nullptr; - QAction *m_postEditorAction = nullptr; - QAction *m_fetchAction = nullptr; - QAction *m_fetchUrlAction = nullptr; - QList<Protocol*> m_protocols; - QStringList m_fetchedSnippets; - Protocol *m_urlOpen = nullptr; + bool initialize(const QStringList &arguments, QString *errorMessage) final; + void extensionsInitialized() final {} + ShutdownFlag aboutToShutdown() final; + + CodePasterPluginPrivate *d = nullptr; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(CodepasterPlugin::PasteSources) +Q_DECLARE_OPERATORS_FOR_FLAGS(CodePasterPlugin::PasteSources) } // namespace CodePaster |