From cc32336129965d94216cb027f0dd4441a81f96cd Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 11 Jul 2024 14:15:26 +0200 Subject: [PATCH] QmlDesigner: Use IFeatureProvider to hide wizards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of filtering manualy we can simply defien a feature only in the full QDS. Change-Id: Ibeb2faca85cba77aacd1a99d5f405b21fcf3530b Reviewed-by: Henning Gründl --- .../projects/application-3d/wizard.json | 2 +- .../application-extended-3d/wizard.json | 2 +- src/plugins/qmldesigner/qmldesignerplugin.cpp | 21 +++++++++++++++++-- src/plugins/studiowelcome/wizardfactories.cpp | 5 ++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json index cd4b862dc8e..a6eb427a765 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json @@ -10,7 +10,7 @@ "fontIconName": "wizardsGeneric", "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}", "platformIndependent": true, - "featuresRequired": [ "QDS.3D" ], + "featuresRequired": [ "QmlDesigner.Wizards.FullQDS" ], "options": [ diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json index 89157dafb01..d654b2b3867 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json @@ -10,7 +10,7 @@ "fontIconName": "wizardsGeneric", "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}", "platformIndependent": true, - "featuresRequired": [ "QDS.3D" ], + "featuresRequired": [ "QmlDesigner.Wizards.FullQDS" ], "options": [ diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 6b396ebc725..1426c513734 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -96,6 +96,19 @@ namespace QmlDesigner { namespace Internal { +class FullQDSFeatureProvider : public Core::IFeatureProvider +{ +public: + QSet availableFeatures(Utils::Id) const override + { + return {"QmlDesigner.Wizards.FullQDS"}; + } + + QSet availablePlatforms() const override { return {}; } + + QString displayNameForPlatform(Utils::Id) const override { return {}; } +}; + class EnterpriseFeatureProvider : public Core::IFeatureProvider { public: @@ -300,8 +313,6 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e StudioQuickWidget::registerDeclarativeType(); QmlDesignerBase::WindowManager::registerDeclarativeType(); - if (checkEnterpriseLicense()) - Core::IWizardFactory::registerFeatureProvider(new EnterpriseFeatureProvider); Exception::setWarnAboutException(!QmlDesignerPlugin::instance() ->settings() .value(DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT) @@ -343,6 +354,12 @@ void QmlDesignerPlugin::extensionsInitialized() registerCombinedTracedPoints(Constants::EVENT_STATE_ADDED, Constants::EVENT_STATE_CLONED, Constants::EVENT_STATE_ADDED_AND_CLONED); + + if (checkEnterpriseLicense()) + Core::IWizardFactory::registerFeatureProvider(new EnterpriseFeatureProvider); + + if (!QmlDesignerBasePlugin::isLiteModeEnabled()) + Core::IWizardFactory::registerFeatureProvider(new FullQDSFeatureProvider); } ExtensionSystem::IPlugin::ShutdownFlag QmlDesignerPlugin::aboutToShutdown() diff --git a/src/plugins/studiowelcome/wizardfactories.cpp b/src/plugins/studiowelcome/wizardfactories.cpp index 55749bd914b..ea0e51e1784 100644 --- a/src/plugins/studiowelcome/wizardfactories.cpp +++ b/src/plugins/studiowelcome/wizardfactories.cpp @@ -49,9 +49,8 @@ void WizardFactories::sortByCategoryAndId() void WizardFactories::filter() { QList acceptedFactories = Utils::filtered(m_factories, [&](auto *wizard) { - const bool liteDesigner = QmlDesigner::QmlDesignerBasePlugin::isLiteModeEnabled(); - return wizard->isAvailable(m_platform) && wizard->kind() == JsonWizardFactory::ProjectWizard - && (!liteDesigner || !wizard->requiredFeatures().contains("QDS.3D")); + return wizard->isAvailable(m_platform) + && wizard->kind() == JsonWizardFactory::ProjectWizard; }); m_factories = acceptedFactories;