diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/utils/shellcommandpage.cpp (renamed from src/plugins/vcsbase/checkoutprogresswizardpage.cpp) | 63 | ||||
-rw-r--r-- | src/libs/utils/shellcommandpage.h (renamed from src/plugins/vcsbase/checkoutprogresswizardpage.h) | 40 | ||||
-rw-r--r-- | src/libs/utils/utils-lib.pri | 2 | ||||
-rw-r--r-- | src/libs/utils/utils.qbs | 2 | ||||
-rw-r--r-- | src/plugins/cvs/checkoutwizard.cpp | 4 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizard.cpp | 7 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizard.h | 6 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbase.pro | 2 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbase.qbs | 2 |
9 files changed, 62 insertions, 66 deletions
diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp b/src/libs/utils/shellcommandpage.cpp index 662fb74720..8cc6fcf229 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp +++ b/src/libs/utils/shellcommandpage.cpp @@ -28,12 +28,11 @@ ** ****************************************************************************/ -#include "checkoutprogresswizardpage.h" -#include "vcscommand.h" -#include "vcsbaseplugin.h" - -#include <utils/outputformatter.h> -#include <utils/qtcassert.h> +#include "shellcommandpage.h" +#include "shellcommand.h" +#include "outputformatter.h" +#include "qtcassert.h" +#include "theme/theme.h" #include <QApplication> #include <QLabel> @@ -41,22 +40,19 @@ #include <QVBoxLayout> /*! - \class VcsBase::Internal::CheckoutProgressWizardPage - - \brief The CheckoutProgressWizardPage implements a page showing the - progress of an initial project checkout. + \class Utils::ShellCommandPage - Turns complete when the job succeeds. + \brief The ShellCommandPage implements a page showing the + progress of a \c ShellCommand. - \sa VcsBase::BaseCheckoutWizard + Turns complete when the command succeeds. */ -namespace VcsBase { -namespace Internal { +namespace Utils { -CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) : - QWizardPage(parent), - m_startedStatus(tr("Checkout started...")), +ShellCommandPage::ShellCommandPage(QWidget *parent) : + WizardPage(parent), + m_startedStatus(tr("Command started...")), m_overwriteOutput(false), m_state(Idle) { @@ -71,21 +67,21 @@ CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) : m_statusLabel = new QLabel; verticalLayout->addWidget(m_statusLabel); - setTitle(tr("Checkout")); + setTitle(tr("Run Command")); } -CheckoutProgressWizardPage::~CheckoutProgressWizardPage() +ShellCommandPage::~ShellCommandPage() { QTC_ASSERT(m_state != Running, QApplication::restoreOverrideCursor()); delete m_formatter; } -void CheckoutProgressWizardPage::setStartedStatus(const QString &startedStatus) +void ShellCommandPage::setStartedStatus(const QString &startedStatus) { m_startedStatus = startedStatus; } -void CheckoutProgressWizardPage::start(VcsCommand *command) +void ShellCommandPage::start(ShellCommand *command) { if (!command) { m_logPlainTextEdit->setPlainText(tr("No job running, please abort.")); @@ -95,9 +91,9 @@ void CheckoutProgressWizardPage::start(VcsCommand *command) QTC_ASSERT(m_state != Running, return); m_command = command; command->setProgressiveOutput(true); - connect(command, &VcsCommand::stdOutText, this, &CheckoutProgressWizardPage::reportStdOut); - connect(command, &VcsCommand::stdErrText, this, &CheckoutProgressWizardPage::reportStdErr); - connect(command, &VcsCommand::finished, this, &CheckoutProgressWizardPage::slotFinished); + connect(command, &ShellCommand::stdOutText, this, &ShellCommandPage::reportStdOut); + connect(command, &ShellCommand::stdErrText, this, &ShellCommandPage::reportStdErr); + connect(command, &ShellCommand::finished, this, &ShellCommandPage::slotFinished); QApplication::setOverrideCursor(Qt::WaitCursor); m_logPlainTextEdit->clear(); m_overwriteOutput = false; @@ -107,7 +103,7 @@ void CheckoutProgressWizardPage::start(VcsCommand *command) command->execute(); } -void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVariant &) +void ShellCommandPage::slotFinished(bool ok, int exitCode, const QVariant &) { QTC_ASSERT(m_state == Running, return); @@ -118,11 +114,11 @@ void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVari if (success) { m_state = Succeeded; message = tr("Succeeded."); - palette.setColor(QPalette::Active, QPalette::Text, Qt::green); + palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorNormal).name()); } else { m_state = Failed; message = tr("Failed."); - palette.setColor(QPalette::Active, QPalette::Text, Qt::red); + palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorError).name()); } m_statusLabel->setText(message); @@ -132,29 +128,28 @@ void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVari if (success) emit completeChanged(); - emit terminated(success); + emit finished(success); } -void CheckoutProgressWizardPage::reportStdOut(const QString &text) +void ShellCommandPage::reportStdOut(const QString &text) { m_formatter->appendMessage(text, Utils::StdOutFormat); } -void CheckoutProgressWizardPage::reportStdErr(const QString &text) +void ShellCommandPage::reportStdErr(const QString &text) { m_formatter->appendMessage(text, Utils::StdErrFormat); } -void CheckoutProgressWizardPage::terminate() +void ShellCommandPage::terminate() { if (m_command) m_command->cancel(); } -bool CheckoutProgressWizardPage::isComplete() const +bool ShellCommandPage::isComplete() const { return m_state == Succeeded; } -} // namespace Internal -} // namespace VcsBase +} // namespace Utils diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.h b/src/libs/utils/shellcommandpage.h index 13c7e18217..f648728deb 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.h +++ b/src/libs/utils/shellcommandpage.h @@ -28,36 +28,34 @@ ** ****************************************************************************/ -#ifndef CHECKOUTPROGRESSWIZARDPAGE_H -#define CHECKOUTPROGRESSWIZARDPAGE_H +#ifndef SHELLCOMMANDPAGE_H +#define SHELLCOMMANDPAGE_H -#include <QSharedPointer> -#include <QWizardPage> +#include "utils_global.h" + +#include "wizardpage.h" QT_BEGIN_NAMESPACE class QPlainTextEdit; class QLabel; QT_END_NAMESPACE -namespace Utils { class OutputFormatter; } - -namespace VcsBase { -class VcsCommand; - -namespace Internal { +namespace Utils { +class OutputFormatter; +class ShellCommand; -class CheckoutProgressWizardPage : public QWizardPage +class QTCREATOR_UTILS_EXPORT ShellCommandPage : public WizardPage { Q_OBJECT public: enum State { Idle, Running, Failed, Succeeded }; - explicit CheckoutProgressWizardPage(QWidget *parent = 0); - ~CheckoutProgressWizardPage(); + explicit ShellCommandPage(QWidget *parent = 0); + ~ShellCommandPage(); void setStartedStatus(const QString &startedStatus); - void start(VcsCommand *command); + void start(ShellCommand *command); virtual bool isComplete() const; bool isRunning() const{ return m_state == Running; } @@ -65,26 +63,24 @@ public: void terminate(); signals: - void terminated(bool success); + void finished(bool success); -private slots: +private: void slotFinished(bool ok, int exitCode, const QVariant &cookie); void reportStdOut(const QString &text); void reportStdErr(const QString &text); -private: QPlainTextEdit *m_logPlainTextEdit; - Utils::OutputFormatter *m_formatter; + OutputFormatter *m_formatter; QLabel *m_statusLabel; - VcsCommand *m_command; + ShellCommand *m_command; QString m_startedStatus; bool m_overwriteOutput; State m_state; }; -} // namespace Internal -} // namespace VcsBase +} // namespace Utils -#endif // CHECKOUTPROGRESSWIZARDPAGE_H +#endif // SHELLCOMMANDPAGE_H diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri index 419b985914..800920a46d 100644 --- a/src/libs/utils/utils-lib.pri +++ b/src/libs/utils/utils-lib.pri @@ -13,6 +13,7 @@ SOURCES += $$PWD/environment.cpp \ $$PWD/qtcprocess.cpp \ $$PWD/reloadpromptutils.cpp \ $$PWD/shellcommand.cpp \ + $$PWD/shellcommandpage.cpp \ $$PWD/settingsselector.cpp \ $$PWD/stringutils.cpp \ $$PWD/textfieldcheckbox.cpp \ @@ -101,6 +102,7 @@ HEADERS += \ $$PWD/reloadpromptutils.h \ $$PWD/settingsselector.h \ $$PWD/shellcommand.h \ + $$PWD/shellcommandpage.h \ $$PWD/stringutils.h \ $$PWD/textfieldcheckbox.h \ $$PWD/textfieldcombobox.h \ diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs index 6545bfba02..a3855fff54 100644 --- a/src/libs/utils/utils.qbs +++ b/src/libs/utils/utils.qbs @@ -162,6 +162,8 @@ QtcLibrary { "settingsutils.h", "shellcommand.cpp", "shellcommand.h", + "shellcommandpage.cpp", + "shellcommandpage.h", "sleep.cpp", "sleep.h", "statuslabel.cpp", diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp index 343ee8161e..334cd415c2 100644 --- a/src/plugins/cvs/checkoutwizard.cpp +++ b/src/plugins/cvs/checkoutwizard.cpp @@ -73,6 +73,10 @@ VcsCommand *CheckoutWizard::createCommand(Utils::FileName *checkoutDir) const Utils::FileName binary = settings.binaryPath(); QStringList args; + // cwp->repository() contains the CVS module to check out only. + // The CVSROOT (== actual repository) for that module is part of the CVS settings. + // The checkout will always go into a new subfolder named after the CVS module. + const QString repository = cwp->repository(); args << QLatin1String("checkout") << repository; const QString workingDirectory = cwp->path(); diff --git a/src/plugins/vcsbase/basecheckoutwizard.cpp b/src/plugins/vcsbase/basecheckoutwizard.cpp index 1d48b588af..d24e10a940 100644 --- a/src/plugins/vcsbase/basecheckoutwizard.cpp +++ b/src/plugins/vcsbase/basecheckoutwizard.cpp @@ -30,9 +30,10 @@ #include "basecheckoutwizard.h" #include "basecheckoutwizardfactory.h" -#include "checkoutprogresswizardpage.h" +#include "vcscommand.h" #include <utils/qtcassert.h> +#include <utils/shellcommandpage.h> #include <QPushButton> @@ -47,12 +48,12 @@ namespace VcsBase { BaseCheckoutWizard::BaseCheckoutWizard(const Utils::FileName &path, QWidget *parent) : Utils::Wizard(parent), - m_progressPage(new Internal::CheckoutProgressWizardPage), + m_progressPage(new Utils::ShellCommandPage), m_progressPageId(-1) { Q_UNUSED(path); connect(this, &QWizard::currentIdChanged, this, &BaseCheckoutWizard::slotPageChanged); - connect(m_progressPage, &Internal::CheckoutProgressWizardPage::terminated, + connect(m_progressPage, &Utils::ShellCommandPage::finished, this, &BaseCheckoutWizard::slotTerminated); setOption(QWizard::NoBackButtonOnLastPage); } diff --git a/src/plugins/vcsbase/basecheckoutwizard.h b/src/plugins/vcsbase/basecheckoutwizard.h index 0b362c6284..ff8f850d2b 100644 --- a/src/plugins/vcsbase/basecheckoutwizard.h +++ b/src/plugins/vcsbase/basecheckoutwizard.h @@ -36,11 +36,11 @@ #include <utils/fileutils.h> #include <utils/wizard.h> +namespace Utils { class ShellCommandPage; } + namespace VcsBase { class VcsCommand; -namespace Internal { class CheckoutProgressWizardPage; } - class VCSBASE_EXPORT BaseCheckoutWizard : public Utils::Wizard { Q_OBJECT @@ -62,7 +62,7 @@ private slots: virtual void reject(); private: - Internal::CheckoutProgressWizardPage *m_progressPage; + Utils::ShellCommandPage *m_progressPage; int m_progressPageId; Utils::FileName m_checkoutDir; }; diff --git a/src/plugins/vcsbase/vcsbase.pro b/src/plugins/vcsbase/vcsbase.pro index 80f0fcbeb5..7da27cbfd9 100644 --- a/src/plugins/vcsbase/vcsbase.pro +++ b/src/plugins/vcsbase/vcsbase.pro @@ -21,7 +21,6 @@ HEADERS += vcsbase_global.h \ nicknamedialog.h \ basecheckoutwizardfactory.h \ basecheckoutwizard.h \ - checkoutprogresswizardpage.h \ basecheckoutwizardpage.h \ vcsoutputwindow.h \ cleandialog.h \ @@ -52,7 +51,6 @@ SOURCES += vcsplugin.cpp \ nicknamedialog.cpp \ basecheckoutwizardfactory.cpp \ basecheckoutwizard.cpp \ - checkoutprogresswizardpage.cpp \ basecheckoutwizardpage.cpp \ vcsoutputwindow.cpp \ cleandialog.cpp \ diff --git a/src/plugins/vcsbase/vcsbase.qbs b/src/plugins/vcsbase/vcsbase.qbs index 5b8d7a3358..733a6d5ab3 100644 --- a/src/plugins/vcsbase/vcsbase.qbs +++ b/src/plugins/vcsbase/vcsbase.qbs @@ -27,8 +27,6 @@ QtcPlugin { "basevcseditorfactory.h", "basevcssubmiteditorfactory.cpp", "basevcssubmiteditorfactory.h", - "checkoutprogresswizardpage.cpp", - "checkoutprogresswizardpage.h", "cleandialog.cpp", "cleandialog.h", "cleandialog.ui", |