Commit 56c3d8ff authored by Eike Ziller's avatar Eike Ziller
Browse files

Unify wizards with TOC and cancel button.



QTBUG-28385 is biting us over and over (QWizard doesn't have close
button nor cancel button on Mac in Qt 5), and actually there's no reason
for us having a wizard without the features from Utils::Wizard.

Task-number: QTCREATORBUG-10346
Task-number: QTBUG-28385
Change-Id: I80c0d82fe6738496c2ac03c31a1c2757ade8e266
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@digia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 1ba9c8ef
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include "filewizarddialog.h" #include "filewizarddialog.h"
#include "filewizardpage.h" #include "filewizardpage.h"
#include "hostosinfo.h"
#include <QAbstractButton> #include <QAbstractButton>
/*! /*!
...@@ -49,18 +47,6 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) : ...@@ -49,18 +47,6 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
Wizard(parent), Wizard(parent),
m_filePage(new FileWizardPage) m_filePage(new FileWizardPage)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false);
if (HostOsInfo::isMacHost()) {
setButtonLayout(QList<QWizard::WizardButton>()
<< QWizard::CancelButton
<< QWizard::Stretch
<< QWizard::BackButton
<< QWizard::NextButton
<< QWizard::CommitButton
<< QWizard::FinishButton);
}
const int filePageId = addPage(m_filePage); const int filePageId = addPage(m_filePage);
wizardProgress()->item(filePageId)->setTitle(tr("Location")); wizardProgress()->item(filePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick())); connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "wizard.h" #include "wizard.h"
#include "hostosinfo.h"
#include <QMap> #include <QMap>
#include <QHash> #include <QHash>
...@@ -318,6 +319,20 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) : ...@@ -318,6 +319,20 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) :
connect(this, SIGNAL(pageAdded(int)), this, SLOT(_q_pageAdded(int))); connect(this, SIGNAL(pageAdded(int)), this, SLOT(_q_pageAdded(int)));
connect(this, SIGNAL(pageRemoved(int)), this, SLOT(_q_pageRemoved(int))); connect(this, SIGNAL(pageRemoved(int)), this, SLOT(_q_pageRemoved(int)));
setSideWidget(new LinearProgressWidget(d_ptr->m_wizardProgress, this)); setSideWidget(new LinearProgressWidget(d_ptr->m_wizardProgress, this));
setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false);
setOption(QWizard::NoBackButtonOnStartPage, true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
if (Utils::HostOsInfo::isMacHost()) {
setButtonLayout(QList<QWizard::WizardButton>()
<< QWizard::CancelButton
<< QWizard::Stretch
<< QWizard::BackButton
<< QWizard::NextButton
<< QWizard::CommitButton
<< QWizard::FinishButton);
}
} }
Wizard::~Wizard() Wizard::~Wizard()
......
...@@ -131,8 +131,6 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard) ...@@ -131,8 +131,6 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
CreateAndroidManifestWizard::CreateAndroidManifestWizard(ProjectExplorer::Target *target) CreateAndroidManifestWizard::CreateAndroidManifestWizard(ProjectExplorer::Target *target)
: m_target(target), m_node(0) : m_target(target), m_node(0)
{ {
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoCancelButton, false);
setWindowTitle(tr("Create Android Manifest Wizard")); setWindowTitle(tr("Create Android Manifest Wizard"));
Qt4Project *project = static_cast<Qt4Project *>(target->project()); Qt4Project *project = static_cast<Qt4Project *>(target->project());
......
...@@ -57,12 +57,6 @@ AutotoolsOpenProjectWizard::AutotoolsOpenProjectWizard(AutotoolsManager *manager ...@@ -57,12 +57,6 @@ AutotoolsOpenProjectWizard::AutotoolsOpenProjectWizard(AutotoolsManager *manager
setPage(BuildPathPageId, new BuildPathPage(this)); setPage(BuildPathPageId, new BuildPathPage(this));
setStartId(BuildPathPageId); setStartId(BuildPathPageId);
init();
}
void AutotoolsOpenProjectWizard::init()
{
setOption(QWizard::NoBackButtonOnStartPage);
setWindowTitle(tr("Autotools Wizard")); setWindowTitle(tr("Autotools Wizard"));
} }
......
...@@ -63,7 +63,6 @@ public: ...@@ -63,7 +63,6 @@ public:
AutotoolsManager *autotoolsManager() const; AutotoolsManager *autotoolsManager() const;
private: private:
void init();
AutotoolsManager *m_manager; AutotoolsManager *m_manager;
QString m_buildDirectory; QString m_buildDirectory;
QString m_sourceDirectory; QString m_sourceDirectory;
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
} //namespace Internal } //namespace Internal
BareMetalDeviceConfigurationWizard::BareMetalDeviceConfigurationWizard(QWidget *parent) : BareMetalDeviceConfigurationWizard::BareMetalDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent), Utils::Wizard(parent),
d(new Internal::BareMetalDeviceConfigrationWizardPrivate(this)) d(new Internal::BareMetalDeviceConfigrationWizardPrivate(this))
{ {
setWindowTitle(tr("New Bare Metal Device Configuration Setup")); setWindowTitle(tr("New Bare Metal Device Configuration Setup"));
......
...@@ -31,15 +31,14 @@ ...@@ -31,15 +31,14 @@
#define BAREMETALDEVICECONFIGURATIONWIZARD_H #define BAREMETALDEVICECONFIGURATIONWIZARD_H
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <utils/wizard.h>
#include <QWizard>
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {
class BareMetalDeviceConfigrationWizardPrivate; class BareMetalDeviceConfigrationWizardPrivate;
} // namespace Internal } // namespace Internal
class BareMetalDeviceConfigurationWizard : public QWizard class BareMetalDeviceConfigurationWizard : public Utils::Wizard
{ {
Q_OBJECT Q_OBJECT
public: public:
......
...@@ -273,8 +273,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake ...@@ -273,8 +273,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
void CMakeOpenProjectWizard::init() void CMakeOpenProjectWizard::init()
{ {
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoCancelButton, false);
setWindowTitle(tr("CMake Wizard")); setWindowTitle(tr("CMake Wizard"));
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <utils/filewizarddialog.h> #include <utils/filewizarddialog.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
...@@ -345,28 +344,6 @@ bool BaseFileWizard::writeFiles(const GeneratedFiles &files, QString *errorMessa ...@@ -345,28 +344,6 @@ bool BaseFileWizard::writeFiles(const GeneratedFiles &files, QString *errorMessa
return true; return true;
} }
/*!
Sets some standard options on a QWizard.
*/
void BaseFileWizard::setupWizard(QWizard *w)
{
w->setOption(QWizard::NoCancelButton, false);
w->setOption(QWizard::NoDefaultButton, false);
w->setOption(QWizard::NoBackButtonOnStartPage, true);
w->setWindowFlags(w->windowFlags() & ~Qt::WindowContextHelpButtonHint);
if (Utils::HostOsInfo::isMacHost()) {
w->setButtonLayout(QList<QWizard::WizardButton>()
<< QWizard::CancelButton
<< QWizard::Stretch
<< QWizard::BackButton
<< QWizard::NextButton
<< QWizard::CommitButton
<< QWizard::FinishButton);
}
}
/*! /*!
Reads the \c shortTitle dynamic property of \a pageId and applies it as Reads the \c shortTitle dynamic property of \a pageId and applies it as
the title of corresponding progress item. the title of corresponding progress item.
...@@ -571,7 +548,6 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent, ...@@ -571,7 +548,6 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
if (wizardDialogParameters.flags().testFlag(WizardDialogParameters::ForceCapitalLetterForFileName)) if (wizardDialogParameters.flags().testFlag(WizardDialogParameters::ForceCapitalLetterForFileName))
standardWizardDialog->setForceFirstCapitalLetterForFileName(true); standardWizardDialog->setForceFirstCapitalLetterForFileName(true);
standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName())); standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(standardWizardDialog);
standardWizardDialog->setPath(wizardDialogParameters.defaultPath()); standardWizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages()) foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p)); BaseFileWizard::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p));
......
...@@ -114,7 +114,6 @@ public: ...@@ -114,7 +114,6 @@ public:
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues); virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension); static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
static void setupWizard(QWizard *);
static void applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId); static void applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId);
protected: protected:
......
...@@ -114,7 +114,6 @@ CppClassWizardDialog::CppClassWizardDialog(QWidget *parent) : ...@@ -114,7 +114,6 @@ CppClassWizardDialog::CppClassWizardDialog(QWidget *parent) :
Utils::Wizard(parent), Utils::Wizard(parent),
m_classNamePage(new ClassNamePage(this)) m_classNamePage(new ClassNamePage(this))
{ {
Core::BaseFileWizard::setupWizard(this);
setWindowTitle(tr("C++ Class Wizard")); setWindowTitle(tr("C++ Class Wizard"));
const int classNameId = addPage(m_classNamePage); const int classNameId = addPage(m_classNamePage);
wizardProgress()->item(classNameId)->setTitle(tr("Details")); wizardProgress()->item(classNameId)->setTitle(tr("Details"));
......
...@@ -54,7 +54,6 @@ FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages, ...@@ -54,7 +54,6 @@ FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
void FormWizardDialog::init(const WizardPageList &extensionPages) void FormWizardDialog::init(const WizardPageList &extensionPages)
{ {
Core::BaseFileWizard::setupWizard(this);
setWindowTitle(tr("Qt Designer Form")); setWindowTitle(tr("Qt Designer Form"));
setPage(FormPageId, m_formPage); setPage(FormPageId, m_formPage);
wizardProgress()->item(FormPageId)->setTitle(tr("Form Template")); wizardProgress()->item(FormPageId)->setTitle(tr("Form Template"));
......
...@@ -131,7 +131,6 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent, ...@@ -131,7 +131,6 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const const Core::WizardDialogParameters &wizardDialogParameters) const
{ {
GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent); GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent);
setupWizard(wizard);
wizard->setPath(wizardDialogParameters.defaultPath()); wizard->setPath(wizardDialogParameters.defaultPath());
......
...@@ -132,7 +132,6 @@ QWizard *GLSLFileWizard::createWizardDialog(QWidget *parent, ...@@ -132,7 +132,6 @@ QWizard *GLSLFileWizard::createWizardDialog(QWidget *parent,
{ {
GLSLFileWizardDialog *wizardDialog = new GLSLFileWizardDialog(parent); GLSLFileWizardDialog *wizardDialog = new GLSLFileWizardDialog(parent);
wizardDialog->setWindowTitle(tr("New %1").arg(displayName())); wizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(wizardDialog);
wizardDialog->setPath(wizardDialogParameters.defaultPath()); wizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages()) foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p)); BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p));
......
...@@ -89,7 +89,6 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introP ...@@ -89,7 +89,6 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introP
void BaseProjectWizardDialog::init() void BaseProjectWizardDialog::init()
{ {
Core::BaseFileWizard::setupWizard(this);
if (d->introPageId == -1) { if (d->introPageId == -1) {
d->introPageId = addPage(d->introPage); d->introPageId = addPage(d->introPage);
} else { } else {
......
...@@ -145,7 +145,6 @@ void CustomWizard::initWizardDialog(Utils::Wizard *wizard, const QString &defaul ...@@ -145,7 +145,6 @@ void CustomWizard::initWizardDialog(Utils::Wizard *wizard, const QString &defaul
customPage->setTitle(parameters()->fieldPageTitle); customPage->setTitle(parameters()->fieldPageTitle);
foreach (QWizardPage *ep, extensionPages) foreach (QWizardPage *ep, extensionPages)
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(ep)); BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(ep));
Core::BaseFileWizard::setupWizard(wizard);
if (CustomWizardPrivate::verbose) if (CustomWizardPrivate::verbose)
qDebug() << "initWizardDialog" << wizard << wizard->pageIds(); qDebug() << "initWizardDialog" << wizard << wizard->pageIds();
} }
......
...@@ -41,7 +41,6 @@ ClassWizardDialog::ClassWizardDialog(QWidget *parent) ...@@ -41,7 +41,6 @@ ClassWizardDialog::ClassWizardDialog(QWidget *parent)
, m_classNamePage(new ClassNamePage(this)) , m_classNamePage(new ClassNamePage(this))
{ {
setWindowTitle(tr("Python Class Wizard")); setWindowTitle(tr("Python Class Wizard"));
Core::BaseFileWizard::setupWizard(this);
const int classNameId = addPage(m_classNamePage.data()); const int classNameId = addPage(m_classNamePage.data());
wizardProgress()->item(classNameId)->setTitle(tr("Details")); wizardProgress()->item(classNameId)->setTitle(tr("Details"));
} }
......
...@@ -70,7 +70,6 @@ QWizard *FileWizard::createWizardDialog(QWidget *parent, ...@@ -70,7 +70,6 @@ QWizard *FileWizard::createWizardDialog(QWidget *parent,
{ {
Utils::FileWizardDialog *pDialog = new Utils::FileWizardDialog(parent); Utils::FileWizardDialog *pDialog = new Utils::FileWizardDialog(parent);
pDialog->setWindowTitle(tr("New %1").arg(displayName())); pDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(pDialog);
pDialog->setPath(params.defaultPath()); pDialog->setPath(params.defaultPath());
foreach (QWizardPage *p, params.extensionPages()) foreach (QWizardPage *p, params.extensionPages())
applyExtensionPageShortTitle(pDialog, pDialog->addPage(p)); applyExtensionPageShortTitle(pDialog, pDialog->addPage(p));
......
...@@ -127,7 +127,6 @@ QWizard *JsFileWizard::createWizardDialog(QWidget *parent, ...@@ -127,7 +127,6 @@ QWizard *JsFileWizard::createWizardDialog(QWidget *parent,
{ {
JsFileWizardDialog *wizardDialog = new JsFileWizardDialog(parent); JsFileWizardDialog *wizardDialog = new JsFileWizardDialog(parent);
wizardDialog->setWindowTitle(tr("New %1").arg(displayName())); wizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(wizardDialog);
wizardDialog->setPath(wizardDialogParameters.defaultPath()); wizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages()) foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p)); BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p));
......
...@@ -41,7 +41,7 @@ using namespace Qnx; ...@@ -41,7 +41,7 @@ using namespace Qnx;
using namespace Qnx::Internal; using namespace Qnx::Internal;
BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget *parent) : BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent) Utils::Wizard(parent)
{ {
setWindowTitle(tr("New BlackBerry Device Configuration Setup")); setWindowTitle(tr("New BlackBerry Device Configuration Setup"));
......
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