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

View File

@@ -33,13 +33,16 @@
#include <QSharedPointer> #include <QSharedPointer>
#include <QWizardPage> #include <QWizardPage>
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
class QLabel;
QT_END_NAMESPACE
namespace VcsBase { namespace VcsBase {
class Command; class Command;
namespace Internal { namespace Internal {
namespace Ui { class CheckoutProgressWizardPage; }
class CheckoutProgressWizardPage : public QWizardPage class CheckoutProgressWizardPage : public QWizardPage
{ {
Q_OBJECT Q_OBJECT
@@ -69,7 +72,8 @@ private slots:
private: private:
void outputText(const QString &text); void outputText(const QString &text);
Ui::CheckoutProgressWizardPage *ui; QPlainTextEdit *m_logPlainTextEdit;
QLabel *m_statusLabel;
Command *m_command; Command *m_command;
QString m_startedStatus; QString m_startedStatus;

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VcsBase::Internal::CheckoutProgressWizardPage</class>
<widget class="QWizardPage" name="VcsBase::Internal::CheckoutProgressWizardPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>264</width>
<height>200</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPlainTextEdit" name="logPlainTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -64,7 +64,6 @@ RESOURCES += vcsbase.qrc
FORMS += commonsettingspage.ui \ FORMS += commonsettingspage.ui \
nicknamedialog.ui \ nicknamedialog.ui \
checkoutprogresswizardpage.ui \
basecheckoutwizardpage.ui \ basecheckoutwizardpage.ui \
cleandialog.ui \ cleandialog.ui \
submiteditorwidget.ui submiteditorwidget.ui

View File

@@ -29,7 +29,6 @@ QtcPlugin {
"basevcssubmiteditorfactory.h", "basevcssubmiteditorfactory.h",
"checkoutprogresswizardpage.cpp", "checkoutprogresswizardpage.cpp",
"checkoutprogresswizardpage.h", "checkoutprogresswizardpage.h",
"checkoutprogresswizardpage.ui",
"checkoutwizarddialog.cpp", "checkoutwizarddialog.cpp",
"checkoutwizarddialog.h", "checkoutwizarddialog.h",
"cleandialog.cpp", "cleandialog.cpp",