diff options
author | Jarek Kobus <jkobus@trolltech.com> | 2010-03-31 14:48:08 +0200 |
---|---|---|
committer | Jarek Kobus <jkobus@trolltech.com> | 2010-03-31 15:22:14 +0200 |
commit | 20c0817a3fc3ba80116e78ed32166d5641d1579a (patch) | |
tree | 2b5742fcba5bd53af440af72b215c7068f0ab934 /src/plugins/projectexplorer | |
parent | 9408378a24f556649ba918830dd3e3a95e381718 (diff) |
Replace QWizard with Utils::Wizard
Diffstat (limited to 'src/plugins/projectexplorer')
5 files changed, 25 insertions, 11 deletions
diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp index a232405470..dfb3ff6b50 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp @@ -56,7 +56,7 @@ BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectInt } BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent) : - QWizard(parent), + Utils::Wizard(parent), d(new BaseProjectWizardDialogPrivate(new Utils::ProjectIntroPage)) { init(); @@ -65,7 +65,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent) : BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introPage, int introId, QWidget *parent) : - QWizard(parent), + Utils::Wizard(parent), d(new BaseProjectWizardDialogPrivate(introPage, introId)) { init(); @@ -80,6 +80,7 @@ void BaseProjectWizardDialog::init() d->introPageId = d->desiredIntroPageId; setPage(d->desiredIntroPageId, d->introPage); } + wizardProgress()->item(d->introPageId)->setTitle(tr("Location")); connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted())); connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotBaseCurrentIdChanged(int))); } diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.h b/src/plugins/projectexplorer/baseprojectwizarddialog.h index a0b669644a..32f47d96e3 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.h +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.h @@ -31,6 +31,7 @@ #define BASEPROJECTWIZARDDIALOG_H #include "projectexplorer_export.h" +#include <utils/wizard.h> #include <QtGui/QWizard> @@ -46,7 +47,7 @@ struct BaseProjectWizardDialogPrivate; * page and takes care of setting the directory as default * should the user wish to do that. */ -class PROJECTEXPLORER_EXPORT BaseProjectWizardDialog : public QWizard +class PROJECTEXPLORER_EXPORT BaseProjectWizardDialog : public Utils::Wizard { Q_OBJECT diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 87dfbb2f2b..ae40298001 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -43,6 +43,7 @@ #include <QtCore/QMap> #include <QtCore/QDir> #include <QtCore/QFileInfo> +#include <QtCore/QCoreApplication> static const char templatePathC[] = "templates/wizards"; static const char configFileC[] = "wizard.xml"; @@ -87,22 +88,25 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p) } // Add a wizard page with an id, visibly warn if something goes wrong. -static inline void addWizardPage(QWizard *w, QWizardPage *p, int id) +static inline void addWizardPage(Utils::Wizard *w, QWizardPage *p, int id) { + int addedPageId = 0; if (id == -1) { - w->addPage(p); + addedPageId = w->addPage(p); } else { if (w->pageIds().contains(id)) { qWarning("Page %d already present in custom wizard dialog, defaulting to add.", id); - w->addPage(p); + addedPageId = w->addPage(p); } else { w->setPage(id, p); + addedPageId = id; } } + w->wizardProgress()->item(addedPageId)->setTitle(QCoreApplication::translate("ProjectExplorer::CustomWizard", "Details", "Default short title for custom wizard page to be shown in the progress pane of the wizard.")); } // Initialize a wizard with a custom file page. -void CustomWizard::initWizardDialog(QWizard *wizard, const QString &defaultPath, +void CustomWizard::initWizardDialog(Utils::Wizard *wizard, const QString &defaultPath, const WizardPageList &extensionPages) const { QTC_ASSERT(!parameters().isNull(), return); @@ -114,7 +118,7 @@ void CustomWizard::initWizardDialog(QWizard *wizard, const QString &defaultPath, if (!parameters()->fieldPageTitle.isEmpty()) customPage->setTitle(parameters()->fieldPageTitle); foreach(QWizardPage *ep, extensionPages) - wizard->addPage(ep); + BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(ep)); Core::BaseFileWizard::setupWizard(wizard); if (CustomWizardPrivate::verbose) qDebug() << "initWizardDialog" << wizard << wizard->pageIds(); @@ -125,7 +129,7 @@ QWizard *CustomWizard::createWizardDialog(QWidget *parent, const WizardPageList &extensionPages) const { QTC_ASSERT(!d->m_parameters.isNull(), return 0); - QWizard *wizard = new QWizard(parent); + Utils::Wizard *wizard = new Utils::Wizard(parent); initWizardDialog(wizard, defaultPath, extensionPages); return wizard; } @@ -373,6 +377,9 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w, const CustomWizardContextPtr ctx = context(); ctx->reset(); + if (!displayName().isEmpty()) + w->setWindowTitle(displayName()); + if (!pa->fields.isEmpty()) { Internal::CustomWizardFieldPage *cp = new Internal::CustomWizardFieldPage(ctx, pa->fields); addWizardPage(w, cp, parameters()->firstPageId); @@ -380,7 +387,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w, cp->setTitle(pa->fieldPageTitle); } foreach(QWizardPage *ep, extensionPages) - w->addPage(ep); + BaseFileWizard::applyExtensionPageShortTitle(w, w->addPage(ep)); w->setPath(defaultPath); w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath)); diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h index 842afd85f5..522c31d580 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.h +++ b/src/plugins/projectexplorer/customwizard/customwizard.h @@ -42,6 +42,10 @@ QT_BEGIN_NAMESPACE class QDir; QT_END_NAMESPACE +namespace Utils { + class Wizard; +} + namespace ProjectExplorer { class CustomWizard; struct CustomWizardPrivate; @@ -108,7 +112,7 @@ protected: typedef QSharedPointer<Internal::CustomWizardParameters> CustomWizardParametersPtr; typedef QSharedPointer<Internal::CustomWizardContext> CustomWizardContextPtr; - void initWizardDialog(QWizard *w, const QString &defaultPath, + void initWizardDialog(Utils::Wizard *w, const QString &defaultPath, const WizardPageList &extensionPages) const; // generate files in path diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index 20709529b3..34fbf26308 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -42,6 +42,7 @@ ProjectWizardPage::ProjectWizardPage(QWidget *parent) : m_ui->setupUi(this); connect(m_ui->projectComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotProjectChanged(int))); + setProperty("shortTitle", tr("Summary")); } ProjectWizardPage::~ProjectWizardPage() |