forked from qt-creator/qt-creator
Git: Small simplification to Gerrit "plugin" setup
The indirection is not needed. It's not really stand-alone, and not touched before GitPlugin::initialize(). Change-Id: If8552dc69ff9efa18a3f1d6d998a8f28ab65e501 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -152,16 +152,15 @@ void FetchContext::checkout()
|
||||
GitClient::instance()->checkout(m_repository, "FETCH_HEAD");
|
||||
}
|
||||
|
||||
GerritPlugin::GerritPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_parameters(new GerritParameters)
|
||||
GerritPlugin::GerritPlugin()
|
||||
: m_parameters(new GerritParameters)
|
||||
, m_server(new GerritServer)
|
||||
{
|
||||
}
|
||||
|
||||
GerritPlugin::~GerritPlugin() = default;
|
||||
|
||||
void GerritPlugin::initialize(ActionContainer *ac)
|
||||
void GerritPlugin::addToMenu(ActionContainer *ac)
|
||||
{
|
||||
m_parameters->fromSettings(ICore::settings());
|
||||
|
||||
|
||||
@@ -29,11 +29,12 @@ class GerritServer;
|
||||
class GerritPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GerritPlugin(QObject *parent = nullptr);
|
||||
GerritPlugin();
|
||||
~GerritPlugin() override;
|
||||
|
||||
void initialize(Core::ActionContainer *ac);
|
||||
void addToMenu(Core::ActionContainer *ac);
|
||||
|
||||
static Utils::FilePath gitBinDirectory();
|
||||
static QString branch(const Utils::FilePath &repository);
|
||||
|
||||
@@ -418,7 +418,7 @@ public:
|
||||
QVector<ParameterAction *> m_projectActions;
|
||||
QVector<QAction *> m_repositoryActions;
|
||||
ParameterAction *m_applyCurrentFilePatchAction = nullptr;
|
||||
Gerrit::Internal::GerritPlugin *m_gerritPlugin = nullptr;
|
||||
Gerrit::Internal::GerritPlugin m_gerritPlugin;
|
||||
|
||||
GitSettings m_settings;
|
||||
GitClient m_gitClient{&m_settings};
|
||||
@@ -1065,10 +1065,9 @@ GitPluginPrivate::GitPluginPrivate()
|
||||
this, &GitPluginPrivate::updateBranches, Qt::QueuedConnection);
|
||||
|
||||
/* "Gerrit" */
|
||||
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
|
||||
m_gerritPlugin->initialize(remoteRepositoryMenu);
|
||||
m_gerritPlugin->updateActions(currentState());
|
||||
m_gerritPlugin->addToLocator(m_commandLocator);
|
||||
m_gerritPlugin.addToMenu(remoteRepositoryMenu);
|
||||
m_gerritPlugin.updateActions(currentState());
|
||||
m_gerritPlugin.addToLocator(m_commandLocator);
|
||||
|
||||
connect(&m_settings, &AspectContainer::applied, this, &GitPluginPrivate::onApplySettings);
|
||||
|
||||
@@ -1927,7 +1926,7 @@ void GitPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
updateContinueAndAbortCommands();
|
||||
updateRepositoryBrowserAction();
|
||||
|
||||
m_gerritPlugin->updateActions(state);
|
||||
m_gerritPlugin.updateActions(state);
|
||||
}
|
||||
|
||||
void GitPluginPrivate::updateContinueAndAbortCommands()
|
||||
@@ -1965,7 +1964,7 @@ void GitPluginPrivate::updateContinueAndAbortCommands()
|
||||
|
||||
void GitPluginPrivate::delayedPushToGerrit()
|
||||
{
|
||||
m_gerritPlugin->push(m_submitRepository);
|
||||
m_gerritPlugin.push(m_submitRepository);
|
||||
}
|
||||
|
||||
void GitPluginPrivate::updateBranches(const FilePath &repository)
|
||||
@@ -2172,7 +2171,7 @@ void GitPlugin::updateBranches(const FilePath &repository)
|
||||
|
||||
void GitPlugin::gerritPush(const FilePath &topLevel)
|
||||
{
|
||||
dd->m_gerritPlugin->push(topLevel);
|
||||
dd->m_gerritPlugin.push(topLevel);
|
||||
}
|
||||
|
||||
bool GitPlugin::isCommitEditorOpen()
|
||||
|
||||
Reference in New Issue
Block a user