forked from qt-creator/qt-creator
RunFlags: Add ProgressiveOutput flag
It replaces VcsCommand::setProgressiveOutput() property. Change-Id: Icebd2205a5b489f60ded1eeee21e2deacbfde1fe Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -138,7 +138,7 @@ void GitLabCloneDialog::cloneProject()
|
|||||||
m_pathChooser->absoluteFilePath(),
|
m_pathChooser->absoluteFilePath(),
|
||||||
m_directoryLE->text(), extraArgs);
|
m_directoryLE->text(), extraArgs);
|
||||||
const FilePath workingDirectory = m_pathChooser->absoluteFilePath();
|
const FilePath workingDirectory = m_pathChooser->absoluteFilePath();
|
||||||
m_command->setProgressiveOutput(true);
|
m_command->addFlags(RunFlags::ProgressiveOutput);
|
||||||
connect(m_command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
connect(m_command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
||||||
m_cloneOutput->appendPlainText(text);
|
m_cloneOutput->appendPlainText(text);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -110,8 +110,6 @@ public:
|
|||||||
QFutureInterface<void> m_futureInterface;
|
QFutureInterface<void> m_futureInterface;
|
||||||
|
|
||||||
RunFlags m_flags = RunFlags::None;
|
RunFlags m_flags = RunFlags::None;
|
||||||
|
|
||||||
bool m_progressiveOutput = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QString VcsCommandPrivate::displayName() const
|
QString VcsCommandPrivate::displayName() const
|
||||||
@@ -184,19 +182,20 @@ void VcsCommandPrivate::setupProcess(QtcProcess *process, const Job &job)
|
|||||||
|
|
||||||
void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
|
void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
|
||||||
{
|
{
|
||||||
if (!(m_flags & RunFlags::MergeOutputChannels)
|
if (!(m_flags & RunFlags::MergeOutputChannels) && (m_flags & RunFlags::ProgressiveOutput
|
||||||
&& (m_progressiveOutput || !(m_flags & RunFlags::SuppressStdErr))) {
|
|| !(m_flags & RunFlags::SuppressStdErr))) {
|
||||||
process->setStdErrCallback([this](const QString &text) {
|
process->setStdErrCallback([this](const QString &text) {
|
||||||
if (m_progressParser)
|
if (m_progressParser)
|
||||||
m_progressParser->parseProgress(text);
|
m_progressParser->parseProgress(text);
|
||||||
if (!(m_flags & RunFlags::SuppressStdErr))
|
if (!(m_flags & RunFlags::SuppressStdErr))
|
||||||
emit q->appendError(text);
|
emit q->appendError(text);
|
||||||
if (m_progressiveOutput)
|
if (m_flags & RunFlags::ProgressiveOutput)
|
||||||
emit q->stdErrText(text);
|
emit q->stdErrText(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// connect stdout to the output window if desired
|
// connect stdout to the output window if desired
|
||||||
if (m_progressParser || m_progressiveOutput || (m_flags & RunFlags::ShowStdOut)) {
|
if (m_progressParser || m_flags & RunFlags::ProgressiveOutput
|
||||||
|
|| m_flags & RunFlags::ShowStdOut) {
|
||||||
process->setStdOutCallback([this](const QString &text) {
|
process->setStdOutCallback([this](const QString &text) {
|
||||||
if (m_progressParser)
|
if (m_progressParser)
|
||||||
m_progressParser->parseProgress(text);
|
m_progressParser->parseProgress(text);
|
||||||
@@ -206,7 +205,7 @@ void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
|
|||||||
else
|
else
|
||||||
emit q->append(text);
|
emit q->append(text);
|
||||||
}
|
}
|
||||||
if (m_progressiveOutput)
|
if (m_flags & RunFlags::ProgressiveOutput)
|
||||||
emit q->stdOutText(text);
|
emit q->stdOutText(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -422,11 +421,6 @@ void VcsCommand::setProgressParser(ProgressParser *parser)
|
|||||||
d->m_progressParser = parser;
|
d->m_progressParser = parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsCommand::setProgressiveOutput(bool progressive)
|
|
||||||
{
|
|
||||||
d->m_progressiveOutput = progressive;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgressParser::ProgressParser() :
|
ProgressParser::ProgressParser() :
|
||||||
m_futureMutex(new QMutex)
|
m_futureMutex(new QMutex)
|
||||||
{ }
|
{ }
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ public:
|
|||||||
void setCodec(QTextCodec *codec);
|
void setCodec(QTextCodec *codec);
|
||||||
|
|
||||||
void setProgressParser(ProgressParser *parser);
|
void setProgressParser(ProgressParser *parser);
|
||||||
void setProgressiveOutput(bool progressive);
|
|
||||||
|
|
||||||
static CommandResult runBlocking(const Utils::FilePath &workingDirectory,
|
static CommandResult runBlocking(const Utils::FilePath &workingDirectory,
|
||||||
const Utils::Environment &environmentconst,
|
const Utils::Environment &environmentconst,
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ enum class RunFlags {
|
|||||||
ShowSuccessMessage = (1 << 6), // Show message about successful completion of command.
|
ShowSuccessMessage = (1 << 6), // Show message about successful completion of command.
|
||||||
ShowStdOut = (1 << 7), // Show standard output.
|
ShowStdOut = (1 << 7), // Show standard output.
|
||||||
SilentOutput = (1 << 8), // Only when ShowStdOut is set to true, outputs silently.
|
SilentOutput = (1 << 8), // Only when ShowStdOut is set to true, outputs silently.
|
||||||
ExpectRepoChanges = (1 << 9), // Expect changes in repository by the command
|
ProgressiveOutput = (1 << 9), // Emit stdOutText() and stdErrText() signals.
|
||||||
|
ExpectRepoChanges = (1 << 10), // Expect changes in repository by the command.
|
||||||
NoOutput = SuppressStdErr | SuppressFailMessage | SuppressCommandLogging
|
NoOutput = SuppressStdErr | SuppressFailMessage | SuppressCommandLogging
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -358,14 +358,14 @@ void VcsCommandPage::start(VcsCommand *command)
|
|||||||
|
|
||||||
QTC_ASSERT(m_state != Running, return);
|
QTC_ASSERT(m_state != Running, return);
|
||||||
m_command = command;
|
m_command = command;
|
||||||
command->setProgressiveOutput(true);
|
m_command->addFlags(RunFlags::ProgressiveOutput);
|
||||||
connect(command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
connect(m_command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
||||||
m_formatter->appendMessage(text, StdOutFormat);
|
m_formatter->appendMessage(text, StdOutFormat);
|
||||||
});
|
});
|
||||||
connect(command, &VcsCommand::stdErrText, this, [this](const QString &text) {
|
connect(m_command, &VcsCommand::stdErrText, this, [this](const QString &text) {
|
||||||
m_formatter->appendMessage(text, StdErrFormat);
|
m_formatter->appendMessage(text, StdErrFormat);
|
||||||
});
|
});
|
||||||
connect(command, &VcsCommand::done, this, [this] {
|
connect(m_command, &VcsCommand::done, this, [this] {
|
||||||
finished(m_command->result() == ProcessResult::FinishedWithSuccess);
|
finished(m_command->result() == ProcessResult::FinishedWithSuccess);
|
||||||
});
|
});
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
@@ -374,7 +374,7 @@ void VcsCommandPage::start(VcsCommand *command)
|
|||||||
m_statusLabel->setText(m_startedStatus);
|
m_statusLabel->setText(m_startedStatus);
|
||||||
m_statusLabel->setPalette(QPalette());
|
m_statusLabel->setPalette(QPalette());
|
||||||
m_state = Running;
|
m_state = Running;
|
||||||
command->start();
|
m_command->start();
|
||||||
|
|
||||||
wizard()->button(QWizard::BackButton)->setEnabled(false);
|
wizard()->button(QWizard::BackButton)->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user