From 600042131f58ed43bca97bc4b4016a56094b0bc8 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 22 Sep 2010 14:22:57 +0200 Subject: Only show the modules deployment page for imported Qml projets Some people who tried the 'new Qml app' wizard fell on their backs and helplessly waved their arms and legs like turtles when they were confronted with the complexity of the modules deployment page in the 'New Qml App' wizard. --- .../wizards/qmlstandaloneappwizard.cpp | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp index c8ab9dd238..bb4da242ea 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp @@ -64,6 +64,7 @@ QmlStandaloneAppWizardDialog::QmlStandaloneAppWizardDialog(QmlStandaloneAppWizar QWidget *parent) : AbstractMobileAppWizardDialog(parent) , m_type(type) + , m_qmlSourcesPage(0) { setWindowTitle(m_type == QmlStandaloneAppWizard::NewQmlFile ? tr("New QML Project") @@ -72,10 +73,12 @@ QmlStandaloneAppWizardDialog::QmlStandaloneAppWizardDialog(QmlStandaloneAppWizar ? tr("This wizard generates a QML application project.") : tr("This wizard imports an existing, QML Viewer-based application and creates a standalone version of it.")); - m_qmlSourcesPage = new QmlStandaloneAppWizardSourcesPage; - m_qmlSourcesPage->setMainQmlFileChooserVisible(m_type == QmlStandaloneAppWizard::ImportQmlFile); - const int qmlSourcesPagePageId = addPage(m_qmlSourcesPage); - wizardProgress()->item(qmlSourcesPagePageId)->setTitle(tr("QML Sources")); + if (m_type == QmlStandaloneAppWizard::ImportQmlFile) { + m_qmlSourcesPage = new QmlStandaloneAppWizardSourcesPage; + m_qmlSourcesPage->setMainQmlFileChooserVisible(true); + const int qmlSourcesPagePageId = addPage(m_qmlSourcesPage); + wizardProgress()->item(qmlSourcesPagePageId)->setTitle(tr("QML Sources")); + } } class QmlStandaloneAppWizardPrivate @@ -127,9 +130,11 @@ Core::BaseFileWizardParameters QmlStandaloneAppWizard::parameters(WizardType typ AbstractMobileAppWizardDialog *QmlStandaloneAppWizard::createWizardDialogInternal(QWidget *parent) const { m_d->wizardDialog = new QmlStandaloneAppWizardDialog(m_d->type, parent); - connect(m_d->wizardDialog->m_qmlSourcesPage, - SIGNAL(externalModulesChanged(QStringList, QStringList)), SLOT(handleModulesChange(QStringList, QStringList))); - + if (m_d->wizardDialog->m_qmlSourcesPage) { + connect(m_d->wizardDialog->m_qmlSourcesPage, + SIGNAL(externalModulesChanged(QStringList, QStringList)), + SLOT(handleModulesChange(QStringList, QStringList))); + } const QList &qtVersions = TargetSetupPage::importInfosForKnownQtVersions(); QList qmlQtVersions; @@ -154,10 +159,12 @@ void QmlStandaloneAppWizard::prepareGenerateFiles(const QWizard *w, { Q_UNUSED(errorMessage) const QmlStandaloneAppWizardDialog *wizard = qobject_cast(w); - if (m_d->type == QmlStandaloneAppWizard::ImportQmlFile) + if (wizard->m_qmlSourcesPage) { m_d->standaloneApp->setMainQmlFile(wizard->m_qmlSourcesPage->mainQmlFile()); - m_d->standaloneApp->setExternalModules( - wizard->m_qmlSourcesPage->moduleUris(), wizard->m_qmlSourcesPage->moduleImportPaths()); + m_d->standaloneApp->setExternalModules( + wizard->m_qmlSourcesPage->moduleUris(), + wizard->m_qmlSourcesPage->moduleImportPaths()); + } } bool QmlStandaloneAppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l, @@ -174,6 +181,7 @@ bool QmlStandaloneAppWizard::postGenerateFilesInternal(const Core::GeneratedFile void QmlStandaloneAppWizard::handleModulesChange(const QStringList &uris, const QStringList &paths) { + Q_ASSERT(m_d->wizardDialog->m_qmlSourcesPage); QmlStandaloneApp testApp; testApp.setExternalModules(uris, paths); m_d->wizardDialog->m_qmlSourcesPage->setModulesError(testApp.error()); -- cgit v1.2.1