From 1f007a6264f667a0281a4c14ac9d8b87405fed06 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 26 Jul 2013 14:49:11 +0200 Subject: [PATCH] Consolidate the different "Plain C/C++" wizards somewhat. We should not duplicate all wizard resources for every supported build system -- this will not scale. Instead, have one top-level directory for each type of wizard with build system specific data in respective subdirectories and common data in another. To support this approach, CustomWizard now traverses the template directory recursively as long as no wizard specification has been found. Change-Id: I8aad8cf36c5bf24d062f2d2c17fdb87ad12fd450 Reviewed-by: Friedemann Kleint Reviewed-by: Christian Kandeler --- .../cmake}/CMakeLists.txt | 0 .../cmake}/wizard.xml | 4 ++-- .../common}/console.png | Bin .../{plaincapp-cmake => plaincapp/common}/main.c | 0 .../qtcreator/templates/wizards/plaincapp/main.c | 7 ------- .../wizards/plaincapp/{ => qmake}/project.pro | 0 .../wizards/plaincapp/{ => qmake}/wizard.xml | 4 ++-- .../wizards/plaincppapp-cmake/console.png | Bin 567 -> 0 bytes .../cmake}/CMakeLists.txt | 0 .../cmake}/wizard.xml | 4 ++-- .../{plaincapp => plaincppapp/common}/console.png | Bin .../common}/main.cpp | 0 .../templates/wizards/plaincppapp/console.png | Bin 567 -> 0 bytes .../templates/wizards/plaincppapp/main.cpp | 9 --------- .../wizards/plaincppapp/{ => qmake}/project.pro | 0 .../wizards/plaincppapp/{ => qmake}/wizard.xml | 4 ++-- .../projectexplorer/customwizard/customwizard.cpp | 14 ++++++++++---- 17 files changed, 18 insertions(+), 28 deletions(-) rename share/qtcreator/templates/wizards/{plaincapp-cmake => plaincapp/cmake}/CMakeLists.txt (100%) rename share/qtcreator/templates/wizards/{plaincapp-cmake => plaincapp/cmake}/wizard.xml (94%) rename share/qtcreator/templates/wizards/{plaincapp-cmake => plaincapp/common}/console.png (100%) rename share/qtcreator/templates/wizards/{plaincapp-cmake => plaincapp/common}/main.c (100%) delete mode 100644 share/qtcreator/templates/wizards/plaincapp/main.c rename share/qtcreator/templates/wizards/plaincapp/{ => qmake}/project.pro (100%) rename share/qtcreator/templates/wizards/plaincapp/{ => qmake}/wizard.xml (95%) delete mode 100644 share/qtcreator/templates/wizards/plaincppapp-cmake/console.png rename share/qtcreator/templates/wizards/{plaincppapp-cmake => plaincppapp/cmake}/CMakeLists.txt (100%) rename share/qtcreator/templates/wizards/{plaincppapp-cmake => plaincppapp/cmake}/wizard.xml (94%) rename share/qtcreator/templates/wizards/{plaincapp => plaincppapp/common}/console.png (100%) rename share/qtcreator/templates/wizards/{plaincppapp-cmake => plaincppapp/common}/main.cpp (100%) delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/console.png delete mode 100644 share/qtcreator/templates/wizards/plaincppapp/main.cpp rename share/qtcreator/templates/wizards/plaincppapp/{ => qmake}/project.pro (100%) rename share/qtcreator/templates/wizards/plaincppapp/{ => qmake}/wizard.xml (94%) diff --git a/share/qtcreator/templates/wizards/plaincapp-cmake/CMakeLists.txt b/share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt similarity index 100% rename from share/qtcreator/templates/wizards/plaincapp-cmake/CMakeLists.txt rename to share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt diff --git a/share/qtcreator/templates/wizards/plaincapp-cmake/wizard.xml b/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml similarity index 94% rename from share/qtcreator/templates/wizards/plaincapp-cmake/wizard.xml rename to share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml index 75de53e3db9..0c9ae22b1b3 100644 --- a/share/qtcreator/templates/wizards/plaincapp-cmake/wizard.xml +++ b/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml @@ -31,12 +31,12 @@ --> - console.png + ../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/plaincapp-cmake/console.png b/share/qtcreator/templates/wizards/plaincapp/common/console.png similarity index 100% rename from share/qtcreator/templates/wizards/plaincapp-cmake/console.png rename to share/qtcreator/templates/wizards/plaincapp/common/console.png diff --git a/share/qtcreator/templates/wizards/plaincapp-cmake/main.c b/share/qtcreator/templates/wizards/plaincapp/common/main.c similarity index 100% rename from share/qtcreator/templates/wizards/plaincapp-cmake/main.c rename to share/qtcreator/templates/wizards/plaincapp/common/main.c diff --git a/share/qtcreator/templates/wizards/plaincapp/main.c b/share/qtcreator/templates/wizards/plaincapp/main.c deleted file mode 100644 index 8f1edd610c6..00000000000 --- a/share/qtcreator/templates/wizards/plaincapp/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) -{ - printf("Hello World!\n"); - return 0; -} diff --git a/share/qtcreator/templates/wizards/plaincapp/project.pro b/share/qtcreator/templates/wizards/plaincapp/qmake/project.pro similarity index 100% rename from share/qtcreator/templates/wizards/plaincapp/project.pro rename to share/qtcreator/templates/wizards/plaincapp/qmake/project.pro diff --git a/share/qtcreator/templates/wizards/plaincapp/wizard.xml b/share/qtcreator/templates/wizards/plaincapp/qmake/wizard.xml similarity index 95% rename from share/qtcreator/templates/wizards/plaincapp/wizard.xml rename to share/qtcreator/templates/wizards/plaincapp/qmake/wizard.xml index b8d3ae87245..389f156fc18 100644 --- a/share/qtcreator/templates/wizards/plaincapp/wizard.xml +++ b/share/qtcreator/templates/wizards/plaincapp/qmake/wizard.xml @@ -38,12 +38,12 @@ leave room for the Qt 4 target page. class="qt4project" firstpage="10" id="R.Plain C" category="I.Projects" featuresRequired="QtSupport.Wizards.FeatureQt"> - console.png + ../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/console.png b/share/qtcreator/templates/wizards/plaincppapp-cmake/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-cmake/CMakeLists.txt b/share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt similarity index 100% rename from share/qtcreator/templates/wizards/plaincppapp-cmake/CMakeLists.txt rename to share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt diff --git a/share/qtcreator/templates/wizards/plaincppapp-cmake/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml similarity index 94% rename from share/qtcreator/templates/wizards/plaincppapp-cmake/wizard.xml rename to share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml index 7bce30db613..d5212bd4cda 100644 --- a/share/qtcreator/templates/wizards/plaincppapp-cmake/wizard.xml +++ b/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml @@ -31,12 +31,12 @@ --> - console.png + ../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/plaincapp/console.png b/share/qtcreator/templates/wizards/plaincppapp/common/console.png similarity index 100% rename from share/qtcreator/templates/wizards/plaincapp/console.png rename to share/qtcreator/templates/wizards/plaincppapp/common/console.png diff --git a/share/qtcreator/templates/wizards/plaincppapp-cmake/main.cpp b/share/qtcreator/templates/wizards/plaincppapp/common/main.cpp similarity index 100% rename from share/qtcreator/templates/wizards/plaincppapp-cmake/main.cpp rename to share/qtcreator/templates/wizards/plaincppapp/common/main.cpp diff --git a/share/qtcreator/templates/wizards/plaincppapp/console.png b/share/qtcreator/templates/wizards/plaincppapp/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/main.cpp b/share/qtcreator/templates/wizards/plaincppapp/main.cpp deleted file mode 100644 index 3129fb9dd95..00000000000 --- a/share/qtcreator/templates/wizards/plaincppapp/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -using namespace std; - -int main() -{ - cout << "Hello World!" << endl; - return 0; -} diff --git a/share/qtcreator/templates/wizards/plaincppapp/project.pro b/share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro similarity index 100% rename from share/qtcreator/templates/wizards/plaincppapp/project.pro rename to share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro diff --git a/share/qtcreator/templates/wizards/plaincppapp/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml similarity index 94% rename from share/qtcreator/templates/wizards/plaincppapp/wizard.xml rename to share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml index bba186cecd5..a9e3640b8ed 100644 --- a/share/qtcreator/templates/wizards/plaincppapp/wizard.xml +++ b/share/qtcreator/templates/wizards/plaincppapp/qmake/wizard.xml @@ -38,12 +38,12 @@ leave room for the Qt 4 target page. class="qt4project" firstpage="10" id="R.Plain C++" category="I.Projects" featuresRequired="QtSupport.Wizards.FeatureQt"> - console.png + ../common/console.png Creates a plain C++ project using qmake, not using the Qt library. Plain C++ Project; Non-Qt Project - + diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index cd3c717ffcb..88c1805a3d4 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -450,7 +450,8 @@ QList CustomWizard::createWizards() const QString configFile = QLatin1String(configFileC); // Check and parse config file in each directory. - foreach (const QFileInfo &dirFi, dirs) { + while (!dirs.isEmpty()) { + const QFileInfo dirFi = dirs.takeFirst(); const QDir dir(dirFi.absoluteFilePath()); if (CustomWizardPrivate::verbose) verboseLog += QString::fromLatin1("CustomWizard: Scanning %1\n").arg(dirFi.absoluteFilePath()); @@ -481,9 +482,14 @@ QList CustomWizard::createWizards() break; } } else { - if (CustomWizardPrivate::verbose) - if (CustomWizardPrivate::verbose) - verboseLog += QString::fromLatin1("CustomWizard: '%1' not found\n").arg(configFile); + QList subDirs = dir.entryInfoList(filters, sortflags); + if (!subDirs.isEmpty()) { + // There is no QList::prepend(QList)... + dirs.swap(subDirs); + dirs.append(subDirs); + } else if (CustomWizardPrivate::verbose) { + verboseLog += QString::fromLatin1("CustomWizard: '%1' not found\n").arg(configFile); + } } } if (CustomWizardPrivate::verbose) { // Print to output pane for Windows.