Replace QWizard with Utils::Wizard

This commit is contained in:
Jarek Kobus
2010-03-31 14:48:08 +02:00
parent 9408378a24
commit 20c0817a3f
49 changed files with 199 additions and 81 deletions

View File

@@ -35,13 +35,14 @@
namespace Utils {
FileWizardDialog::FileWizardDialog(QWidget *parent) :
QWizard(parent),
Wizard(parent),
m_filePage(new FileWizardPage)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false);
addPage(m_filePage);
const int filePageId = addPage(m_filePage);
wizardProgress()->item(filePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
}

View File

@@ -31,8 +31,7 @@
#define FILEWIZARDDIALOG_H
#include "utils_global.h"
#include <QtGui/QWizard>
#include "wizard.h"
namespace Utils {
@@ -43,7 +42,7 @@ class FileWizardPage;
and path. Custom pages can be added via Core::IWizardExtension.
*/
class QTCREATOR_UTILS_EXPORT FileWizardDialog : public QWizard {
class QTCREATOR_UTILS_EXPORT FileWizardDialog : public Wizard {
Q_OBJECT
Q_DISABLE_COPY(FileWizardDialog)
public:

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="title">
<string>Choose the location</string>
<string>Choose the Location</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
@@ -37,17 +37,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::FileNameValidatingLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">utils/filenamevalidatinglineedit.h</header>
</customwidget>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header>pathchooser.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>Utils::FileNameValidatingLineEdit</class>
<extends>QLineEdit</extends>
<header>filenamevalidatinglineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@@ -33,6 +33,7 @@
#include <QHBoxLayout>
#include <QMap>
#include <QHash>
#include <QVariant>
namespace Utils {

View File

@@ -38,6 +38,7 @@
namespace Utils {
class Wizard;
class WizardProgress;
class WizardPrivate;

View File

@@ -84,6 +84,13 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
setPage(ShadowBuildPageId, new ShadowBuildPage(this));
setPage(CMakeRunPageId, new CMakeRunPage(this));
Utils::WizardProgress *wp = wizardProgress();
Utils::WizardProgressItem *inSourceItem = wp->item(InSourcePageId);
Utils::WizardProgressItem *shadowBuildItem = wp->item(ShadowBuildPageId);
Utils::WizardProgressItem *cmakeRunItem = wp->item(CMakeRunPageId);
inSourceItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
shadowBuildItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
setStartId(startid);
init();
}
@@ -216,6 +223,7 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
"If you want a shadow build, clean your source directory and re-open the project.")
.arg(m_cmakeWizard->buildDirectory()));
layout()->addWidget(label);
setTitle(tr("Build Location"));
}
@@ -239,6 +247,7 @@ ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool chang
m_pc->setPath(m_cmakeWizard->buildDirectory());
connect(m_pc, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
fl->addRow(tr("Build directory:"), m_pc);
setTitle(tr("Build Location"));
}
void ShadowBuildPage::buildDirectoryChanged()
@@ -312,6 +321,7 @@ void CMakeRunPage::initWidgets()
pl.setVerticalStretch(1);
m_output->setSizePolicy(pl);
fl->addRow(m_output);
setTitle(tr("Run CMake"));
}
void CMakeRunPage::initializePage()

View File

@@ -31,13 +31,13 @@
#define CMAKEOPENPROJECTWIZARD_H
#include <projectexplorer/environment.h>
#include <utils/wizard.h>
#include <QtCore/QProcess>
#include <QtGui/QPushButton>
#include <QtGui/QComboBox>
#include <QtGui/QLineEdit>
#include <QtGui/QLabel>
#include <QtGui/QWizard>
#include <QtGui/QPlainTextEdit>
namespace Utils {
@@ -49,7 +49,7 @@ namespace Internal {
class CMakeManager;
class CMakeOpenProjectWizard : public QWizard
class CMakeOpenProjectWizard : public Utils::Wizard
{
Q_OBJECT
public:

View File

@@ -569,6 +569,21 @@ void BaseFileWizard::setupWizard(QWizard *w)
w->setOption(QWizard::NoBackButtonOnStartPage, true);
}
void BaseFileWizard::applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId)
{
if (pageId < 0)
return;
QWizardPage *p = wizard->page(pageId);
if (!p)
return;
Utils::WizardProgressItem *item = wizard->wizardProgress()->item(pageId);
if (!item)
return;
const QString shortTitle = p->property("shortTitle").toString();
if (!shortTitle.isEmpty())
item->setTitle(shortTitle);
}
bool BaseFileWizard::postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage)
{
Q_UNUSED(w);
@@ -691,7 +706,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
setupWizard(standardWizardDialog);
standardWizardDialog->setPath(defaultPath);
foreach (QWizardPage *p, extensionPages)
standardWizardDialog->addPage(p);
BaseFileWizard::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p));
return standardWizardDialog;
}

View File

@@ -44,6 +44,10 @@ class QWizardPage;
class QDebug;
QT_END_NAMESPACE
namespace Utils {
class Wizard;
}
namespace Core {
class IEditor;
@@ -172,6 +176,9 @@ public:
// Sets some standard options on a QWizard
static void setupWizard(QWizard *);
// Read "shortTitle" dynamic property of the pageId and apply it as the title of corresponding progress item
static void applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId);
protected:
typedef QList<QWizardPage *> WizardPageList;

View File

@@ -60,7 +60,7 @@ ClassNamePage::ClassNamePage(QWidget *parent) :
QWizardPage(parent),
m_isValid(false)
{
setTitle(tr("Enter class name"));
setTitle(tr("Enter Class Name"));
setSubTitle(tr("The header and source file names will be derived from the class name"));
m_newClassWidget = new Utils::NewClassWidget;
@@ -133,12 +133,13 @@ void ClassNamePage::slotValidChanged()
}
CppClassWizardDialog::CppClassWizardDialog(QWidget *parent) :
QWizard(parent),
Utils::Wizard(parent),
m_classNamePage(new ClassNamePage(this))
{
Core::BaseFileWizard::setupWizard(this);
setWindowTitle(tr("C++ Class Wizard"));
addPage(m_classNamePage);
const int classNameId = addPage(m_classNamePage);
wizardProgress()->item(classNameId)->setTitle(tr("Details"));
}
void CppClassWizardDialog::setPath(const QString &path)
@@ -183,7 +184,7 @@ QWizard *CppClassWizard::createWizardDialog(QWidget *parent,
{
CppClassWizardDialog *wizard = new CppClassWizardDialog(parent);
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
wizard->setPath(defaultPath);
return wizard;
}

View File

@@ -31,10 +31,10 @@
#define CPPCLASSWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <utils/wizard.h>
#include <QtCore/QStringList>
#include <QtGui/QWizardPage>
#include <QtGui/QWizard>
namespace Utils {
@@ -77,7 +77,7 @@ struct CppClassWizardParameters
int classType;
};
class CppClassWizardDialog : public QWizard
class CppClassWizardDialog : public Utils::Wizard
{
Q_OBJECT
Q_DISABLE_COPY(CppClassWizardDialog)

View File

@@ -35,6 +35,7 @@ namespace Internal {
CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) :
VCSBase::BaseCheckoutWizardPage(parent)
{
setTitle(tr("Location"));
setSubTitle(tr("Specify repository and path."));
setRepositoryLabel(tr("Repository:"));
setDirectoryVisible(false);

View File

@@ -32,6 +32,8 @@
#include "formclasswizardpage.h"
#include "formclasswizardparameters.h"
#include <coreplugin/basefilewizard.h>
#include <QtCore/QDebug>
#include <QtGui/QAbstractButton>
@@ -43,20 +45,22 @@ namespace Internal {
// ----------------- FormClassWizardDialog
FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
QWidget *parent) :
QWizard(parent),
Utils::Wizard(parent),
m_formPage(new FormTemplateWizardPage),
m_classPage(new FormClassWizardPage)
{
setWindowTitle(tr("Qt Designer Form Class"));
setPage(FormPageId, m_formPage);
wizardProgress()->item(FormPageId)->setTitle(tr("Form Template"));
connect(m_formPage, SIGNAL(templateActivated()),
button(QWizard::NextButton), SLOT(animateClick()));
setPage(ClassPageId, m_classPage);
wizardProgress()->item(ClassPageId)->setTitle(tr("Class Details"));
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
QString FormClassWizardDialog::path() const

View File

@@ -30,7 +30,7 @@
#ifndef FORMCLASSWIZARDDIALOG_H
#define FORMCLASSWIZARDDIALOG_H
#include <QtGui/QWizard>
#include <utils/wizard.h>
namespace Designer {
@@ -42,7 +42,7 @@ namespace Internal {
class FormClassWizardPage;
class FormTemplateWizardPage;
class FormClassWizardDialog : public QWizard
class FormClassWizardDialog : public Utils::Wizard
{
Q_DISABLE_COPY(FormClassWizardDialog)
Q_OBJECT

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="title">
<string>Choose a class name</string>
<string>Choose a Class Name</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@@ -21,7 +21,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="Utils::NewClassWidget" name="newClassWidget"/>
<widget class="Utils::NewClassWidget" name="newClassWidget" native="true"/>
</item>
</layout>
</widget>
@@ -62,7 +62,4 @@
</customwidgets>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>

View File

@@ -59,7 +59,7 @@ FormTemplateWizardPage::FormTemplateWizardPage(QWidget * parent) :
m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(FormEditorW::instance()->designerEditor())),
m_templateSelected(m_newFormWidget->hasCurrentTemplate())
{
setTitle(tr("Choose a form template"));
setTitle(tr("Choose a Form Template"));
QVBoxLayout *layout = new QVBoxLayout;
connect(m_newFormWidget, SIGNAL(currentTemplateChanged(bool)),

View File

@@ -48,7 +48,7 @@ namespace Internal {
// ----------------- FormWizardDialog
FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
QWidget *parent)
: QWizard(parent),
: Utils::Wizard(parent),
m_formPage(new FormTemplateWizardPage)
{
init(extensionPages);
@@ -59,11 +59,15 @@ void FormWizardDialog::init(const WizardPageList &extensionPages)
Core::BaseFileWizard::setupWizard(this);
setWindowTitle(tr("Qt Designer Form"));
setPage(FormPageId, m_formPage);
wizardProgress()->item(FormPageId)->setTitle(tr("Form Template"));
if (!extensionPages.empty()) {
int id = FirstExtensionPageId;
foreach (QWizardPage *p, extensionPages)
setPage(id++, p);
foreach (QWizardPage *p, extensionPages) {
setPage(id, p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, id);
id++;
}
}
}
@@ -82,6 +86,7 @@ FormFileWizardDialog::FormFileWizardDialog(const WizardPageList &extensionPages,
m_filePage(new Utils::FileWizardPage)
{
setPage(FilePageId, m_filePage);
wizardProgress()->item(FilePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()),
button(QWizard::FinishButton), SLOT(animateClick()));

View File

@@ -30,7 +30,7 @@
#ifndef FORMWIZARDDIALOG_H
#define FORMWIZARDDIALOG_H
#include <QtGui/QWizard>
#include <utils/wizard.h>
namespace Utils {
class FileWizardPage;
@@ -44,7 +44,7 @@ class FormTemplateWizardPage;
// Single-Page Wizard for new forms offering all types known to Qt Designer.
// To be used for Mode "CreateNewEditor" [not currently used]
class FormWizardDialog : public QWizard
class FormWizardDialog : public Utils::Wizard
{
Q_DISABLE_COPY(FormWizardDialog)
Q_OBJECT

View File

@@ -51,7 +51,7 @@ using namespace Utils;
//////////////////////////////////////////////////////////////////////////////
GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent)
: QWizard(parent)
: Utils::Wizard(parent)
{
setWindowTitle(tr("Import Existing Project"));
@@ -61,7 +61,8 @@ GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent)
m_firstPage->setFileNameLabel(tr("Project name:"));
m_firstPage->setPathLabel(tr("Location:"));
addPage(m_firstPage);
const int firstPageId = addPage(m_firstPage);
wizardProgress()->item(firstPageId)->setTitle(tr("Location"));
}
GenericProjectWizardDialog::~GenericProjectWizardDialog()
@@ -111,7 +112,7 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
wizard->setPath(defaultPath);
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
return wizard;
}

View File

@@ -31,8 +31,7 @@
#define GENERICPROJECTWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <QtGui/QWizard>
#include <utils/wizard.h>
QT_BEGIN_NAMESPACE
class QFileInfo;
@@ -48,7 +47,7 @@ class FileWizardPage;
namespace GenericProjectManager {
namespace Internal {
class GenericProjectWizardDialog : public QWizard
class GenericProjectWizardDialog : public Utils::Wizard
{
Q_OBJECT

View File

@@ -55,6 +55,7 @@ CloneWizardPage::CloneWizardPage(QWidget *parent) :
VCSBase::BaseCheckoutWizardPage(parent),
d(new CloneWizardPagePrivate)
{
setTitle(tr("Location"));
setSubTitle(tr("Specify repository URL, checkout directory and path."));
setRepositoryLabel(tr("Clone URL:"));
}

View File

@@ -73,6 +73,7 @@ GitoriousHostWizardPage::GitoriousHostWizardPage(QWidget *parent) :
QVBoxLayout *lt = new QVBoxLayout;
lt->addWidget(m_widget);
setLayout(lt);
setTitle(tr("Host"));
setSubTitle(tr("Select a host."));
}

View File

@@ -50,6 +50,7 @@ GitoriousProjectWizardPage::GitoriousProjectWizardPage(const GitoriousHostWizard
QVBoxLayout *lt = new QVBoxLayout;
lt->addWidget(m_stackedWidget);
setLayout(lt);
setTitle(tr("Project"));
}
static inline QString msgChooseProject(const QString &h)

View File

@@ -97,6 +97,8 @@ GitoriousRepositoryWizardPage::GitoriousRepositoryWizardPage(const GitoriousProj
ui->repositoryTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
connect(ui->repositoryTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(slotCurrentChanged(QModelIndex,QModelIndex)));
setTitle(tr("Repository"));
}
GitoriousRepositoryWizardPage::~GitoriousRepositoryWizardPage()

View File

@@ -34,6 +34,8 @@ using namespace Mercurial::Internal;
CloneWizardPage::CloneWizardPage(QWidget *parent)
: VCSBase::BaseCheckoutWizardPage(parent)
{
setTitle(tr("Location"));
setSubTitle(tr("Specify repository URL, checkout directory and path."));
setRepositoryLabel(tr("Clone URL:"));
}

View File

@@ -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)));
}

View File

@@ -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

View File

@@ -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));

View File

@@ -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

View File

@@ -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()

View File

@@ -79,7 +79,7 @@ QWizard *QmlProjectApplicationWizard::createWizardDialog(QWidget *parent,
wizard->setProjectName(QmlProjectApplicationWizardDialog::uniqueProjectName(defaultPath));
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
return wizard;
}

View File

@@ -55,17 +55,18 @@ namespace Internal {
//////////////////////////////////////////////////////////////////////////////
QmlProjectImportWizardDialog::QmlProjectImportWizardDialog(QWidget *parent)
: QWizard(parent)
: Utils::Wizard(parent)
{
setWindowTitle(tr("Import Existing Qt QML Directory"));
// first page
m_firstPage = new FileWizardPage;
m_firstPage->setTitle(tr("QML Project"));
m_firstPage->setTitle(tr("Project Name and Location"));
m_firstPage->setFileNameLabel(tr("Project name:"));
m_firstPage->setPathLabel(tr("Location:"));
addPage(m_firstPage);
const int firstPageId = addPage(m_firstPage);
wizardProgress()->item(firstPageId)->setTitle(tr("Location"));
}
QmlProjectImportWizardDialog::~QmlProjectImportWizardDialog()
@@ -120,7 +121,7 @@ QWizard *QmlProjectImportWizard::createWizardDialog(QWidget *parent,
wizard->setPath(defaultPath);
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
return wizard;
}

View File

@@ -31,8 +31,7 @@
#define QMLPROJECTIMPORTWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <QtGui/QWizard>
#include <utils/wizard.h>
QT_BEGIN_NAMESPACE
class QDir;
@@ -48,7 +47,7 @@ class FileWizardPage;
namespace QmlProjectManager {
namespace Internal {
class QmlProjectImportWizardDialog : public QWizard
class QmlProjectImportWizardDialog : public Utils::Wizard
{
Q_OBJECT

View File

@@ -55,9 +55,11 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
addTargetSetupPage(BaseQt4ProjectWizardDialog::desktopTarget());
m_widgetPageId = addPage(m_widgetsPage);
m_pluginPageId = addPage(m_pluginPage);
wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets"));
wizardProgress()->item(m_pluginPageId)->setTitle(tr("Plugin Details"));
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
}

View File

@@ -48,7 +48,7 @@ using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags)
: QWizard(parent, flags), m_project(project), m_targetSetupPage(0)
: Utils::Wizard(parent, flags), m_project(project), m_targetSetupPage(0)
{
Q_ASSERT(project);
@@ -105,7 +105,8 @@ void ProjectLoadWizard::setupTargetPage()
m_targetSetupPage->setImportDirectoryBrowsingEnabled(true);
m_targetSetupPage->setImportDirectoryBrowsingLocation(m_project->projectDirectory());
addPage(m_targetSetupPage);
const int targetPageId = addPage(m_targetSetupPage);
wizardProgress()->item(targetPageId)->setTitle(tr("Targets"));
}
void ProjectLoadWizard::applySettings()

View File

@@ -31,7 +31,8 @@
#define PROJECTLOADWIZARD_H
#include "qtversionmanager.h"
#include "wizards/targetsetuppage.h"
#include <wizards/targetsetuppage.h>
#include <utils/wizard.h>
namespace Qt4ProjectManager {
class Qt4Project;
@@ -40,7 +41,7 @@ namespace Internal {
class TargetsPage;
class ProjectLoadWizard : public QWizard
class ProjectLoadWizard : public Utils::Wizard
{
Q_OBJECT
public:

View File

@@ -29,6 +29,7 @@
#include "consoleappwizarddialog.h"
#include "consoleappwizard.h"
#include <coreplugin/basefilewizard.h>
#include <QtCore/QDebug>
@@ -55,7 +56,7 @@ ConsoleAppWizardDialog::ConsoleAppWizardDialog(const QString &templateName,
addTargetSetupPage();
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
QtProjectParameters ConsoleAppWizardDialog::parameters() const

View File

@@ -48,7 +48,7 @@ EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName,
addTargetSetupPage();
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
QtProjectParameters EmptyProjectWizardDialog::parameters() const

View File

@@ -67,10 +67,11 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
m_filesPage->setFormInputCheckable(true);
m_filesPage->setClassTypeComboVisible(false);
addPage(m_filesPage);
const int filesPageId = addPage(m_filesPage);
wizardProgress()->item(filesPageId)->setTitle(tr("Details"));
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
void GuiAppWizardDialog::setBaseClasses(const QStringList &baseClasses)

View File

@@ -154,11 +154,12 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
m_filesPage->setClassTypeComboVisible(false);
m_filesPageId = addPage(m_filesPage);
wizardProgress()->item(m_filesPageId)->setTitle(tr("Details"));
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
void LibraryWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)

View File

@@ -218,9 +218,12 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
return -1;
if (id >= 0) {
setPage(id, m_modulesPage);
wizardProgress()->item(id)->setTitle(tr("Modules"));
return id;
}
return addPage(m_modulesPage);
const int newId = addPage(m_modulesPage);
wizardProgress()->item(newId)->setTitle(tr("Modules"));
return newId;
}
int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool mobile, int id)
@@ -242,6 +245,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool m
setPage(id, m_targetSetupPage);
else
id = addPage(m_targetSetupPage);
wizardProgress()->item(id)->setTitle(tr("Qt Versions"));
return id;
}

View File

@@ -61,10 +61,11 @@ TestWizardDialog::TestWizardDialog(const QString &templateName,
setWindowTitle(templateName);
setSelectedModules(QLatin1String("core testlib"), true);
addTargetSetupPage();
m_testPageId = addPage(m_testPage);
m_modulesPageId = addModulesPage();
m_testPageId = addPage(m_testPage);
wizardProgress()->item(m_testPageId)->setTitle(tr("Details"));
foreach (QWizardPage *p, extensionPages)
addPage(p);
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
}

View File

@@ -43,6 +43,7 @@ TestWizardPage::TestWizardPage(QWidget *parent) :
m_fileNameEdited(false),
m_valid(false)
{
setTitle(tr("Test Class Information"));
ui->setupUi(this);
ui->testSlotLineEdit->setText(QLatin1String("testCase1"));
ui->testClassLineEdit->setLowerCaseFileName(m_lowerCaseFileNames);

View File

@@ -14,6 +14,32 @@
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string>Specify basic information about the test class for which you want to generate skeleton source code file.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
@@ -59,7 +85,7 @@
</item>
<item row="6" column="1">
<widget class="Utils::FileNameValidatingLineEdit" name="fileLineEdit">
<property name="allowDirectories">
<property name="allowDirectories" stdset="0">
<bool>true</bool>
</property>
</widget>

View File

@@ -35,7 +35,8 @@ namespace Internal {
CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) :
VCSBase::BaseCheckoutWizardPage(parent)
{
setSubTitle(tr("Specify repository, checkout directory and path."));
setTitle(tr("Location"));
setSubTitle(tr("Specify repository URL, checkout directory and path."));
setRepositoryLabel(tr("Repository:"));
}

View File

@@ -45,6 +45,7 @@ CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) :
m_state(Idle)
{
ui->setupUi(this);
setTitle(tr("Checkout"));
}
CheckoutProgressWizardPage::~CheckoutProgressWizardPage()
@@ -63,7 +64,8 @@ void CheckoutProgressWizardPage::start(const QSharedPointer<AbstractCheckoutJob>
connect(job.data(), SIGNAL(succeeded()), this, SLOT(slotSucceeded()));
QApplication::setOverrideCursor(Qt::WaitCursor);
ui->logPlainTextEdit->clear();
setSubTitle(tr("Checkout started..."));
ui->statusLabel->setText(tr("Checkout started..."));
ui->statusLabel->setPalette(QPalette());
m_state = Running;
// Note: Process jobs can emit failed() right from
// the start() method on Windows.
@@ -76,7 +78,10 @@ void CheckoutProgressWizardPage::slotFailed(const QString &why)
if (m_state == Running) {
m_state = Failed;
QApplication::restoreOverrideCursor();
setSubTitle(tr("Failed."));
ui->statusLabel->setText(tr("Failed."));
QPalette palette = ui->statusLabel->palette();
palette.setColor(QPalette::Active, QPalette::Text, Qt::red);
ui->statusLabel->setPalette(palette);
emit terminated(false);
}
}
@@ -86,7 +91,10 @@ void CheckoutProgressWizardPage::slotSucceeded()
if (m_state == Running) {
m_state = Succeeded;
QApplication::restoreOverrideCursor();
setSubTitle(tr("Succeeded."));
ui->statusLabel->setText(tr("Succeeded."));
QPalette palette = ui->statusLabel->palette();
palette.setColor(QPalette::Active, QPalette::Text, Qt::green);
ui->statusLabel->setPalette(palette);
emit completeChanged();
emit terminated(true);
}

View File

@@ -18,6 +18,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -41,7 +41,7 @@ namespace Internal {
CheckoutWizardDialog::CheckoutWizardDialog(const QList<QWizardPage *> &parameterPages,
QWidget *parent) :
QWizard(parent),
Utils::Wizard(parent),
m_progressPage(new CheckoutProgressWizardPage),
m_progressPageId(-1)
{

View File

@@ -32,7 +32,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QList>
#include <QtGui/QWizard>
#include <utils/wizard.h>
namespace VCSBase {
class AbstractCheckoutJob;
@@ -44,7 +44,7 @@ class CheckoutProgressWizardPage;
* Overwrites reject() to first kill the checkout
* and then close. */
class CheckoutWizardDialog : public QWizard {
class CheckoutWizardDialog : public Utils::Wizard {
Q_OBJECT
public:
CheckoutWizardDialog(const QList<QWizardPage *> &parameterPages,