summaryrefslogtreecommitdiff
path: root/share/qtcreator/templates
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-08-27 16:38:03 +0200
committerEike Ziller <eike.ziller@qt.io>2019-08-28 16:38:23 +0000
commit6c9f75ff4a6a98cb45fa48928b1d8ef25d3d14ad (patch)
tree85ca3d5a23319707e094efc8cf98b84ff4cb2d56 /share/qtcreator/templates
parent2e8f65004410ed650ef5c3737991edc7bdc91f0d (diff)
downloadqt-creator-6c9f75ff4a6a98cb45fa48928b1d8ef25d3d14ad.tar.gz
Transform Qt Quick 2 Extension Plugin wizard to JSON
Change-Id: I0e59219adeb5b3aa08a99da7c0bb657d793ba2e1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png (renamed from share/qtcreator/templates/wizards/qtquick2-extension/lib.png)bin1789 -> 1789 bytes
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png (renamed from share/qtcreator/templates/wizards/qtquick2-extension/lib@2x.png)bin3717 -> 3717 bytes
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp (renamed from share/qtcreator/templates/wizards/qtquick2-extension/object.cpp)8
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h23
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp12
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h (renamed from share/qtcreator/templates/wizards/qtquick2-extension/plugin.h)9
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro (renamed from share/qtcreator/templates/wizards/qtquick2-extension/project.pro)18
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir2
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json109
-rw-r--r--share/qtcreator/templates/wizards/qtquick2-extension/object.h22
-rw-r--r--share/qtcreator/templates/wizards/qtquick2-extension/plugin.cpp11
-rw-r--r--share/qtcreator/templates/wizards/qtquick2-extension/qmldir2
-rw-r--r--share/qtcreator/templates/wizards/qtquick2-extension/wizard.xml66
13 files changed, 164 insertions, 118 deletions
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/lib.png b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png
index 0566f1d5f1..0566f1d5f1 100644
--- a/share/qtcreator/templates/wizards/qtquick2-extension/lib.png
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png
Binary files differ
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/lib@2x.png b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png
index 90a842d6e8..90a842d6e8 100644
--- a/share/qtcreator/templates/wizards/qtquick2-extension/lib@2x.png
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png
Binary files differ
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/object.cpp b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp
index 15fe405242..a2288c47c1 100644
--- a/share/qtcreator/templates/wizards/qtquick2-extension/object.cpp
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp
@@ -1,7 +1,7 @@
-#include "%ObjectName:l%.%CppHeaderSuffix%"
+#include "%{ObjectHdr}"
-%ObjectName%::%ObjectName%(QQuickItem *parent):
- QQuickItem(parent)
+%{ObjectName}::%{ObjectName}(QQuickItem *parent)
+ : QQuickItem(parent)
{
// By default, QQuickItem does not draw anything. If you subclass
// QQuickItem to create a visual item, you will need to uncomment the
@@ -10,6 +10,6 @@
// setFlag(ItemHasContents, true);
}
-%ObjectName%::~%ObjectName%()
+%{ObjectName}::~%{ObjectName}()
{
}
diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h
new file mode 100644
index 0000000000..e74c4233e8
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h
@@ -0,0 +1,23 @@
+%{Cpp:LicenseTemplate}\
+@if '%{Cpp:PragmaOnce}'
+#pragma once
+@else
+#ifndef %{OBJECTGUARD}
+#define %{OBJECTGUARD}
+@endif
+
+#include <QQuickItem>
+
+class %{ObjectName} : public QQuickItem
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(%{ObjectName})
+
+public:
+ explicit %{ObjectName}(QQuickItem *parent = nullptr);
+ ~%{ObjectName}() override;
+};
+
+@if ! '%{Cpp:PragmaOnce}'
+#endif // %{OBJECTGUARD}
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp
new file mode 100644
index 0000000000..69afb9badd
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp
@@ -0,0 +1,12 @@
+#include "%{PluginHdr}"
+
+#include "%{ObjectHdr}"
+
+#include <qqml.h>
+
+void %{PluginName}::registerTypes(const char *uri)
+{
+ // @uri %{Uri}
+ qmlRegisterType<%{ObjectName}>(uri, 1, 0, "%{ObjectName}");
+}
+
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/plugin.h b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h
index a7a18893ef..539aee0d5d 100644
--- a/share/qtcreator/templates/wizards/qtquick2-extension/plugin.h
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h
@@ -1,13 +1,14 @@
+%{Cpp:LicenseTemplate}\
@if '%{Cpp:PragmaOnce}'
#pragma once
@else
-#ifndef %ProjectName:h%_PLUGIN_H
-#define %ProjectName:h%_PLUGIN_H
+#ifndef %{PLUGINGUARD}
+#define %{PLUGINGUARD}
@endif
#include <QQmlExtensionPlugin>
-class %ProjectName:s%Plugin : public QQmlExtensionPlugin
+class %{PluginName} : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
@@ -17,5 +18,5 @@ public:
};
@if ! '%{Cpp:PragmaOnce}'
-#endif // %ProjectName:h%_PLUGIN_H
+#endif // %{PLUGINGUARD}
@endif
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/project.pro b/share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro
index b9677739e4..78d4325d32 100644
--- a/share/qtcreator/templates/wizards/qtquick2-extension/project.pro
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro
@@ -1,26 +1,26 @@
TEMPLATE = lib
-TARGET = %ProjectName%
+TARGET = %{ProjectName}
QT += qml quick
CONFIG += plugin c++11
TARGET = $$qtLibraryTarget($$TARGET)
-uri = %Uri%
+uri = %{Uri}
# Input
-SOURCES += \
- %ProjectName:l%_plugin.%CppSourceSuffix% \
- %ObjectName:l%.%CppSourceSuffix%
+SOURCES += \\
+ %{PluginSrc} \\
+ %{ObjectSrc}
-HEADERS += \
- %ProjectName:l%_plugin.%CppHeaderSuffix% \
- %ObjectName:l%.%CppHeaderSuffix%
+HEADERS += \\
+ %{PluginHdr} \\
+ %{ObjectHdr}
DISTFILES = qmldir
!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
copy_qmldir.target = $$OUT_PWD/qmldir
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
- copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
+ copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"
QMAKE_EXTRA_TARGETS += copy_qmldir
PRE_TARGETDEPS += $$copy_qmldir.target
}
diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir b/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir
new file mode 100644
index 0000000000..8a3038ae48
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir
@@ -0,0 +1,2 @@
+module %{Uri}
+plugin %{ProjectName}
diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json
new file mode 100644
index 0000000000..f548d18c9b
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json
@@ -0,0 +1,109 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
+ "id": "M.QtQuick2ExtensionPlugin",
+ "category": "G.Library",
+ "trDescription": "Creates a C++ plugin to load Qt Quick extensions dynamically into applications using the QQmlEngine class.",
+ "trDisplayName": "Qt Quick 2 Extension Plugin",
+ "trDisplayCategory": "Library",
+ "icon": "lib.png",
+ "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick", "QtSupport.Wizards.FeatureQtQuick.2" ],
+ "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}",
+
+ "options":
+ [
+ { "key": "ProjectFile", "value": "%{ProFile}" },
+ { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
+ { "key": "PluginBaseFileName", "value": "%{JS: value('ProjectName') + '_plugin'}" },
+ { "key": "PluginSrc", "value": "%{JS: Cpp.classToFileName(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++src'))}" },
+ { "key": "PluginHdr", "value": "%{JS: Cpp.classToFileName(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" },
+ { "key": "ObjectSrc", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++src'))}" },
+ { "key": "ObjectHdr", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" },
+ { "key": "PluginName", "value": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1) + 'Plugin' }" },
+ { "key": "PLUGINGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" },
+ { "key": "OBJECTGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project"
+ },
+ {
+ "trDisplayName": "Custom Parameters",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data":
+ [
+ {
+ "name": "ObjectName",
+ "trDisplayName": "Object class-name:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data":
+ {
+ "validator": "^[A-Za-z0-9_]+$",
+ "trText": "MyItem"
+ }
+ },
+ {
+ "name": "Uri",
+ "trDisplayName": "URI:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data":
+ {
+ "validator": "^[A-Za-z0-9]+([A-Za-z0-9-]*[A-Za-z0-9]+)?(\.[A-Za-z0-9]+([-A-Za-z0-9]*[A-Za-z0-9]+)?)*$",
+ "trText": "com.mycompany.qmlcomponents"
+ }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "project.pro",
+ "target": "%{ProFile}",
+ "openAsProject": true
+ },
+ {
+ "source": "qmldir",
+ "target": "qmldir"
+ },
+ {
+ "source": "plugin.cpp",
+ "target": "%{PluginSrc}"
+ },
+ {
+ "source": "plugin.h",
+ "target": "%{PluginHdr}"
+ },
+ {
+ "source": "object.cpp",
+ "target": "%{ObjectSrc}"
+ },
+ {
+ "source": "object.h",
+ "target": "%{ObjectHdr}"
+ },
+ {
+ "source": "../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
+ }
+ ]
+ }
+ ]
+}
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/object.h b/share/qtcreator/templates/wizards/qtquick2-extension/object.h
deleted file mode 100644
index cabd5229db..0000000000
--- a/share/qtcreator/templates/wizards/qtquick2-extension/object.h
+++ /dev/null
@@ -1,22 +0,0 @@
-@if '%{Cpp:PragmaOnce}'
-#pragma once
-@else
-#ifndef %ObjectName:u%_H
-#define %ObjectName:u%_H
-@endif
-
-#include <QQuickItem>
-
-class %ObjectName% : public QQuickItem
-{
- Q_OBJECT
- Q_DISABLE_COPY(%ObjectName%)
-
-public:
- explicit %ObjectName%(QQuickItem *parent = nullptr);
- ~%ObjectName%() override;
-};
-
-@if ! '%{Cpp:PragmaOnce}'
-#endif // %ObjectName:u%_H
-@endif
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/plugin.cpp b/share/qtcreator/templates/wizards/qtquick2-extension/plugin.cpp
deleted file mode 100644
index c4ff1b1732..0000000000
--- a/share/qtcreator/templates/wizards/qtquick2-extension/plugin.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "%ProjectName:l%_plugin.%CppHeaderSuffix%"
-#include "%ObjectName:l%.%CppHeaderSuffix%"
-
-#include <qqml.h>
-
-void %ProjectName:s%Plugin::registerTypes(const char *uri)
-{
- // @uri %Uri%
- qmlRegisterType<%ObjectName%>(uri, 1, 0, "%ObjectName:c%");
-}
-
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/qmldir b/share/qtcreator/templates/wizards/qtquick2-extension/qmldir
deleted file mode 100644
index f1f54802f3..0000000000
--- a/share/qtcreator/templates/wizards/qtquick2-extension/qmldir
+++ /dev/null
@@ -1,2 +0,0 @@
-module %Uri%
-plugin %ProjectName%
diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/wizard.xml b/share/qtcreator/templates/wizards/qtquick2-extension/wizard.xml
deleted file mode 100644
index 2c3a288c0c..0000000000
--- a/share/qtcreator/templates/wizards/qtquick2-extension/wizard.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/****************************************************************************
-**
-** 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.
-**
-****************************************************************************/
-
-Custom project wizard configuration example file. Note that by convention,
-the project file goes last.
-The "class" and "firstpage" attributes specify that it is a Qt 4 wizard and
-leave room for the Qt 4 target page.
--->
-<wizard version="1" kind="project"
- class="qmakeproject" firstpage="10"
- id="QtQuick2ExtensionPlugin" category="G.Library"
- featuresRequired="QtSupport.Wizards.FeatureQtQuick,QtSupport.Wizards.FeatureQtQuick.2">
- <icon>lib.png</icon>
- <description>Creates a C++ plugin to load extensions dynamically into applications using the QQmlEngine class. Requires Qt 5.0 or newer.</description>
- <displayname>Qt Quick 2 Extension Plugin</displayname>
- <displaycategory>Library</displaycategory>
- <files>
- <file source="qmldir" target="qmldir"/>
- <file source="plugin.h" target="%ProjectName:l%_plugin.%CppHeaderSuffix%"/>
- <file source="plugin.cpp" target="%ProjectName:l%_plugin.%CppSourceSuffix%"/>
- <file source="object.h" target="%ObjectName:l%.%CppHeaderSuffix%"/>
- <file source="object.cpp" target="%ObjectName:l%.%CppSourceSuffix%" openeditor="true"/>
- <file source="project.pro" target="%ProjectName:l%.pro" openproject="true"/>
- </files>
- <!-- Create a 2nd wizard page with parameters -->
- <fieldpagetitle>Custom QML Extension Plugin Parameters</fieldpagetitle>
- <fields>
- <field mandatory="true" name="ObjectName">
- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="MyItem"/>
- <fielddescription>Object class-name:</fielddescription>
- </field>
- <field mandatory="true" name="Uri">
- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9]+([A-Za-z0-9-]*[A-Za-z0-9]+)?(\.[A-Za-z0-9]+([-A-Za-z0-9]*[A-Za-z0-9]+)?)*$' defaulttext="com.mycompany.qmlcomponents"/>
- <fielddescription>URI:</fielddescription>
- </field>
- </fields>
- <validationrules>
- <validationrule condition='"%ObjectName%" != "%ProjectName%_plugin"'>
- <message>The project name and the object class-name cannot be the same.</message>
- </validationrule>
- </validationrules>
-</wizard>