Commit 1c953f0a authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Inline CheckoutProgressWizardPage UI file



Change-Id: Ibc6be53693a6ae3499d6d24cc3aeeeef2ca12225
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent f9a7bb7b
......@@ -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()
......
......@@ -33,13 +33,16 @@
#include <QSharedPointer>
#include <QWizardPage>
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;
......
<?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>
......@@ -64,7 +64,6 @@ RESOURCES += vcsbase.qrc
FORMS += commonsettingspage.ui \
nicknamedialog.ui \
checkoutprogresswizardpage.ui \
basecheckoutwizardpage.ui \
cleandialog.ui \
submiteditorwidget.ui
......@@ -29,7 +29,6 @@ QtcPlugin {
"basevcssubmiteditorfactory.h",
"checkoutprogresswizardpage.cpp",
"checkoutprogresswizardpage.h",
"checkoutprogresswizardpage.ui",
"checkoutwizarddialog.cpp",
"checkoutwizarddialog.h",
"cleandialog.cpp",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment