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:
@@ -149,7 +149,7 @@ FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
connect(&m_watcher, &QFutureWatcher<void>::canceled, this, &FetchContext::terminate);
|
||||
m_watcher.setFuture(m_progress.future());
|
||||
m_process.setWorkingDirectory(repository);
|
||||
m_process.setProcessEnvironment(GitPlugin::client()->processEnvironment());
|
||||
m_process.setProcessEnvironment(GitPluginPrivate::client()->processEnvironment());
|
||||
m_process.closeWriteChannel();
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void FetchContext::show()
|
||||
{
|
||||
const QString title = QString::number(m_change->number) + '/'
|
||||
+ QString::number(m_change->currentPatchSet.patchSetNumber);
|
||||
GitPlugin::client()->show(m_repository, "FETCH_HEAD", title);
|
||||
GitPluginPrivate::client()->show(m_repository, "FETCH_HEAD", title);
|
||||
}
|
||||
|
||||
void FetchContext::cherryPick()
|
||||
@@ -249,12 +249,12 @@ void FetchContext::cherryPick()
|
||||
// Point user to errors.
|
||||
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
|
||||
| IOutputPane::WithFocus);
|
||||
GitPlugin::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
|
||||
GitPluginPrivate::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
|
||||
}
|
||||
|
||||
void FetchContext::checkout()
|
||||
{
|
||||
GitPlugin::client()->checkout(m_repository, "FETCH_HEAD");
|
||||
GitPluginPrivate::client()->checkout(m_repository, "FETCH_HEAD");
|
||||
}
|
||||
|
||||
void FetchContext::terminate()
|
||||
@@ -272,7 +272,7 @@ GerritPlugin::GerritPlugin(QObject *parent)
|
||||
|
||||
GerritPlugin::~GerritPlugin() = default;
|
||||
|
||||
bool GerritPlugin::initialize(ActionContainer *ac)
|
||||
void GerritPlugin::initialize(ActionContainer *ac)
|
||||
{
|
||||
m_parameters->fromSettings(ICore::settings());
|
||||
|
||||
@@ -296,7 +296,6 @@ bool GerritPlugin::initialize(ActionContainer *ac)
|
||||
if (m_dialog)
|
||||
m_dialog->scheduleUpdateRemotes();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
void GerritPlugin::updateActions(const VcsBase::VcsBasePluginState &state)
|
||||
@@ -330,12 +329,12 @@ void GerritPlugin::push(const QString &topLevel)
|
||||
|
||||
dialog.storeTopic();
|
||||
m_reviewers = dialog.reviewers();
|
||||
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
|
||||
GitPluginPrivate::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
|
||||
}
|
||||
|
||||
static QString currentRepository()
|
||||
{
|
||||
return GitPlugin::instance()->currentState().topLevel();
|
||||
return GitPluginPrivate::instance()->currentState().topLevel();
|
||||
}
|
||||
|
||||
// Open or raise the Gerrit dialog window.
|
||||
@@ -377,19 +376,19 @@ void GerritPlugin::push()
|
||||
|
||||
Utils::FilePath GerritPlugin::gitBinDirectory()
|
||||
{
|
||||
return GitPlugin::client()->gitBinDirectory();
|
||||
return GitPluginPrivate::client()->gitBinDirectory();
|
||||
}
|
||||
|
||||
// Find the branch of a repository.
|
||||
QString GerritPlugin::branch(const QString &repository)
|
||||
{
|
||||
return GitPlugin::client()->synchronousCurrentLocalBranch(repository);
|
||||
return GitPluginPrivate::client()->synchronousCurrentLocalBranch(repository);
|
||||
}
|
||||
|
||||
void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
{
|
||||
// Locate git.
|
||||
const Utils::FilePath git = GitPlugin::client()->vcsBinary();
|
||||
const Utils::FilePath git = GitPluginPrivate::client()->vcsBinary();
|
||||
if (git.isEmpty()) {
|
||||
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
|
||||
return;
|
||||
@@ -402,7 +401,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
|
||||
if (!repository.isEmpty()) {
|
||||
// Check if remote from a working dir is the same as remote from patch
|
||||
QMap<QString, QString> remotesList = GitPlugin::client()->synchronousRemotesList(repository);
|
||||
QMap<QString, QString> remotesList = GitPluginPrivate::client()->synchronousRemotesList(repository);
|
||||
if (!remotesList.isEmpty()) {
|
||||
const QStringList remotes = remotesList.values();
|
||||
for (QString remote : remotes) {
|
||||
@@ -415,7 +414,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
}
|
||||
|
||||
if (!verifiedRepository) {
|
||||
const SubmoduleDataMap submodules = GitPlugin::client()->submoduleList(repository);
|
||||
const SubmoduleDataMap submodules = GitPluginPrivate::client()->submoduleList(repository);
|
||||
for (const SubmoduleData &submoduleData : submodules) {
|
||||
QString remote = submoduleData.url;
|
||||
if (remote.endsWith(".git"))
|
||||
@@ -474,7 +473,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
// Try to find a matching repository for a project by asking the VcsManager.
|
||||
QString GerritPlugin::findLocalRepository(QString project, const QString &branch) const
|
||||
{
|
||||
const QStringList gitRepositories = VcsManager::repositories(GitPlugin::instance()->gitVersionControl());
|
||||
const QStringList gitRepositories = VcsManager::repositories(GitPluginPrivate::instance()->gitVersionControl());
|
||||
// Determine key (file name) to look for (qt/qtbase->'qtbase').
|
||||
const int slashPos = project.lastIndexOf('/');
|
||||
if (slashPos != -1)
|
||||
|
||||
Reference in New Issue
Block a user