diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index ef2ac00330f..84129040248 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -474,7 +474,8 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QStri allExtensionPages, platform, requiredFeatures(), - dialogParameterFlags))); + dialogParameterFlags, + extraValues))); QTC_ASSERT(!wizard.isNull(), return); GeneratedFiles files; diff --git a/src/plugins/coreplugin/basefilewizard.h b/src/plugins/coreplugin/basefilewizard.h index 4f424058a6c..4c03360025f 100644 --- a/src/plugins/coreplugin/basefilewizard.h +++ b/src/plugins/coreplugin/basefilewizard.h @@ -120,12 +120,15 @@ public: explicit WizardDialogParameters(const QString &defaultPath, const WizardPageList &extensionPages, const QString &platform, const Core::FeatureSet &requiredFeatures, - DialogParameterFlags flags) + DialogParameterFlags flags, + QVariantMap extraValues) : m_defaultPath(defaultPath), m_extensionPages(extensionPages), m_selectedPlatform(platform), m_requiredFeatures(requiredFeatures), - m_parameterFlags(flags) {} + m_parameterFlags(flags), + m_extraValues(extraValues) + {} QString defaultPath() const { return m_defaultPath; } @@ -142,12 +145,16 @@ public: DialogParameterFlags flags() const { return m_parameterFlags; } + QVariantMap extraValues() const + { return m_extraValues; } + private: QString m_defaultPath; WizardPageList m_extensionPages; QString m_selectedPlatform; Core::FeatureSet m_requiredFeatures; DialogParameterFlags m_parameterFlags; + QVariantMap m_extraValues; }; class CORE_EXPORT BaseFileWizard : public IWizard diff --git a/src/plugins/coreplugin/id.h b/src/plugins/coreplugin/id.h index cea21131d10..d8f89d45f10 100644 --- a/src/plugins/coreplugin/id.h +++ b/src/plugins/coreplugin/id.h @@ -70,5 +70,6 @@ inline uint qHash(const Id &id) { return id.uniqueIdentifier(); } } // namespace Core Q_DECLARE_METATYPE(Core::Id) +Q_DECLARE_METATYPE(QList) #endif // CORE_ID_H diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index dbc0fd66cbf..27b77be91e3 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2597,6 +2597,12 @@ void ProjectExplorerPlugin::addNewFile() QVariantMap map; map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path()); + if (d->m_currentProject) { + QList profileIds; + foreach (Target *target, d->m_currentProject->targets()) + profileIds << target->id(); + map.insert(QLatin1String(Constants::PROJECT_PROFILE_IDS), QVariant::fromValue(profileIds)); + } Core::ICore::showNewItemDialog(tr("New File", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::FileWizard) + Core::IWizard::wizardsOfKind(Core::IWizard::ClassWizard), @@ -2613,6 +2619,13 @@ void ProjectExplorerPlugin::addNewSubproject() d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) { QVariantMap map; map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path()); + if (d->m_currentProject) { + QList profileIds; + foreach (Target *target, d->m_currentProject->targets()) + profileIds << target->id(); + map.insert(QLatin1String(Constants::PROJECT_PROFILE_IDS), QVariant::fromValue(profileIds)); + } + Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard), location, map); diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index f7d984a515c..ef2a5d4f932 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -210,6 +210,7 @@ const char IMPORT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer // Wizard extra values const char PREFERED_PROJECT_NODE[] = "ProjectExplorer.PreferedProjectNode"; +const char PROJECT_PROFILE_IDS[] = "ProjectExplorer.Target.Ids"; // Build step lists ids: const char BUILDSTEPS_CLEAN[] = "ProjectExplorer.BuildSteps.Clean"; diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp index 520091e3d61..d23796151e1 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp @@ -34,6 +34,7 @@ #include "customwidgetwidgetswizardpage.h" #include "customwidgetpluginwizardpage.h" #include "customwidgetwizard.h" +#include #include #include @@ -80,7 +81,9 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName, setIntroDescription(tr("This wizard generates a Qt4 Designer Custom Widget " "or a Qt4 Designer Custom Widget Collection project.")); - addTargetSetupPage(); + + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(); m_widgetPageId = addPage(m_widgetsPage); m_pluginPageId = addPage(m_pluginPage); wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets")); diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index f0e63cd78d3..78b4ec1d76c 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -56,6 +56,7 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &maximumQtVersionNumber, const Core::WizardDialogParameters ¶meters) : ProjectExplorer::BaseProjectWizardDialog(parent, parameters) + , m_targetsPage(0) , m_genericOptionsPageId(-1) , m_symbianOptionsPageId(-1) , m_maemoOptionsPageId(-1) @@ -67,13 +68,16 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, , m_symbianItem(0) , m_maemoItem(0) , m_harmattanItem(0) + , m_profileIds(parameters.extraValues().value(ProjectExplorer::Constants::PROJECT_PROFILE_IDS).value >()) { - m_targetsPage = new TargetSetupPage; - m_targetsPage->setPreferredProfileMatcher(new QtSupport::QtPlatformProfileMatcher(selectedPlatform())); - m_targetsPage->setRequiredProfileMatcher(new QtSupport::QtVersionProfileMatcher(requiredFeatures(), - minimumQtVersionNumber, - maximumQtVersionNumber)); - resize(900, 450); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) { + m_targetsPage = new TargetSetupPage; + m_targetsPage->setPreferredProfileMatcher(new QtSupport::QtPlatformProfileMatcher(selectedPlatform())); + m_targetsPage->setRequiredProfileMatcher(new QtSupport::QtVersionProfileMatcher(requiredFeatures(), + minimumQtVersionNumber, + maximumQtVersionNumber)); + resize(900, 450); + } m_genericOptionsPage = new Internal::MobileAppWizardGenericOptionsPage; m_symbianOptionsPage = new Internal::MobileAppWizardSymbianOptionsPage; @@ -83,24 +87,48 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, void AbstractMobileAppWizardDialog::addMobilePages() { - m_targetsPageId = addPageWithTitle(m_targetsPage, tr("Qt Versions")); + if (m_targetsPage) { + m_targetsPageId = addPageWithTitle(m_targetsPage, tr("Targets")); + m_targetItem = wizardProgress()->item(m_targetsPageId); + } - m_genericOptionsPageId = addPageWithTitle(m_genericOptionsPage, - tr("Mobile Options")); - m_symbianOptionsPageId = addPageWithTitle(m_symbianOptionsPage, - QLatin1String(" ") + tr("Symbian Specific")); - m_maemoOptionsPageId = addPageWithTitle(m_maemoOptionsPage, - QLatin1String(" ") + tr("Maemo5 And MeeGo Specific")); - m_harmattanOptionsPageId = addPageWithTitle(m_harmattanOptionsPage, - QLatin1String(" ") + tr("Harmattan Specific")); + const bool shouldAddGenericPage = m_targetsPage + || (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && !m_ignoreGeneralOptions) + || isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM); + const bool shouldAddSymbianPage = m_targetsPage || + isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM); + const bool shouldAddMaemoPage = m_targetsPage || + isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) + || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM); + const bool shouldAddHarmattanPage = m_targetsPage || + isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM); - m_targetItem = wizardProgress()->item(m_targetsPageId); - m_genericItem = wizardProgress()->item(m_genericOptionsPageId); - m_symbianItem = wizardProgress()->item(m_symbianOptionsPageId); - m_maemoItem = wizardProgress()->item(m_maemoOptionsPageId); - m_harmattanItem = wizardProgress()->item(m_harmattanOptionsPageId); + if (shouldAddGenericPage) { + m_genericOptionsPageId = addPageWithTitle(m_genericOptionsPage, + tr("Mobile Options")); + m_genericItem = wizardProgress()->item(m_genericOptionsPageId); + } - m_targetItem->setNextShownItem(0); + if (shouldAddSymbianPage) { + m_symbianOptionsPageId = addPageWithTitle(m_symbianOptionsPage, + QLatin1String(" ") + tr("Symbian Specific")); + m_symbianItem = wizardProgress()->item(m_symbianOptionsPageId); + } + + if (shouldAddMaemoPage) { + m_maemoOptionsPageId = addPageWithTitle(m_maemoOptionsPage, + QLatin1String(" ") + tr("Maemo5 And MeeGo Specific")); + m_maemoItem = wizardProgress()->item(m_maemoOptionsPageId); + } + + if (shouldAddHarmattanPage) { + m_harmattanOptionsPageId = addPageWithTitle(m_harmattanOptionsPage, + QLatin1String(" ") + tr("Harmattan Specific")); + m_harmattanItem = wizardProgress()->item(m_harmattanOptionsPageId); + } + + if (m_targetItem) + m_targetItem->setNextShownItem(0); } TargetSetupPage *AbstractMobileAppWizardDialog::targetsPage() const @@ -117,72 +145,78 @@ int AbstractMobileAppWizardDialog::addPageWithTitle(QWizardPage *page, const QSt int AbstractMobileAppWizardDialog::nextId() const { - if (currentPage() == m_targetsPage) { - if ((isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && !m_ignoreGeneralOptions) || - isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)) - return m_genericOptionsPageId; - // If Symbian target and Qt Quick components for Symbian, skip the mobile options page. - else if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && m_ignoreGeneralOptions) - return m_symbianOptionsPageId; - else if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)) - return m_maemoOptionsPageId; - else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) - return m_harmattanOptionsPageId; - else - return idOfNextGenericPage(); - } else if (currentPage() == m_genericOptionsPage) { - if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) - return m_symbianOptionsPageId; - else if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) - || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) - return m_maemoOptionsPageId; - else - return m_harmattanOptionsPageId; - } else if (currentPage() == m_symbianOptionsPage) { - if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) - || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) - return m_maemoOptionsPageId; - else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) - return m_harmattanOptionsPageId; - else - return idOfNextGenericPage(); - } else if (currentPage() == m_maemoOptionsPage) { - if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) - return m_harmattanOptionsPageId; - else - return idOfNextGenericPage(); - } else { - return BaseProjectWizardDialog::nextId(); + if (m_targetsPage) { + if (currentPage() == m_targetsPage) { + if ((isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && !m_ignoreGeneralOptions) || + isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)) + return m_genericOptionsPageId; + // If Symbian target and Qt Quick components for Symbian, skip the mobile options page. + else if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && m_ignoreGeneralOptions) + return m_symbianOptionsPageId; + else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) + return m_maemoOptionsPageId; + else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) + return m_harmattanOptionsPageId; + else + return idOfNextGenericPage(); + } else if (currentPage() == m_genericOptionsPage) { + if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) + return m_symbianOptionsPageId; + else if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) + || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) + return m_maemoOptionsPageId; + else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) + return m_harmattanOptionsPageId; + else + return idOfNextGenericPage(); + } else if (currentPage() == m_symbianOptionsPage) { + if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) + || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) + return m_maemoOptionsPageId; + else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) + return m_harmattanOptionsPageId; + else + return idOfNextGenericPage(); + } else if (currentPage() == m_maemoOptionsPage) { + if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) + return m_harmattanOptionsPageId; + else + return idOfNextGenericPage(); + } } + return BaseProjectWizardDialog::nextId(); } void AbstractMobileAppWizardDialog::initializePage(int id) { - if (id == startId()) { - m_targetItem->setNextItems(QList() - << m_genericItem << m_symbianItem << m_maemoItem << m_harmattanItem << itemOfNextGenericPage()); - m_genericItem->setNextItems(QList() - << m_symbianItem << m_maemoItem); - m_symbianItem->setNextItems(QList() - << m_maemoItem << m_harmattanItem << itemOfNextGenericPage()); - m_maemoItem->setNextItems(QList() - << m_harmattanItem << itemOfNextGenericPage()); - } else if (id == m_genericOptionsPageId - || id == m_symbianOptionsPageId - || id == m_maemoOptionsPageId) { - QList order; - order << m_genericItem; - if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) - order << m_symbianItem; - if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) - || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) - order << m_maemoItem; - if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) - order << m_harmattanItem; - order << itemOfNextGenericPage(); + if (m_targetItem) { + if (id == startId()) { + m_targetItem->setNextItems(QList() + << m_genericItem << m_symbianItem << m_maemoItem << m_harmattanItem << itemOfNextGenericPage()); + m_genericItem->setNextItems(QList() + << m_symbianItem << m_maemoItem); + m_symbianItem->setNextItems(QList() + << m_maemoItem << m_harmattanItem << itemOfNextGenericPage()); + m_maemoItem->setNextItems(QList() + << m_harmattanItem << itemOfNextGenericPage()); + } else if ((!m_targetItem && id == startId()) + || id == m_genericOptionsPageId + || id == m_symbianOptionsPageId + || id == m_maemoOptionsPageId) { + QList order; + order << m_genericItem; + if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) + order << m_symbianItem; + if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) + || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM)) + order << m_maemoItem; + if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM)) + order << m_harmattanItem; + order << itemOfNextGenericPage(); - for (int i = 0; i < order.count() - 1; i++) - order.at(i)->setNextShownItem(order.at(i + 1)); + for (int i = 0; i < order.count() - 1; i++) + order.at(i)->setNextShownItem(order.at(i + 1)); + } } BaseProjectWizardDialog::initializePage(id); } @@ -209,9 +243,27 @@ Utils::WizardProgressItem *AbstractMobileAppWizardDialog::itemOfNextGenericPage( bool AbstractMobileAppWizardDialog::isQtPlatformSelected(const QString &platform) const { - return m_targetsPage->isQtPlatformSelected(platform); + QList selectedProfileList = selectedProfiles(); + + QtSupport::QtPlatformProfileMatcher matcher(platform); + QList allProfileList + = ProjectExplorer::ProfileManager::instance()->profiles(&matcher); + foreach (ProjectExplorer::Profile *p, allProfileList) { + if (selectedProfileList.contains(p->id())) + return true; + } + return false; } +QList AbstractMobileAppWizardDialog::selectedProfiles() const +{ + if (m_targetsPage) + return m_targetsPage->selectedProfiles(); + return m_profileIds; +} + + + AbstractMobileAppWizard::AbstractMobileAppWizard(const Core::BaseFileWizardParameters ¶ms, QObject *parent) : Core::BaseFileWizard(params, parent) { } @@ -262,16 +314,19 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w, = ExtensionSystem::PluginManager::getObject(); Q_ASSERT(manager); Qt4Project project(manager, app()->path(AbstractMobileApp::AppPro)); - bool success = wizardDialog()->m_targetsPage->setupProject(&project); - if (success) { - project.saveSettings(); - success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage); + bool success = true; + if (wizardDialog()->m_targetsPage) { + success = wizardDialog()->m_targetsPage->setupProject(&project); if (success) { - const QString fileToOpen = fileToOpenPostGeneration(); - if (!fileToOpen.isEmpty()) { - Core::EditorManager::openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); - ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, fileToOpen); - } + project.saveSettings(); + success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage); + } + } + if (success) { + const QString fileToOpen = fileToOpenPostGeneration(); + if (!fileToOpen.isEmpty()) { + Core::EditorManager::openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); + ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, fileToOpen); } } return success; @@ -283,7 +338,8 @@ void AbstractMobileAppWizard::useProjectPath(const QString &projectName, wizardDialog()->m_symbianOptionsPage->setSymbianUid(app()->symbianUidForPath(projectPath + projectName)); app()->setProjectName(projectName); app()->setProjectPath(projectPath); - wizardDialog()->m_targetsPage->setProFilePath(app()->path(AbstractMobileApp::AppPro)); + if (wizardDialog()->m_targetsPage) + wizardDialog()->m_targetsPage->setProFilePath(app()->path(AbstractMobileApp::AppPro)); projectPathChanged(app()->path(AbstractMobileApp::AppPro)); } diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h index 77a32779e2c..748dbd20f4d 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h @@ -77,6 +77,7 @@ private: int idOfNextGenericPage() const; Utils::WizardProgressItem *itemOfNextGenericPage() const; bool isQtPlatformSelected(const QString &platform) const; + QList selectedProfiles() const; Internal::MobileAppWizardGenericOptionsPage *m_genericOptionsPage; Internal::MobileAppWizardSymbianOptionsPage *m_symbianOptionsPage; @@ -95,6 +96,7 @@ private: Utils::WizardProgressItem *m_symbianItem; Utils::WizardProgressItem *m_maemoItem; Utils::WizardProgressItem *m_harmattanItem; + QList m_profileIds; friend class AbstractMobileAppWizard; }; diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp index 10b34537293..f4b7f329e78 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp @@ -33,6 +33,7 @@ #include "consoleappwizarddialog.h" #include "consoleappwizard.h" #include +#include #include @@ -55,7 +56,8 @@ ConsoleAppWizardDialog::ConsoleAppWizardDialog(const QString &templateName, "provide a GUI.")); addModulesPage(); - addTargetSetupPage(); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(); addExtensionPages(parameters.extensionPages()); } diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp index 14cc8e9733d..5e23fedb210 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp @@ -32,6 +32,7 @@ #include "emptyprojectwizarddialog.h" #include "qtprojectparameters.h" +#include namespace Qt4ProjectManager { namespace Internal { @@ -47,7 +48,8 @@ EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName, setIntroDescription(tr("This wizard generates an empty Qt4 project. " "Add files to it later on by using the other wizards.")); - addTargetSetupPage(); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(); addExtensionPages(parameters.extensionPages()); } diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp index d6a581ce34e..f3b77c7e902 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp @@ -37,6 +37,7 @@ #include +#include #include namespace Qt4ProjectManager { @@ -66,7 +67,8 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName, "and includes an empty widget.")); addModulesPage(); - addTargetSetupPage(isMobile); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(isMobile); m_filesPage->setFormInputCheckable(true); m_filesPage->setClassTypeComboVisible(false); diff --git a/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp b/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp index 4b7d185024a..ae63b2e2dd9 100644 --- a/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp @@ -129,7 +129,8 @@ AbstractMobileAppWizardDialog *Html5AppWizard::createWizardDialogInternal(QWidge void Html5AppWizard::projectPathChanged(const QString &path) const { - d->wizardDialog->targetsPage()->setProFilePath(path); + if (d->wizardDialog->targetsPage()) + d->wizardDialog->targetsPage()->setProFilePath(path); } void Html5AppWizard::prepareGenerateFiles(const QWizard *w, diff --git a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp index 62e8ff464f7..05b2c71ed34 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -154,10 +155,12 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName, // Use the intro page instead, set up initially setIntroDescription(tr("This wizard generates a C++ library project.")); - m_targetPageId = addTargetSetupPage(); - - if (m_targetPageId != -1) + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) { + m_targetPageId = addTargetSetupPage(); m_mobilePageId = addPage(m_mobilePage); + } else if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) { + m_mobilePageId = addPage(m_mobilePage); + } m_modulesPageId = addModulesPage(); @@ -169,10 +172,12 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName, Utils::WizardProgressItem *introItem = wizardProgress()->item(startId()); Utils::WizardProgressItem *targetItem = 0; - if (m_targetPageId != -1) + Utils::WizardProgressItem *mobileItem = 0; + if (m_targetPageId != -1) { targetItem = wizardProgress()->item(m_targetPageId); - Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId); - mobileItem->setTitle(QLatin1String(" ") + tr("Symbian Specific")); + mobileItem = wizardProgress()->item(m_mobilePageId); + mobileItem->setTitle(QLatin1String(" ") + tr("Symbian Specific")); + } Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId); Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId); filesItem->setTitle(tr("Details")); @@ -185,12 +190,19 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName, << modulesItem << filesItem); mobileItem->setNextShownItem(0); } else { - introItem->setNextItems(QList() - << modulesItem << filesItem); - introItem->setNextShownItem(0); + if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) { + introItem->setNextItems(QList() + << mobileItem); + mobileItem->setNextItems(QList() + << modulesItem << filesItem); + mobileItem->setNextShownItem(0); + } else { + introItem->setNextItems(QList() + << modulesItem << filesItem); + introItem->setNextShownItem(0); + } } - connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int))); addExtensionPages(parameters.extensionPages()); @@ -254,6 +266,10 @@ int LibraryWizardDialog::nextId() const return skipModulesPageIfNeeded(); } } else if (currentId() == startId()) { + if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) + return m_mobilePageId; + return skipModulesPageIfNeeded(); + } else if (currentId() == m_mobilePageId) { return skipModulesPageIfNeeded(); } @@ -262,7 +278,8 @@ int LibraryWizardDialog::nextId() const void LibraryWizardDialog::initializePage(int id) { - if (m_targetPageId != -1 && id == m_targetPageId) { + if ((m_targetPageId != -1 && id == m_targetPageId) + || (m_targetPageId == -1 && id == m_mobilePageId)) { Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId); Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId); Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId); @@ -277,7 +294,8 @@ void LibraryWizardDialog::initializePage(int id) void LibraryWizardDialog::cleanupPage(int id) { - if (m_targetPageId != -1 && id == m_targetPageId) { + if ((m_targetPageId != -1 && id == m_targetPageId) + || (m_targetPageId == -1 && id == m_mobilePageId)) { Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId); mobileItem->setNextShownItem(0); } diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp index a79a53e39a0..b31ceeb1bfe 100644 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp @@ -120,7 +120,8 @@ AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidg void MobileAppWizard::projectPathChanged(const QString &path) const { - d->wizardDialog->targetsPage()->setProFilePath(path); + if (d->wizardDialog->targetsPage()) + d->wizardDialog->targetsPage()->setProFilePath(path); } void MobileAppWizard::prepareGenerateFiles(const QWizard *w, diff --git a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp index 66b67f11937..e95e52ba240 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp @@ -88,8 +88,9 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent, AbstractMobileAppWizardDialog::addMobilePages(); if (kind == QtQuickAppWizard::ImportQml) { - m_componentItem->setNextItems(QList() - << targetsPageItem()); + if (targetsPageItem()) + m_componentItem->setNextItems(QList() + << targetsPageItem()); } } @@ -235,7 +236,8 @@ AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWid void QtQuickAppWizard::projectPathChanged(const QString &path) const { - d->wizardDialog->targetsPage()->setProFilePath(path); + if (d->wizardDialog->targetsPage()) + d->wizardDialog->targetsPage()->setProFilePath(path); } void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w, diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp index c2b8e78363d..2848cc752ae 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp @@ -174,7 +174,8 @@ CustomQt4ProjectWizard::CustomQt4ProjectWizard(const Core::BaseFileWizardParamet initProjectWizardDialog(wizard, wizardDialogParameters.defaultPath(), wizardDialogParameters.extensionPages()); if (wizard->pageIds().contains(targetPageId)) qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId)); - wizard->addTargetSetupPage(false, targetPageId); + if (!wizardDialogParameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + wizard->addTargetSetupPage(false, targetPageId); return wizard; } @@ -193,7 +194,8 @@ BaseQt4ProjectWizardDialog::BaseQt4ProjectWizardDialog(bool showModulesPage, QWi const Core::WizardDialogParameters ¶meters) : ProjectExplorer::BaseProjectWizardDialog(parent, parameters), m_modulesPage(0), - m_targetSetupPage(0) + m_targetSetupPage(0), + m_profileIds(parameters.extraValues().value(ProjectExplorer::Constants::PROJECT_PROFILE_IDS).value >()) { init(showModulesPage); } @@ -204,7 +206,8 @@ BaseQt4ProjectWizardDialog::BaseQt4ProjectWizardDialog(bool showModulesPage, const Core::WizardDialogParameters ¶meters) : ProjectExplorer::BaseProjectWizardDialog(introPage, introId, parent, parameters), m_modulesPage(0), - m_targetSetupPage(0) + m_targetSetupPage(0), + m_profileIds(parameters.extraValues().value(ProjectExplorer::Constants::PROJECT_PROFILE_IDS).value >()) { init(showModulesPage); } @@ -315,12 +318,30 @@ bool BaseQt4ProjectWizardDialog::writeUserFile(const QString &proFileName) const bool BaseQt4ProjectWizardDialog::setupProject(Qt4Project *project) const { + if (!m_targetSetupPage) + return true; return m_targetSetupPage->setupProject(project); } bool BaseQt4ProjectWizardDialog::isQtPlatformSelected(const QString &platform) const { - return m_targetSetupPage->isQtPlatformSelected(platform); + QList selectedProfileList = selectedProfiles(); + + QtSupport::QtPlatformProfileMatcher matcher(platform); + QList allProfileList + = ProjectExplorer::ProfileManager::instance()->profiles(&matcher); + foreach (ProjectExplorer::Profile *p, allProfileList) { + if (selectedProfileList.contains(p->id())) + return true; + } + return false; +} + +QList BaseQt4ProjectWizardDialog::selectedProfiles() const +{ + if (!m_targetSetupPage) + return m_profileIds; + return m_targetSetupPage->selectedProfiles(); } void BaseQt4ProjectWizardDialog::addExtensionPages(const QList &wizardPageList) @@ -331,8 +352,12 @@ void BaseQt4ProjectWizardDialog::addExtensionPages(const QList &w void BaseQt4ProjectWizardDialog::generateProfileName(const QString &name, const QString &path) { + if (!m_targetSetupPage) + return; + const QString proFile = QDir::cleanPath(path + QLatin1Char('/') + name + QLatin1Char('/') + name + QLatin1String(".pro")); + m_targetSetupPage->setProFilePath(proFile); } diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.h b/src/plugins/qt4projectmanager/wizards/qtwizard.h index 1882fc98e3e..b997730ee68 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.h +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.h @@ -143,6 +143,7 @@ public: bool writeUserFile(const QString &proFileName) const; bool setupProject(Qt4Project *project) const; bool isQtPlatformSelected(const QString &platform) const; + QList selectedProfiles() const; void addExtensionPages(const QList &wizardPageList); @@ -156,6 +157,7 @@ private: TargetSetupPage *m_targetSetupPage; QStringList m_selectedModules; QStringList m_deselectedModules; + QList m_profileIds; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp index fb603ca1242..ba804b6d83b 100644 --- a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp @@ -88,6 +88,7 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix()); QVariantMap map; map.insert(QLatin1String(ProjectExplorer::Constants::PREFERED_PROJECT_NODE), profileName); + map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_PROFILE_IDS), QVariant::fromValue(wizard->selectedProfiles())); Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard), wizard->parameters().projectPath(), diff --git a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizarddialog.cpp index 80f7355cf3f..ee08e8534c2 100644 --- a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizarddialog.cpp @@ -32,6 +32,7 @@ #include "subdirsprojectwizarddialog.h" #include "qtprojectparameters.h" +#include namespace Qt4ProjectManager { namespace Internal { @@ -48,7 +49,8 @@ SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateNa setIntroDescription(tr("This wizard generates a Qt4 subdirs project. " "Add subprojects to it later on by using the other wizards.")); - addTargetSetupPage(); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(); addExtensionPages(parameters.extensionPages()); } diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index 59557f8cb3e..b51a5d36942 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -110,6 +110,20 @@ void TargetSetupPage::setRequiredProfileMatcher(ProjectExplorer::ProfileMatcher m_requiredMatcher = matcher; } +QList TargetSetupPage::selectedProfiles() const +{ + QList result; + QMap::const_iterator it, end; + it = m_widgets.constBegin(); + end = m_widgets.constEnd(); + + for ( ; it != end; ++it) { + if (isProfileSelected(it.key())) + result << it.key(); + } + return result; +} + void TargetSetupPage::setPreferredProfileMatcher(ProjectExplorer::ProfileMatcher *matcher) { m_preferredMatcher = matcher; diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h index 2c8bb5c8701..27a48615c4b 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h @@ -82,6 +82,7 @@ public: bool isProfileSelected(Core::Id id) const; void setProfileSelected(Core::Id id, bool selected); bool isQtPlatformSelected(const QString &type) const; + QList selectedProfiles() const; void setProFilePath(const QString &dir); /// Overrides the summary text of the targetsetuppage diff --git a/src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp index 6b5561a3e8c..9af4d83b1d1 100644 --- a/src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp @@ -32,6 +32,7 @@ #include "testwizarddialog.h" #include "testwizardpage.h" +#include #include @@ -63,7 +64,8 @@ TestWizardDialog::TestWizardDialog(const QString &templateName, setWindowIcon(icon); setWindowTitle(templateName); setSelectedModules(QLatin1String("core testlib"), true); - addTargetSetupPage(); + if (!parameters.extraValues().contains(ProjectExplorer::Constants::PROJECT_PROFILE_IDS)) + addTargetSetupPage(); m_modulesPageId = addModulesPage(); m_testPageId = addPage(m_testPage); wizardProgress()->item(m_testPageId)->setTitle(tr("Details"));