diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-09-19 12:08:38 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-09-20 10:41:35 +0000 |
commit | b795bd8042871cbfd741a365396184d51d6df64e (patch) | |
tree | 9c25ac7148dcbe4230b2de58536ea1efd90a8dc3 /src/plugins/vcsbase | |
parent | 5e10ea19c1123293ae048e1eb66c3cb77fc0ea7b (diff) |
VcsPlugin: Use VcsCommand::done() signal instead of finished()
Conform to QtcProcess interface. Use result() when needed.
Change-Id: Idd4c71d9a103e8649b08ec7787c2f286423a31ec
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/vcsbase')
-rw-r--r-- | src/plugins/vcsbase/vcsbaseclient.cpp | 21 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp | 5 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbaseeditor.cpp | 4 | ||||
-rw-r--r-- | src/plugins/vcsbase/wizard/vcscommandpage.cpp | 4 |
4 files changed, 19 insertions, 15 deletions
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index adf70c831a..a472ab33cc 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -81,7 +81,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory, if (editor) // assume that the commands output is the important thing cmd->addFlags(VcsCommand::SilentOutput); } else if (editor) { - connect(cmd, &VcsCommand::finished, editor, + connect(cmd, &VcsCommand::done, editor, [editor, cmd] { editor->setPlainText(cmd->cleanedStdOut()); }); } @@ -412,8 +412,8 @@ void VcsBaseClient::revertFile(const FilePath &workingDir, // Indicate repository change or file list VcsCommand *cmd = createCommand(workingDir); const QStringList files = QStringList(workingDir.pathAppended(file).toString()); - connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { - if (success) + connect(cmd, &VcsCommand::done, this, [this, files, cmd] { + if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(files); }, Qt::QueuedConnection); enqueueJob(cmd, args); @@ -428,8 +428,8 @@ void VcsBaseClient::revertAll(const FilePath &workingDir, // Indicate repository change or file list VcsCommand *cmd = createCommand(workingDir); const QStringList files = QStringList(workingDir.toString()); - connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { - if (success) + connect(cmd, &VcsCommand::done, this, [this, files, cmd] { + if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(files); }, Qt::QueuedConnection); enqueueJob(createCommand(workingDir), args); @@ -443,8 +443,7 @@ void VcsBaseClient::status(const FilePath &workingDir, args << extraOptions << file; VcsOutputWindow::setRepository(workingDir); VcsCommand *cmd = createCommand(workingDir, nullptr, VcsWindowOutputBind); - connect(cmd, &VcsCommand::finished, - VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository, + connect(cmd, &VcsCommand::done, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository, Qt::QueuedConnection); enqueueJob(cmd, args); } @@ -454,7 +453,7 @@ void VcsBaseClient::emitParsedStatus(const FilePath &repository, const QStringLi QStringList args(vcsCommandString(StatusCommand)); args << extraOptions; VcsCommand *cmd = createCommand(repository); - connect(cmd, &VcsCommand::finished, this, [this, cmd] { statusParser(cmd->cleanedStdOut()); }); + connect(cmd, &VcsCommand::done, this, [this, cmd] { statusParser(cmd->cleanedStdOut()); }); enqueueJob(cmd, args); } @@ -528,8 +527,8 @@ void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revisi QStringList args(vcsCommandString(UpdateCommand)); args << revisionSpec(revision) << extraOptions; VcsCommand *cmd = createCommand(repositoryRoot); - connect(cmd, &VcsCommand::finished, this, [this, repositoryRoot](bool success) { - if (success) + connect(cmd, &VcsCommand::done, this, [this, repositoryRoot, cmd] { + if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(repositoryRoot.toString()); }, Qt::QueuedConnection); enqueueJob(cmd, args); @@ -552,7 +551,7 @@ void VcsBaseClient::commit(const FilePath &repositoryRoot, args << extraOptions << files; VcsCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind); if (!commitMessageFile.isEmpty()) - connect(cmd, &VcsCommand::finished, [commitMessageFile] { QFile(commitMessageFile).remove(); }); + connect(cmd, &VcsCommand::done, [commitMessageFile] { QFile(commitMessageFile).remove(); }); enqueueJob(cmd, args); } diff --git a/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp b/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp index 4f8d83ca94..341c4bde94 100644 --- a/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp +++ b/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp @@ -148,8 +148,9 @@ void VcsBaseDiffEditorController::runCommand(const QList<QStringList> &args, uns d->m_command = VcsBaseClient::createVcsCommand(workingDirectory(), d->m_processEnvironment); d->m_command->setDisplayName(d->m_displayName); d->m_command->setCodec(codec ? codec : EditorManager::defaultTextCodec()); - connect(d->m_command.data(), &VcsCommand::finished, - this, [this](bool success) { d->commandFinished(success); }); + connect(d->m_command.data(), &VcsCommand::done, this, [this] { + d->commandFinished(d->m_command->result() == ProcessResult::FinishedWithSuccess); + }); d->m_command->addFlags(flags); for (const QStringList &arg : args) { diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index a52fafb17b..a962953fb1 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1394,7 +1394,9 @@ void VcsBaseEditorWidget::setCommand(VcsCommand *command) if (command) { d->m_progressIndicator = new ProgressIndicator(ProgressIndicatorSize::Large); d->m_progressIndicator->attachToWidget(this); - connect(command, &VcsCommand::finished, this, &VcsBaseEditorWidget::reportCommandFinished); + connect(command, &VcsCommand::done, this, [this] { + reportCommandFinished(d->m_command->result() == ProcessResult::FinishedWithSuccess); + }); QTimer::singleShot(100, this, &VcsBaseEditorWidget::showProgressIndicator); } } diff --git a/src/plugins/vcsbase/wizard/vcscommandpage.cpp b/src/plugins/vcsbase/wizard/vcscommandpage.cpp index bf86416f5f..73681ba726 100644 --- a/src/plugins/vcsbase/wizard/vcscommandpage.cpp +++ b/src/plugins/vcsbase/wizard/vcscommandpage.cpp @@ -365,7 +365,9 @@ void VcsCommandPage::start(VcsCommand *command) connect(command, &VcsCommand::stdErrText, this, [this](const QString &text) { m_formatter->appendMessage(text, StdErrFormat); }); - connect(command, &VcsCommand::finished, this, &VcsCommandPage::finished); + connect(command, &VcsCommand::done, this, [this] { + finished(m_command->result() == ProcessResult::FinishedWithSuccess); + }); QApplication::setOverrideCursor(Qt::WaitCursor); m_logPlainTextEdit->clear(); m_overwriteOutput = false; |