aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator
diff options
context:
space:
mode:
Diffstat (limited to 'share/qtcreator')
-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
9 files changed, 459 insertions, 0 deletions
diff --git a/share/qtcreator/templates/wizards/global/lib.png b/share/qtcreator/templates/wizards/global/lib.png
new file mode 100644
index 00000000000..52cb73e382e
--- /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 00000000000..c959779b029
--- /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 00000000000..29d83968520
--- /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 00000000000..23bf7797da0
--- /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 00000000000..80ef326ce54
--- /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 00000000000..d6d65c377d7
--- /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 00000000000..1e811388e48
--- /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 00000000000..f6652ee9301
--- /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 00000000000..e1d58c25e74
--- /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'}"
+ }
+ ]
+ }
+ ]
+}