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 <Friedemann.Kleint@digia.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
Christian Kandeler
2013-07-26 14:49:11 +02:00
parent 080277e8ae
commit 1f007a6264
17 changed files with 18 additions and 28 deletions

View File

@@ -31,12 +31,12 @@
--> -->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C (CMake)" category="I.Projects" <wizard version="1" kind="project" firstpage="10" id="S.Plain C (CMake)" category="I.Projects"
platformIndependent="true" featuresRequired="CMake.CMakeSupport"> platformIndependent="true" featuresRequired="CMake.CMakeSupport">
<icon>console.png</icon> <icon>../common/console.png</icon>
<description>Creates a plain C project using CMake, not using the Qt library.</description> <description>Creates a plain C project using CMake, not using the Qt library.</description>
<displayname>Plain C Project (CMake Build)</displayname>; <displayname>Plain C Project (CMake Build)</displayname>;
<displaycategory>Non-Qt Project</displaycategory> <displaycategory>Non-Qt Project</displaycategory>
<files> <files>
<file source="main.c" openeditor="true"/> <file source="../common/main.c" target="main.c" openeditor="true"/>
<file source="CMakeLists.txt" openproject="true"/> <file source="CMakeLists.txt" openproject="true"/>
</files> </files>
</wizard> </wizard>

View File

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 567 B

View File

@@ -1,7 +0,0 @@
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}

View File

@@ -38,12 +38,12 @@ leave room for the Qt 4 target page.
class="qt4project" firstpage="10" class="qt4project" firstpage="10"
id="R.Plain C" category="I.Projects" id="R.Plain C" category="I.Projects"
featuresRequired="QtSupport.Wizards.FeatureQt"> featuresRequired="QtSupport.Wizards.FeatureQt">
<icon>console.png</icon> <icon>../common/console.png</icon>
<description>Creates a plain C project using qmake, not using the Qt library.</description> <description>Creates a plain C project using qmake, not using the Qt library.</description>
<displayname>Plain C Project</displayname>; <displayname>Plain C Project</displayname>;
<displaycategory>Non-Qt Project</displaycategory> <displaycategory>Non-Qt Project</displaycategory>
<files> <files>
<file source="main.c" openeditor="true"/> <file source="../common/main.c" target="main.c" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/> <file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files> </files>
</wizard> </wizard>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

View File

@@ -31,12 +31,12 @@
--> -->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (CMake)" category="I.Projects" <wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (CMake)" category="I.Projects"
platformIndependent="true" featuresRequired="CMake.CMakeSupport"> platformIndependent="true" featuresRequired="CMake.CMakeSupport">
<icon>console.png</icon> <icon>../common/console.png</icon>
<description>Creates a plain C++ project using CMake, not using the Qt library.</description> <description>Creates a plain C++ project using CMake, not using the Qt library.</description>
<displayname>Plain C++ Project (CMake Build)</displayname>; <displayname>Plain C++ Project (CMake Build)</displayname>;
<displaycategory>Non-Qt Project</displaycategory> <displaycategory>Non-Qt Project</displaycategory>
<files> <files>
<file source="main.cpp" openeditor="true"/> <file source="../common/main.cpp" target="main.cpp" openeditor="true"/>
<file source="CMakeLists.txt" openproject="true"/> <file source="CMakeLists.txt" openproject="true"/>
</files> </files>
</wizard> </wizard>

View File

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

View File

@@ -1,9 +0,0 @@
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}

View File

@@ -38,12 +38,12 @@ leave room for the Qt 4 target page.
class="qt4project" firstpage="10" class="qt4project" firstpage="10"
id="R.Plain C++" category="I.Projects" id="R.Plain C++" category="I.Projects"
featuresRequired="QtSupport.Wizards.FeatureQt"> featuresRequired="QtSupport.Wizards.FeatureQt">
<icon>console.png</icon> <icon>../common/console.png</icon>
<description>Creates a plain C++ project using qmake, not using the Qt library.</description> <description>Creates a plain C++ project using qmake, not using the Qt library.</description>
<displayname>Plain C++ Project</displayname>; <displayname>Plain C++ Project</displayname>;
<displaycategory>Non-Qt Project</displaycategory> <displaycategory>Non-Qt Project</displaycategory>
<files> <files>
<file source="main.cpp" openeditor="true"/> <file source="../common/main.cpp" target="main.cpp" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/> <file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files> </files>
</wizard> </wizard>

View File

@@ -450,7 +450,8 @@ QList<CustomWizard*> CustomWizard::createWizards()
const QString configFile = QLatin1String(configFileC); const QString configFile = QLatin1String(configFileC);
// Check and parse config file in each directory. // 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()); const QDir dir(dirFi.absoluteFilePath());
if (CustomWizardPrivate::verbose) if (CustomWizardPrivate::verbose)
verboseLog += QString::fromLatin1("CustomWizard: Scanning %1\n").arg(dirFi.absoluteFilePath()); verboseLog += QString::fromLatin1("CustomWizard: Scanning %1\n").arg(dirFi.absoluteFilePath());
@@ -481,9 +482,14 @@ QList<CustomWizard*> CustomWizard::createWizards()
break; break;
} }
} else { } else {
if (CustomWizardPrivate::verbose) QList<QFileInfo> subDirs = dir.entryInfoList(filters, sortflags);
if (CustomWizardPrivate::verbose) if (!subDirs.isEmpty()) {
verboseLog += QString::fromLatin1("CustomWizard: '%1' not found\n").arg(configFile); // 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. if (CustomWizardPrivate::verbose) { // Print to output pane for Windows.