aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-04-03 19:02:30 +0200
committerEike Ziller <eike.ziller@qt.io>2019-04-17 10:53:21 +0000
commitcb63706f83610ebda34f6713b51d4ff61aaa82a5 (patch)
tree6a64e6739141c55f76f66e8a26b9b092b4b3cd12
parentf213f6176b7941e3fc5406423c79ac8a96a95fae (diff)
Move C++ Library wizard to JSON
And add build system option (QMake & CMake) Task-number: QTCREATORBUG-17308 Fixes: QTCREATORBUG-14605 Change-Id: Ibfadc4bffeabd7ec11271647460a21b6400625c7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qtcreator/templates/wizards/global/lib.pngbin0 -> 1411 bytes
-rw-r--r--share/qtcreator/templates/wizards/global/lib@2x.pngbin0 -> 2555 bytes
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt35
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp17
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/lib.h48
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h29
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/project.json3
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/project.pro50
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json277
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs3
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp193
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/libraryparameters.h64
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp161
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizard.h48
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp347
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h78
18 files changed, 459 insertions, 902 deletions
diff --git a/share/qtcreator/templates/wizards/global/lib.png b/share/qtcreator/templates/wizards/global/lib.png
new file mode 100644
index 0000000000..52cb73e382
--- /dev/null
+++ b/share/qtcreator/templates/wizards/global/lib.png
Binary files differ
diff --git a/share/qtcreator/templates/wizards/global/lib@2x.png b/share/qtcreator/templates/wizards/global/lib@2x.png
new file mode 100644
index 0000000000..c959779b02
--- /dev/null
+++ b/share/qtcreator/templates/wizards/global/lib@2x.png
Binary files differ
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
new file mode 100644
index 0000000000..29d8396852
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(%{ProjectName} LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+@if '%{QtModule}' != 'none'
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+@endif
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+@if '%{QtModule}' != 'none'
+
+find_package(Qt5 COMPONENTS %{QtModuleUpperCase} REQUIRED)
+@endif
+
+add_library(${PROJECT_NAME} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'}
+@if '%{Type}' === 'shared'
+ "%{GlobalHdrFileName}"
+@endif
+ "%{SrcFileName}"
+ "%{HdrFileName}"
+@if %{IsQtPlugin}
+ "%{PluginJsonFile}"
+@endif
+)
+@if '%{QtModule}' != 'none'
+
+target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::%{QtModuleUpperCase})
+@endif
+@if '%{IsShared}'
+
+target_compile_definitions(${PROJECT_NAME} PRIVATE %{LibraryDefine})
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp
new file mode 100644
index 0000000000..23bf7797da
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp
@@ -0,0 +1,17 @@
+%{Cpp:LicenseTemplate}\
+#include "%{HdrFileName}"
+%{JS: Cpp.openNamespaces('%{Class}')}\
+
+@if ! %{IsQtPlugin}
+%{CN}::%{CN}()
+{
+}
+@else
+%{CN}::%{CN}(QObject *parent)
+ : %{BaseClassName}(parent)
+{
+}
+%{JS: '%{PluginMethods}'.split('|').map(s => '\n' + s.replace(/([a-zA-Z0-9]+\()/, '%{CN}::$1') + '\n\u007B\n static_assert(false, "You need to implement this function");\n\u007D').join('\n')}\
+
+@endif
+%{JS: Cpp.closeNamespaces('%{Class}')}\
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
new file mode 100644
index 0000000000..80ef326ce5
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
@@ -0,0 +1,48 @@
+%{Cpp:LicenseTemplate}\
+@if '%{Cpp:PragmaOnce}'
+#pragma once
+@else
+#ifndef %{GUARD}
+#define %{GUARD}
+@endif
+@if %{IsShared}
+
+#include "%{GlobalHdrFileName}"
+@elsif %{IsQtPlugin}
+
+#include <%{BaseClassName}>
+@endif
+%{JS: Cpp.openNamespaces('%{Class}')}\
+
+@if %{IsShared}
+class %{LibraryExport} %{CN}
+{
+
+public:
+ %{CN}();
+};
+@elsif %{IsStatic}
+class %{CN}
+{
+
+public:
+ %{CN}();
+};
+@else
+class %{CN} : public %{BaseClassName}
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.%{PluginInterface}" FILE "%{PluginJsonFile}")
+
+public:
+ explicit %{CN}(QObject *parent = nullptr);
+
+private:
+%{JS: '%{PluginMethods}'.split('|').map(s => ' ' + s + ' override;').join('\n')}
+};
+@endif
+%{JS: Cpp.closeNamespaces('%{Class}')}\
+@if ! '%{Cpp:PragmaOnce}'
+
+#endif // %{GUARD}
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h b/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h
new file mode 100644
index 0000000000..d6d65c377d
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h
@@ -0,0 +1,29 @@
+%{Cpp:LicenseTemplate}\
+@if '%{Cpp:PragmaOnce}'
+#pragma once
+@else
+#ifndef %{GLOBAL_GUARD}
+#define %{GLOBAL_GUARD}
+@endif
+
+@if '%{QtModule}' != 'none'
+#include <QtCore/qglobal.h>
+@else
+#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
+# define Q_DECL_EXPORT __declspec(dllexport)
+# define Q_DECL_IMPORT __declspec(dllimport)
+#else
+# define Q_DECL_EXPORT __attribute__((visibility("default")))
+# define Q_DECL_IMPORT __attribute__((visibility("default")))
+#endif
+@endif
+
+#if defined(%{LibraryDefine})
+# define %{LibraryExport} Q_DECL_EXPORT
+#else
+# define %{LibraryExport} Q_DECL_IMPORT
+#endif
+
+@if ! '%{Cpp:PragmaOnce}'
+#endif // %{GLOBAL_GUARD}
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.json b/share/qtcreator/templates/wizards/projects/cpplibrary/project.json
new file mode 100644
index 0000000000..1e811388e4
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.json
@@ -0,0 +1,3 @@
+{
+ "Keys" : [ ]
+}
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro
new file mode 100644
index 0000000000..f6652ee930
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro
@@ -0,0 +1,50 @@
+@if '%{QtModule}' === 'none'
+QT -= core
+@elsif '%{QtModule}' === 'core'
+QT -= gui
+@else
+QT += %{QtModule}
+@endif
+
+TEMPLATE = lib
+@if %{IsStatic}
+CONFIG += staticlib
+@elsif %{IsQtPlugin}
+CONFIG += plugin
+@elsif %{IsShared}
+DEFINES += %{LibraryDefine}
+@endif
+
+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 += \\
+ %{SrcFileName}
+
+HEADERS += \\
+@if %{IsShared}
+ %{GlobalHdrFileName} \\
+@endif
+ %{HdrFileName}
+@if %{IsQtPlugin}
+
+DISTFILES += %{PluginJsonFile}
+@endif
+
+@if '%{TargetInstallPath}' != ''
+# Default rules for deployment.
+unix {
+ target.path = %{TargetInstallPath}
+}
+!isEmpty(target.path): INSTALLS += target
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
new file mode 100644
index 0000000000..e1d58c25e7
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
@@ -0,0 +1,277 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ],
+ "id": "H.CppLibrary",
+ "category": "G.Library",
+ "trDescription": "Creates a C++ library. This can be used to create:<ul><li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li><li>a shared or static C++ library for use with another project at linktime</li></ul>",
+ "trDisplayName": "C++ Library",
+ "trDisplayCategory": "Library",
+ "icon": "../../global/lib.png",
+ "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{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": "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}')}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project",
+ "data": { "trDescription": "This wizard creates a C++ library project." }
+ },
+ {
+ "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": "Define Project Details",
+ "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": "Type",
+ "trDisplayName": "Type:",
+ "type": "ComboBox",
+ "data":
+ {
+ "index": 0,
+ "items":
+ [
+ {
+ "trKey": "Shared Library",
+ "value": "shared"
+ },
+ {
+ "trKey": "Statically Linked Library",
+ "value": "static"
+ },
+ {
+ "trKey": "Qt Plugin",
+ "value": "qtplugin"
+ }
+ ]
+ }
+ },
+ {
+ "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: '%{Type}' === 'qtplugin' ? '%{BaseClassName}'.slice(1) : ('%{ProjectName}'.charAt(0).toUpperCase() + '%{ProjectName}'.slice(1))}"
+ }
+ },
+ {
+ "name": "BaseClassInfo",
+ "trDisplayName": "Base class:",
+ "type": "ComboBox",
+ "visible": "%{JS: '%{Type}' === 'qtplugin'}",
+ "data":
+ {
+ "index": 1,
+ "items":
+ [
+ {
+ "trKey": "QAccessiblePlugin",
+ "value": "'QAccessiblePlugin', 'accessible', 'QAccessibleFactoryInterface', 'gui', 'QAccessibleInterface *create(const QString &key, QObject *object)'"
+ },
+ {
+ "trKey": "QGenericPlugin",
+ "value": "'QGenericPlugin', 'generic', 'QGenericPluginFactoryInterface', 'gui', 'QObject *create(const QString &name, const QString &spec)'"
+ },
+ {
+ "trKey": "QIconEnginePlugin",
+ "value": "'QIconEnginePlugin', 'imageformats', 'QIconEngineFactoryInterface', 'gui', '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'"
+ },
+ {
+ "trKey": "QScriptExtensionPlugin",
+ "value": "'QScriptExtensionPlugin', '', 'QScriptExtensionInterface', 'script', 'void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const'"
+ },
+ {
+ "trKey": "QSqlDriverPlugin",
+ "value": "'QSqlDriverPlugin', 'sqldrivers', 'QSqlDriverFactoryInterface', 'sql', 'QSqlDriver *create(const QString &key)'"
+ },
+ {
+ "trKey": "QStylePlugin",
+ "value": "'QStylePlugin', 'styles', 'QStyleFactoryInterface', 'widgets', 'QStyle *create(const QString &key)'"
+ }
+ ]
+ }
+ },
+ {
+ "name": "LibraryQtModule",
+ "trDisplayName": "Qt module:",
+ "type": "ComboBox",
+ "visible": "%{JS: '%{Type}' != 'qtplugin'}",
+ "data":
+ {
+ "index": 1,
+ "items":
+ [
+ {
+ "trKey": "None",
+ "value": "none"
+ },
+ {
+ "trKey": "Core",
+ "value": "core"
+ },
+ {
+ "trKey": "Gui",
+ "value": "gui"
+ },
+ {
+ "trKey": "Widgets",
+ "value": "widgets"
+ }
+ ]
+ }
+ },
+ {
+ "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')}')}" }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Kit Selection",
+ "trShortTitle": "Kits",
+ "typeId": "Kits",
+ "enabled": "%{JS: ! %{IsSubproject}}",
+ "data": { "projectFilePath": "%{ProjectFile}" }
+ },
+ {
+ "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": "lib.cpp",
+ "target": "%{SrcFileName}",
+ "openInEditor": true
+ },
+ {
+ "source": "lib.h",
+ "target": "%{HdrFileName}"
+ },
+ {
+ "source": "lib_global.h",
+ "target": "%{GlobalHdrFileName}",
+ "condition": "%{JS: '%{Type}' === 'shared'}"
+ },
+ {
+ "source": "project.json",
+ "target": "%{PluginJsonFile}",
+ "condition": "%{JS: '%{Type}' === 'qtplugin'}"
+ },
+ {
+ "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 6b5890ecf1..a56131074e 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
@@ -19,9 +19,6 @@ HEADERS += \
profilehighlighter.h \
profilehoverhandler.h \
wizards/qtprojectparameters.h \
- wizards/libraryparameters.h \
- wizards/librarywizard.h \
- wizards/librarywizarddialog.h \
wizards/modulespage.h \
wizards/filespage.h \
wizards/qtwizard.h \
@@ -57,9 +54,6 @@ SOURCES += \
profilehighlighter.cpp \
profilehoverhandler.cpp \
wizards/qtprojectparameters.cpp \
- wizards/libraryparameters.cpp \
- wizards/librarywizard.cpp \
- wizards/librarywizarddialog.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 08a6d21b14..b510c40348 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
@@ -78,9 +78,6 @@ Project {
prefix: "wizards/"
files: [
"filespage.cpp", "filespage.h",
- "libraryparameters.cpp", "libraryparameters.h",
- "librarywizard.cpp", "librarywizard.h",
- "librarywizarddialog.cpp", "librarywizarddialog.h",
"modulespage.cpp", "modulespage.h",
"qtprojectparameters.cpp", "qtprojectparameters.h",
"qtwizard.cpp", "qtwizard.h",
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index 98a3adf8b9..a6c256db80 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/librarywizard.h"
#include "wizards/simpleprojectwizard.h"
#include "wizards/subdirsprojectwizard.h"
#include "customwidgetwizard/customwidgetwizard.h"
@@ -150,7 +149,6 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
IWizardFactory::registerFactoryCreator([] {
return QList<IWizardFactory *> {
new SubdirsProjectWizard,
- new LibraryWizard,
new CustomWidgetWizard,
new SimpleProjectWizard
};
diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
deleted file mode 100644
index 83217ce2bf..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
+++ /dev/null
@@ -1,193 +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 "libraryparameters.h"
-#include "librarywizarddialog.h"
-
-#include <utils/codegeneration.h>
-#include <utils/qtcassert.h>
-
-#include <QTextStream>
-#include <QStringList>
-
-#include <cstring>
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-void LibraryParameters::generateCode(QtProjectParameters:: Type t,
- const QString &headerName,
- const QString &sharedHeader,
- const QString &exportMacro,
- const QString &pluginJsonFileName,
- int indentation,
- bool usePragmaOnce,
- QString *header,
- QString *source) const
-{
- QTextStream headerStr(header);
-
- const QString indent = QString(indentation, QLatin1Char(' '));
-
- // Do we have namespaces?
- QStringList namespaceList = className.split(QLatin1String("::"));
- if (namespaceList.empty()) // Paranoia!
- return;
-
- const QString unqualifiedClassName = namespaceList.takeLast();
-
- // 1) Header
- const QString guard = Utils::headerGuard(headerFileName, namespaceList);
- if (usePragmaOnce)
- headerStr << "#pragma once\n\n";
- else
- headerStr << "#ifndef " << guard << "\n#define " << guard << "\n\n";
-
- if (!sharedHeader.isEmpty())
- Utils::writeIncludeFileDirective(sharedHeader, false, headerStr);
-
- // include base class header
- if (!baseClassName.isEmpty()) {
- Utils::writeIncludeFileDirective(baseClassName, true, headerStr);
- headerStr << '\n';
- }
-
- const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr);
-
- // Class declaraction
- if (!namespaceIndent.isEmpty())
- headerStr << '\n';
- headerStr << namespaceIndent << "class ";
- if (t == QtProjectParameters::SharedLibrary && !exportMacro.isEmpty())
- headerStr << exportMacro << ' ';
-
- headerStr << unqualifiedClassName;
- if (!baseClassName.isEmpty())
- headerStr << " : public " << baseClassName;
- headerStr << "\n{\n";
-
- // Is this a QObject (plugin)
- const bool inheritsQObject = t == QtProjectParameters::QtPlugin;
- if (inheritsQObject)
- headerStr << namespaceIndent << indent << "Q_OBJECT\n";
- if (t == QtProjectParameters::QtPlugin) { // Write Qt plugin meta data.
- const QString qt5InterfaceName = LibraryWizardDialog::pluginInterface(baseClassName);
- QTC_CHECK(!qt5InterfaceName.isEmpty());
- headerStr << namespaceIndent << indent << "Q_PLUGIN_METADATA(IID \""
- << qt5InterfaceName << '"';
- QTC_CHECK(!pluginJsonFileName.isEmpty());
- headerStr << " FILE \"" << pluginJsonFileName << '"';
- headerStr << ")\n";
- }
-
- headerStr << namespaceIndent << "\npublic:\n";
- if (inheritsQObject) {
- headerStr << namespaceIndent << indent << "explicit " << unqualifiedClassName
- << "(QObject *parent = nullptr);\n";
- } else {
- headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n";
- }
- if (!pureVirtualSignatures.empty()) {
- headerStr << "\nprivate:\n";
- for (const QString &signature : pureVirtualSignatures)
- headerStr << namespaceIndent << indent << signature << " override;\n";
- }
- headerStr << namespaceIndent << "};\n";
- if (!namespaceIndent.isEmpty())
- headerStr << '\n';
- Utils::writeClosingNameSpaces(namespaceList, indent, headerStr);
- if (!usePragmaOnce)
- headerStr << "\n#endif // " << guard << '\n';
-
- /// 2) Source
- QTextStream sourceStr(source);
-
- Utils::writeIncludeFileDirective(headerName, false, sourceStr);
- sourceStr << '\n';
-
- Utils::writeOpeningNameSpaces(namespaceList, indent, sourceStr);
- if (!namespaceIndent.isEmpty())
- sourceStr << '\n';
-
- // Constructor
- sourceStr << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName;
- if (inheritsQObject) {
- sourceStr << "(QObject *parent) :\n"
- << namespaceIndent << indent << baseClassName << "(parent)\n";
- } else {
- sourceStr << "()\n";
- }
- sourceStr << namespaceIndent << "{\n" << namespaceIndent << "}\n";
- for (const QString &signature : pureVirtualSignatures) {
- const int parenIndex = signature.indexOf('(');
- QTC_ASSERT(parenIndex != -1, continue);
- int nameIndex = -1;
- for (int i = parenIndex - 1; i > 0; --i) {
- if (!signature.at(i).isLetterOrNumber()) {
- nameIndex = i + 1;
- break;
- }
- }
- QTC_ASSERT(nameIndex != -1, continue);
- sourceStr << '\n' << namespaceIndent << signature.left(nameIndex);
- if (!std::strchr("&* ", signature.at(nameIndex - 1).toLatin1()))
- sourceStr << ' ';
- sourceStr << unqualifiedClassName << "::" << signature.mid(nameIndex) << '\n';
- sourceStr << namespaceIndent << "{\n" << indent
- << "static_assert(false, \"You need to implement this function\");\n}\n";
- }
-
- Utils::writeClosingNameSpaces(namespaceList, indent, sourceStr);
-}
-
-QString LibraryParameters::generateSharedHeader(const QString &globalHeaderFileName,
- const QString &projectTarget,
- const QString &exportMacro,
- bool usePragmaOnce)
-{
- QString contents;
- if (usePragmaOnce) {
- contents += "#pragma once\n";
- } else {
- contents += "#ifndef " + Utils::headerGuard(globalHeaderFileName) + "\n";
- contents += "#define " + Utils::headerGuard(globalHeaderFileName) + "\n";
- }
- contents += "\n";
- contents += "#include <QtCore/qglobal.h>\n";
- contents += "\n";
- contents += "#if defined(" + QtProjectParameters::libraryMacro(projectTarget) + ")\n";
- contents += "# define " + exportMacro + " Q_DECL_EXPORT\n";
- contents += "#else\n";
- contents += "# define " + exportMacro + " Q_DECL_IMPORT\n";
- contents += "#endif\n";
- contents += "\n";
- if (!usePragmaOnce)
- contents += "#endif // " + Utils::headerGuard(globalHeaderFileName) + '\n';
-
- return contents;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h
deleted file mode 100644
index 4fe7d00dc1..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h
+++ /dev/null
@@ -1,64 +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 "qtprojectparameters.h"
-
-#include <QStringList>
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-// Additional parameters required besides QtProjectParameters for creating
-// libraries
-struct LibraryParameters {
-
- // generate class
- void generateCode(QtProjectParameters:: Type t,
- const QString &headerName,
- const QString &sharedHeader,
- const QString &exportMacro,
- const QString &pluginJsonFileName,
- int indentation,
- bool usePragmaOnce,
- QString *header,
- QString *source) const;
-
- // Generate the code of the shared header containing the export macro
- static QString generateSharedHeader(const QString &globalHeaderFileName,
- const QString &projectTarget,
- const QString &exportMacro,
- bool usePragmaOnce);
-
- QString className;
- QString baseClassName;
- QString sourceFileName;
- QString headerFileName;
- QStringList pureVirtualSignatures;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
deleted file mode 100644
index 239fec9c3f..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
+++ /dev/null
@@ -1,161 +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 "librarywizard.h"
-#include "librarywizarddialog.h"
-
-#include <cpptools/abstracteditorsupport.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/qtsupportconstants.h>
-
-#include <utils/fileutils.h>
-
-#include <QTextStream>
-#include <QCoreApplication>
-
-static const char sharedHeaderPostfixC[] = "_global";
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-LibraryWizard::LibraryWizard()
-{
- setId("H.Qt4Library");
- setCategory(QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY));
- setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
- ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY_DISPLAY));
- setDisplayName(tr("C++ Library"));
- setDescription(tr("Creates a C++ library based on qmake. This can be used to create:<ul>"
- "<li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li>"
- "<li>a shared or static C++ library for use with another project at linktime</li></ul>"));
- setIcon(QIcon(QLatin1String(":/wizards/images/lib.png")));
- setRequiredFeatures({QtSupport::Constants::FEATURE_QT_PREFIX});
-}
-
-Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
-{
- LibraryWizardDialog *dialog = new LibraryWizardDialog(this, displayName(), icon(), parent, parameters);
- dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
- dialog->setProjectName(LibraryWizardDialog::uniqueProjectName(parameters.defaultPath()));
- dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix());
- return dialog;
-}
-
-static void writeLinuxProFile(QTextStream &str, const QtProjectParameters &params)
-{
- str << "\n"
- "unix {\n";
- if (!params.targetDirectory.isEmpty())
- str << " target.path = " << params.targetDirectory << '\n';
- else
- str << " target.path = /usr/lib\n";
- str << " INSTALLS += target\n"
- "}\n";
-}
-
-Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
- QString *errorMessage) const
-{
- Q_UNUSED(errorMessage)
- const auto *dialog = qobject_cast<const LibraryWizardDialog *>(w);
- const QtProjectParameters projectParams = dialog->parameters();
- const QString projectPath = projectParams.projectPath();
- const LibraryParameters params = dialog->libraryParameters();
- const bool usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce();
-
- const QString sharedLibExportMacro = QtProjectParameters::exportMacro(projectParams.fileName);
-
- Core::GeneratedFiles rc;
- // Class header + source
- const QString sourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix());
- Core::GeneratedFile source(sourceFileName);
- source.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
-
- const QString headerFileFullName = buildFileName(projectPath, params.headerFileName, headerSuffix());
- const QString headerFileName = Utils::FileName::fromString(headerFileFullName).fileName();
- QString pluginJsonFileFullName;
- QString pluginJsonFileName;
- if (projectParams.type == QtProjectParameters::QtPlugin) {
- pluginJsonFileFullName = buildFileName(projectPath, projectParams.fileName, QLatin1String("json"));
- pluginJsonFileName = Utils::FileName::fromString(pluginJsonFileFullName).fileName();
- }
-
- Core::GeneratedFile header(headerFileFullName);
-
- // Create files: global header for shared libs
- QString globalHeaderFileName;
- if (projectParams.type == QtProjectParameters::SharedLibrary) {
- const QString globalHeaderName = buildFileName(projectPath, projectParams.fileName.toLower() + QLatin1String(sharedHeaderPostfixC), headerSuffix());
- Core::GeneratedFile globalHeader(globalHeaderName);
- globalHeaderFileName = Utils::FileName::fromString(globalHeader.path()).fileName();
- globalHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(globalHeaderFileName)
- + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro, usePragmaOnce));
- rc.push_back(globalHeader);
- }
-
- // Generate code
- QString headerContents, sourceContents;
- params.generateCode(projectParams.type, headerFileName,
- globalHeaderFileName, sharedLibExportMacro, pluginJsonFileName,
- /* indentation*/ 4, usePragmaOnce, &headerContents, &sourceContents);
-
- source.setContents(CppTools::AbstractEditorSupport::licenseTemplate(sourceFileName, params.className)
- + sourceContents);
- header.setContents(CppTools::AbstractEditorSupport::licenseTemplate(headerFileFullName, params.className)
- + headerContents);
- rc.push_back(source);
- rc.push_back(header);
- // Create files: profile
- const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix());
- Core::GeneratedFile profile(profileName);
- profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
- QString profileContents;
- {
- QTextStream proStr(&profileContents);
- QtProjectParameters::writeProFileHeader(proStr);
- projectParams.writeProFile(proStr);
- proStr << "\nSOURCES +="
- << " \\\n " << Utils::FileName::fromString(source.path()).fileName()
- << "\n\nHEADERS +="
- << " \\\n " << headerFileName;
- if (!globalHeaderFileName.isEmpty())
- proStr << " \\\n " << globalHeaderFileName << " \n";
- if (!pluginJsonFileName.isEmpty())
- proStr << "\nDISTFILES += " << pluginJsonFileName << " \n";
- writeLinuxProFile(proStr, projectParams);
- }
- profile.setContents(profileContents);
- rc.push_back(profile);
-
- if (!pluginJsonFileName.isEmpty()) {
- Core::GeneratedFile jsonFile(pluginJsonFileFullName);
- jsonFile.setContents(QLatin1String("{\n \"Keys\" : [ ]\n}\n"));
- rc.push_back(jsonFile);
- }
- return rc;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.h b/src/plugins/qmakeprojectmanager/wizards/librarywizard.h
deleted file mode 100644
index f7edeb5330..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.h
+++ /dev/null
@@ -1,48 +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"
-#include "libraryparameters.h"
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-class LibraryWizard : public QtWizard
-{
- Q_OBJECT
-
-public:
- LibraryWizard();
-
-protected:
- Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const override;
-
- Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
deleted file mode 100644
index 2aed6d43cd..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
+++ /dev/null
@@ -1,347 +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 "librarywizarddialog.h"
-#include "filespage.h"
-#include "libraryparameters.h"
-#include "modulespage.h"
-
-#include <utils/projectintropage.h>
-#include <projectexplorer/projectexplorerconstants.h>
-
-#include <QDebug>
-
-#include <QComboBox>
-#include <QLabel>
-
-enum { debugLibWizard = 0 };
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-struct PluginBaseClasses {
- const char *name;
- const char *module;
- QStringList pureVirtuals;
-
- // blank separated list or 0
- const char *dependentModules;
- const char *targetDirectory;
- const char *pluginInterface;
-};
-using QSL = QStringList;
-
-static const PluginBaseClasses pluginBaseClasses[] =
-{
- {"QAccessiblePlugin", "QtGui",
- QSL{"QAccessibleInterface *create(const QString &key, QObject *object)"},
- "QtCore", "accessible", "QAccessibleFactoryInterface"},
- {"QGenericPlugin", "QtGui", QSL{"QObject *create(const QString &name, const QString &spec)"},
- "QtCore", "generic", "QGenericPluginFactoryInterface"},
- {"QIconEnginePlugin", "QtGui", QSL{"QIconEngine *create(const QString &filename)"},
- "QtCore", "imageformats", "QIconEngineFactoryInterface"},
- {"QImageIOPlugin", "QtGui",
- QSL{"QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const",
- "QImageIOHandler *create(QIODevice *device, const QByteArray &format) const"},
- "QtCore", "imageformats", "QImageIOHandlerFactoryInterface"},
- {"QScriptExtensionPlugin", "QtScript",
- QSL{"void initialize(const QString &key, QScriptEngine *engine)", "QStringList keys() const"},
- "QtCore", nullptr, "QScriptExtensionInterface"},
- {"QSqlDriverPlugin", "QtSql", QSL{"QSqlDriver *create(const QString &key)"},
- "QtCore", "sqldrivers", "QSqlDriverFactoryInterface"},
- {"QStylePlugin", "QtWidgets", QSL{"QStyle *create(const QString &key)"},
- "QtCore", "styles", "QStyleFactoryInterface"},
-};
-
-enum { defaultPluginBaseClass = 1 };
-
-static const PluginBaseClasses *findPluginBaseClass(const QString &name)
-{
- const int pluginBaseClassCount = sizeof(pluginBaseClasses)/sizeof(PluginBaseClasses);
- for (int i = 0; i < pluginBaseClassCount; i++)
- if (name == QLatin1String(pluginBaseClasses[i].name))
- return pluginBaseClasses + i;
- return nullptr;
-}
-
-// return dependencies of a plugin as a line ready for the 'QT=' line in a pro
-// file
-static QStringList pluginDependencies(const PluginBaseClasses *plb)
-{
- QStringList dependencies;
- const QChar blank = QLatin1Char(' ');
- // Find the module names and convert to ids
- QStringList pluginModules= plb->dependentModules ?
- QString::fromLatin1(plb->dependentModules).split(blank) :
- QStringList();
- pluginModules.push_back(QLatin1String(plb->module));
- foreach (const QString &module, pluginModules) {
- dependencies.append(ModulesPage::idOfModule(module));
- }
- return dependencies;
-}
-
-// A Project intro page with an additional type chooser.
-class LibraryIntroPage : public Utils::ProjectIntroPage
-{
-public:
- explicit LibraryIntroPage(QWidget *parent = nullptr);
-
- QtProjectParameters::Type type() const;
-
-private:
- QComboBox *m_typeCombo;
-};
-
-LibraryIntroPage::LibraryIntroPage(QWidget *parent) :
- Utils::ProjectIntroPage(parent),
- m_typeCombo(new QComboBox)
-{
- m_typeCombo->setEditable(false);
- m_typeCombo->addItem(LibraryWizardDialog::tr("Shared Library"),
- QVariant(QtProjectParameters::SharedLibrary));
- m_typeCombo->addItem(LibraryWizardDialog::tr("Statically Linked Library"),
- QVariant(QtProjectParameters::StaticLibrary));
- m_typeCombo->addItem(LibraryWizardDialog::tr("Qt Plugin"),
- QVariant(QtProjectParameters::QtPlugin));
- insertControl(0, new QLabel(LibraryWizardDialog::tr("Type")), m_typeCombo);
-}
-
-QtProjectParameters::Type LibraryIntroPage::type() const
-{
- return static_cast<QtProjectParameters::Type>(m_typeCombo->itemData(m_typeCombo->currentIndex()).toInt());
-}
-
-// ------------------- LibraryWizardDialog
-LibraryWizardDialog::LibraryWizardDialog(const Core::BaseFileWizardFactory *factory,
- const QString &templateName,
- const QIcon &icon,
- QWidget *parent,
- const Core::WizardDialogParameters &parameters) :
- BaseQmakeProjectWizardDialog(factory, true, new LibraryIntroPage, -1, parent, parameters),
- m_filesPage(new FilesPage),
- m_pluginBaseClassesInitialized(false),
- m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1)
-{
- setWindowIcon(icon);
- setWindowTitle(templateName);
- setSelectedModules(QLatin1String("core"));
-
- // Note that QWizard::currentIdChanged() is emitted at strange times.
- // Use the intro page instead, set up initially
- setIntroDescription(tr("This wizard generates a C++ Library project."));
-
- if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
- m_targetPageId = addTargetSetupPage();
-
- m_modulesPageId = addModulesPage();
-
- m_filesPage->setNamespacesEnabled(true);
- m_filesPage->setFormFileInputVisible(false);
- m_filesPage->setClassTypeComboVisible(false);
-
- m_filesPageId = addPage(m_filesPage);
-
- Utils::WizardProgressItem *introItem = wizardProgress()->item(startId());
- Utils::WizardProgressItem *targetItem = nullptr;
- if (m_targetPageId != -1)
- targetItem = wizardProgress()->item(m_targetPageId);
- Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
- Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
- filesItem->setTitle(tr("Details"));
-
- if (targetItem) {
- if (m_targetPageId != -1) {
- targetItem->setNextItems(QList<Utils::WizardProgressItem *>()
- << modulesItem << filesItem);
- targetItem->setNextShownItem(nullptr);
- } else {
- introItem->setNextItems(QList<Utils::WizardProgressItem *>()
- << modulesItem << filesItem);
- introItem->setNextShownItem(nullptr);
- }
- }
-
- connect(this, &QWizard::currentIdChanged, this, &LibraryWizardDialog::slotCurrentIdChanged);
-
- addExtensionPages(extensionPages());
-}
-
-void LibraryWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
-{
- m_filesPage->setSuffixes(header, source, form);
-}
-
-void LibraryWizardDialog::setLowerCaseFiles(bool l)
-{
- m_filesPage->setLowerCaseFiles(l);
-}
-
-QtProjectParameters::Type LibraryWizardDialog::type() const
-{
- return static_cast<const LibraryIntroPage*>(introPage())->type();
-}
-
-bool LibraryWizardDialog::isModulesPageSkipped() const
-{
- // When leaving the intro or target page, the modules page is skipped
- // in the case of a plugin since it knows its dependencies by itself.
- return type() == QtProjectParameters::QtPlugin;
-}
-
-int LibraryWizardDialog::skipModulesPageIfNeeded() const
-{
- if (isModulesPageSkipped())
- return m_filesPageId;
- return m_modulesPageId;
-}
-
-int LibraryWizardDialog::nextId() const
-{
- if (m_targetPageId != -1) {
- if (currentId() == m_targetPageId)
- return skipModulesPageIfNeeded();
- } else if (currentId() == startId()) {
- return skipModulesPageIfNeeded();
- }
-
- return BaseQmakeProjectWizardDialog::nextId();
-}
-
-void LibraryWizardDialog::initializePage(int id)
-{
- if (m_targetPageId != -1 && id == m_targetPageId) {
- Utils::WizardProgressItem *targetsItem = wizardProgress()->item(m_targetPageId);
- Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
- Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
- if (isModulesPageSkipped())
- targetsItem->setNextShownItem(filesItem);
- else
- targetsItem->setNextShownItem(modulesItem);
-
- }
- BaseQmakeProjectWizardDialog::initializePage(id);
-}
-
-void LibraryWizardDialog::cleanupPage(int id)
-{
- if (m_targetPageId != -1 && id == m_targetPageId) {
- Utils::WizardProgressItem *targetsItem = wizardProgress()->item(m_targetPageId);
- targetsItem->setNextShownItem(nullptr);
- }
- BaseQmakeProjectWizardDialog::cleanupPage(id);
-}
-
-QtProjectParameters LibraryWizardDialog::parameters() const
-{
- QtProjectParameters rc;
- rc.type = type();
- rc.fileName = projectName();
- rc.path = path();
- if (rc.type == QtProjectParameters::QtPlugin) {
- // Plugin: Dependencies & Target directory
- if (const PluginBaseClasses *plb = findPluginBaseClass(m_filesPage->baseClassName())) {
- rc.selectedModules = pluginDependencies(plb);
- if (plb->targetDirectory) {
- rc.targetDirectory = QLatin1String("$$[QT_INSTALL_PLUGINS]/");
- rc.targetDirectory += QLatin1String(plb->targetDirectory);
- }
- }
- } else {
- // Modules from modules page
- rc.selectedModules = selectedModulesList();
- rc.deselectedModules = deselectedModulesList();
- }
- return rc;
-}
-
-void LibraryWizardDialog::slotCurrentIdChanged(int id)
-{
- if (debugLibWizard)
- qDebug() << Q_FUNC_INFO << id;
- if (id == m_filesPageId)
- setupFilesPage();// Switching to files page: Set up base class accordingly (plugin)
-}
-
-void LibraryWizardDialog::setupFilesPage()
-{
- switch (type()) {
- case QtProjectParameters::QtPlugin:
- if (!m_pluginBaseClassesInitialized) {
- if (debugLibWizard)
- qDebug("initializing for plugins");
- QStringList baseClasses;
- const int pluginBaseClassCount = sizeof(pluginBaseClasses)/sizeof(PluginBaseClasses);
- Q_ASSERT(defaultPluginBaseClass < pluginBaseClassCount);
- for (const PluginBaseClasses &pluginBaseClasse : pluginBaseClasses)
- baseClasses.push_back(QLatin1String(pluginBaseClasse.name));
- m_filesPage->setBaseClassChoices(baseClasses);
- m_filesPage->setBaseClassName(baseClasses.at(defaultPluginBaseClass));
- m_pluginBaseClassesInitialized = true;
- }
- m_filesPage->setBaseClassInputVisible(true);
- break;
- default:
- if (!m_filesPage->isComplete()) {
- // Urrm, figure out a good class name. Use project name this time
- QString className = projectName();
- if (!className.isEmpty())
- className[0] = className.at(0).toUpper();
- m_filesPage->setClassName(className);
- m_filesPage->setBaseClassInputVisible(false);
- }
- break;
- }
-}
-
-LibraryParameters LibraryWizardDialog::libraryParameters() const
-{
- LibraryParameters rc;
- rc.className = m_filesPage->className();
- if (type() == QtProjectParameters::QtPlugin) {
- rc.baseClassName = m_filesPage->baseClassName();
- for (const PluginBaseClasses &c : pluginBaseClasses) {
- if (QLatin1String(c.name) == rc.baseClassName) {
- rc.pureVirtualSignatures = c.pureVirtuals;
- break;
- }
- }
- }
- rc.sourceFileName = m_filesPage->sourceFileName();
- rc.headerFileName = m_filesPage->headerFileName();
- return rc;
-}
-
-QString LibraryWizardDialog::pluginInterface(const QString &baseClass)
-{
- if (const PluginBaseClasses *plb = findPluginBaseClass(baseClass))
- if (plb->pluginInterface)
- return QLatin1String("org.qt-project.Qt.") + QLatin1String(plb->pluginInterface);
- return QString();
-}
-
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
deleted file mode 100644
index 620ffe7cca..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
+++ /dev/null
@@ -1,78 +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;
-struct LibraryParameters;
-
-// Library wizard dialog.
-class LibraryWizardDialog : public BaseQmakeProjectWizardDialog
-{
- Q_OBJECT
-
-public:
- LibraryWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
- const QIcon &icon,
- QWidget *parent,
- const Core::WizardDialogParameters &parameters);
-
- void setSuffixes(const QString &header, const QString &source, const QString &form= QString());
- void setLowerCaseFiles(bool);
-
- QtProjectParameters parameters() const;
- LibraryParameters libraryParameters() const;
-
- static QString pluginInterface(const QString &baseClass);
-
- int nextId() const override;
-
-protected:
- void initializePage(int id) override;
- void cleanupPage(int id) override;
-
-private:
- void slotCurrentIdChanged(int);
-
- QtProjectParameters::Type type() const;
- void setupFilesPage();
- bool isModulesPageSkipped() const;
- int skipModulesPageIfNeeded() const;
-
- FilesPage *m_filesPage;
- bool m_pluginBaseClassesInitialized;
- int m_filesPageId;
- int m_modulesPageId;
- int m_targetPageId;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager