diff --git a/src/plugins/coreplugin/iwizardfactory.h b/src/plugins/coreplugin/iwizardfactory.h index c250c9fbb1aa24bdf0b02a51e3818715ea3da877..6120282215b49a07dfff8b8c267e3c7ce9614c18 100644 --- a/src/plugins/coreplugin/iwizardfactory.h +++ b/src/plugins/coreplugin/iwizardfactory.h @@ -64,7 +64,7 @@ public: Q_DECLARE_FLAGS(WizardFlags, WizardFlag) Id id() const { return m_id; } - WizardKind kind() const { return m_kind; } + WizardKind kind() const { return m_supportedProjectTypes.isEmpty() ? FileWizard : ProjectWizard; } QIcon icon() const { return m_icon; } QString description() const { return m_description; } QString displayName() const { return m_displayName; } @@ -73,9 +73,10 @@ public: QString descriptionImage() const { return m_descriptionImage; } QSet requiredFeatures() const { return m_requiredFeatures; } WizardFlags flags() const { return m_flags; } + QSet supportedProjectTypes() const { return m_supportedProjectTypes; } void setId(const Id id) { m_id = id; } - void setWizardKind(WizardKind kind) { m_kind = kind; } + void setSupportedProjectTypes(const QSet &projectTypes) { m_supportedProjectTypes = projectTypes; } void setIcon(const QIcon &icon) { m_icon = icon; } void setDescription(const QString &description) { m_description = description; } void setDisplayName(const QString &displayName) { m_displayName = displayName; } @@ -132,10 +133,10 @@ private: QString m_category; QString m_displayCategory; QString m_descriptionImage; - Id m_id; QSet m_requiredFeatures; - WizardKind m_kind = FileWizard; + QSet m_supportedProjectTypes; WizardFlags m_flags = 0; + Id m_id; friend class Internal::CorePlugin; }; diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index 63da86bd40e3a5017ce3653b5eb58e1205c83eab..912627f6f15c0d927f49b7f079e6141d9d3a46e0 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -89,7 +89,6 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) IWizardFactory::registerFactoryCreator( [this]() -> QList { IWizardFactory *wizard = new FormClassWizard; - wizard->setWizardKind(IWizardFactory::FileWizard); wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT)); wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT)); wizard->setDisplayName(tr("Qt Designer Form Class")); diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index f0bf10d34753eafb6139e2b027466ea9d95e969d..d37e5f8e9122b14f0e148de5b81113c9f32fc595 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -29,6 +29,7 @@ ****************************************************************************/ #include "genericprojectwizard.h" +#include "genericprojectconstants.h" #include "filesselectionwizardpage.h" #include @@ -114,7 +115,7 @@ QString GenericProjectWizardDialog::projectName() const GenericProjectWizard::GenericProjectWizard() { - setWizardKind(ProjectWizard); + setSupportedProjectTypes({ Constants::GENERICPROJECT_ID }); // TODO do something about the ugliness of standard icons in sizes different than 16, 32, 64, 128 { QPixmap icon(22, 22); diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index fbbe9e7b9e9389a4e541f334437d71a5ca4250e3..03f6d49824f2a682112fd2f82fd86a06b3602adf 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -126,7 +126,8 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p) d->m_parameters = p; setId(p->id); - setWizardKind(p->kind); + setSupportedProjectTypes((p->kind == Core::IWizardFactory::FileWizard) + ? QSet() : QSet() << "UNKNOWN_PROJECT"); setIcon(p->icon); setDescription(p->description); setDisplayName(p->displayName); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 9768e043e9861fc4afca1e970809c627be1fecbf..17b12df82d90339466a89f833f370b2deca92a97 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -55,6 +55,7 @@ #include #include #include +#include namespace ProjectExplorer { @@ -68,6 +69,7 @@ static const char VERSION_KEY[] = "version"; static const char ENABLED_EXPRESSION_KEY[] = "enabled"; static const char KIND_KEY[] = "kind"; +static const char SUPPORTED_PROJECTS[] = "supportedProjectTypes"; static const char ID_KEY[] = "id"; static const char CATEGORY_KEY[] = "category"; static const char CATEGORY_NAME_KEY[] = "trDisplayCategory"; @@ -521,17 +523,25 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, m_enabledExpression = data.value(QLatin1String(ENABLED_EXPRESSION_KEY), true); - QString strVal = data.value(QLatin1String(KIND_KEY)).toString(); - if (strVal != QLatin1String("class") + QSet projectTypes = Core::Id::fromStringList(data.value(QLatin1String(SUPPORTED_PROJECTS)).toStringList()); + // FIXME: "kind" was relevant up to and including Qt Creator 3.6: + const QString unsetKind = QUuid::createUuid().toString(); + QString strVal = data.value(QLatin1String(KIND_KEY), unsetKind).toString(); + if (strVal != unsetKind + && strVal != QLatin1String("class") && strVal != QLatin1String("file") && strVal != QLatin1String("project")) { *errorMessage = tr("\"kind\" value \"%1\" is not \"class\" (deprecated), \"file\" or \"project\".").arg(strVal); return false; } - IWizardFactory::WizardKind kind = IWizardFactory::ProjectWizard; - if (strVal == QLatin1String("file") || strVal == QLatin1String("class")) - kind = IWizardFactory::FileWizard; - setWizardKind(kind); + if ((strVal == QLatin1String("file") || strVal == QLatin1String("class")) && !projectTypes.isEmpty()) { + *errorMessage = tr("\"kind\" is \"file\" or \"class\" (deprecated) and \"%1\" is also set.").arg(QLatin1String(SUPPORTED_PROJECTS)); + return false; + } + if (strVal == QLatin1String("project") && projectTypes.isEmpty()) + projectTypes.insert("UNKNOWN_PROJECT"); + // end of legacy code + setSupportedProjectTypes(projectTypes); strVal = data.value(QLatin1String(ID_KEY)).toString(); if (strVal.isEmpty()) { diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp index bc2f3589f2fde0263bb435879fd9a4983abaefe7..f16943b48100111c05e9ecbafde3250a7c44302b 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp @@ -60,7 +60,7 @@ using namespace QtSupport; // -------------------- QtWizard QtWizard::QtWizard() { - setWizardKind(Core::IWizardFactory::ProjectWizard); + setSupportedProjectTypes({ Constants::QMAKEPROJECT_ID }); } QString QtWizard::sourceSuffix()