diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index 4acfc68d394..e7c74e02d36 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -279,12 +279,10 @@ void ShellCommand::run(QFutureInterface &future) } emit finished(lastExecSuccess, cookie()); - if (lastExecSuccess) { - emit success(cookie()); + if (lastExecSuccess) future.setProgressValue(future.progressMaximum()); - } else { + else future.cancel(); // sets the progress indicator red - } } if (d->m_progressParser) diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index f188fd4b4b2..3cf4e5c23b1 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -144,7 +144,6 @@ signals: void stdErrText(const QString &); void started(); void finished(bool success, const QVariant &cookie); - void success(const QVariant &cookie); void terminate(); // Internal diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 7ae932ad206..3a5175fdfdf 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -984,25 +984,25 @@ void GitClient::chunkActionsRequested(DiffEditor::DiffEditorController *controll menu->addSeparator(); QAction *stageChunkAction = menu->addAction(tr("Stage Chunk")); connect(stageChunkAction, &QAction::triggered, this, - [stageChunk, diffController, fileIndex, chunkIndex]() { + [stageChunk, diffController, fileIndex, chunkIndex] { stageChunk(diffController, fileIndex, chunkIndex, DiffEditorController::NoOption, DiffEditor::ChunkSelection()); }); QAction *stageLinesAction = menu->addAction(tr("Stage Selection (%n Lines)", "", selection.selectedRowsCount())); connect(stageLinesAction, &QAction::triggered, this, - [stageChunk, diffController, fileIndex, chunkIndex, selection]() { + [stageChunk, diffController, fileIndex, chunkIndex, selection] { stageChunk(diffController, fileIndex, chunkIndex, DiffEditorController::NoOption, selection); }); QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk")); connect(unstageChunkAction, &QAction::triggered, this, - [stageChunk, diffController, fileIndex, chunkIndex]() { + [stageChunk, diffController, fileIndex, chunkIndex] { stageChunk(diffController, fileIndex, chunkIndex, DiffEditorController::Revert, DiffEditor::ChunkSelection()); }); QAction *unstageLinesAction = menu->addAction(tr("Unstage Selection (%n Lines)", "", selection.selectedRowsCount())); connect(unstageLinesAction, &QAction::triggered, this, - [stageChunk, diffController, fileIndex, chunkIndex, selection]() { + [stageChunk, diffController, fileIndex, chunkIndex, selection] { stageChunk(diffController, fileIndex, chunkIndex, DiffEditorController::Revert, selection); @@ -1199,7 +1199,7 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName, argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor); argWidget->setBaseArguments(args); connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this, - [=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); }); + [=] { this->log(workingDir, fileName, enableAnnotationContextMenu, args); }); editor->setEditorConfig(argWidget); } editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); @@ -1506,8 +1506,10 @@ void GitClient::removeStaleRemoteBranches(const FilePath &workingDirectory, cons ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true, ShellCommand::ShowSuccessMessage); - connect(command, &ShellCommand::success, - this, [workingDirectory]() { GitPlugin::updateBranches(workingDirectory); }); + connect(command, &ShellCommand::finished, this, [workingDirectory](bool success) { + if (success) + GitPlugin::updateBranches(workingDirectory); + }); } void GitClient::recoverDeletedFiles(const FilePath &workingDirectory) @@ -3150,8 +3152,10 @@ void GitClient::fetch(const FilePath &workingDirectory, const QString &remote) QStringList const arguments = {"fetch", (remote.isEmpty() ? "--all" : remote)}; ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true, ShellCommand::ShowSuccessMessage); - connect(command, &ShellCommand::success, - this, [workingDirectory] { GitPlugin::updateBranches(workingDirectory); }); + connect(command, &ShellCommand::finished, this, [workingDirectory](bool success) { + if (success) + GitPlugin::updateBranches(workingDirectory); + }); } bool GitClient::executeAndHandleConflicts(const FilePath &workingDirectory, @@ -3182,9 +3186,10 @@ void GitClient::pull(const FilePath &workingDirectory, bool rebase) } ShellCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase, abortCommand); - connect(command, &ShellCommand::success, this, - [this, workingDirectory] { updateSubmodulesIfNeeded(workingDirectory, true); }, - Qt::QueuedConnection); + connect(command, &ShellCommand::finished, this, [this, workingDirectory](bool success) { + if (success) + updateSubmodulesIfNeeded(workingDirectory, true); + }, Qt::QueuedConnection); } void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QString &abortCommand) @@ -3368,8 +3373,10 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr ShellCommand *rePushCommand = vcsExec(workingDirectory, QStringList({"push", "--force-with-lease"}) + pushArgs, nullptr, true, ShellCommand::ShowSuccessMessage); - connect(rePushCommand, &ShellCommand::success, - this, []() { GitPlugin::updateCurrentBranch(); }); + connect(rePushCommand, &ShellCommand::finished, this, [](bool success) { + if (success) + GitPlugin::updateCurrentBranch(); + }); } break; } @@ -3389,8 +3396,10 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr ShellCommand *rePushCommand = vcsExec(workingDirectory, fallbackCommandParts.mid(1), nullptr, true, ShellCommand::ShowSuccessMessage); - connect(rePushCommand, &ShellCommand::success, this, [workingDirectory]() { - GitPlugin::updateBranches(workingDirectory); + connect(rePushCommand, &ShellCommand::finished, this, + [workingDirectory](bool success) { + if (success) + GitPlugin::updateBranches(workingDirectory); }); } break; diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 685784e8423..5a927df86a7 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -570,7 +570,10 @@ void VcsBaseClient::revertFile(const FilePath &workingDir, // Indicate repository change or file list ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.pathAppended(file).toString())); - connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + if (success) + emit changed(cookie); + }, Qt::QueuedConnection); enqueueJob(cmd, args); } @@ -583,7 +586,10 @@ void VcsBaseClient::revertAll(const FilePath &workingDir, // Indicate repository change or file list ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString())); - connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + if (success) + emit changed(cookie); + }, Qt::QueuedConnection); enqueueJob(createCommand(workingDir), args); } @@ -681,7 +687,10 @@ void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revisi args << revisionSpec(revision) << extraOptions; ShellCommand *cmd = createCommand(repositoryRoot); cmd->setCookie(repositoryRoot.toString()); - connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + if (success) + emit changed(cookie); + }, Qt::QueuedConnection); enqueueJob(cmd, args); } @@ -702,7 +711,7 @@ void VcsBaseClient::commit(const FilePath &repositoryRoot, args << extraOptions << files; ShellCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind); if (!commitMessageFile.isEmpty()) - connect(cmd, &ShellCommand::finished, [commitMessageFile]() { QFile(commitMessageFile).remove(); }); + connect(cmd, &ShellCommand::finished, [commitMessageFile] { QFile(commitMessageFile).remove(); }); enqueueJob(cmd, args); } diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index 084ab53b7e9..7a41fb4d26b 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -259,7 +259,7 @@ protected: QString vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const; private: - void statusParser(const QString&); + void statusParser(const QString &); VcsBaseClient::ConfigCreator m_diffConfigCreator; VcsBaseClient::ConfigCreator m_logConfigCreator;