From 1c953f0ac0749fc71f3446556de0aaed915c6382 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 18 Mar 2014 18:22:10 +0200 Subject: [PATCH] VCS: Inline CheckoutProgressWizardPage UI file Change-Id: Ibc6be53693a6ae3499d6d24cc3aeeeef2ca12225 Reviewed-by: Tobias Hunger --- .../vcsbase/checkoutprogresswizardpage.cpp | 40 +++++++++++-------- .../vcsbase/checkoutprogresswizardpage.h | 10 +++-- .../vcsbase/checkoutprogresswizardpage.ui | 32 --------------- src/plugins/vcsbase/vcsbase.pro | 1 - src/plugins/vcsbase/vcsbase.qbs | 1 - 5 files changed, 31 insertions(+), 53 deletions(-) delete mode 100644 src/plugins/vcsbase/checkoutprogresswizardpage.ui diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp b/src/plugins/vcsbase/checkoutprogresswizardpage.cpp index e188f5391d3..cd47f9e2dcb 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp +++ b/src/plugins/vcsbase/checkoutprogresswizardpage.cpp @@ -28,13 +28,15 @@ ****************************************************************************/ #include "checkoutprogresswizardpage.h" -#include "ui_checkoutprogresswizardpage.h" #include "command.h" #include "vcsbaseplugin.h" #include #include +#include +#include +#include /*! \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() diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.h b/src/plugins/vcsbase/checkoutprogresswizardpage.h index bd0bf104a39..b87b017af80 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.h +++ b/src/plugins/vcsbase/checkoutprogresswizardpage.h @@ -33,13 +33,16 @@ #include #include +QT_BEGIN_NAMESPACE +class QPlainTextEdit; +class QLabel; +QT_END_NAMESPACE + namespace VcsBase { class Command; namespace Internal { -namespace Ui { class CheckoutProgressWizardPage; } - class CheckoutProgressWizardPage : public QWizardPage { Q_OBJECT @@ -69,7 +72,8 @@ private slots: private: void outputText(const QString &text); - Ui::CheckoutProgressWizardPage *ui; + QPlainTextEdit *m_logPlainTextEdit; + QLabel *m_statusLabel; Command *m_command; QString m_startedStatus; diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.ui b/src/plugins/vcsbase/checkoutprogresswizardpage.ui deleted file mode 100644 index c11ddbe46ab..00000000000 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - VcsBase::Internal::CheckoutProgressWizardPage - - - - 0 - 0 - 264 - 200 - - - - - - - true - - - - - - - - - - - - - - - diff --git a/src/plugins/vcsbase/vcsbase.pro b/src/plugins/vcsbase/vcsbase.pro index 807d501d17a..deaf8798f8f 100644 --- a/src/plugins/vcsbase/vcsbase.pro +++ b/src/plugins/vcsbase/vcsbase.pro @@ -64,7 +64,6 @@ RESOURCES += vcsbase.qrc FORMS += commonsettingspage.ui \ nicknamedialog.ui \ - checkoutprogresswizardpage.ui \ basecheckoutwizardpage.ui \ cleandialog.ui \ submiteditorwidget.ui diff --git a/src/plugins/vcsbase/vcsbase.qbs b/src/plugins/vcsbase/vcsbase.qbs index 8d93398fe76..65b124cff4d 100644 --- a/src/plugins/vcsbase/vcsbase.qbs +++ b/src/plugins/vcsbase/vcsbase.qbs @@ -29,7 +29,6 @@ QtcPlugin { "basevcssubmiteditorfactory.h", "checkoutprogresswizardpage.cpp", "checkoutprogresswizardpage.h", - "checkoutprogresswizardpage.ui", "checkoutwizarddialog.cpp", "checkoutwizarddialog.h", "cleandialog.cpp",