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

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"));
......
......@@ -34,14 +34,13 @@
#include "blackberrydeviceconfigurationwizardpages.h"
#include <QWizard>
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/wizard.h>
namespace Qnx {
namespace Internal {
class BlackBerryDeviceConfigurationWizard : public QWizard
class BlackBerryDeviceConfigurationWizard : public Utils::Wizard
{
Q_OBJECT
public:
......
......@@ -75,7 +75,7 @@ BlackBerryDeviceConfigurationWizardSetupPage::BlackBerryDeviceConfigurationWizar
{
m_ui->setupUi(this);
setTitle(tr("Connection Details"));
setTitle(tr("Connection"));
connect(m_ui->deviceListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onDeviceSelectionChanged()));
connect(m_deviceListDetector, SIGNAL(deviceDetected(QString,QString,bool)),
......@@ -225,7 +225,7 @@ BlackBerryDeviceConfigurationWizardQueryPage::BlackBerryDeviceConfigurationWizar
, m_deviceInformation(new BlackBerryDeviceInformation(this))
{
m_ui->setupUi(this);
setTitle(tr("Query Device Information"));
setTitle(tr("Device Information"));
m_ui->progressBar->setMaximum(Done);
connect(m_deviceInformation,SIGNAL(finished(int)),this,SLOT(processQueryFinished(int)));
......@@ -426,7 +426,7 @@ QString BlackBerryDeviceConfigurationWizardConfigPage::debugToken() const
BlackBerryDeviceConfigurationWizardFinalPage::BlackBerryDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent)
{
setTitle(tr("Setup Finished"));
setTitle(tr("Summary"));
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *label = new QLabel(tr("The new device configuration will be created now."), this);
......
......@@ -42,7 +42,7 @@ using namespace Qnx::Internal;
BlackBerryInstallWizard::BlackBerryInstallWizard(BlackBerryInstallerDataHandler::Mode mode,
const QString& version,
QWidget *parent)
: QWizard(parent)
: Utils::Wizard(parent)
, m_ndkPage(0)
, m_targetPage(0)
{
......
......@@ -32,9 +32,9 @@
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#include <QProcess>
#include <utils/wizard.h>
#include <QWizard>
#include <QProcess>
namespace Qnx {
namespace Internal {
......@@ -61,7 +61,7 @@ public:
Mode mode;
};
class BlackBerryInstallWizard : public QWizard
class BlackBerryInstallWizard : public Utils::Wizard
{
Q_OBJECT
public:
......
......@@ -57,7 +57,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
BlackBerrySetupWizard::BlackBerrySetupWizard(QWidget *parent) :
QWizard(parent),
Utils::Wizard(parent),
m_ndkPage(0),
m_keysPage(0),
m_certificatePage(0),
......
......@@ -32,12 +32,12 @@
#ifndef BLACKBERRYSETUPWIZARD_H
#define BLACKBERRYSETUPWIZARD_H
#include <QWizard>
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/wizard.h>
#include <QList>
#include <QByteArray>
#include <projectexplorer/devicesupport/idevice.h>
namespace QSsh {
class SshKeyGenerator;
}
......@@ -57,7 +57,7 @@ class BlackBerryDebugTokenRequester;
class BlackBerryDebugTokenUploader;
class BlackBerrySigningUtils;
class BlackBerrySetupWizard : public QWizard
class BlackBerrySetupWizard : public Utils::Wizard
{
Q_OBJECT
public:
......
......@@ -143,7 +143,6 @@ QWizard *CascadesImportWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
{
CascadesImportWizardDialog *wizard = new CascadesImportWizardDialog(parent);
setupWizard(wizard);
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
BaseFileWizard::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
......
......@@ -44,7 +44,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
QnxDeviceConfigurationWizard::QnxDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent)
Utils::Wizard(parent)
{
setWindowTitle(tr("New QNX Device Configuration Setup"));
......
......@@ -32,9 +32,8 @@
#ifndef QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARD_H
#define QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARD_H
#include <QWizard>
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/wizard.h>
namespace RemoteLinux {
class GenericLinuxDeviceConfigurationWizardSetupPage;
......@@ -44,7 +43,7 @@ class GenericLinuxDeviceConfigurationWizardFinalPage;
namespace Qnx {
namespace Internal {
class QnxDeviceConfigurationWizard : public QWizard
class QnxDeviceConfigurationWizard : public Utils::Wizard
{
Q_OBJECT
public:
......
......@@ -58,7 +58,7 @@ public:
} // namespace Internal
GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWidget *parent)
: QWizard(parent),
: Utils::Wizard(parent),
d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this))
{
setWindowTitle(tr("New Generic Linux Device Configuration Setup"));
......
......@@ -32,15 +32,14 @@
#include "remotelinux_export.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <QWizard>
#include <utils/wizard.h>
namespace RemoteLinux {
namespace Internal {
class GenericLinuxDeviceConfigurationWizardPrivate;
} // namespace Internal
class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizard : public QWizard
class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizard : public Utils::Wizard
{
Q_OBJECT
......
......@@ -56,7 +56,7 @@ GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationW
QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate)
{
d->ui.setupUi(this);
setTitle(tr("Connection Data"));
setTitle(tr("Connection"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
d->ui.privateKeyPathChooser->setPromptDialogTitle(tr("Choose a Private Key File"));
......@@ -153,7 +153,7 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate)
{
setTitle(tr("Setup Finished"));
setTitle(tr("Summary"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
d->infoLabel.setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this);
......
......@@ -51,14 +51,12 @@ CheckoutWizardDialog::CheckoutWizardDialog(const QList<QWizardPage *> &parameter
m_progressPage(new CheckoutProgressWizardPage),
m_progressPageId(-1)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
foreach (QWizardPage *wp, parameterPages)
addPage(wp);
m_progressPageId = parameterPages.size();
setPage(m_progressPageId, m_progressPage);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotPageChanged(int)));
connect(m_progressPage, SIGNAL(terminated(bool)), this, SLOT(slotTerminated(bool)));
Core::BaseFileWizard::setupWizard(this);
}
void CheckoutWizardDialog::setTitle(const QString &title)
......
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