Commit f1f2475d authored by Tobias Hunger's avatar Tobias Hunger

JsonWizard: split plugins and features when considering enabled state

Now that we have the infrastructure to handle both separately it makes
no more sense to merge them.

Change-Id: Ia2694eef60c0fe17b025e4d6766c7a8f775513f5
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent bd40ef36
......@@ -7,7 +7,7 @@
"trDisplayName": "C++ Class",
"trDisplayCategory": "C++",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.CppEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
"options":
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Python Class",
"trDisplayCategory": "Python",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.PythonEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}",
"options":
[
......
......@@ -7,7 +7,8 @@
"trDisplayName": "QtQuick UI File",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.QmlJSEditor", "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}",
"options" : [
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('text/x-qml')}" },
......
......@@ -7,7 +7,7 @@
"trDisplayName": "C++ Header File",
"trDisplayCategory": "C++",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.CppEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "C++ Source File",
"trDisplayCategory": "C++",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.CppEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Qt Designer Form",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.Designer" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Designer') >= 0}",
"options": [
{ "key": "UiClass", "value": "%{JS: QtSupport.uiClassName([ %{FormContents} ].join('\\n'))}" },
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "GLSL",
"icon": "../../../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.GLSLEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}",
"pages" :
[
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "GLSL",
"icon": "../../../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.GLSLEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}",
"pages" :
[
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "GLSL",
"icon": "../../../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.GLSLEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}",
"pages" :
[
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "GLSL",
"icon": "../../../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.GLSLEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Java File",
"trDisplayCategory": "Java",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.Android" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Android') >= 0}",
"options": [ { "key": "ClassName", "value": "%{JS: '%{FileName}'.charAt(0).toUpperCase() + '%{FileName}'.substr(1)}" } ],
......
......@@ -7,7 +7,7 @@
"trDisplayName": "JS File",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.QmlJSEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Python File",
"trDisplayCategory": "Python",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.PythonEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Qt Resource File",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.ResourceEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('ResourceEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "QML File (Qt Quick 1)",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.QmlJSEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "QML File (Qt Quick 2)",
"trDisplayCategory": "Qt",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.QmlJSEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}",
"pages" :
[
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "General",
"icon": "../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.TextEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}",
"options": [ { "key": "TargetPath", "value": "%{JS: Util.mktemp('scratch-XXXXXX.txt')}" } ],
......
......@@ -8,7 +8,7 @@
"trDisplayCategory": "General",
"icon": "../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.TextEditor" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}",
"pages" :
[
......
......@@ -7,7 +7,8 @@
"trDisplayName": "Qt Console Application",
"trDisplayCategory": "Application",
"icon": "../../../global/consoleapplication.png",
"featuresRequired": [ "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ],
"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
"options":
[
......
......@@ -7,8 +7,8 @@
"trDisplayName": "Empty qmake Project",
"trDisplayCategory": "Other Project",
"icon": "../../../global/guiapplication.png",
"featuresRequired": [ "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ],
"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
"options":
[
{ "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
......
......@@ -7,7 +7,8 @@
"trDisplayName": "Qt Quick Application",
"trDisplayCategory": "Application",
"icon": "qml_wizard.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.2.4", "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ],
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.2.4", "QtSupport.Wizards.FeatureQt" ],
"enabled": "${JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
"options":
[
......
......@@ -7,7 +7,8 @@
"trDisplayName": "Qt Quick Controls Application",
"trDisplayCategory": "Application",
"icon": "../qtquickapplication/qml_wizard.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ],
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "QtSupport.Wizards.FeatureQt" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
"options":
[
......
......@@ -7,6 +7,7 @@
"trDisplayName": "Qt Quick UI",
"trDisplayCategory": "Application",
"icon": "../../qmake/qtquickapplication/qml_wizard.png",
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ],
"options":
......
......@@ -7,6 +7,7 @@
"trDisplayName": "Qt Quick Controls UI",
"trDisplayCategory": "Application",
"icon": "../../qmake/qtquickapplication/qml_wizard.png",
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ],
"options":
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Bazaar Clone (Or Branch)",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.Bazaar" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Bazaar') >= 0}",
"options":
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "CVS Checkout",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.CVS" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('CVS') >= 0}",
"options":
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Git Clone",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.Git" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Git') >= 0}",
"options":
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Mercurial Clone",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.Mercurial" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Mercurial') >= 0}",
"options":
[
......
......@@ -7,7 +7,7 @@
"trDisplayName": "Subversion Checkout",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.Subversion" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('Subversion') >= 0}",
"options":
[
......
......@@ -326,7 +326,7 @@ FeatureSet IWizardFactory::pluginFeatures() const
// Implicitly create a feature for each plugin loaded:
foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) {
if (s->state() == ExtensionSystem::PluginSpec::Running)
list.append(QString::fromLatin1("Plugin.") + s->name());
list.append(s->name());
}
plugins = FeatureSet::fromStringList(list);
}
......
......@@ -371,6 +371,9 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
tmp.remove(pluginFeatures());
wizard.setValue(QStringLiteral("PreferredFeatures"), tmp.toStringList());
wizard.setValue(QStringLiteral("Features"), availableFeatures(platform).toStringList());
wizard.setValue(QStringLiteral("Plugins"), pluginFeatures().toStringList());
// Add data to wizard:
for (auto i = variables.constBegin(); i != variables.constEnd(); ++i)
wizard.setProperty(i.key().toUtf8(), i.value());
......@@ -477,8 +480,13 @@ bool JsonWizardFactory::isAvailable(const QString &platformName) const
return false;
Utils::MacroExpander expander;
Utils::MacroExpander *e = &expander;
expander.registerVariable("Platform", tr("The platform selected for the wizard."),
[platformName]() { return platformName; });
expander.registerVariable("Features", tr("The features available to this wizard."),
[this, e, platformName]() { return JsonWizard::stringListToArrayString(availableFeatures(platformName).toStringList(), e); });
expander.registerVariable("Plugins", tr("The plugins loaded."),
[this, e]() { return JsonWizard::stringListToArrayString(pluginFeatures().toStringList(), e); });
return JsonWizard::boolFromVariant(m_enabledExpression, &expander);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment