diff options
author | hjk <hjk@qt.io> | 2020-01-23 17:22:05 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-24 09:47:28 +0000 |
commit | 1cd936c53145f520fb9a3817a6548d9d25c399f0 (patch) | |
tree | 2c1cc9c375b986b5d9a7abf3f982781256ae612d /src/plugins/perforce/perforceplugin.h | |
parent | 01e4f573e812c9c855a11d0cb199f9d9bed8de49 (diff) |
Vcs: Pimpl plugins
Essentially rename all *Plugin into *PluginPrivate, and pull out
the actual IPlugin related pieces into new *Plugin classes.
Shift the construction of the PluginPrivate to initialize(),
following the general pattern.
I tried to keep the patch as mechanical as possible, giving
room to some obvious but less mechanical cleanup needs,
that are intentionally left out of this here.
Change-Id: Iac662bf73338f9f7669064ed67b960246875c23c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/perforce/perforceplugin.h')
-rw-r--r-- | src/plugins/perforce/perforceplugin.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 6c1e7733579..eaf698aebae 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -69,16 +69,12 @@ struct PerforceResponse QString message; }; -class PerforcePlugin : public VcsBase::VcsBasePlugin +class PerforcePluginPrivate final : public VcsBase::VcsBasePluginPrivate { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json") public: - PerforcePlugin() = default; - - bool initialize(const QStringList &arguments, QString *errorMessage) override; - void extensionsInitialized() override; + PerforcePluginPrivate(); bool managesDirectory(const QString &directory, QString *topLevel = nullptr); bool managesFile(const QString &workingDirectory, const QString &fileName) const; @@ -103,15 +99,12 @@ public: void vcsAnnotate(const QString &workingDirectory, const QString &file, const QString &revision, int lineNumber); + static void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false); + protected: - void updateActions(VcsBase::VcsBasePlugin::ActionState) override; + void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; bool submitEditorAboutToClose() override; -#ifdef WITH_TESTS -private slots: - void testLogResolving(); -#endif - private: QString commitDisplayName() const final; void p4Diff(const PerforceDiffParameters &p); @@ -203,7 +196,6 @@ private: static QSharedPointer<Utils::TempFileSaver> createTemporaryArgumentFile(const QStringList &extraArgs, QString *errorString); - static void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false); QString pendingChangesData(); void updateCheckout(const QString &workingDir = QString(), @@ -240,11 +232,25 @@ private: mutable QString m_tempFilePattern; QAction *m_menuAction = nullptr; - static PerforcePlugin *m_instance; - PerforceSettings m_settings; ManagedDirectoryCache m_managedDirectoryCache; }; +class PerforcePlugin final : public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json") + + ~PerforcePlugin() final; + + bool initialize(const QStringList &arguments, QString *errorMessage) final; + void extensionsInitialized() final; + +#ifdef WITH_TESTS +private slots: + void testLogResolving(); +#endif +}; + } // namespace Perforce } // namespace Internal |