forked from qt-creator/qt-creator
ShellCommand: Remove success() signal
Use finished() signal instead. Change-Id: I4e28a2c6d90f40790cb9d19411186bd98402f4bb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -279,12 +279,10 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit finished(lastExecSuccess, cookie());
|
emit finished(lastExecSuccess, cookie());
|
||||||
if (lastExecSuccess) {
|
if (lastExecSuccess)
|
||||||
emit success(cookie());
|
|
||||||
future.setProgressValue(future.progressMaximum());
|
future.setProgressValue(future.progressMaximum());
|
||||||
} else {
|
else
|
||||||
future.cancel(); // sets the progress indicator red
|
future.cancel(); // sets the progress indicator red
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_progressParser)
|
if (d->m_progressParser)
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ signals:
|
|||||||
void stdErrText(const QString &);
|
void stdErrText(const QString &);
|
||||||
void started();
|
void started();
|
||||||
void finished(bool success, const QVariant &cookie);
|
void finished(bool success, const QVariant &cookie);
|
||||||
void success(const QVariant &cookie);
|
|
||||||
|
|
||||||
void terminate(); // Internal
|
void terminate(); // Internal
|
||||||
|
|
||||||
|
|||||||
@@ -984,25 +984,25 @@ void GitClient::chunkActionsRequested(DiffEditor::DiffEditorController *controll
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
QAction *stageChunkAction = menu->addAction(tr("Stage Chunk"));
|
QAction *stageChunkAction = menu->addAction(tr("Stage Chunk"));
|
||||||
connect(stageChunkAction, &QAction::triggered, this,
|
connect(stageChunkAction, &QAction::triggered, this,
|
||||||
[stageChunk, diffController, fileIndex, chunkIndex]() {
|
[stageChunk, diffController, fileIndex, chunkIndex] {
|
||||||
stageChunk(diffController, fileIndex, chunkIndex,
|
stageChunk(diffController, fileIndex, chunkIndex,
|
||||||
DiffEditorController::NoOption, DiffEditor::ChunkSelection());
|
DiffEditorController::NoOption, DiffEditor::ChunkSelection());
|
||||||
});
|
});
|
||||||
QAction *stageLinesAction = menu->addAction(tr("Stage Selection (%n Lines)", "", selection.selectedRowsCount()));
|
QAction *stageLinesAction = menu->addAction(tr("Stage Selection (%n Lines)", "", selection.selectedRowsCount()));
|
||||||
connect(stageLinesAction, &QAction::triggered, this,
|
connect(stageLinesAction, &QAction::triggered, this,
|
||||||
[stageChunk, diffController, fileIndex, chunkIndex, selection]() {
|
[stageChunk, diffController, fileIndex, chunkIndex, selection] {
|
||||||
stageChunk(diffController, fileIndex, chunkIndex,
|
stageChunk(diffController, fileIndex, chunkIndex,
|
||||||
DiffEditorController::NoOption, selection);
|
DiffEditorController::NoOption, selection);
|
||||||
});
|
});
|
||||||
QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk"));
|
QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk"));
|
||||||
connect(unstageChunkAction, &QAction::triggered, this,
|
connect(unstageChunkAction, &QAction::triggered, this,
|
||||||
[stageChunk, diffController, fileIndex, chunkIndex]() {
|
[stageChunk, diffController, fileIndex, chunkIndex] {
|
||||||
stageChunk(diffController, fileIndex, chunkIndex,
|
stageChunk(diffController, fileIndex, chunkIndex,
|
||||||
DiffEditorController::Revert, DiffEditor::ChunkSelection());
|
DiffEditorController::Revert, DiffEditor::ChunkSelection());
|
||||||
});
|
});
|
||||||
QAction *unstageLinesAction = menu->addAction(tr("Unstage Selection (%n Lines)", "", selection.selectedRowsCount()));
|
QAction *unstageLinesAction = menu->addAction(tr("Unstage Selection (%n Lines)", "", selection.selectedRowsCount()));
|
||||||
connect(unstageLinesAction, &QAction::triggered, this,
|
connect(unstageLinesAction, &QAction::triggered, this,
|
||||||
[stageChunk, diffController, fileIndex, chunkIndex, selection]() {
|
[stageChunk, diffController, fileIndex, chunkIndex, selection] {
|
||||||
stageChunk(diffController, fileIndex, chunkIndex,
|
stageChunk(diffController, fileIndex, chunkIndex,
|
||||||
DiffEditorController::Revert,
|
DiffEditorController::Revert,
|
||||||
selection);
|
selection);
|
||||||
@@ -1199,7 +1199,7 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName,
|
|||||||
argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor);
|
argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor);
|
||||||
argWidget->setBaseArguments(args);
|
argWidget->setBaseArguments(args);
|
||||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
|
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
|
||||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
[=] { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
||||||
editor->setEditorConfig(argWidget);
|
editor->setEditorConfig(argWidget);
|
||||||
}
|
}
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
@@ -1506,8 +1506,10 @@ void GitClient::removeStaleRemoteBranches(const FilePath &workingDirectory, cons
|
|||||||
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||||
ShellCommand::ShowSuccessMessage);
|
ShellCommand::ShowSuccessMessage);
|
||||||
|
|
||||||
connect(command, &ShellCommand::success,
|
connect(command, &ShellCommand::finished, this, [workingDirectory](bool success) {
|
||||||
this, [workingDirectory]() { GitPlugin::updateBranches(workingDirectory); });
|
if (success)
|
||||||
|
GitPlugin::updateBranches(workingDirectory);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::recoverDeletedFiles(const FilePath &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)};
|
QStringList const arguments = {"fetch", (remote.isEmpty() ? "--all" : remote)};
|
||||||
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||||
ShellCommand::ShowSuccessMessage);
|
ShellCommand::ShowSuccessMessage);
|
||||||
connect(command, &ShellCommand::success,
|
connect(command, &ShellCommand::finished, this, [workingDirectory](bool success) {
|
||||||
this, [workingDirectory] { GitPlugin::updateBranches(workingDirectory); });
|
if (success)
|
||||||
|
GitPlugin::updateBranches(workingDirectory);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::executeAndHandleConflicts(const FilePath &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);
|
ShellCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase, abortCommand);
|
||||||
connect(command, &ShellCommand::success, this,
|
connect(command, &ShellCommand::finished, this, [this, workingDirectory](bool success) {
|
||||||
[this, workingDirectory] { updateSubmodulesIfNeeded(workingDirectory, true); },
|
if (success)
|
||||||
Qt::QueuedConnection);
|
updateSubmodulesIfNeeded(workingDirectory, true);
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QString &abortCommand)
|
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,
|
ShellCommand *rePushCommand = vcsExec(workingDirectory,
|
||||||
QStringList({"push", "--force-with-lease"}) + pushArgs,
|
QStringList({"push", "--force-with-lease"}) + pushArgs,
|
||||||
nullptr, true, ShellCommand::ShowSuccessMessage);
|
nullptr, true, ShellCommand::ShowSuccessMessage);
|
||||||
connect(rePushCommand, &ShellCommand::success,
|
connect(rePushCommand, &ShellCommand::finished, this, [](bool success) {
|
||||||
this, []() { GitPlugin::updateCurrentBranch(); });
|
if (success)
|
||||||
|
GitPlugin::updateCurrentBranch();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3389,8 +3396,10 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr
|
|||||||
ShellCommand *rePushCommand = vcsExec(workingDirectory,
|
ShellCommand *rePushCommand = vcsExec(workingDirectory,
|
||||||
fallbackCommandParts.mid(1), nullptr, true,
|
fallbackCommandParts.mid(1), nullptr, true,
|
||||||
ShellCommand::ShowSuccessMessage);
|
ShellCommand::ShowSuccessMessage);
|
||||||
connect(rePushCommand, &ShellCommand::success, this, [workingDirectory]() {
|
connect(rePushCommand, &ShellCommand::finished, this,
|
||||||
GitPlugin::updateBranches(workingDirectory);
|
[workingDirectory](bool success) {
|
||||||
|
if (success)
|
||||||
|
GitPlugin::updateBranches(workingDirectory);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -570,7 +570,10 @@ void VcsBaseClient::revertFile(const FilePath &workingDir,
|
|||||||
// Indicate repository change or file list
|
// Indicate repository change or file list
|
||||||
ShellCommand *cmd = createCommand(workingDir);
|
ShellCommand *cmd = createCommand(workingDir);
|
||||||
cmd->setCookie(QStringList(workingDir.pathAppended(file).toString()));
|
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);
|
enqueueJob(cmd, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +586,10 @@ void VcsBaseClient::revertAll(const FilePath &workingDir,
|
|||||||
// Indicate repository change or file list
|
// Indicate repository change or file list
|
||||||
ShellCommand *cmd = createCommand(workingDir);
|
ShellCommand *cmd = createCommand(workingDir);
|
||||||
cmd->setCookie(QStringList(workingDir.toString()));
|
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);
|
enqueueJob(createCommand(workingDir), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,7 +687,10 @@ void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revisi
|
|||||||
args << revisionSpec(revision) << extraOptions;
|
args << revisionSpec(revision) << extraOptions;
|
||||||
ShellCommand *cmd = createCommand(repositoryRoot);
|
ShellCommand *cmd = createCommand(repositoryRoot);
|
||||||
cmd->setCookie(repositoryRoot.toString());
|
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);
|
enqueueJob(cmd, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,7 +711,7 @@ void VcsBaseClient::commit(const FilePath &repositoryRoot,
|
|||||||
args << extraOptions << files;
|
args << extraOptions << files;
|
||||||
ShellCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind);
|
ShellCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind);
|
||||||
if (!commitMessageFile.isEmpty())
|
if (!commitMessageFile.isEmpty())
|
||||||
connect(cmd, &ShellCommand::finished, [commitMessageFile]() { QFile(commitMessageFile).remove(); });
|
connect(cmd, &ShellCommand::finished, [commitMessageFile] { QFile(commitMessageFile).remove(); });
|
||||||
enqueueJob(cmd, args);
|
enqueueJob(cmd, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ protected:
|
|||||||
QString vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const;
|
QString vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void statusParser(const QString&);
|
void statusParser(const QString &);
|
||||||
|
|
||||||
VcsBaseClient::ConfigCreator m_diffConfigCreator;
|
VcsBaseClient::ConfigCreator m_diffConfigCreator;
|
||||||
VcsBaseClient::ConfigCreator m_logConfigCreator;
|
VcsBaseClient::ConfigCreator m_logConfigCreator;
|
||||||
|
|||||||
Reference in New Issue
Block a user