aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitgrep.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-02-07 13:26:29 +0100
committerhjk <hjk@qt.io>2020-02-07 13:01:35 +0000
commit6f2beafaf297595c61af0ba7b505b0b329a49a4e (patch)
tree6fcb9a4c35d70b292f18467b269ab6734da2c519 /src/plugins/git/gitgrep.cpp
parenteb1226df68edb2180425fda8411f57aab06c7b5f (diff)
Git: Make a few objects proper plugin pimpl members
Change-Id: Ib996ed248cd6e10d49fa3ae1086189acfc04de34 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/git/gitgrep.cpp')
-rw-r--r--src/plugins/git/gitgrep.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp
index 056903f855e..66e249fbf70 100644
--- a/src/plugins/git/gitgrep.cpp
+++ b/src/plugins/git/gitgrep.cpp
@@ -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;
}