Vcs: Report stderr messages in checkout wizard

Do not delay them till after the command has finished.

Change-Id: I52984e1deeaeb33e3feba0a5b6b982059870f4b8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2014-11-06 12:30:39 +01:00
parent 66a87a1748
commit 2de666da61
2 changed files with 31 additions and 31 deletions

View File

@@ -76,8 +76,7 @@ CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) :
CheckoutProgressWizardPage::~CheckoutProgressWizardPage()
{
if (m_state == Running) // Paranoia!
QApplication::restoreOverrideCursor();
QTC_ASSERT(m_state != Running, QApplication::restoreOverrideCursor());
delete m_formatter;
}
@@ -96,8 +95,9 @@ void CheckoutProgressWizardPage::start(VcsCommand *command)
QTC_ASSERT(m_state != Running, return);
m_command = command;
command->setProgressiveOutput(true);
connect(command, SIGNAL(output(QString)), this, SLOT(slotOutput(QString)));
connect(command, SIGNAL(finished(bool,int,QVariant)), this, SLOT(slotFinished(bool,int,QVariant)));
connect(command, &VcsCommand::output, this, &CheckoutProgressWizardPage::reportStdOut);
connect(command, &VcsCommand::errorText, this, &CheckoutProgressWizardPage::reportStdErr);
connect(command, &VcsCommand::finished, this, &CheckoutProgressWizardPage::slotFinished);
QApplication::setOverrideCursor(Qt::WaitCursor);
m_logPlainTextEdit->clear();
m_overwriteOutput = false;
@@ -109,39 +109,40 @@ void CheckoutProgressWizardPage::start(VcsCommand *command)
void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVariant &)
{
if (ok && exitCode == 0) {
if (m_state == Running) {
QTC_ASSERT(m_state == Running, return);
const bool success = (ok && exitCode == 0);
QString message;
QPalette palette;
if (success) {
m_state = Succeeded;
QApplication::restoreOverrideCursor();
m_statusLabel->setText(tr("Succeeded."));
QPalette palette;
message = tr("Succeeded.");
palette.setColor(QPalette::Active, QPalette::Text, Qt::green);
m_statusLabel->setPalette(palette);
emit completeChanged();
emit terminated(true);
}
} else {
m_logPlainTextEdit->appendPlainText(m_error);
if (m_state == Running) {
m_state = Failed;
QApplication::restoreOverrideCursor();
m_statusLabel->setText(tr("Failed."));
QPalette palette;
message = tr("Failed.");
palette.setColor(QPalette::Active, QPalette::Text, Qt::red);
m_statusLabel->setPalette(palette);
emit terminated(false);
}
}
}
void CheckoutProgressWizardPage::slotOutput(const QString &text)
m_statusLabel->setText(message);
m_statusLabel->setPalette(palette);
QApplication::restoreOverrideCursor();
if (success)
emit completeChanged();
emit terminated(success);
}
void CheckoutProgressWizardPage::reportStdOut(const QString &text)
{
m_formatter->appendMessage(text, Utils::StdOutFormat);
}
void CheckoutProgressWizardPage::slotError(const QString &text)
void CheckoutProgressWizardPage::reportStdErr(const QString &text)
{
m_error.append(text);
m_formatter->appendMessage(text, Utils::StdErrFormat);
}
void CheckoutProgressWizardPage::terminate()

View File

@@ -69,8 +69,8 @@ signals:
private slots:
void slotFinished(bool ok, int exitCode, const QVariant &cookie);
void slotOutput(const QString &text);
void slotError(const QString &text);
void reportStdOut(const QString &text);
void reportStdErr(const QString &text);
private:
QPlainTextEdit *m_logPlainTextEdit;
@@ -79,7 +79,6 @@ private:
VcsCommand *m_command;
QString m_startedStatus;
QString m_error;
bool m_overwriteOutput;
State m_state;