VCS: Inline CheckoutProgressWizardPage UI file

Change-Id: Ibc6be53693a6ae3499d6d24cc3aeeeef2ca12225
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2014-03-18 18:22:10 +02:00
committed by Orgad Shaneh
parent f9a7bb7bcf
commit 1c953f0ac0
5 changed files with 31 additions and 53 deletions

View File

@@ -28,13 +28,15 @@
****************************************************************************/
#include "checkoutprogresswizardpage.h"
#include "ui_checkoutprogresswizardpage.h"
#include "command.h"
#include "vcsbaseplugin.h"
#include <utils/qtcassert.h>
#include <QApplication>
#include <QLabel>
#include <QPlainTextEdit>
#include <QVBoxLayout>
/*!
\class VcsBase::Internal::CheckoutProgressWizardPage
@@ -52,12 +54,19 @@ namespace Internal {
CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) :
QWizardPage(parent),
ui(new Ui::CheckoutProgressWizardPage),
m_startedStatus(tr("Checkout started...")),
m_overwriteOutput(false),
m_state(Idle)
{
ui->setupUi(this);
resize(264, 200);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
m_logPlainTextEdit = new QPlainTextEdit;
m_logPlainTextEdit->setReadOnly(true);
verticalLayout->addWidget(m_logPlainTextEdit);
m_statusLabel = new QLabel;
verticalLayout->addWidget(m_statusLabel);
setTitle(tr("Checkout"));
}
@@ -65,7 +74,6 @@ CheckoutProgressWizardPage::~CheckoutProgressWizardPage()
{
if (m_state == Running) // Paranoia!
QApplication::restoreOverrideCursor();
delete ui;
}
void CheckoutProgressWizardPage::setStartedStatus(const QString &startedStatus)
@@ -76,7 +84,7 @@ void CheckoutProgressWizardPage::setStartedStatus(const QString &startedStatus)
void CheckoutProgressWizardPage::start(Command *command)
{
if (!command) {
ui->logPlainTextEdit->setPlainText(tr("No job running, please abort."));
m_logPlainTextEdit->setPlainText(tr("No job running, please abort."));
return;
}
@@ -86,10 +94,10 @@ void CheckoutProgressWizardPage::start(Command *command)
connect(command, SIGNAL(output(QString)), this, SLOT(slotOutput(QString)));
connect(command, SIGNAL(finished(bool,int,QVariant)), this, SLOT(slotFinished(bool,int,QVariant)));
QApplication::setOverrideCursor(Qt::WaitCursor);
ui->logPlainTextEdit->clear();
m_logPlainTextEdit->clear();
m_overwriteOutput = false;
ui->statusLabel->setText(m_startedStatus);
ui->statusLabel->setPalette(QPalette());
m_statusLabel->setText(m_startedStatus);
m_statusLabel->setPalette(QPalette());
m_state = Running;
command->execute();
}
@@ -100,22 +108,22 @@ void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVari
if (m_state == Running) {
m_state = Succeeded;
QApplication::restoreOverrideCursor();
ui->statusLabel->setText(tr("Succeeded."));
m_statusLabel->setText(tr("Succeeded."));
QPalette palette;
palette.setColor(QPalette::Active, QPalette::Text, Qt::green);
ui->statusLabel->setPalette(palette);
m_statusLabel->setPalette(palette);
emit completeChanged();
emit terminated(true);
}
} else {
ui->logPlainTextEdit->appendPlainText(m_error);
m_logPlainTextEdit->appendPlainText(m_error);
if (m_state == Running) {
m_state = Failed;
QApplication::restoreOverrideCursor();
ui->statusLabel->setText(tr("Failed."));
m_statusLabel->setText(tr("Failed."));
QPalette palette;
palette.setColor(QPalette::Active, QPalette::Text, Qt::red);
ui->statusLabel->setPalette(palette);
m_statusLabel->setPalette(palette);
emit terminated(false);
}
}
@@ -147,13 +155,13 @@ void CheckoutProgressWizardPage::slotError(const QString &text)
void CheckoutProgressWizardPage::outputText(const QString &text)
{
if (m_overwriteOutput) {
QTextCursor cursor = ui->logPlainTextEdit->textCursor();
QTextCursor cursor = m_logPlainTextEdit->textCursor();
cursor.clearSelection();
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
ui->logPlainTextEdit->setTextCursor(cursor);
m_logPlainTextEdit->setTextCursor(cursor);
m_overwriteOutput = false;
}
ui->logPlainTextEdit->insertPlainText(text);
m_logPlainTextEdit->insertPlainText(text);
}
void CheckoutProgressWizardPage::terminate()