forked from qt-creator/qt-creator
Fix replacement of variables in wizard parameters.
This was broken in case of no targets page being used, and using the project name variable in default values for wizard parameters in the page following the intro page (like it is done in the hello world wizard). Reviewed-by: Friedemann Kleint
This commit is contained in:
@@ -337,6 +337,12 @@ WizardProgress *Wizard::wizardProgress() const
|
||||
return d->m_wizardProgress;
|
||||
}
|
||||
|
||||
bool Wizard::validateCurrentPage()
|
||||
{
|
||||
emit nextClicked();
|
||||
return QWizard::validateCurrentPage();
|
||||
}
|
||||
|
||||
void Wizard::_q_currentPageChanged(int pageId)
|
||||
{
|
||||
Q_D(Wizard);
|
||||
|
||||
@@ -57,6 +57,11 @@ public:
|
||||
void setStartId(int pageId);
|
||||
|
||||
WizardProgress *wizardProgress() const;
|
||||
virtual bool validateCurrentPage();
|
||||
|
||||
signals:
|
||||
void nextClicked(); /* workaround for QWizard behavior where page->initialize is
|
||||
called before currentIdChanged */
|
||||
|
||||
private slots:
|
||||
void _q_currentPageChanged(int pageId);
|
||||
|
||||
@@ -44,14 +44,12 @@ struct BaseProjectWizardDialogPrivate {
|
||||
const int desiredIntroPageId;
|
||||
Utils::ProjectIntroPage *introPage;
|
||||
int introPageId;
|
||||
int lastId;
|
||||
};
|
||||
|
||||
BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id) :
|
||||
desiredIntroPageId(id),
|
||||
introPage(page),
|
||||
introPageId(-1),
|
||||
lastId(-1)
|
||||
introPageId(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -82,7 +80,7 @@ void BaseProjectWizardDialog::init()
|
||||
}
|
||||
wizardProgress()->item(d->introPageId)->setTitle(tr("Location"));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted()));
|
||||
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotBaseCurrentIdChanged(int)));
|
||||
connect(this, SIGNAL(nextClicked()), this, SLOT(nextClicked()));
|
||||
}
|
||||
|
||||
BaseProjectWizardDialog::~BaseProjectWizardDialog()
|
||||
@@ -125,12 +123,11 @@ void BaseProjectWizardDialog::slotAccepted()
|
||||
}
|
||||
}
|
||||
|
||||
void BaseProjectWizardDialog::slotBaseCurrentIdChanged(int id)
|
||||
void BaseProjectWizardDialog::nextClicked()
|
||||
{
|
||||
if (d->lastId == d->introPageId) {
|
||||
emit introPageLeft(d->introPage->projectName(), d->introPage->path());
|
||||
if (currentId() == d->introPageId) {
|
||||
emit projectParametersChanged(d->introPage->projectName(), d->introPage->path());
|
||||
}
|
||||
d->lastId = id;
|
||||
}
|
||||
|
||||
Utils::ProjectIntroPage *BaseProjectWizardDialog::introPage() const
|
||||
|
||||
@@ -73,14 +73,14 @@ public slots:
|
||||
void setProjectName(const QString &name);
|
||||
|
||||
signals:
|
||||
void introPageLeft(const QString &projectName, const QString &path);
|
||||
void projectParametersChanged(const QString &projectName, const QString &path);
|
||||
|
||||
protected:
|
||||
Utils::ProjectIntroPage *introPage() const;
|
||||
|
||||
private slots:
|
||||
void slotAccepted();
|
||||
void slotBaseCurrentIdChanged(int);
|
||||
void nextClicked();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
@@ -503,7 +503,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
||||
w->setPath(defaultPath);
|
||||
w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath));
|
||||
|
||||
connect(w, SIGNAL(introPageLeft(QString,QString)), this, SLOT(introPageLeft(QString,QString)));
|
||||
connect(w, SIGNAL(projectParametersChanged(QString,QString)), this, SLOT(projectParametersChanged(QString,QString)));
|
||||
|
||||
if (CustomWizardPrivate::verbose)
|
||||
qDebug() << "initProjectWizardDialog" << w << w->pageIds();
|
||||
@@ -549,7 +549,7 @@ bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::Generat
|
||||
return CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
||||
}
|
||||
|
||||
void CustomProjectWizard::introPageLeft(const QString &project, const QString & path)
|
||||
void CustomProjectWizard::projectParametersChanged(const QString &project, const QString & path)
|
||||
{
|
||||
// Make '%ProjectName%' available in base replacements.
|
||||
context()->baseReplacements.insert(QLatin1String("ProjectName"), project);
|
||||
|
||||
@@ -170,7 +170,7 @@ protected:
|
||||
const WizardPageList &extensionPages) const;
|
||||
|
||||
private slots:
|
||||
void introPageLeft(const QString &project, const QString &path);
|
||||
void projectParametersChanged(const QString &project, const QString &path);
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -72,7 +72,7 @@ QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
|
||||
wdlg->m_optionsPage->setMaemoPngIcon(app()->maemoPngIcon());
|
||||
wdlg->m_optionsPage->setOrientation(app()->orientation());
|
||||
wdlg->m_optionsPage->setNetworkEnabled(app()->networkEnabled());
|
||||
connect(wdlg, SIGNAL(introPageLeft(QString, QString)),
|
||||
connect(wdlg, SIGNAL(projectParametersChanged(QString, QString)),
|
||||
SLOT(useProjectPath(QString, QString)));
|
||||
foreach (QWizardPage *p, extensionPages)
|
||||
BaseFileWizard::applyExtensionPageShortTitle(wdlg, wdlg->addPage(p));
|
||||
|
||||
@@ -212,7 +212,7 @@ void BaseQt4ProjectWizardDialog::init(bool showModulesPage)
|
||||
{
|
||||
if (showModulesPage)
|
||||
m_modulesPage = new ModulesPage;
|
||||
connect(this, SIGNAL(introPageLeft(QString,QString)),
|
||||
connect(this, SIGNAL(projectParametersChanged(QString,QString)),
|
||||
this, SLOT(generateProfileName(QString,QString)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user