From 6b6091ea61ca86bd7675b84e3e763fd69feb45c7 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 25 Jun 2015 12:10:23 +0200 Subject: [PATCH] Replace several "Plain C++" with one JSON wizard Change-Id: Ia08f2127cdb25785cf313ec0a31a3d9775161c9b Reviewed-by: Christian Stenger --- .../wizards/plaincppapp/cmake/wizard.xml | 43 ------- .../wizards/plaincppapp/common/console.png | Bin 567 -> 0 bytes .../wizards/plaincppapp/qbs/wizard.xml | 43 ------- .../wizards/plaincppapp/qmake/wizard.xml | 50 -------- .../plaincpp}/CMakeLists.txt | 2 +- .../plaincpp/file.pro} | 2 +- .../plaincpp/file.qbs} | 2 +- .../common => projects/plaincpp}/main.cpp | 1 + .../wizards/projects/plaincpp/wizard.json | 114 ++++++++++++++++++ 9 files changed, 118 insertions(+), 139 deletions(-) delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/common/console.png delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml rename share/qtcreator/templates/wizards/{plaincppapp/cmake => projects/plaincpp}/CMakeLists.txt (82%) rename share/qtcreator/templates/wizards/{plaincppapp/qmake/project.pro => projects/plaincpp/file.pro} (68%) rename share/qtcreator/templates/wizards/{plaincppapp/qbs/project.qbs => projects/plaincpp/file.qbs} (87%) rename share/qtcreator/templates/wizards/{plaincppapp/common => projects/plaincpp}/main.cpp (81%) create mode 100644 share/qtcreator/templates/wizards/projects/plaincpp/wizard.json diff --git a/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml deleted file mode 100644 index 4bd5e93384f..00000000000 --- a/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - ../common/console.png - Creates a plain C++ project using CMake, not using the Qt library. - Plain C++ Project (CMake Build); - Non-Qt Project - - - - - diff --git a/share/qtcreator/templates/wizards/plaincppapp/common/console.png b/share/qtcreator/templates/wizards/plaincppapp/common/console.png deleted file mode 100644 index 7569a988f4a09ad0a72d7250b47db99c88471a79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 567 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}Y)RhkE)4%caKYZ?lNlHo zI14-?iy0WWg+Z8+Vb&Z81_lQ95>H=O_G?VcTn3Cs1+>;PFfhoLxJHyX=jZ08=9Mrw z7o{eaq^2m8XO?6rgk+>DxO@5ryiZZhV_;yM?djqeQgQ3;^u1Y3jv}q+*ErwUeRRVD z?xyHp9AO8uvbp7z^(Xjk*mzp|iDFR1%ml%Xsr?Bn7p-}eWVre0j%7lVcD(BP?R?-e z@0q7HcXk@jN&KBB?t04Mpq5O-{}_{Be{1EIJr3(W%EZv{ymH0$*E1#j)r5K44_}sL zXgHWqutifhbL~OP{rnH@Sp&QjyA~xeY`d-dtiM?23scak8pb74KG@113})E>T={|H zDgkjupUW)095u%lW?PkZbThOi9=K*Ur*AT+%Oc4QI@-n^N47tZIikD$@v8C%41sl; zi$$g^$d+2QQlKr-jv>g4#pb}T%HFwqnQH~L-irzZeq&%S-v8YBy2+28!*yF7T@reh zPG(9aldF71(QNkFKwd#djzVh(5m)uIx~C5n?L6`&w<_fMw!1D2;{6Id&MTI6 znflvKI@;OspvJ<1!Vad*&C Q3=9kmp00i_>zopr0NOF+bpQYW diff --git a/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml deleted file mode 100644 index 67a4e4f66b7..00000000000 --- a/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - ../common/console.png - Creates a plain (non-Qt) C++ project using Qbs. - Plain C++ Project (Qbs Build); - Non-Qt Project - - - - - diff --git a/share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml deleted file mode 100644 index 466a5a79bc5..00000000000 --- a/share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - ../common/console.png - Creates a plain C++ project using qmake, not using the Qt library. - Plain C++ Project; - Non-Qt Project - - - - - diff --git a/share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt similarity index 82% rename from share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt rename to share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt index aad92e30c3c..9001db70166 100644 --- a/share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt @@ -1,4 +1,4 @@ -project(%ProjectName%) +project(%{ProjectName}) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) diff --git a/share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro b/share/qtcreator/templates/wizards/projects/plaincpp/file.pro similarity index 68% rename from share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro rename to share/qtcreator/templates/wizards/projects/plaincpp/file.pro index 3f05c8e3bbf..2aa18858cea 100644 --- a/share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro +++ b/share/qtcreator/templates/wizards/projects/plaincpp/file.pro @@ -3,4 +3,4 @@ CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt -SOURCES += main.%CppSourceSuffix% +SOURCES += %{CppFileName} diff --git a/share/qtcreator/templates/wizards/plaincppapp/qbs/project.qbs b/share/qtcreator/templates/wizards/projects/plaincpp/file.qbs similarity index 87% rename from share/qtcreator/templates/wizards/plaincppapp/qbs/project.qbs rename to share/qtcreator/templates/wizards/projects/plaincpp/file.qbs index e828e26a6d9..257f61dc498 100644 --- a/share/qtcreator/templates/wizards/plaincppapp/qbs/project.qbs +++ b/share/qtcreator/templates/wizards/projects/plaincpp/file.qbs @@ -3,7 +3,7 @@ import qbs CppApplication { type: "application" // To suppress bundle generation on Mac consoleApplication: true - files: "main.%CppSourceSuffix%" + files: "%{CppFileName}" Group { // Properties for the produced executable fileTagsFilter: product.type diff --git a/share/qtcreator/templates/wizards/plaincppapp/common/main.cpp b/share/qtcreator/templates/wizards/projects/plaincpp/main.cpp similarity index 81% rename from share/qtcreator/templates/wizards/plaincppapp/common/main.cpp rename to share/qtcreator/templates/wizards/projects/plaincpp/main.cpp index 3129fb9dd95..0f458918994 100644 --- a/share/qtcreator/templates/wizards/plaincppapp/common/main.cpp +++ b/share/qtcreator/templates/wizards/projects/plaincpp/main.cpp @@ -1,3 +1,4 @@ +%{Cpp:LicenseTemplate}\ #include using namespace std; diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json new file mode 100644 index 00000000000..5ec2b6ed317 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json @@ -0,0 +1,114 @@ +{ + "version": 1, + "kind": "project", + "id": "R.Plain Cpp Application", + "category": "I.Projects", + "trDescription": "Creates a simple C++ application using either qmake, CMake, or Qbs to build.", + "trDisplayName": "Plain C++ Application", + "trDisplayCategory": "Non-Qt Project", + "icon": "../../global/consoleapplication.png", + "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{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": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, + { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project" + }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "qmake", + "value": "qmake", + "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + }, + { + "trKey": "CMake", + "value": "cmake", + "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + }, + { + "trKey": "Qbs", + "value": "qbs", + "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + } + ] + } + } + ] + }, + + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{IsTopLevelProject}", + "data": { "projectFilePath": "%{ProjectFile}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "file.pro", + "target": "%{ProFile}", + "openAsProject": true, + "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + }, + { + "source": "CMakeLists.txt", + "openAsProject": true, + "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + }, + { + "source": "file.qbs", + "target": "%{QbsFile}", + "openAsProject": true, + "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + }, + { + "source": "main.cpp", + "target": "%{CppFileName}", + "openInEditor": true + }, + { + "source": "../git.ignore", + "target": "%{ProjectDirectory}/.gitignore", + "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + } + ] + } + ] +}