Git: Make a few objects proper plugin pimpl members

Change-Id: Ib996ed248cd6e10d49fa3ae1086189acfc04de34
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-07 13:26:29 +01:00
parent eb1226df68
commit 6f2beafaf2
5 changed files with 189 additions and 150 deletions

View File

@@ -158,7 +158,6 @@ public:
void exec()
{
GitClient *client = GitPlugin::client();
QStringList arguments = {
"-c", "color.grep.match=bold red",
"-c", "color.grep=always",
@@ -188,7 +187,7 @@ public:
return QString(":!" + filter);
});
arguments << "--" << filterArgs << exclusionArgs;
QScopedPointer<VcsCommand> command(client->createCommand(m_directory));
QScopedPointer<VcsCommand> command(GitPlugin::client()->createCommand(m_directory));
command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage);
command->setProgressiveOutput(true);
QFutureWatcher<FileSearchResultList> watcher;
@@ -196,7 +195,7 @@ public:
connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled,
command.data(), &VcsCommand::cancel);
connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read);
SynchronousProcessResponse resp = command->runCommand({client->vcsBinary(), arguments}, 0);
SynchronousProcessResponse resp = command->runCommand({GitPlugin::client()->vcsBinary(), arguments}, 0);
switch (resp.result) {
case SynchronousProcessResponse::TerminatedAbnormally:
case SynchronousProcessResponse::StartFailed:
@@ -235,8 +234,8 @@ static bool isGitDirectory(const QString &path)
return gitVc == VcsManager::findVersionControlForDirectory(path, nullptr);
}
GitGrep::GitGrep(QObject *parent)
: SearchEngine(parent)
GitGrep::GitGrep(GitClient *client)
: m_client(client)
{
m_widget = new QWidget;
auto layout = new QHBoxLayout(m_widget);
@@ -248,7 +247,7 @@ GitGrep::GitGrep(QObject *parent)
const QRegularExpression refExpression("[\\S]*");
m_treeLineEdit->setValidator(new QRegularExpressionValidator(refExpression, this));
layout->addWidget(m_treeLineEdit);
if (GitPlugin::client()->gitVersion() >= 0x021300) {
if (client->gitVersion() >= 0x021300) {
m_recurseSubmodules = new QCheckBox(tr("Recurse submodules"));
layout->addWidget(m_recurseSubmodules);
}
@@ -320,7 +319,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
QByteArray content;
const QString topLevel = parameters.additionalParameters.toString();
const QString relativePath = QDir(topLevel).relativeFilePath(path);
if (!GitPlugin::client()->synchronousShow(topLevel, params.ref + ":./" + relativePath,
if (!m_client->synchronousShow(topLevel, params.ref + ":./" + relativePath,
&content, nullptr)) {
return nullptr;
}