diff --git a/share/qtcreator/templates/qt4project/main.cpp b/share/qtcreator/templates/qt4project/main.cpp
deleted file mode 100644
index cc228553ac8..00000000000
--- a/share/qtcreator/templates/qt4project/main.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "%INCLUDE%"
-#include <%QAPP_INCLUDE%>
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- %CLASS% w;
-%SHOWMETHOD%
- return a.exec();
-}
diff --git a/share/qtcreator/templates/qt4project/mywidget.cpp b/share/qtcreator/templates/qt4project/mywidget.cpp
deleted file mode 100644
index ae355e98dd6..00000000000
--- a/share/qtcreator/templates/qt4project/mywidget.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "%INCLUDE%"
-
-%CLASS%::%CLASS%(QWidget *parent)
- : %BASECLASS%(parent)
-{
-}
-
-%CLASS%::~%CLASS%()
-{
-
-}
diff --git a/share/qtcreator/templates/qt4project/mywidget.h b/share/qtcreator/templates/qt4project/mywidget.h
deleted file mode 100644
index 993914c8cc9..00000000000
--- a/share/qtcreator/templates/qt4project/mywidget.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef %PRE_DEF%
-#define %PRE_DEF%
-
-#include <%BASECLASS%>
-
-class %CLASS% : public %BASECLASS%
-{
- Q_OBJECT
-
-public:
- %CLASS%(QWidget *parent = 0);
- ~%CLASS%();
-};
-
-#endif // %PRE_DEF%
diff --git a/share/qtcreator/templates/qt4project/mywidget_form.cpp b/share/qtcreator/templates/qt4project/mywidget_form.cpp
deleted file mode 100644
index b7e3ae6200b..00000000000
--- a/share/qtcreator/templates/qt4project/mywidget_form.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "%INCLUDE%"
-#include "%UI_HDR%"
-
-%CLASS%::%CLASS%(QWidget *parent)
- : %BASECLASS%(parent), ui(new Ui::%CLASS%)
-{
- ui->setupUi(this);
-}
-
-%CLASS%::~%CLASS%()
-{
- delete ui;
-}
diff --git a/share/qtcreator/templates/qt4project/mywidget_form.h b/share/qtcreator/templates/qt4project/mywidget_form.h
deleted file mode 100644
index f519708a521..00000000000
--- a/share/qtcreator/templates/qt4project/mywidget_form.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef %PRE_DEF%
-#define %PRE_DEF%
-
-#include <%BASECLASS%>
-
-namespace Ui
-{
- class %CLASS%;
-}
-
-class %CLASS% : public %BASECLASS%
-{
- Q_OBJECT
-
-public:
- %CLASS%(QWidget *parent = 0);
- ~%CLASS%();
-
-private:
- Ui::%CLASS% *ui;
-};
-
-#endif // %PRE_DEF%
diff --git a/share/qtcreator/templates/qt4project/widget.ui b/share/qtcreator/templates/qt4project/widget.ui
deleted file mode 100644
index 2ac9f1d7c70..00000000000
--- a/share/qtcreator/templates/qt4project/widget.ui
+++ /dev/null
@@ -1,20 +0,0 @@
-
- %CLASS%
-
-
-
- 0
- 0
- %WIDGET_WIDTH%
- %WIDGET_HEIGHT%
-
-
-
- %CLASS%
- %CENTRAL_WIDGET%
-
-
-
-
-
-
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
new file mode 100644
index 00000000000..75a2beb233d
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(%{ProjectName} LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt5 COMPONENTS Widgets REQUIRED)
+
+add_executable(${PROJECT_NAME}
+ "%{MainFileName}"
+ "%{SrcFileName}"
+ "%{HdrFileName}"
+@if %{GenerateForm}
+ "%{FormFileName}"
+@endif
+)
+
+target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp
new file mode 100644
index 00000000000..5c64f1d05e9
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp
@@ -0,0 +1,12 @@
+%{Cpp:LicenseTemplate}\
+#include "%{HdrFileName}"
+
+%{JS: QtSupport.qtIncludes([ 'QtGui/QApplication' ], [ 'QtWidgets/QApplication' ]) }\
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ %{Class} w;
+ w.show();
+ return a.exec();
+}
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro
new file mode 100644
index 00000000000..a5362aa9bcb
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro
@@ -0,0 +1,33 @@
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \\
+ %{MainFileName} \\
+ %{SrcFileName}
+
+HEADERS += \\
+ %{HdrFileName}
+@if %{GenerateForm}
+
+FORMS += \\
+ %{FormFileName}
+@endif
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp
new file mode 100644
index 00000000000..ee0d05a5ab2
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp
@@ -0,0 +1,26 @@
+%{Cpp:LicenseTemplate}\
+#include "%{HdrFileName}"
+@if %{GenerateForm}
+#include "%{UiHdrFileName}"
+@endif
+%{JS: Cpp.openNamespaces('%{Class}')}\
+
+%{CN}::%{CN}(QWidget *parent)
+ : %{BaseClass}(parent)
+@if %{GenerateForm}
+ , ui(new Ui::%{CN})
+@endif
+{
+@if %{GenerateForm}
+ ui->setupUi(this);
+@endif
+}
+
+%{CN}::~%{CN}()
+{
+@if %{GenerateForm}
+ delete ui;
+@endif
+}
+
+%{JS: Cpp.closeNamespaces('%{Class}')}\
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h
new file mode 100644
index 00000000000..4ce74ac814f
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h
@@ -0,0 +1,32 @@
+%{Cpp:LicenseTemplate}\
+@if '%{Cpp:PragmaOnce}'
+#pragma once
+@else
+#ifndef %{GUARD}
+#define %{GUARD}
+@endif
+
+%{JS: QtSupport.qtIncludes([ 'QtGui/%{BaseClass}' ], [ 'QtWidgets/%{BaseClass}' ]) }\
+%{JS: Cpp.openNamespaces('%{Class}')}\
+@if %{GenerateForm}
+
+namespace Ui { class %{CN}; }
+@endif
+
+class %{CN} : public %{BaseClass}
+{
+ Q_OBJECT
+
+public:
+ %{CN}(QWidget *parent = nullptr);
+ ~%{CN}();
+@if %{GenerateForm}
+
+private:
+ Ui::%{CN} *ui;
+@endif
+};
+%{JS: Cpp.closeNamespaces('%{Class}')}\
+@if ! '%{Cpp:PragmaOnce}'
+#endif // %{GUARD}
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui
new file mode 100644
index 00000000000..1b21b83109c
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui
@@ -0,0 +1,24 @@
+
+
+ %{Class}
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ %{CN}
+
+@if '%{BaseClass}' === 'QMainWindow'
+
+
+
+@endif
+
+
+
+
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
new file mode 100644
index 00000000000..1eaddb794b3
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
@@ -0,0 +1,192 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ],
+ "id": "C.QtWidgets",
+ "category": "F.Application",
+ "trDescription": "Creates a Qt application for the desktop. Includes a Qt Designer-based main window.\n\nPreselects a desktop Qt for building the application if available.",
+ "trDisplayName": "Qt Widgets Application",
+ "trDisplayCategory": "Application",
+ "icon": "../../global/guiapplication.png",
+ "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
+ "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}",
+
+ "options":
+ [
+ { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{CMakeFile}'}" },
+ { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
+ { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "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}')}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project",
+ "data": { "trDescription": "This wizard generates a Qt Widgets Application project. The application derives by default from QApplication and includes an empty widget." }
+ },
+ {
+ "trDisplayName": "Define Build System",
+ "trShortTitle": "Build System",
+ "typeId": "Fields",
+ "enabled": "%{JS: ! %{IsSubproject}}",
+ "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}"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Kit Selection",
+ "trShortTitle": "Kits",
+ "typeId": "Kits",
+ "enabled": "%{JS: ! %{IsSubproject}}",
+ "data": { "projectFilePath": "%{ProjectFile}" }
+ },
+ {
+ "trDisplayName": "Class Information",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data":
+ [
+ {
+ "name": "ClassPageDescription",
+ "type": "Label",
+ "data":
+ {
+ "trText": "Specify basic information about the classes for which you want to generate skeleton source code files.",
+ "wordWrap": true
+ }
+ },
+ {
+ "name": "Sp0",
+ "type": "Spacer"
+ },
+ {
+ "name": "Class",
+ "trDisplayName": "Class name:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data":
+ {
+ "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)",
+ "trText": "%{JS: '%{BaseClass}'.slice(1)}"
+ }
+ },
+ {
+ "name": "BaseClass",
+ "trDisplayName": "Base class:",
+ "type": "ComboBox",
+ "data":
+ {
+ "items": [ "QMainWindow", "QWidget", "QDialog" ]
+ }
+ },
+ {
+ "name": "Sp1",
+ "type": "Spacer"
+ },
+ {
+ "name": "HdrFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Header file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: 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')}')}" }
+ },
+ {
+ "name": "GenerateForm",
+ "type": "CheckBox",
+ "trDisplayName": "Generate form:",
+ "data": { "checked": true }
+ },
+ {
+ "name": "FormFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Form file:",
+ "enabled": "%{GenerateForm}",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', 'ui')}" }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "project.pro",
+ "target": "%{ProFile}",
+ "openAsProject": true,
+ "condition": "%{JS: '%{BuildSystem}' === 'qmake'}"
+ },
+ {
+ "source": "CMakeLists.txt",
+ "openAsProject": true,
+ "condition": "%{JS: '%{BuildSystem}' === 'cmake'}"
+ },
+ {
+ "source": "main.cpp",
+ "target": "%{MainFileName}",
+ "openInEditor": true
+ },
+ {
+ "source": "widget.cpp",
+ "target": "%{SrcFileName}"
+ },
+ {
+ "source": "widget.h",
+ "target": "%{HdrFileName}"
+ },
+ {
+ "source": "widget.ui",
+ "target": "%{FormFileName}",
+ "condition": "%{GenerateForm}"
+ },
+ {
+ "source": "../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}"
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
index 5d907a0e955..6b5890ecf19 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
@@ -19,11 +19,9 @@ HEADERS += \
profilehighlighter.h \
profilehoverhandler.h \
wizards/qtprojectparameters.h \
- wizards/guiappwizard.h \
wizards/libraryparameters.h \
wizards/librarywizard.h \
wizards/librarywizarddialog.h \
- wizards/guiappwizarddialog.h \
wizards/modulespage.h \
wizards/filespage.h \
wizards/qtwizard.h \
@@ -59,11 +57,9 @@ SOURCES += \
profilehighlighter.cpp \
profilehoverhandler.cpp \
wizards/qtprojectparameters.cpp \
- wizards/guiappwizard.cpp \
wizards/libraryparameters.cpp \
wizards/librarywizard.cpp \
wizards/librarywizarddialog.cpp \
- wizards/guiappwizarddialog.cpp \
wizards/modulespage.cpp \
wizards/filespage.cpp \
wizards/qtwizard.cpp \
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
index b32dc907a5a..08a6d21b146 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
@@ -78,8 +78,6 @@ Project {
prefix: "wizards/"
files: [
"filespage.cpp", "filespage.h",
- "guiappwizard.cpp", "guiappwizard.h",
- "guiappwizarddialog.cpp", "guiappwizarddialog.h",
"libraryparameters.cpp", "libraryparameters.h",
"librarywizard.cpp", "librarywizard.h",
"librarywizarddialog.cpp", "librarywizarddialog.h",
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index b2ac41a8a28..4c039cfaf9d 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -33,7 +33,6 @@
#include "qmakemakestep.h"
#include "qmakebuildconfiguration.h"
#include "desktopqmakerunconfiguration.h"
-#include "wizards/guiappwizard.h"
#include "wizards/librarywizard.h"
#include "wizards/simpleprojectwizard.h"
#include "wizards/subdirsprojectwizard.h"
@@ -151,7 +150,6 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
IWizardFactory::registerFactoryCreator([] {
return QList {
new SubdirsProjectWizard,
- new GuiAppWizard,
new LibraryWizard,
new CustomWidgetWizard,
new SimpleProjectWizard
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp
deleted file mode 100644
index 08b7514a8e5..00000000000
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "guiappwizard.h"
-
-#include "guiappwizarddialog.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-
-static const char mainSourceFileC[] = "main";
-static const char mainSourceShowC[] = " w.show();\n";
-static const char mainSourceMobilityShowC[] = " w.show();\n";
-
-static const char mainWindowUiContentsC[] =
-"\n "
-"\n "
-"\n "
-"\n ";
-static const char mainWindowMobileUiContentsC[] =
-"\n ";
-
-static const char *baseClassesC[] = {"QMainWindow", "QWidget", "QDialog"};
-
-static inline QStringList baseClasses()
-{
- QStringList rc;
- for (auto baseClass : baseClassesC)
- rc.push_back(QLatin1String(baseClass));
- return rc;
-}
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-GuiAppWizard::GuiAppWizard()
-{
- setId("C.Qt4Gui");
- setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
- setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
- ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
- setDisplayName(tr("Qt Widgets Application"));
- setDescription(tr("Creates a Qt application for the desktop. "
- "Includes a Qt Designer-based main window.\n\n"
- "Preselects a desktop Qt for building the application if available."));
- setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
- setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS});
-}
-
-Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
-{
- GuiAppWizardDialog *dialog = new GuiAppWizardDialog(this, displayName(), icon(), parent, parameters);
- dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(parameters.defaultPath()));
- // Order! suffixes first to generate files correctly
- dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
- dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix());
- dialog->setBaseClasses(baseClasses());
- return dialog;
-}
-
-// Use the class generation utils provided by the designer plugin
-static inline bool generateFormClass(const GuiAppParameters ¶ms,
- const Core::GeneratedFile &uiFile,
- Core::GeneratedFile *formSource,
- Core::GeneratedFile *formHeader,
- QString *errorMessage)
-{
- // Retrieve parameters from settings
- Designer::FormClassWizardParameters fp;
- fp.uiTemplate = uiFile.contents();
- fp.uiFile = uiFile.path();
- fp.className = params.className;
- fp.sourceFile = params.sourceFileName;
- fp.headerFile = params.headerFileName;
- fp.usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce();
- QString headerContents;
- QString sourceContents;
- // Invoke code generation service of Qt Designer plugin.
- if (QObject *codeGenerator = ExtensionSystem::PluginManager::getObjectByName("QtDesignerFormClassCodeGenerator")) {
- const QVariant code = ExtensionSystem::invoke(codeGenerator, "generateFormClassCode", fp);
- if (code.type() == QVariant::List) {
- const QVariantList vl = code.toList();
- if (vl.size() == 2) {
- headerContents = vl.front().toString();
- sourceContents = vl.back().toString();
- }
- }
- }
- if (headerContents.isEmpty() || sourceContents.isEmpty()) {
- *errorMessage = QString::fromLatin1("Failed to obtain Designer plugin code generation service.");
- return false;
- }
-
- formHeader->setContents(headerContents);
- formSource->setContents(sourceContents);
- return true;
-}
-
-Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
- QString *errorMessage) const
-{
- const auto *dialog = qobject_cast(w);
- const QtProjectParameters projectParams = dialog->projectParameters();
- const QString projectPath = projectParams.projectPath();
- const GuiAppParameters params = dialog->parameters();
-
- // Generate file names. Note that the path for the project files is the
- // newly generated project directory.
- const QString templatePath = templateDir();
- // Create files: main source
- QString contents;
- const QString mainSourceFileName = buildFileName(projectPath, QLatin1String(mainSourceFileC), sourceSuffix());
- Core::GeneratedFile mainSource(mainSourceFileName);
- if (!parametrizeTemplate(templatePath, QLatin1String("main.cpp"), params, &contents, errorMessage))
- return Core::GeneratedFiles();
- mainSource.setContents(CppTools::AbstractEditorSupport::licenseTemplate(mainSourceFileName)
- + contents);
- // Create files: form source with or without form
- const QString formSourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix());
- const QString formHeaderName = buildFileName(projectPath, params.headerFileName, headerSuffix());
- Core::GeneratedFile formSource(formSourceFileName);
- Core::GeneratedFile formHeader(formHeaderName);
- formSource.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
-
- QSharedPointer form;
- if (params.designerForm) {
- // Create files: form
- const QString formName = buildFileName(projectPath, params.formFileName, formSuffix());
- form = QSharedPointer(new Core::GeneratedFile(formName));
- if (!parametrizeTemplate(templatePath, QLatin1String("widget.ui"), params, &contents, errorMessage))
- return Core::GeneratedFiles();
- form->setContents(contents);
- if (!generateFormClass(params, *form, &formSource, &formHeader, errorMessage))
- return Core::GeneratedFiles();
- } else {
- const QString formSourceTemplate = QLatin1String("mywidget.cpp");
- if (!parametrizeTemplate(templatePath, formSourceTemplate, params, &contents, errorMessage))
- return Core::GeneratedFiles();
- formSource.setContents(CppTools::AbstractEditorSupport::licenseTemplate(formSourceFileName)
- + contents);
- // Create files: form header
- const QString formHeaderTemplate = QLatin1String("mywidget.h");
- if (!parametrizeTemplate(templatePath, formHeaderTemplate, params, &contents, errorMessage))
- return Core::GeneratedFiles();
- formHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(formHeaderName)
- + contents);
- }
- // Create files: profile
- const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix());
- Core::GeneratedFile profile(profileName);
- profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
- contents.clear();
- {
- QTextStream proStr(&contents);
- QtProjectParameters::writeProFileHeader(proStr);
- projectParams.writeProFile(proStr);
- proStr << "\nCONFIG += c++11"; // ensure all Qt5 versions can handle the source
- proStr << "\n\nSOURCES +="
- << " \\\n " << Utils::FileName::fromString(mainSourceFileName).fileName()
- << " \\\n " << Utils::FileName::fromString(formSource.path()).fileName()
- << "\n\nHEADERS +="
- << " \\\n " << Utils::FileName::fromString(formHeader.path()).fileName();
- if (params.designerForm)
- proStr << "\n\nFORMS +="
- << " \\\n " << Utils::FileName::fromString(form->path()).fileName();
- if (params.isMobileApplication) {
- proStr << "\n\nCONFIG += mobility"
- << "\nMOBILITY = "
- << "\n";
- }
- proStr << "\n\n# Default rules for deployment.\n"
- "qnx: target.path = /tmp/$${TARGET}/bin\n"
- "else: unix:!android: target.path = /opt/$${TARGET}/bin\n"
- "!isEmpty(target.path): INSTALLS += target\n";
- }
- profile.setContents(contents);
- // List
- Core::GeneratedFiles rc;
- rc << mainSource << formSource << formHeader;
- if (params.designerForm)
- rc << *form;
- rc << profile;
- return rc;
-}
-
-bool GuiAppWizard::parametrizeTemplate(const QString &templatePath, const QString &templateName,
- const GuiAppParameters ¶ms,
- QString *target, QString *errorMessage)
-{
- const QString fileName = templatePath + QLatin1Char('/') + templateName;
- Utils::FileReader reader;
- if (!reader.fetch(fileName, QIODevice::Text, errorMessage))
- return false;
- QString contents = QString::fromUtf8(reader.data());
- contents.replace(QLatin1String("%QAPP_INCLUDE%"), QLatin1String("QApplication"));
- contents.replace(QLatin1String("%INCLUDE%"), params.headerFileName);
- contents.replace(QLatin1String("%CLASS%"), params.className);
- contents.replace(QLatin1String("%BASECLASS%"), params.baseClassName);
- contents.replace(QLatin1String("%WIDGET_HEIGHT%"), QString::number(params.widgetHeight));
- contents.replace(QLatin1String("%WIDGET_WIDTH%"), QString::number(params.widgetWidth));
- if (params.isMobileApplication)
- contents.replace(QLatin1String("%SHOWMETHOD%"), QString::fromLatin1(mainSourceMobilityShowC));
- else
- contents.replace(QLatin1String("%SHOWMETHOD%"), QString::fromLatin1(mainSourceShowC));
-
- // Replace include guards with pragma once
- if (CppTools::AbstractEditorSupport::usePragmaOnce()) {
- contents.replace(QLatin1String("#ifndef %PRE_DEF%\n#define %PRE_DEF%"), "#pragma once");
- contents.replace(QLatin1String("#endif // %PRE_DEF%\n"), QString());
- }
-
- const QChar dot = QLatin1Char('.');
-
- QString preDef = params.headerFileName.toUpper();
- preDef.replace(dot, QLatin1Char('_'));
- contents.replace(QLatin1String("%PRE_DEF%"), preDef);
-
- const QString uiFileName = params.formFileName;
- QString uiHdr = QLatin1String("ui_");
- uiHdr += uiFileName.left(uiFileName.indexOf(dot));
- uiHdr += QLatin1String(".h");
-
- contents.replace(QLatin1String("%UI_HDR%"), uiHdr);
- if (params.baseClassName == QLatin1String("QMainWindow")) {
- if (params.isMobileApplication)
- contents.replace(QLatin1String("%CENTRAL_WIDGET%"), QLatin1String(mainWindowMobileUiContentsC));
- else
- contents.replace(QLatin1String("%CENTRAL_WIDGET%"), QLatin1String(mainWindowUiContentsC));
- } else {
- contents.remove(QLatin1String("%CENTRAL_WIDGET%"));
- }
- *target = contents;
- return true;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.h b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.h
deleted file mode 100644
index 31eb5b7ce93..00000000000
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "qtwizard.h"
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-struct GuiAppParameters;
-
-class GuiAppWizard : public QtWizard
-{
- Q_OBJECT
-
-public:
- GuiAppWizard();
-
-private:
- Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const override;
-
- Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
-
-private:
- static bool parametrizeTemplate(const QString &templatePath, const QString &templateName,
- const GuiAppParameters ¶ms,
- QString *target, QString *errorMessage);
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp
deleted file mode 100644
index 5f12fdc41a0..00000000000
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "guiappwizarddialog.h"
-
-#include "filespage.h"
-
-#include
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-GuiAppWizardDialog::GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory,
- const QString &templateName,
- const QIcon &icon, QWidget *parent,
- const Core::WizardDialogParameters ¶meters) :
- BaseQmakeProjectWizardDialog(factory, false, parent, parameters),
- m_filesPage(new FilesPage)
-{
- setWindowIcon(icon);
- setWindowTitle(templateName);
- setSelectedModules(QLatin1String("core gui"), true);
-
- setIntroDescription(tr("This wizard generates a Qt Widgets Application "
- "project. The application derives by default from QApplication "
- "and includes an empty widget."));
-
- addModulesPage();
- if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
- addTargetSetupPage();
-
- m_filesPage->setFormInputCheckable(true);
- m_filesPage->setClassTypeComboVisible(false);
- addPage(m_filesPage);
-
- addExtensionPages(extensionPages());
-}
-
-void GuiAppWizardDialog::setBaseClasses(const QStringList &baseClasses)
-{
- m_filesPage->setBaseClassChoices(baseClasses);
- if (!baseClasses.empty())
- m_filesPage->setBaseClassName(baseClasses.front());
-}
-
-void GuiAppWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
-{
- m_filesPage->setSuffixes(header, source, form);
-}
-
-void GuiAppWizardDialog::setLowerCaseFiles(bool l)
-{
- m_filesPage->setLowerCaseFiles(l);
-}
-
-QtProjectParameters GuiAppWizardDialog::projectParameters() const
-{
- QtProjectParameters rc;
- rc.type = QtProjectParameters::GuiApp;
- rc.flags |= QtProjectParameters::WidgetsRequiredFlag;
- rc.fileName = projectName();
- rc.path = path();
- rc.selectedModules = selectedModulesList();
- rc.deselectedModules = deselectedModulesList();
- return rc;
-}
-
-GuiAppParameters GuiAppWizardDialog::parameters() const
-{
- GuiAppParameters rc;
- rc.className = m_filesPage->className();
- rc.baseClassName = m_filesPage->baseClassName();
- rc.sourceFileName = m_filesPage->sourceFileName();
- rc.headerFileName = m_filesPage->headerFileName();
- rc.formFileName = m_filesPage->formFileName();
- rc.designerForm = m_filesPage->formInputChecked();
- if (isQtPlatformSelected("Android.Device.Type")) { // FIXME: Is this really necessary?
- rc.isMobileApplication = true;
- rc.widgetWidth = 800;
- rc.widgetHeight = 480;
- }
- return rc;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h
deleted file mode 100644
index b12644e1239..00000000000
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "qtwizard.h"
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-struct QtProjectParameters;
-class FilesPage;
-
-// Additional parameters required besides QtProjectParameters
-struct GuiAppParameters
-{
- QString className;
- QString baseClassName;
- QString sourceFileName;
- QString headerFileName;
- QString formFileName;
- int widgetWidth = 400;
- int widgetHeight = 300;
- bool designerForm = true;
- bool isMobileApplication = false;
-};
-
-class GuiAppWizardDialog : public BaseQmakeProjectWizardDialog
-{
- Q_OBJECT
-
-public:
- explicit GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
- const QIcon &icon,
- QWidget *parent,
- const Core::WizardDialogParameters ¶meters);
-
- void setBaseClasses(const QStringList &baseClasses);
- void setSuffixes(const QString &header, const QString &source, const QString &form);
- void setLowerCaseFiles(bool l);
-
- QtProjectParameters projectParameters() const;
- GuiAppParameters parameters() const;
-
-private:
- FilesPage *m_filesPage;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager