diff --git a/doc/src/projects/creator-only/creator-projects-custom-wizards-json.qdoc b/doc/src/projects/creator-only/creator-projects-custom-wizards-json.qdoc index e63abe650c6..1e1cad47703 100644 --- a/doc/src/projects/creator-only/creator-projects-custom-wizards-json.qdoc +++ b/doc/src/projects/creator-only/creator-projects-custom-wizards-json.qdoc @@ -98,15 +98,22 @@ \section1 Using Variables in Wizards - You can use variables (\c {%\{\}}) in the configuration and - template source files. A set of variables is predefined by the wizards and - their pages. You can introduce new variables as shortcuts to be used later. - Define the variable key names and values in the \c options section in the + You can use variables (\c {%\{\}}) in strings in the JSON configuration + file and in template source files. + A set of variables is predefined by the wizards and their pages. + You can introduce new variables as shortcuts to be used later by + defining the variable key names and values in the \c options section in the \c {wizard.json} file. - The variables always return strings. In places where a boolean value is - expected and a string is given, an empty string as well as the string - \c {"false"} is treated as \c false and anything else as \c true. + There is a special variable \c {%\{JS:\}} which evaluates the given + JavaScript expression and converts the resulting JavaScript value to a string. + In the JavaScript expression you can refer to variables defined by the wizard with + \c {value('')}. The returned JavaScript object has the type that the value + of the variable has, which can be a string, list, dictionary or boolean. + + In places where a boolean value is expected and a string is given, + an empty string as well as the string \c {"false"} is treated as + \c false and anything else as \c true. \section1 Localizing Wizards @@ -221,7 +228,7 @@ "trDisplayName": "C++ Class", "trDisplayCategory": "C++", "icon": "../../global/genericfilewizard.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", \endcode \list @@ -295,11 +302,11 @@ { "key": "TargetPath", "value": "%{Path}" }, { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" }, { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, - { "key": "isQObject", "value": "%{JS: ('%{Base}' === 'QObject' || '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' || '%{Base}' === 'QDeclarativeItem' || '%{Base}' === 'QQuickItem' ) ? 'yes' : ''}" }, - { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }, - { "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" } + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, + { "key": "isQObject", "value": "%{JS: (value('Base') === 'QObject' || value('Base') === 'QWidget' || value('Base') === 'QMainWindow' || value('Base') === 'QDeclarativeItem' || value('Base') === 'QQuickItem' ) ? 'true' : 'false'}" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "SharedDataInit", "value": "%{JS: value('IncludeQSharedData') ? 'data(new %{CN}Data)' : '' }" } ], \endcode @@ -712,7 +719,7 @@ { "checkedValue": "QObject", "uncheckedValue": "", - "checked": "%{JS: ('%{BaseCB}' === 'QObject' ) ? 'yes' : ''}" + "checked": "%{JS: value('BaseCB') === 'QObject' ? 'true' : 'false'}" } }, \endcode @@ -788,7 +795,7 @@ "name": "LabelQQC_2_0", "type": "Label", "span": true, - "visible": "%{( '%{CS}' === 'QQC_2_0' )}", + "visible": "%{JS: value('CS') === 'QQC_2_0'}", "data": { "wordWrap": true, @@ -819,7 +826,7 @@ { "name": "BaseEdit", "type": "LineEdit", - "enabled": "%{JS: ( '%{BaseCB}' === '' ) ? 'yes' : ''}", + "enabled": "%{JS: value('BaseCB') === '' ? 'true' : 'false'}", "mandatory": false, "data": { diff --git a/share/qtcreator/templates/wizards/autotest/wizard.json b/share/qtcreator/templates/wizards/autotest/wizard.json index 64e8b8d6af5..fd56df0578f 100644 --- a/share/qtcreator/templates/wizards/autotest/wizard.json +++ b/share/qtcreator/templates/wizards/autotest/wizard.json @@ -8,19 +8,19 @@ "trDisplayCategory": "Other Project", "icon": "autotest.png", "featuresRequired": [ "QtSupport.Wizards.FeatureDesktop" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('AutoTest') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('AutoTest') >= 0}", "options": [ { "key": "ProjectFilePath", - "value": "%{JS: '%{BuildSystem}' == 'qmake' ? '%{ProFileName}' : ('%{BuildSystem}' == 'qbs' ? '%{QbsFileName}' : '%{CMakeFileName}') }" + "value": "%{JS: value('BuildSystem') == 'qmake' ? value('ProFileName') : (value('BuildSystem') == 'qbs' ? value('QbsFileName') : value('CMakeFileName')) }" }, { "key": "ProFileName", - "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" + "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, { "key": "QbsFileName", - "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" + "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFileName", @@ -34,19 +34,19 @@ }, { "key": "TestCaseFileWithHeaderSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++hdr') }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++hdr') }" }, { "key": "GUARD", - "value": "%{JS: '%{TestCaseFileWithHeaderSuffix}'.toUpperCase().replace('.', '_') }" + "value": "%{JS: value('TestCaseFileWithHeaderSuffix').toUpperCase().replace('.', '_') }" }, { "key": "TestCaseFileWithCppSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++src') }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++src') }" }, { "key": "TestCaseFileWithQmlSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.qml'.toLowerCase() }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.qml' }" } ], @@ -95,7 +95,7 @@ { "name": "RequireGUI", "trDisplayName": "GUI Application", - "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}", + "visible": "%{JS: value('TestFrameWork') === 'QtTest'}", "type": "CheckBox", "data": { "checked": false @@ -111,7 +111,7 @@ { "name": "RequireApplication", "trDisplayName": "Requires QApplication", - "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}", + "visible": "%{JS: value('TestFrameWork') === 'QtTest'}", "type": "CheckBox", "data": { "checked": false @@ -120,7 +120,7 @@ { "name": "GenerateInitAndCleanup", "trDisplayName": "Generate initialization and cleanup code", - "visible": "%{JS: [ 'QtTest', 'QtQuickTest' ].indexOf('%{TestFrameWork}') >= 0 }", + "visible": "%{JS: [ 'QtTest', 'QtQuickTest' ].indexOf(value('TestFrameWork')) >= 0 }", "type": "CheckBox", "data": { "checked": false @@ -129,14 +129,14 @@ { "name": "TestSetName", "trDisplayName": "Test set name:", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", + "visible": "%{JS: value('TestFrameWork') === 'GTest'}", "type": "LineEdit", "data": { "validator": "^[a-zA-Z0-9]+$" } }, { "name": "GTestCXX11", "trDisplayName": "Enable C++11", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", + "visible": "%{JS: value('TestFrameWork') === 'GTest'}", "type": "CheckBox", "data": { "checked": false @@ -145,7 +145,7 @@ { "name": "GTestRepository", "trDisplayName": "Googletest repository:", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", + "visible": "%{JS: value('TestFrameWork') === 'GTest'}", "type": "PathChooser", "data": { "kind": "existingDirectory" @@ -163,17 +163,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -187,7 +187,7 @@ "enabled": "%{IsTopLevelProject}", "data": { "projectFilePath": "%{ProjectFilePath}", - "requiredFeatures": [ "%{JS: ('%{TestFrameWork}' === 'QtQuickTest' ? 'QtSupport.Wizards.FeatureQt.5' : (('%{BuildSystem}' === 'qmake' || '%{TestFrameWork}' === 'QtTest') ? 'QtSupport.Wizards.FeatureQt' : 'DeviceType.Desktop' )) }" ] + "requiredFeatures": [ "%{JS: (value('TestFrameWork') === 'QtQuickTest' ? 'QtSupport.Wizards.FeatureQt.5' : ((value('BuildSystem') === 'qmake' || value('TestFrameWork') === 'QtTest') ? 'QtSupport.Wizards.FeatureQt' : 'DeviceType.Desktop' )) }" ] } }, { @@ -205,64 +205,64 @@ { "source": "files/gtest_dependency.pri", "target": "gtest_dependency.pri", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qmake'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest' && value('BuildSystem') == 'qmake'}", "openInEditor": false }, { "source": "files/googlecommon.js", "target": "googlecommon.js", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qbs'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest' && value('BuildSystem') == 'qbs'}", "openInEditor": false }, { "source": "files/tst.pro", "target": "%{ProjectFilePath}", - "condition": "%{JS: '%{BuildSystem}' == 'qmake'}", + "condition": "%{JS: value('BuildSystem') == 'qmake'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst.qbs", "target": "%{ProjectFilePath}", - "condition": "%{JS: '%{BuildSystem}' == 'qbs'}", + "condition": "%{JS: value('BuildSystem') == 'qbs'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst.txt", "target": "CMakeLists.txt", - "condition": "%{JS: '%{BuildSystem}' == 'cmake'}", + "condition": "%{JS: value('BuildSystem') == 'cmake'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst_src.h", "target": "%{TestCaseFileWithHeaderSuffix}", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest'}", "openInEditor": true }, { "source": "files/tst_src.cpp", "target": "%{TestCaseFileWithCppSuffix}", - "condition": "%{JS: '%{TestFrameWork}' == 'QtTest'}", + "condition": "%{JS: value('TestFrameWork') == 'QtTest'}", "openInEditor": true }, { "source": "files/tst_main.cpp", "target": "%{MainCppName}", - "condition": "%{JS: ['GTest', 'QtQuickTest'].indexOf('%{TestFrameWork}') >= 0}", + "condition": "%{JS: ['GTest', 'QtQuickTest'].indexOf(value('TestFrameWork')) >= 0}", "openInEditor": true }, { "source": "files/tst_qml.tmpl", "target": "%{TestCaseFileWithQmlSuffix}", - "condition": "%{JS: '%{TestFrameWork}' === 'QtQuickTest'}", + "condition": "%{JS: value('TestFrameWork') === 'QtQuickTest'}", "openInEditor": true }, { "source": "../projects/git.ignore", "target": ".gitignore", - "condition": "%{JS: ( %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git' )}" + "condition": "%{JS: ( %{IsTopLevelProject} && value('VersionControl') === 'G.Git' )}" } ] } diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 54c7dcabfd5..dd67d0dd59f 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -7,18 +7,18 @@ "trDisplayName": "C++ Class", "trDisplayCategory": "C++", "iconText": "h/cpp", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{Path}" }, { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" }, { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, - { "key": "isQObject", "value": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf('%{Base}') >= 0 }" }, - { "key": "GUARD", "value": "%{JS: Cpp.headerGuard('%{HdrFileName}')}" }, - { "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" } + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, + { "key": "isQObject", "value": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf(value('Base')) >= 0 }" }, + { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" }, + { "key": "SharedDataInit", "value": "%{JS: (value('IncludeQSharedData')) ? 'data(new %{CN}Data)' : '' }" } ], "pages": @@ -49,7 +49,7 @@ { "name": "BaseEdit", "type": "LineEdit", - "enabled": "%{JS: '%{BaseCB}' === ''}", + "enabled": "%{JS: value('BaseCB') === ''}", "mandatory": false, "data": { @@ -71,7 +71,7 @@ { "checkedValue": "QObject", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QObject'}" + "checked": "%{JS: value('BaseCB') === 'QObject'}" } }, { @@ -82,7 +82,7 @@ { "checkedValue": "QWidget", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QWidget'}" + "checked": "%{JS: value('BaseCB') === 'QWidget'}" } }, { @@ -93,7 +93,7 @@ { "checkedValue": "QMainWindow", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QMainWindow'}" + "checked": "%{JS: value('BaseCB') === 'QMainWindow'}" } }, { @@ -104,7 +104,7 @@ { "checkedValue": "QDeclarativeItem", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QDeclarativeItem'}" + "checked": "%{JS: value('BaseCB') === 'QDeclarativeItem'}" } }, { @@ -115,7 +115,7 @@ { "checkedValue": "QQuickItem", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QQuickItem'}" + "checked": "%{JS: value('BaseCB') === 'QQuickItem'}" } }, { @@ -139,14 +139,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } }, { "name": "Path", diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json index 8b4830ca32d..1e0cd06e197 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json +++ b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json @@ -6,15 +6,15 @@ "trDescription": "Creates a Qt item model.", "trDisplayName": "Qt Item Model", "trDisplayCategory": "Qt", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{Path}" }, { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" }, { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } ], "pages": @@ -92,14 +92,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } }, { "name": "Path", @@ -131,7 +131,7 @@ { "source": "itemmodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractItemModel'}", + "condition": "%{JS: value('Base') === 'QAbstractItemModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -141,7 +141,7 @@ "source": "itemmodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractItemModel'}", + "condition": "%{JS: value('Base') === 'QAbstractItemModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -150,7 +150,7 @@ { "source": "tablemodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractTableModel'}", + "condition": "%{JS: value('Base') === 'QAbstractTableModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -160,7 +160,7 @@ "source": "tablemodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractTableModel'}", + "condition": "%{JS: value('Base') === 'QAbstractTableModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -169,7 +169,7 @@ { "source": "listmodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractListModel'}", + "condition": "%{JS: value('Base') === 'QAbstractListModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -179,7 +179,7 @@ "source": "listmodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractListModel'}", + "condition": "%{JS: value('Base') === 'QAbstractListModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } diff --git a/share/qtcreator/templates/wizards/classes/python/wizard.json b/share/qtcreator/templates/wizards/classes/python/wizard.json index 56a8d419e79..233a8bac7a0 100644 --- a/share/qtcreator/templates/wizards/classes/python/wizard.json +++ b/share/qtcreator/templates/wizards/classes/python/wizard.json @@ -7,11 +7,11 @@ "trDisplayName": "Python Class", "trDisplayCategory": "Python", "icon": "../../files/python/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "options": [ - { "key": "Base", "value":"%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, + { "key": "Base", "value":"%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, { "key": "Imports", "value": "%{ImportQtCore}%{ImportQtWidgets}%{ImportQtDeclarative}"} ], @@ -52,7 +52,7 @@ { "name": "BaseEdit", "type": "LineEdit", - "enabled": "%{JS: '%{BaseCB}' === ''}", + "enabled": "%{JS: value('BaseCB') === ''}", "mandatory": false, "data": { "trText": "%{BaseCB}" } }, @@ -71,7 +71,7 @@ { "checkedValue": "QtCore", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' !== ''}" + "checked": "%{JS: value('Base') !== ''}" } }, { @@ -82,7 +82,7 @@ { "checkedValue": "QtWidgets", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' === 'QWidget'}" + "checked": "%{JS: value('Base') === 'QWidget'}" } }, { @@ -93,7 +93,7 @@ { "checkedValue": "QtQuick", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' === 'QQuickItem'}" + "checked": "%{JS: value('Base') === 'QQuickItem'}" } }, { @@ -108,7 +108,7 @@ "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Util.fileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-python')}')}" } + "data": { "trText": "%{JS: Util.fileName(value('Class'), Util.preferredSuffix('text/x-python'))}" } }, { "name": "TargetPath", diff --git a/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json b/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json index 3fc4ed23a99..e8bd200d759 100644 --- a/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json +++ b/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "Qt", "iconText": "ui.qml", "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.UiFiles" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "options" : [ { "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('text/x-qml')}" }, diff --git a/share/qtcreator/templates/wizards/files/cppheader/wizard.json b/share/qtcreator/templates/wizards/files/cppheader/wizard.json index 94718b35d4c..efb0ea81190 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppheader/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "C++ Header File", "trDisplayCategory": "C++", "iconText": "h", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }, + "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++hdr'))}" }, "pages" : [ @@ -33,7 +33,7 @@ "source": "file.h", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName(value('FileName'))}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/cppsource/wizard.json b/share/qtcreator/templates/wizards/files/cppsource/wizard.json index 88a2b8d7efc..775cd892ab0 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppsource/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "C++ Source File", "trDisplayCategory": "C++", "iconText": "cpp", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" }, + "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++src'))}" }, "pages" : [ @@ -33,7 +33,7 @@ "source": "file.cpp", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName(value('FileName'))}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/form/file.ui b/share/qtcreator/templates/wizards/files/form/file.ui index d83113033f1..1ee54204a8d 100644 --- a/share/qtcreator/templates/wizards/files/form/file.ui +++ b/share/qtcreator/templates/wizards/files/form/file.ui @@ -1 +1 @@ -%{JS: [ %{FormContents} ].join('\n')}\ +%{FormContents} diff --git a/share/qtcreator/templates/wizards/files/form/wizard.json b/share/qtcreator/templates/wizards/files/form/wizard.json index b098ff69238..ec5fd422a36 100644 --- a/share/qtcreator/templates/wizards/files/form/wizard.json +++ b/share/qtcreator/templates/wizards/files/form/wizard.json @@ -7,12 +7,12 @@ "trDisplayName": "Qt Designer Form", "trDisplayCategory": "Qt", "iconText": "ui", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Designer') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Designer') >= 0}", "options": [ - { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName([ %{FormContents} ].join('\\n'))}" }, + { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName(value('FormContents'))}" }, { "key": "Extension", "value": "%{JS: Util.preferredSuffix('application/x-designer')}"}, - { "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName('%{UiClass}', '%{Extension}') }" } + { "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName(value('UiClass'), value('Extension')) }" } ], "pages": @@ -41,7 +41,7 @@ "data": { "source": "file.ui", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{Extension}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('Extension'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json index 9f715268515..900e4f8f68f 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "frag", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.frag", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-frag')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-frag'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json index a8024cf059b..38d2df2947b 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "vert", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.vert", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-vert')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-vert'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json index bbaf2d0129d..a993a3cfcee 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "fsh", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.fsh", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-es-frag')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-frag'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json index 59865e7b55c..54231aadd51 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "vsh", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.vsh", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-es-vert')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-vert'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/java/wizard.json b/share/qtcreator/templates/wizards/files/java/wizard.json index 427dc84e16a..b3e4131d1ac 100644 --- a/share/qtcreator/templates/wizards/files/java/wizard.json +++ b/share/qtcreator/templates/wizards/files/java/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "Java File", "trDisplayCategory": "Java", "iconText": "java", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Android') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Android') >= 0}", - "options": [ { "key": "ClassName", "value": "%{JS: '%{FileName}'.charAt(0).toUpperCase() + '%{FileName}'.substr(1)}" } ], + "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1)}" } ], "pages" : [ @@ -31,7 +31,7 @@ "data": { "source": "source.java", - "target": "%{JS: Util.fileName('%{Path}/%{ClassName}', '%{JS: Util.preferredSuffix('text/x-java')}')}", + "target": "%{JS: Util.fileName(value('Path') + '/' + value('ClassName'), Util.preferredSuffix('text/x-java'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/js/wizard.json b/share/qtcreator/templates/wizards/files/js/wizard.json index 62d3211cda3..d47721bb464 100644 --- a/share/qtcreator/templates/wizards/files/js/wizard.json +++ b/share/qtcreator/templates/wizards/files/js/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "JS File", "trDisplayCategory": "Qt", "iconText": "js", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "pages" : [ @@ -47,7 +47,7 @@ "data": { "source": "file.js", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/javascript')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/javascript'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/modeling/model/wizard.json b/share/qtcreator/templates/wizards/files/modeling/model/wizard.json index b2d9029c74c..c971c8bf9d7 100644 --- a/share/qtcreator/templates/wizards/files/modeling/model/wizard.json +++ b/share/qtcreator/templates/wizards/files/modeling/model/wizard.json @@ -8,12 +8,12 @@ "trDisplayCategory": "Modeling", "iconText": "qmodel", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ModelEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ModelEditor') >= 0}", "options": [ - { "key": "TargetPath", "value": "%{JS: Util.fileName('%{Location}/%{FileName}', '%{JS: Util.preferredSuffix('text/vnd.qtcreator.model')}')}" }, - { "key": "FileName", "value": "%{JS: Modeling.elementNameToFileName('%{Name}')}" } + { "key": "TargetPath", "value": "%{JS: Util.fileName(value('Location') + '/' + value('FileName'), Util.preferredSuffix('text/vnd.qtcreator.model'))}" }, + { "key": "FileName", "value": "%{JS: Modeling.elementNameToFileName(value('Name'))}" } ], "pages" : @@ -34,8 +34,8 @@ "name": "Location", "trDisplayName": "Location:", "type": "PathChooser", - "isComplete": "%{JS: '%{Location}' === '' || !Util.exists('%{TargetPath}')}", - "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "isComplete": "%{JS: value('Location') === '' || !Util.exists(value('TargetPath'))}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators(value('TargetPath'))}\" exists in the filesystem.", "data": { "kind": "directory", diff --git a/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json b/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json index 71bad75ddff..8092ba60216 100644 --- a/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json +++ b/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "Modeling", "iconText": "qmodel", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ModelEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ModelEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{JS: Util.mktemp('model-XXXXXX.qmodel')}" } ], diff --git a/share/qtcreator/templates/wizards/files/nim/wizard.json b/share/qtcreator/templates/wizards/files/nim/wizard.json index 953df6a847a..723531ced59 100644 --- a/share/qtcreator/templates/wizards/files/nim/wizard.json +++ b/share/qtcreator/templates/wizards/files/nim/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Nim File", "trDisplayCategory": "Nim", "icon": "../../projects/nim/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.nim", - "target": "%{JS: Util.fileName('%{TargetPath}', 'nim')}", + "target": "%{JS: Util.fileName(value('TargetPath'), 'nim')}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/nimscript/wizard.json b/share/qtcreator/templates/wizards/files/nimscript/wizard.json index 62aba314cd1..15f366773b6 100644 --- a/share/qtcreator/templates/wizards/files/nimscript/wizard.json +++ b/share/qtcreator/templates/wizards/files/nimscript/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Nim Script File", "trDisplayCategory": "Nim", "icon": "../../projects/nim/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.nims", - "target": "%{JS: Util.fileName('%{TargetPath}', 'nims')}", + "target": "%{JS: Util.fileName(value('TargetPath'), 'nims')}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/python/wizard.json b/share/qtcreator/templates/wizards/files/python/wizard.json index d4a6cfd0126..262de2d37b1 100644 --- a/share/qtcreator/templates/wizards/files/python/wizard.json +++ b/share/qtcreator/templates/wizards/files/python/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Python File", "trDisplayCategory": "Python", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.py", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-python')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-python'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qrc/wizard.json b/share/qtcreator/templates/wizards/files/qrc/wizard.json index ccf8a4fea8f..578eed58a11 100644 --- a/share/qtcreator/templates/wizards/files/qrc/wizard.json +++ b/share/qtcreator/templates/wizards/files/qrc/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt Resource File", "trDisplayCategory": "Qt", "iconText": "qrc", - "enabled": "%{JS: [ %{Plugins} ].indexOf('ResourceEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ResourceEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.qrc", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/vnd.qt.xml.resource')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/vnd.qt.xml.resource'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json index 544368b1735..ead52b16873 100644 --- a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json +++ b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "QML File (Qt Quick 2)", "trDisplayCategory": "Qt", "iconText": "qml", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.qml.tpl", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-qml'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/scratch/wizard.json b/share/qtcreator/templates/wizards/files/scratch/wizard.json index 6508db6aa33..aa0efb0e107 100644 --- a/share/qtcreator/templates/wizards/files/scratch/wizard.json +++ b/share/qtcreator/templates/wizards/files/scratch/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Scratch Buffer", "trDisplayCategory": "General", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('TextEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{JS: Util.mktemp('scratch-XXXXXX.txt')}" } ], diff --git a/share/qtcreator/templates/wizards/files/scxml/wizard.json b/share/qtcreator/templates/wizards/files/scxml/wizard.json index 4c150c62568..36bbda7b71e 100644 --- a/share/qtcreator/templates/wizards/files/scxml/wizard.json +++ b/share/qtcreator/templates/wizards/files/scxml/wizard.json @@ -8,11 +8,11 @@ "trDisplayCategory": "Modeling", "iconText": "scxml", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ScxmlEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ScxmlEditor') >= 0}", "options": [ - { "key": "TargetPath", "value": "%{JS: Util.fileName('%{Location}/%{FileName}', '%{JS: Util.preferredSuffix('application/scxml+xml')}')}" }, + { "key": "TargetPath", "value": "%{JS: Util.fileName(value('Location') + '/' + value('FileName'), Util.preferredSuffix('application/scxml+xml'))}" }, { "key": "FileName", "value": "%{Name}" } ], @@ -34,8 +34,8 @@ "name": "Location", "trDisplayName": "Location:", "type": "PathChooser", - "isComplete": "%{JS: '%{Location}' === '' || !Util.exists('%{TargetPath}')}", - "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "isComplete": "%{JS: value('Location') === '' || !Util.exists(value('TargetPath'))}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators(value('TargetPath'))}\" exists in the filesystem.", "data": { "kind": "directory", diff --git a/share/qtcreator/templates/wizards/files/text/wizard.json b/share/qtcreator/templates/wizards/files/text/wizard.json index 11e0577a2de..b983401ef33 100644 --- a/share/qtcreator/templates/wizards/files/text/wizard.json +++ b/share/qtcreator/templates/wizards/files/text/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "General", "iconText": "txt", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('TextEditor') >= 0}", "pages" : [ diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json index b40d5291696..bee602c87d0 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json +++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json @@ -8,13 +8,13 @@ "trDisplayCategory": "Application", "icon": "../../global/consoleapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } ], @@ -31,7 +31,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -46,17 +46,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -67,7 +67,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -86,18 +86,18 @@ "source": "file.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "file.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "main.cpp", @@ -107,7 +107,7 @@ { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json index e1d58c25e74..ea455be4a2d 100644 --- a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json @@ -7,31 +7,31 @@ "trDisplayName": "C++ Library", "trDisplayCategory": "Library", "icon": "../../global/lib.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{CMakeFile}'}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('CMakeFile')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, - { "key": "PluginJsonFile", "value": "%{JS: Util.fileName('%{ProjectName}', 'json')}" }, - { "key": "IsShared", "value": "%{JS: '%{Type}' === 'shared'}" }, - { "key": "IsStatic", "value": "%{JS: '%{Type}' === 'static'}" }, - { "key": "IsQtPlugin", "value": "%{JS: '%{Type}' === 'qtplugin'}" }, - { "key": "BaseClassName", "value": "%{JS: [%{BaseClassInfo}].length ? [%{BaseClassInfo}][0] : ''}" }, - { "key": "PluginTargetPath", "value": "%{JS: [%{BaseClassInfo}].length ? [%{BaseClassInfo}][1] : ''}" }, - { "key": "PluginInterface", "value": "%{JS: [%{BaseClassInfo}].length ? [%{BaseClassInfo}][2] : ''}" }, - { "key": "PluginModule", "value": "%{JS: [%{BaseClassInfo}].length ? [%{BaseClassInfo}][3] : ''}" }, - { "key": "PluginMethods", "value": "%{JS: [%{BaseClassInfo}].length ? [%{BaseClassInfo}][4] : ''}" }, - { "key": "QtModule", "value": "%{JS: %{IsQtPlugin} ? '%{PluginModule}' : '%{LibraryQtModule}'}" }, - { "key": "QtModuleUpperCase", "value": "%{JS: '%{QtModule}'.charAt(0).toUpperCase() + '%{QtModule}'.slice(1)}" }, - { "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard('%{ProjectName}') + '_LIBRARY'}" }, - { "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard('%{ProjectName}') + '_EXPORT'}" }, - { "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName('%{ProjectName}_global', Util.preferredSuffix('text/x-c++hdr'))}" }, - { "key": "TargetInstallPath", "value": "%{JS: %{IsShared} ? '/usr/lib' : (%{IsQtPlugin} && '%{PluginTargetPath}' ? '$$[QT_INSTALL_PLUGINS]/%{PluginTargetPath}' : '')}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "GUARD", "value": "%{JS: Cpp.headerGuard('%{HdrFileName}')}" }, - { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard('%{GlobalHdrFileName}')}" } + { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" }, + { "key": "IsShared", "value": "%{JS: value('Type') === 'shared'}" }, + { "key": "IsStatic", "value": "%{JS: value('Type') === 'static'}" }, + { "key": "IsQtPlugin", "value": "%{JS: value('Type') === 'qtplugin'}" }, + { "key": "BaseClassName", "value": "%{JS: value('BaseClassInfo').BaseClassName }" }, + { "key": "PluginTargetPath", "value": "%{JS: value('BaseClassInfo').PluginTargetPath }" }, + { "key": "PluginInterface", "value": "%{JS: value('BaseClassInfo').PluginInterface }" }, + { "key": "PluginModule", "value": "%{JS: value('BaseClassInfo').PluginModule }" }, + { "key": "PluginMethods", "value": "%{JS: value('BaseClassInfo').PluginMethods }" }, + { "key": "QtModule", "value": "%{JS: value('IsQtPlugin') ? value('PluginModule') : value('LibraryQtModule')}" }, + { "key": "QtModuleUpperCase", "value": "%{JS: value('QtModule').charAt(0).toUpperCase() + value('QtModule').slice(1)}" }, + { "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_LIBRARY'}" }, + { "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_EXPORT'}" }, + { "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName(value('ProjectName') + '_global', Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "TargetInstallPath", "value": "%{JS: value('IsShared') ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" }, + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" }, + { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" } ], "pages": @@ -46,7 +46,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -61,12 +61,12 @@ { "trKey": "Qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" } ] } @@ -124,14 +124,14 @@ "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)", - "trText": "%{JS: '%{Type}' === 'qtplugin' ? '%{BaseClassName}'.slice(1) : ('%{ProjectName}'.charAt(0).toUpperCase() + '%{ProjectName}'.slice(1))}" + "trText": "%{JS: value('Type') === 'qtplugin' ? value('BaseClassName').slice(1) : (value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1))}" } }, { "name": "BaseClassInfo", "trDisplayName": "Base class:", "type": "ComboBox", - "visible": "%{JS: '%{Type}' === 'qtplugin'}", + "visible": "%{JS: value('Type') === 'qtplugin'}", "data": { "index": 1, @@ -139,31 +139,80 @@ [ { "trKey": "QAccessiblePlugin", - "value": "'QAccessiblePlugin', 'accessible', 'QAccessibleFactoryInterface', 'gui', 'QAccessibleInterface *create(const QString &key, QObject *object)'" + "value": + { + "BaseClassName": "QAccessiblePlugin", + "PluginTargetPath": "accessible", + "PluginInterface": "QAccessibleFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QAccessibleInterface *create(const QString &key, QObject *object)" + } }, { "trKey": "QGenericPlugin", - "value": "'QGenericPlugin', 'generic', 'QGenericPluginFactoryInterface', 'gui', 'QObject *create(const QString &name, const QString &spec)'" + "value": + { + "BaseClassName": "QGenericPlugin", + "PluginTargetPath": "generic", + "PluginInterface": "QGenericPluginFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QObject *create(const QString &name, const QString &spec)" + } }, { "trKey": "QIconEnginePlugin", - "value": "'QIconEnginePlugin', 'imageformats', 'QIconEngineFactoryInterface', 'gui', 'QIconEngine *create(const QString &filename)'" + "value": + { + "BaseClassName": "QIconEnginePlugin", + "PluginTargetPath": "imageformats", + "PluginInterface": "QIconEngineFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QIconEngine *create(const QString &filename)" + } }, { "trKey": "QImageIOPlugin", - "value": "'QImageIOPlugin', 'imageformats', 'QImageIOHandlerFactoryInterface', 'gui', 'QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const|QImageIOHandler *create(QIODevice *device, const QByteArray &format) const'" + "value": + { + "BaseClassName": "QImageIOPlugin", + "PluginTargetPath": "imageformats", + "PluginInterface": "QImageIOHandlerFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const|QImageIOHandler *create(QIODevice *device, const QByteArray &format) const" + } }, { "trKey": "QScriptExtensionPlugin", - "value": "'QScriptExtensionPlugin', '', 'QScriptExtensionInterface', 'script', 'void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const'" + "value": + { + "BaseClassName": "QScriptExtensionPlugin", + "PluginTargetPath": "", + "PluginInterface": "QScriptExtensionInterface", + "PluginModule": "script", + "PluginMethods": "void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const" + } }, { "trKey": "QSqlDriverPlugin", - "value": "'QSqlDriverPlugin', 'sqldrivers', 'QSqlDriverFactoryInterface', 'sql', 'QSqlDriver *create(const QString &key)'" + "value": + { + "BaseClassName": "QSqlDriverPlugin", + "PluginTargetPath": "sqldrivers", + "PluginInterface": "QSqlDriverFactoryInterface", + "PluginModule": "sql", + "PluginMethods": "QSqlDriver *create(const QString &key)" + } }, { "trKey": "QStylePlugin", - "value": "'QStylePlugin', 'styles', 'QStyleFactoryInterface', 'widgets', 'QStyle *create(const QString &key)'" + "value": + { + "BaseClassName": "QStylePlugin", + "PluginTargetPath": "styles", + "PluginInterface": "QStyleFactoryInterface", + "PluginModule": "widgets", + "PluginMethods": "QStyle *create(const QString &key)" + } } ] } @@ -172,7 +221,7 @@ "name": "LibraryQtModule", "trDisplayName": "Qt module:", "type": "ComboBox", - "visible": "%{JS: '%{Type}' != 'qtplugin'}", + "visible": "%{JS: value('Type') != 'qtplugin'}", "data": { "index": 1, @@ -206,14 +255,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } } ] }, @@ -221,7 +270,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -240,12 +289,12 @@ "source": "project.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "lib.cpp", @@ -259,17 +308,17 @@ { "source": "lib_global.h", "target": "%{GlobalHdrFileName}", - "condition": "%{JS: '%{Type}' === 'shared'}" + "condition": "%{JS: value('Type') === 'shared'}" }, { "source": "project.json", "target": "%{PluginJsonFile}", - "condition": "%{JS: '%{Type}' === 'qtplugin'}" + "condition": "%{JS: value('Type') === 'qtplugin'}" }, { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/nim/wizard.json b/share/qtcreator/templates/wizards/projects/nim/wizard.json index bd30370cd5a..1239e444e91 100644 --- a/share/qtcreator/templates/wizards/projects/nim/wizard.json +++ b/share/qtcreator/templates/wizards/projects/nim/wizard.json @@ -8,13 +8,13 @@ "trDisplayCategory": "Non-Qt Project", "featuresRequired": [ "ToolChain.Nim.NimToolChain" ], "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0 }", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0 }", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{NimProjectFile}'}" }, - { "key": "NimProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'nimproject')}" }, - { "key": "NimFileName", "value": "%{JS: 'main.nim'}" } + { "key": "ProjectFile", "value": "%{NimProjectFile}" }, + { "key": "NimProjectFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'nimproject')}" }, + { "key": "NimFileName", "value": "main.nim" } ], "pages": @@ -28,7 +28,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -56,7 +56,7 @@ { "source": "../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/plainc/wizard.json b/share/qtcreator/templates/wizards/projects/plainc/wizard.json index 56361be81d5..66514cb9a75 100644 --- a/share/qtcreator/templates/wizards/projects/plainc/wizard.json +++ b/share/qtcreator/templates/wizards/projects/plainc/wizard.json @@ -7,13 +7,13 @@ "trDisplayName": "Plain C Application", "trDisplayCategory": "Non-Qt Project", "icon": "../../global/consoleapplication.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "CFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-csrc')}" } ], @@ -29,7 +29,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -44,17 +44,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -65,7 +65,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -84,18 +84,18 @@ "source": "file.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "file.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "main.c", @@ -105,7 +105,7 @@ { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json index d605b1c93dc..19e10a84171 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json @@ -8,11 +8,11 @@ "trDisplayCategory": "Other Project", "icon": "../../../global/guiapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}", "options": [ - { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" } + { "key": "ProFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "IsTopLevelProject", "value": "%{JS: !value('Exists:ProjectExplorer.Profile.Ids')}" } ], "pages": @@ -50,7 +50,7 @@ { "source": "../../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: value('IsTopLevelProject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json index a6db89cd551..6d734cb0e88 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt for Python - Empty", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json index 0fad3e3fe82..c8e397d0d82 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt for Python - Window", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": @@ -52,14 +52,14 @@ "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-python')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-python'))}" } }, { "name": "ProjectFileName", "type": "LineEdit", "trDisplayName": "Project file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', 'pyproject')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'pyproject')}" } } ] }, diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json index d26bec5ec69..91b7e3b860c 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json @@ -8,20 +8,20 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.QtQuickWindowVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -36,7 +36,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -51,17 +51,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -86,74 +86,74 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickWindowVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickWindowVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickWindowVersion': '2.12', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickWindowVersion": "2.12", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickWindowVersion': '2.11', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickWindowVersion": "2.11", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickWindowVersion': '2.10', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickWindowVersion": "2.10", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickWindowVersion": "2.9", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickWindowVersion": "2.8", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickWindowVersion": "2.7", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.6", "value": - "({ - 'QtQuickVersion': '2.6', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.Enterprise.VirtualKeyboard 2.0' - })" + { + "QtQuickVersion": "2.6", + "QtQuickWindowVersion": "2.6", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.0" + } } ] } @@ -173,7 +173,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -195,19 +195,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -224,7 +224,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json index 098456a431d..301e915b862 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.9" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,47 +88,47 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } } ] } @@ -145,66 +145,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -224,7 +224,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -246,19 +246,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -279,7 +279,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json index 0b0f8558acb..96b3a439b90 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,65 +88,65 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickControlsVersion': '2.1', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickControlsVersion": "2.1", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickControlsVersion': '2.0', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickControlsVersion": "2.0", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } } ] } @@ -163,66 +163,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -242,7 +242,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -264,19 +264,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -309,7 +309,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json index a89e6cce262..5f15dbffbe8 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,65 +88,65 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickControlsVersion': '2.1', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickControlsVersion": "2.1", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickControlsVersion': '2.0', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickControlsVersion": "2.0", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } } ] } @@ -163,66 +163,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -242,7 +242,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -264,19 +264,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -305,7 +305,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json index 8a726cc09c5..508e0b41ff3 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json @@ -7,18 +7,18 @@ "trDisplayName": "Qt Quick UI Prototype", "trDisplayCategory": "Other Project", "icon": "qtquickuiprototype.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlProjectManager') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ], "options": [ - { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qmlproject')}" }, - { "key": "MainQmlFileName", "value": "%{JS: Util.fileName('%{ProjectName}', 'qml')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.QtQuickWindowVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, + { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" }, + { "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" } + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" } ], "pages": @@ -46,74 +46,74 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickWindowVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickWindowVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickWindowVersion': '2.12', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickWindowVersion": "2.12", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickWindowVersion': '2.11', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickWindowVersion": "2.11", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickWindowVersion': '2.10', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickWindowVersion": "2.10", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickWindowVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickWindowVersion": "2.9", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickWindowVersion": "2.8", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickWindowVersion": "2.7", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.6", "value": - "({ - 'QtQuickVersion': '2.6', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.Enterprise.VirtualKeyboard 2.0' - })" + { + "QtQuickVersion": "2.6", + "QtQuickWindowVersion": "2.6", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.0" + } } ] } @@ -164,7 +164,7 @@ { "source": "../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json index bff52de6a3d..fa7a4124ef0 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json @@ -8,18 +8,18 @@ "trDisplayCategory": "Application", "icon": "../../global/guiapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}'}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "UiHdrFileName", "value": "%{JS: ('%{BuildSystem}' === 'cmake' ? (Util.path('%{FormFileName}') + '/') : '') + 'ui_' + Util.completeBaseName('%{FormFileName}') + '.h'}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "GUARD", "value": "%{JS: Cpp.headerGuard('%{HdrFileName}')}" } + { "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" }, + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" } ], "pages": @@ -34,7 +34,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -47,19 +47,19 @@ "items": [ { - "trKey": "QMake", + "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -93,7 +93,7 @@ "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)", - "trText": "%{JS: '%{BaseClass}'.slice(1)}" + "trText": "%{JS: value('BaseClass') ? value('BaseClass').slice(1) : 'MyClass'}" } }, { @@ -114,14 +114,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } }, { "name": "GenerateForm", @@ -135,7 +135,7 @@ "trDisplayName": "Form file:", "enabled": "%{GenerateForm}", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', 'ui')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'ui')}" } } ] }, @@ -143,7 +143,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -162,18 +162,18 @@ "source": "project.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "project.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "main.cpp", @@ -196,7 +196,7 @@ { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index eb3f05e1750..de1459aae18 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -295,6 +295,29 @@ QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const return expand(QString::fromLatin1(stringWithVariables)).toLatin1(); } +QVariant MacroExpander::expandVariant(const QVariant &v) const +{ + const auto type = QMetaType::Type(v.type()); + if (type == QMetaType::QString) { + return expand(v.toString()); + } else if (type == QMetaType::QStringList) { + return Utils::transform(v.toStringList(), + [this](const QString &s) -> QVariant { return expand(s); }); + } else if (type == QMetaType::QVariantList) { + return Utils::transform(v.toList(), [this](const QVariant &v) { return expandVariant(v); }); + } else if (type == QMetaType::QVariantMap) { + const auto map = v.toMap(); + QVariantMap result; + QMapIterator it(map); + while (it.hasNext()) { + it.next(); + result.insert(it.key(), expandVariant(it.value())); + } + return result; + } + return v; +} + QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const { return QtcProcess::expandMacros(argsWithVariables, d); diff --git a/src/libs/utils/macroexpander.h b/src/libs/utils/macroexpander.h index f17ae86b8c2..30dcf06a4fb 100644 --- a/src/libs/utils/macroexpander.h +++ b/src/libs/utils/macroexpander.h @@ -56,6 +56,7 @@ public: QString expand(const QString &stringWithVariables) const; QByteArray expand(const QByteArray &stringWithVariables) const; + QVariant expandVariant(const QVariant &v) const; QString expandProcessArgs(const QString &argsWithVariables) const; diff --git a/src/libs/utils/wizardpage.h b/src/libs/utils/wizardpage.h index fa8c60b052b..abeccfce137 100644 --- a/src/libs/utils/wizardpage.h +++ b/src/libs/utils/wizardpage.h @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -41,30 +42,30 @@ namespace Internal { class QTCREATOR_UTILS_EXPORT ObjectToFieldWidgetConverter : public QWidget { Q_OBJECT - Q_PROPERTY(QString text READ text NOTIFY textChanged) + Q_PROPERTY(QVariant value READ value NOTIFY valueChanged) public: - template - static ObjectToFieldWidgetConverter *create(T *sender, void (T::*member)(Arguments...), const std::function &toTextFunction) + template + static ObjectToFieldWidgetConverter *create(T *sender, + void (T::*member)(Arguments...), + const std::function &toVariantFunction) { auto widget = new ObjectToFieldWidgetConverter(); - widget->toTextFunction = toTextFunction; + widget->toVariantFunction = toVariantFunction; connect(sender, &QObject::destroyed, widget, &QObject::deleteLater); - connect(sender, member, widget, [widget] () { - emit widget->textChanged(widget->text()); - }); + connect(sender, member, widget, [widget]() { emit widget->valueChanged(widget->value()); }); return widget; } signals: - void textChanged(const QString&); + void valueChanged(const QVariant &); private: ObjectToFieldWidgetConverter () = default; - // is used by the property text - QString text() {return toTextFunction();} - std::function toTextFunction; + // is used by the property value + QVariant value() { return toVariantFunction(); } + std::function toVariantFunction; }; } // Internal @@ -79,10 +80,17 @@ public: virtual void pageWasAdded(); // called when this page was added to a Utils::Wizard template - void registerObjectAsFieldWithName(const QString &name, T *sender, void (T::*changeSignal)(Arguments...), - const std::function &senderToString) + void registerObjectAsFieldWithName(const QString &name, + T *sender, + void (T::*changeSignal)(Arguments...), + const std::function &senderToVariant) { - registerFieldWithName(name, Internal::ObjectToFieldWidgetConverter::create(sender, changeSignal, senderToString), "text", SIGNAL(textChanged(QString))); + registerFieldWithName(name, + Internal::ObjectToFieldWidgetConverter::create(sender, + changeSignal, + senderToVariant), + "value", + SIGNAL(valueChanged(QValue))); } void registerFieldWithName(const QString &name, QWidget *widget, diff --git a/src/plugins/coreplugin/jsexpander.cpp b/src/plugins/coreplugin/jsexpander.cpp index effa3464cc7..5aa9279c7c6 100644 --- a/src/plugins/coreplugin/jsexpander.cpp +++ b/src/plugins/coreplugin/jsexpander.cpp @@ -34,8 +34,26 @@ #include #include -namespace Core { +#include +namespace std { +template<> struct hash +{ + using argument_type = QString; + using result_type = size_t; + result_type operator()(const argument_type &v) const + { + return hash()(v.toStdString()); + } +}; +} // namespace std + +using ExtensionMap = std::unordered_map; +Q_GLOBAL_STATIC(ExtensionMap, globalJsExtensions); + +static Core::JsExpander *globalExpander = nullptr; + +namespace Core { namespace Internal { class JsExpanderPrivate { @@ -45,9 +63,14 @@ public: } // namespace Internal -static Internal::JsExpanderPrivate *d; +void JsExpander::registerGlobalObject(const QString &name, const ObjectFactory &factory) +{ + globalJsExtensions->insert({name, factory}); + if (globalExpander) + globalExpander->registerObject(name, factory()); +} -void JsExpander::registerQObjectForJs(const QString &name, QObject *obj) +void JsExpander::registerObject(const QString &name, QObject *obj) { QJSValue jsObj = d->m_engine.newQObject(obj); d->m_engine.globalObject().setProperty(name, jsObj); @@ -77,16 +100,21 @@ QString JsExpander::evaluate(const QString &expression, QString *errorMessage) return QString(); } -JsExpander::JsExpander() +QJSEngine &JsExpander::engine() { - d = new Internal::JsExpanderPrivate; - Utils::globalMacroExpander()->registerPrefix("JS", + return d->m_engine; +} + +void JsExpander::registerForExpander(Utils::MacroExpander *macroExpander) +{ + macroExpander->registerPrefix( + "JS", QCoreApplication::translate("Core::JsExpander", "Evaluate simple JavaScript statements.
" "The statements may not contain '{' nor '}' characters."), - [](QString in) -> QString { + [this](QString in) -> QString { QString errorMessage; - QString result = JsExpander::evaluate(in, &errorMessage); + QString result = evaluate(in, &errorMessage); if (!errorMessage.isEmpty()) { qWarning() << errorMessage; return errorMessage; @@ -94,8 +122,21 @@ JsExpander::JsExpander() return result; } }); +} - registerQObjectForJs(QLatin1String("Util"), new Internal::UtilsJsExtension); +JsExpander *JsExpander::createGlobalJsExpander() +{ + globalExpander = new JsExpander(); + registerGlobalObject("Util"); + globalExpander->registerForExpander(Utils::globalMacroExpander()); + return globalExpander; +} + +JsExpander::JsExpander() +{ + d = new Internal::JsExpanderPrivate; + for (const std::pair &obj : *globalJsExtensions) + registerObject(obj.first, obj.second()); } JsExpander::~JsExpander() diff --git a/src/plugins/coreplugin/jsexpander.h b/src/plugins/coreplugin/jsexpander.h index 087f494ac0b..df8c6bceeaa 100644 --- a/src/plugins/coreplugin/jsexpander.h +++ b/src/plugins/coreplugin/jsexpander.h @@ -27,26 +27,51 @@ #include "core_global.h" +#include + QT_BEGIN_NAMESPACE +class QJSEngine; class QObject; class QString; QT_END_NAMESPACE +namespace Utils { +class MacroExpander; +} + namespace Core { -namespace Internal { class MainWindow; } +namespace Internal { +class MainWindow; +class JsExpanderPrivate; +} // namespace Internal class CORE_EXPORT JsExpander { public: - static void registerQObjectForJs(const QString &name, QObject *obj); + using ObjectFactory = std::function; - static QString evaluate(const QString &expression, QString *errorMessage = nullptr); - -private: JsExpander(); ~JsExpander(); + template + static void registerGlobalObject(const QString &name) + { + registerGlobalObject(name, []{ return new T; }); + } + + static void registerGlobalObject(const QString &name, const ObjectFactory &factory); + + void registerObject(const QString &name, QObject *obj); + QString evaluate(const QString &expression, QString *errorMessage = nullptr); + + QJSEngine &engine(); + void registerForExpander(Utils::MacroExpander *macroExpander); + +private: + static JsExpander *createGlobalJsExpander(); + + Internal::JsExpanderPrivate *d; friend class Core::Internal::MainWindow; }; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 2e8b5f2ad15..d35477f6b57 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -100,25 +100,26 @@ namespace Internal { enum { debugMainWindow = 0 }; -MainWindow::MainWindow() : - AppMainWindow(), - m_coreImpl(new ICore(this)), - m_lowPrioAdditionalContexts(Constants::C_GLOBAL), - m_settingsDatabase(new SettingsDatabase(QFileInfo(PluginManager::settings()->fileName()).path(), - QLatin1String(Constants::IDE_CASED_ID), - this)), - m_progressManager(new ProgressManagerPrivate), - m_jsExpander(new JsExpander), - m_vcsManager(new VcsManager), - m_modeStack(new FancyTabWidget(this)), - m_generalSettings(new GeneralSettings), - m_systemSettings(new SystemSettings), - m_shortcutSettings(new ShortcutSettings), - m_toolSettings(new ToolSettings), - m_mimeTypeSettings(new MimeTypeSettings), - m_systemEditor(new SystemEditor), - m_toggleLeftSideBarButton(new QToolButton), - m_toggleRightSideBarButton(new QToolButton) +MainWindow::MainWindow() + : AppMainWindow() + , m_coreImpl(new ICore(this)) + , m_lowPrioAdditionalContexts(Constants::C_GLOBAL) + , m_settingsDatabase( + new SettingsDatabase(QFileInfo(PluginManager::settings()->fileName()).path(), + QLatin1String(Constants::IDE_CASED_ID), + this)) + , m_progressManager(new ProgressManagerPrivate) + , m_jsExpander(JsExpander::createGlobalJsExpander()) + , m_vcsManager(new VcsManager) + , m_modeStack(new FancyTabWidget(this)) + , m_generalSettings(new GeneralSettings) + , m_systemSettings(new SystemSettings) + , m_shortcutSettings(new ShortcutSettings) + , m_toolSettings(new ToolSettings) + , m_mimeTypeSettings(new MimeTypeSettings) + , m_systemEditor(new SystemEditor) + , m_toggleLeftSideBarButton(new QToolButton) + , m_toggleRightSideBarButton(new QToolButton) { (void) new DocumentManager(this); diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index d2ca6d5d0b8..4d7599b24bb 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -172,7 +172,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) d = new CppToolsPluginPrivate; - JsExpander::registerQObjectForJs(QLatin1String("Cpp"), new CppToolsJsExtension); + JsExpander::registerGlobalObject("Cpp"); // Menus ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); diff --git a/src/plugins/designer/formtemplatewizardpage.cpp b/src/plugins/designer/formtemplatewizardpage.cpp index ce5f3ddb8c2..fb01ddc5f43 100644 --- a/src/plugins/designer/formtemplatewizardpage.cpp +++ b/src/plugins/designer/formtemplatewizardpage.cpp @@ -117,7 +117,7 @@ bool FormTemplateWizardPage::validatePage() QMessageBox::critical(this, tr("%1 - Error").arg(title()), errorMessage); return false; } - wizard()->setProperty("FormContents", m_templateContents.split('\n')); + wizard()->setProperty("FormContents", m_templateContents); return true; } diff --git a/src/plugins/modeleditor/jsextension.h b/src/plugins/modeleditor/jsextension.h index 74c7cbc892c..6192636e3b7 100644 --- a/src/plugins/modeleditor/jsextension.h +++ b/src/plugins/modeleditor/jsextension.h @@ -35,7 +35,7 @@ class JsExtension : public QObject Q_OBJECT public: - JsExtension(QObject *parent = nullptr) : QObject(parent) { } + JsExtension() {} Q_INVOKABLE QString fileNameToElementName(const QString &file); Q_INVOKABLE QString elementNameToFileName(const QString &element); diff --git a/src/plugins/modeleditor/modeleditor_plugin.cpp b/src/plugins/modeleditor/modeleditor_plugin.cpp index 7571703cbbd..8e08854f4db 100644 --- a/src/plugins/modeleditor/modeleditor_plugin.cpp +++ b/src/plugins/modeleditor/modeleditor_plugin.cpp @@ -92,7 +92,7 @@ bool ModelEditorPlugin::initialize(const QStringList &arguments, QString *errorS d->modelFactory = new ModelEditorFactory(d->uiController, this); d->settingsController = new SettingsController(this); - Core::JsExpander::registerQObjectForJs(QLatin1String("Modeling"), new JsExtension(this)); + Core::JsExpander::registerGlobalObject("Modeling"); connect(d->settingsController, &SettingsController::saveSettings, d->uiController, &UiController::saveSettings); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index 8048d4cc6df..b04ec95efc0 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -810,7 +810,7 @@ std::unique_ptr createStandardItemFromListItem(const QVariant &it if (item.type() == QVariant::Map) { QVariantMap tmp = item.toMap(); const QString key = JsonWizardFactory::localizedString(consumeValue(tmp, "trKey", QString()).toString()); - const QString value = consumeValue(tmp, "value", key).toString(); + const QVariant value = consumeValue(tmp, "value", key); if (key.isNull() || key.isEmpty()) { *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage", @@ -920,7 +920,7 @@ void ListField::initializeData(MacroExpander *expander) if (item.get() == currentItem) currentItem = expandedValuesItem; expandedValuesItem->setText(expander->expand(item->text())); - expandedValuesItem->setData(expander->expand(item->data(ValueRole).toString()), ValueRole); + expandedValuesItem->setData(expander->expandVariant(item->data(ValueRole)), ValueRole); expandedValuesItem->setData(expander->expand(item->data(IconStringRole).toString()), IconStringRole); expandedValuesItem->setData(condition, ConditionRole); @@ -1020,8 +1020,8 @@ void ComboBoxField::setup(JsonFieldPage *page, const QString &name) page->registerObjectAsFieldWithName(name, selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { const QModelIndex i = selectionModel()->currentIndex(); if (i.isValid()) - return i.data(ValueRole).toString(); - return QString(); + return i.data(ValueRole); + return QVariant(); }); QObject::connect(selectionModel(), &QItemSelectionModel::selectionChanged, page, [page]() { emit page->completeChanged(); @@ -1058,8 +1058,8 @@ void IconListField::setup(JsonFieldPage *page, const QString &name) page->registerObjectAsFieldWithName(name, selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { const QModelIndex i = selectionModel()->currentIndex(); if (i.isValid()) - return i.data(ValueRole).toString(); - return QString(); + return i.data(ValueRole); + return QVariant(); }); QObject::connect(selectionModel(), &QItemSelectionModel::selectionChanged, page, [page]() { emit page->completeChanged(); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index 5db2186c46a..6939d0863ec 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -143,7 +144,8 @@ private: } // namespace Internal -JsonWizard::JsonWizard(QWidget *parent) : Utils::Wizard(parent) +JsonWizard::JsonWizard(QWidget *parent) + : Utils::Wizard(parent) { setMinimumSize(800, 500); m_expander.registerExtraResolver([this](const QString &name, QString *ret) -> bool { @@ -157,7 +159,10 @@ JsonWizard::JsonWizard(QWidget *parent) : Utils::Wizard(parent) const QString key = QString::fromLatin1("%{") + value + QLatin1Char('}'); return m_expander.expand(key) == key ? QString() : QLatin1String("true"); }); - + // override default JS macro by custom one that adds Wizard specific features + m_jsExpander.registerObject("Wizard", new Internal::JsonWizardJsExtension(this)); + m_jsExpander.engine().evaluate("var value = Wizard.value"); + m_jsExpander.registerForExpander(&m_expander); } JsonWizard::~JsonWizard() @@ -520,4 +525,17 @@ bool JsonWizard::OptionDefinition::condition(Utils::MacroExpander &expander) con return JsonWizard::boolFromVariant(m_condition, &expander); } +namespace Internal { + +JsonWizardJsExtension::JsonWizardJsExtension(JsonWizard *wizard) + : m_wizard(wizard) +{} + +QVariant JsonWizardJsExtension::value(const QString &name) const +{ + const QVariant value = m_wizard->value(name); + return m_wizard->expander()->expandVariant(m_wizard->value(name)); +} + +} // namespace Internal } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h index 1f8aca77414..99a9ce49527 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -37,8 +38,25 @@ namespace ProjectExplorer { +class JsonWizard; class JsonWizardGenerator; +namespace Internal { + +class JsonWizardJsExtension : public QObject +{ + Q_OBJECT +public: + JsonWizardJsExtension(JsonWizard *wizard); + + Q_INVOKABLE QVariant value(const QString &name) const; + +private: + JsonWizard *m_wizard; +}; + +} // namespace Internal + // Documentation inside. class PROJECTEXPLORER_EXPORT JsonWizard : public Utils::Wizard { @@ -126,6 +144,7 @@ private: GeneratorFiles m_files; Utils::MacroExpander m_expander; + Core::JsExpander m_jsExpander; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 3a01d9e0454..6ef34d8ddc5 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -46,10 +47,11 @@ #include #include -#include +#include #include #include #include +#include #include namespace ProjectExplorer { @@ -513,9 +515,17 @@ bool JsonWizardFactory::isAvailable(Core::Id platformId) const [platformId]() { return platformId.toString(); }); expander.registerVariable("Features", tr("The features available to this wizard."), [this, e, platformId]() { return JsonWizard::stringListToArrayString(Core::Id::toStringList(availableFeatures(platformId)), e); }); - expander.registerVariable("Plugins", tr("The plugins loaded."), - [this, e]() { return JsonWizard::stringListToArrayString(Core::Id::toStringList(pluginFeatures()), e); }); - + expander.registerVariable("Plugins", tr("The plugins loaded."), [this, e]() { + return JsonWizard::stringListToArrayString(Core::Id::toStringList(pluginFeatures()), e); + }); + Core::JsExpander jsExpander; + jsExpander.registerObject("Wizard", + new Internal::JsonWizardFactoryJsExtension(platformId, + availableFeatures( + platformId), + pluginFeatures())); + jsExpander.engine().evaluate("var value = Wizard.value"); + jsExpander.registerForExpander(e); return JsonWizard::boolFromVariant(m_enabledExpression, &expander); } @@ -660,4 +670,26 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, return errorMessage->isEmpty(); } +namespace Internal { + +JsonWizardFactoryJsExtension::JsonWizardFactoryJsExtension(Core::Id platformId, + const QSet &availableFeatures, + const QSet &pluginFeatures) + : m_platformId(platformId) + , m_availableFeatures(availableFeatures) + , m_pluginFeatures(pluginFeatures) +{} + +QVariant JsonWizardFactoryJsExtension::value(const QString &name) const +{ + if (name == "Platform") + return m_platformId.toString(); + if (name == "Features") + return Core::Id::toStringList(m_availableFeatures); + if (name == "Plugins") + return Core::Id::toStringList(m_pluginFeatures); + return QVariant(); +} + +} // namespace Internal } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h index ead93f48412..06af1ebae80 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h @@ -119,4 +119,23 @@ private: friend class ProjectExplorerPluginPrivate; }; -} //namespace ProjectExplorer +namespace Internal { + +class JsonWizardFactoryJsExtension : public QObject +{ + Q_OBJECT +public: + JsonWizardFactoryJsExtension(Core::Id platformId, + const QSet &availableFeatures, + const QSet &pluginFeatures); + + Q_INVOKABLE QVariant value(const QString &name) const; + +private: + Core::Id m_platformId; + QSet m_availableFeatures; + QSet m_pluginFeatures; +}; + +} // namespace Internal +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp index ee7da5b419c..a168fea084f 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp @@ -127,7 +127,9 @@ Core::GeneratedFile JsonWizardFileGenerator::generateFile(const File &file, *ret = options.value(n); return true; }); - nested.registerExtraResolver([expander](QString n, QString *ret) { return expander->resolveMacro(n, ret); }); + nested.registerExtraResolver([expander](QString n, QString *ret) { + return expander->resolveMacro(n, ret); + }); gf.setContents(Utils::TemplateEngine::processText(&nested, QString::fromUtf8(reader.data()), errorMessage)); diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index 7b98a146b9a..5faa9f7a1a2 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -85,7 +85,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes ProFileEvaluator::initialize(); new ProFileCacheManager(this); - JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator); + JsExpander::registerGlobalObject("QtSupport"); d = new QtSupportPluginPrivate; diff --git a/src/plugins/vcsbase/vcsplugin.cpp b/src/plugins/vcsbase/vcsplugin.cpp index 201f2a3b435..efb70f1696b 100644 --- a/src/plugins/vcsbase/vcsplugin.cpp +++ b/src/plugins/vcsbase/vcsplugin.cpp @@ -98,7 +98,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage) JsonWizardFactory::registerPageFactory(new Internal::VcsConfigurationPageFactory); JsonWizardFactory::registerPageFactory(new Internal::VcsCommandPageFactory); - JsExpander::registerQObjectForJs(QLatin1String("Vcs"), new VcsJsExtension); + JsExpander::registerGlobalObject("Vcs"); Utils::MacroExpander *expander = Utils::globalMacroExpander(); expander->registerVariable(Constants::VAR_VCS_NAME,