forked from qt-creator/qt-creator
QmlDesigner: Use IFeatureProvider to hide wizards
Instead of filtering manualy we can simply defien a feature only in the full QDS. Change-Id: Ibeb2faca85cba77aacd1a99d5f405b21fcf3530b Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"fontIconName": "wizardsGeneric",
|
||||
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}",
|
||||
"platformIndependent": true,
|
||||
"featuresRequired": [ "QDS.3D" ],
|
||||
"featuresRequired": [ "QmlDesigner.Wizards.FullQDS" ],
|
||||
|
||||
"options":
|
||||
[
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"fontIconName": "wizardsGeneric",
|
||||
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}",
|
||||
"platformIndependent": true,
|
||||
"featuresRequired": [ "QDS.3D" ],
|
||||
"featuresRequired": [ "QmlDesigner.Wizards.FullQDS" ],
|
||||
|
||||
"options":
|
||||
[
|
||||
|
||||
@@ -96,6 +96,19 @@ namespace QmlDesigner {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class FullQDSFeatureProvider : public Core::IFeatureProvider
|
||||
{
|
||||
public:
|
||||
QSet<Utils::Id> availableFeatures(Utils::Id) const override
|
||||
{
|
||||
return {"QmlDesigner.Wizards.FullQDS"};
|
||||
}
|
||||
|
||||
QSet<Utils::Id> 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()
|
||||
|
||||
@@ -49,9 +49,8 @@ void WizardFactories::sortByCategoryAndId()
|
||||
void WizardFactories::filter()
|
||||
{
|
||||
QList<JsonWizardFactory *> 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;
|
||||
|
||||
Reference in New Issue
Block a user