forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -67,20 +67,17 @@ class RemoteDialog;
|
||||
|
||||
using GitClientMemberFunc = void (GitClient::*)(const QString &);
|
||||
|
||||
class GitPlugin : public VcsBase::VcsBasePlugin
|
||||
class GitPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
|
||||
|
||||
public:
|
||||
GitPlugin();
|
||||
~GitPlugin() override;
|
||||
GitPluginPrivate();
|
||||
~GitPluginPrivate() final;
|
||||
|
||||
static GitPlugin *instance();
|
||||
static GitPluginPrivate *instance();
|
||||
static GitClient *client();
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
|
||||
GitVersionControl *gitVersionControl() const;
|
||||
|
||||
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
|
||||
@@ -91,27 +88,14 @@ public:
|
||||
void updateBranches(const QString &repository);
|
||||
void updateCurrentBranch();
|
||||
|
||||
QObject *remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &args) override;
|
||||
void manageRemotes();
|
||||
void initRepository();
|
||||
void startRebaseFromCommit(const QString &workingDirectory, QString commit);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testStatusParsing_data();
|
||||
void testStatusParsing();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testGitRemote_data();
|
||||
void testGitRemote();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void diffCurrentFile();
|
||||
void diffCurrentProject();
|
||||
@@ -169,7 +153,7 @@ private:
|
||||
QAction *createProjectAction(Core::ActionContainer *ac,
|
||||
const QString &defaultText, const QString ¶meterText,
|
||||
Core::Id id, const Core::Context &context, bool addToLocator,
|
||||
void (GitPlugin::*func)(),
|
||||
void (GitPluginPrivate::*func)(),
|
||||
const QKeySequence &keys = QKeySequence());
|
||||
|
||||
QAction *createRepositoryAction(Core::ActionContainer *ac, const QString &text, Core::Id id,
|
||||
@@ -222,5 +206,32 @@ private:
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
class GitPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
|
||||
|
||||
public:
|
||||
~GitPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
QObject *remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &args) final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testStatusParsing_data();
|
||||
void testStatusParsing();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testGitRemote_data();
|
||||
void testGitRemote();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
Reference in New Issue
Block a user