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 @@
#include "filewizarddialog.h"
#include "filewizardpage.h"
#include "hostosinfo.h"
#include <QAbstractButton>
/*!
......@@ -49,18 +47,6 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
Wizard(parent),
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);
wizardProgress()->item(filePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
......
......@@ -28,6 +28,7 @@
****************************************************************************/
#include "wizard.h"
#include "hostosinfo.h"
#include <QMap>
#include <QHash>
......@@ -318,6 +319,20 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) :
connect(this, SIGNAL(pageAdded(int)), this, SLOT(_q_pageAdded(int)));
connect(this, SIGNAL(pageRemoved(int)), this, SLOT(_q_pageRemoved(int)));
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()
......
......@@ -131,8 +131,6 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
CreateAndroidManifestWizard::CreateAndroidManifestWizard(ProjectExplorer::Target *target)
: m_target(target), m_node(0)
{
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoCancelButton, false);
setWindowTitle(tr("Create Android Manifest Wizard"));
Qt4Project *project = static_cast<Qt4Project *>(target->project());
......
......@@ -57,12 +57,6 @@ AutotoolsOpenProjectWizard::AutotoolsOpenProjectWizard(AutotoolsManager *manager
setPage(BuildPathPageId, new BuildPathPage(this));
setStartId(BuildPathPageId);
init();
}
void AutotoolsOpenProjectWizard::init()
{
setOption(QWizard::NoBackButtonOnStartPage);
setWindowTitle(tr("Autotools Wizard"));
}
......
......@@ -63,7 +63,6 @@ public:
AutotoolsManager *autotoolsManager() const;
private:
void init();
AutotoolsManager *m_manager;
QString m_buildDirectory;
QString m_sourceDirectory;
......
......@@ -55,7 +55,7 @@ public:
} //namespace Internal
BareMetalDeviceConfigurationWizard::BareMetalDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent),
Utils::Wizard(parent),
d(new Internal::BareMetalDeviceConfigrationWizardPrivate(this))
{
setWindowTitle(tr("New Bare Metal Device Configuration Setup"));
......
......@@ -31,15 +31,14 @@
#define BAREMETALDEVICECONFIGURATIONWIZARD_H
#include <projectexplorer/devicesupport/idevice.h>
#include <QWizard>
#include <utils/wizard.h>
namespace BareMetal {
namespace Internal {
class BareMetalDeviceConfigrationWizardPrivate;
} // namespace Internal
class BareMetalDeviceConfigurationWizard : public QWizard
class BareMetalDeviceConfigurationWizard : public Utils::Wizard
{
Q_OBJECT
public:
......
......@@ -273,8 +273,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
void CMakeOpenProjectWizard::init()
{
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoCancelButton, false);
setWindowTitle(tr("CMake Wizard"));
}
......
......@@ -37,7 +37,6 @@
#include <utils/filewizarddialog.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <utils/hostosinfo.h>
#include <QDir>
#include <QFileInfo>
......@@ -345,28 +344,6 @@ bool BaseFileWizard::writeFiles(const GeneratedFiles &files, QString *errorMessa
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
the title of corresponding progress item.
......@@ -571,7 +548,6 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
if (wizardDialogParameters.flags().testFlag(WizardDialogParameters::ForceCapitalLetterForFileName))
standardWizardDialog->setForceFirstCapitalLetterForFileName(true);
standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(standardWizardDialog);
standardWizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p));
......
......@@ -114,7 +114,6 @@ public:
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 void setupWizard(QWizard *);
static void applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId);
protected:
......
......@@ -114,7 +114,6 @@ CppClassWizardDialog::CppClassWizardDialog(QWidget *parent) :
Utils::Wizard(parent),
m_classNamePage(new ClassNamePage(this))
{
Core::BaseFileWizard::setupWizard(this);
setWindowTitle(tr("C++ Class Wizard"));
const int classNameId = addPage(m_classNamePage);
wizardProgress()->item(classNameId)->setTitle(tr("Details"));
......
......@@ -54,7 +54,6 @@ FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
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"));
......
......@@ -131,7 +131,6 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
{
GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent);
setupWizard(wizard);
wizard->setPath(wizardDialogParameters.defaultPath());
......
......@@ -132,7 +132,6 @@ QWizard *GLSLFileWizard::createWizardDialog(QWidget *parent,
{
GLSLFileWizardDialog *wizardDialog = new GLSLFileWizardDialog(parent);
wizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(wizardDialog);
wizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p));
......
......@@ -89,7 +89,6 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introP
void BaseProjectWizardDialog::init()
{
Core::BaseFileWizard::setupWizard(this);
if (d->introPageId == -1) {
d->introPageId = addPage(d->introPage);
} else {
......
......@@ -145,7 +145,6 @@ void CustomWizard::initWizardDialog(Utils::Wizard *wizard, const QString &defaul
customPage->setTitle(parameters()->fieldPageTitle);
foreach (QWizardPage *ep, extensionPages)
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(ep));
Core::BaseFileWizard::setupWizard(wizard);
if (CustomWizardPrivate::verbose)
qDebug() << "initWizardDialog" << wizard << wizard->pageIds();
}
......
......@@ -41,7 +41,6 @@ ClassWizardDialog::ClassWizardDialog(QWidget *parent)
, m_classNamePage(new ClassNamePage(this))
{
setWindowTitle(tr("Python Class Wizard"));
Core::BaseFileWizard::setupWizard(this);
const int classNameId = addPage(m_classNamePage.data());
wizardProgress()->item(classNameId)->setTitle(tr("Details"));
}
......
......@@ -70,7 +70,6 @@ QWizard *FileWizard::createWizardDialog(QWidget *parent,
{
Utils::FileWizardDialog *pDialog = new Utils::FileWizardDialog(parent);
pDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(pDialog);
pDialog->setPath(params.defaultPath());
foreach (QWizardPage *p, params.extensionPages())
applyExtensionPageShortTitle(pDialog, pDialog->addPage(p));
......
......@@ -127,7 +127,6 @@ QWizard *JsFileWizard::createWizardDialog(QWidget *parent,
{
JsFileWizardDialog *wizardDialog = new JsFileWizardDialog(parent);
wizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
setupWizard(wizardDialog);
wizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p));
......
......@@ -41,7 +41,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent)
Utils::Wizard(parent)
{
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