forked from qt-creator/qt-creator
ShellCommand: De-virtualize addTask()
Provide executedAsync() signal instead. Change-Id: I8f04dc90875e5f27827ea553a9f23f41656cc4db Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -209,8 +209,7 @@ void ShellCommand::execute()
|
|||||||
|
|
||||||
QFuture<void> task = runAsync(&ShellCommand::run, this);
|
QFuture<void> task = runAsync(&ShellCommand::run, this);
|
||||||
d->m_watcher.setFuture(task);
|
d->m_watcher.setFuture(task);
|
||||||
if (!(d->m_flags & SuppressCommandLogging))
|
emit executedAsync(task);
|
||||||
addTask(task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellCommand::abort()
|
void ShellCommand::abort()
|
||||||
@@ -224,11 +223,6 @@ void ShellCommand::cancel()
|
|||||||
emit terminate();
|
emit terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellCommand::addTask(QFuture<void> &future)
|
|
||||||
{
|
|
||||||
Q_UNUSED(future)
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShellCommand::postRunCommand(const FilePath &workingDirectory)
|
void ShellCommand::postRunCommand(const FilePath &workingDirectory)
|
||||||
{
|
{
|
||||||
Q_UNUSED(workingDirectory)
|
Q_UNUSED(workingDirectory)
|
||||||
|
@@ -148,13 +148,14 @@ signals:
|
|||||||
void appendCommand(const FilePath &workingDirectory, const CommandLine &command);
|
void appendCommand(const FilePath &workingDirectory, const CommandLine &command);
|
||||||
void appendMessage(const QString &text);
|
void appendMessage(const QString &text);
|
||||||
|
|
||||||
|
void executedAsync(const QFuture<void> &future);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setEnvironment(const Environment &env);
|
void setEnvironment(const Environment &env);
|
||||||
void setDisableUnixTerminal();
|
void setDisableUnixTerminal();
|
||||||
int timeoutS() const;
|
int timeoutS() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void addTask(QFuture<void> &future);
|
|
||||||
virtual void postRunCommand(const Utils::FilePath &workDirectory);
|
virtual void postRunCommand(const Utils::FilePath &workDirectory);
|
||||||
FilePath workDirectory(const FilePath &wd) const;
|
FilePath workDirectory(const FilePath &wd) const;
|
||||||
void run(QFutureInterface<void> &future);
|
void run(QFutureInterface<void> &future);
|
||||||
|
@@ -77,10 +77,15 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi
|
|||||||
connect(this, &ShellCommand::appendError, outputWindow, &VcsOutputWindow::appendError);
|
connect(this, &ShellCommand::appendError, outputWindow, &VcsOutputWindow::appendError);
|
||||||
connect(this, &ShellCommand::appendCommand, outputWindow, &VcsOutputWindow::appendCommand);
|
connect(this, &ShellCommand::appendCommand, outputWindow, &VcsOutputWindow::appendCommand);
|
||||||
connect(this, &ShellCommand::appendMessage, outputWindow, &VcsOutputWindow::appendMessage);
|
connect(this, &ShellCommand::appendMessage, outputWindow, &VcsOutputWindow::appendMessage);
|
||||||
|
|
||||||
|
connect(this, &ShellCommand::executedAsync, this, &VcsCommand::addTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsCommand::addTask(QFuture<void> &future)
|
void VcsCommand::addTask(const QFuture<void> &future)
|
||||||
{
|
{
|
||||||
|
if ((flags() & SuppressCommandLogging))
|
||||||
|
return;
|
||||||
|
|
||||||
const QString name = displayName();
|
const QString name = displayName();
|
||||||
const auto id = Id::fromString(name + QLatin1String(".action"));
|
const auto id = Id::fromString(name + QLatin1String(".action"));
|
||||||
if (hasProgressParser()) {
|
if (hasProgressParser()) {
|
||||||
|
@@ -40,7 +40,7 @@ private:
|
|||||||
VcsCommand(const Utils::FilePath &defaultWorkingDirectory,
|
VcsCommand(const Utils::FilePath &defaultWorkingDirectory,
|
||||||
const Utils::Environment &environment);
|
const Utils::Environment &environment);
|
||||||
|
|
||||||
void addTask(QFuture<void> &future) override;
|
void addTask(const QFuture<void> &future);
|
||||||
void postRunCommand(const Utils::FilePath &workDirectory) override;
|
void postRunCommand(const Utils::FilePath &workDirectory) override;
|
||||||
|
|
||||||
QPointer<Core::FutureProgress> m_progress;
|
QPointer<Core::FutureProgress> m_progress;
|
||||||
|
Reference in New Issue
Block a user