aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2020-10-21 15:15:30 +0200
committerDominik Holland <dominik.holland@qt.io>2020-12-15 13:46:01 +0100
commitcfda2bbf9ab209da0a924ff840c41612329cd91b (patch)
treeca2fc7e439c791f291c4027f5f3b7a4635b8e1d2
parentb93f8aba16a4294c4848412fb7718038a2c36f67 (diff)
ivigenerator: Generate metainfo files for usage in Design Studio
For all generated interfaces we now also generate a metainfo file. This file is read by Qt Design Studio and makes it possible to work with the autogenerated interfaces there and connect to the provided properties. Change-Id: Ie088972e903cc6b7248db41e565eef66956939f2 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r--src/ivicore/doc/src/ivigenerator/generator-usage.qdoc33
-rw-r--r--src/ivivehiclefunctions/ivivehiclefunctions.qface3
-rw-r--r--src/tools/ivigenerator/ivigenerator.pro1
-rw-r--r--src/tools/ivigenerator/templates/backend_simulator.yaml1
-rw-r--r--src/tools/ivigenerator/templates/common/designer.metainfo.tpl81
-rw-r--r--src/tools/ivigenerator/templates/frontend.yaml1
-rw-r--r--src/tools/ivigenerator/templates/qmlplugin.yaml2
-rw-r--r--src/tools/ivigenerator/templates/qmlplugin/module.pri.tpl3
-rw-r--r--src/tools/ivigenerator/templates/server_qtro_simulator.yaml1
9 files changed, 125 insertions, 1 deletions
diff --git a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
index 7d870d9..30513e0 100644
--- a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
+++ b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
@@ -263,6 +263,39 @@
the name which is used to export the interface to QML. For modules, it defines the
URI of the complete module. The last part of the URI is also used for the singleton
that exports all enums to QML.
+ \row
+ \li \code
+ @designer: {categoryName: "QtIvi - Vehicle Functions"}
+ \endcode
+ \li Main IDL file
+ \li Module, Interface
+ \li Defines the category name this interface should be listed under in the Qt Design Studio
+ Library. When defined for a module it sets the category name for all interfaces inside
+ that module, but it can be overridden per interface by defining it there as well.
+ \row
+ \li \code
+ @designer: {name: "Climate Control"}
+ \endcode
+ \li Main IDL file
+ \li Interface
+ \li Defines the name this interface should be listed under in the Qt Design Studio
+ Library.
+ \row
+ \li \code
+ @designer: {typeIcon: "images/climate.png"}
+ \endcode
+ \li Main IDL file
+ \li Interface
+ \li The typeIcon is a 16x16 icon used in the Navigator Pane within Qt Design Studio.
+ \note The icon needs to copied to the correct folder by a custom qmake rule.
+ \row
+ \li \code
+ @designer: {libraryIcon: "images/climate.png"}
+ \endcode
+ \li Main IDL file
+ \li Interface
+ \li The libraryIcon is shown in the Library within Qt Design Studio.
+ \note The icon needs to copied to the correct folder by a custom qmake rule.
\endtable
Annotations that are not logically part of the interface description, but rather the ones used
diff --git a/src/ivivehiclefunctions/ivivehiclefunctions.qface b/src/ivivehiclefunctions/ivivehiclefunctions.qface
index 568715e..906f4cd 100644
--- a/src/ivivehiclefunctions/ivivehiclefunctions.qface
+++ b/src/ivivehiclefunctions/ivivehiclefunctions.qface
@@ -1,5 +1,6 @@
@config: { qml_name: "QtIvi.VehicleFunctions" }
@config_simulator: { simulationFile: "qrc:/simulation/simulation.qml" }
+@designer: { categoryName: "QtIvi - Vehicle Functions" }
module QtIviVehicleFunctions 1.0;
/**
@@ -15,6 +16,7 @@ module QtIviVehicleFunctions 1.0;
* with \l {QIviAbstractFeature::}{discoveryMode} set to \l {QIviAbstractFeature::}{AutoDiscovery}.
*/
@config: { zoned: true, id: "org.qt-project.qtivi.ClimateControl/1.0", qml_type: "ClimateControl" }
+@designer: { name: "Climate Control" }
interface QIviClimateControl {
/**
* Holds whether the air conditioning is enabled.
@@ -169,6 +171,7 @@ enum ClimateMode {
* with \l {QIviAbstractFeature::}{discoveryMode} set to \l {QIviAbstractZonedFeature::}{zoneAt}.
*/
@config: { zoned: true, id: "org.qt-project.qtivi.WindowControl/1.0", qml_type: "WindowControl" }
+@designer: { name: "Window Control" }
interface QIviWindowControl {
/**
diff --git a/src/tools/ivigenerator/ivigenerator.pro b/src/tools/ivigenerator/ivigenerator.pro
index ae1a748..6a3ec0d 100644
--- a/src/tools/ivigenerator/ivigenerator.pro
+++ b/src/tools/ivigenerator/ivigenerator.pro
@@ -16,6 +16,7 @@ common.files += \
templates/common/qtivi_macros.j2 \
templates/common/simulation.qmltypes.tpl \
templates/common/plugins.qmltypes.tpl \
+ templates/common/designer.metainfo.tpl \
templates/common/qmldir.tpl \
templates/common/interface.rep.tpl \
templates/common/simulation_data.json.tpl \
diff --git a/src/tools/ivigenerator/templates/backend_simulator.yaml b/src/tools/ivigenerator/templates/backend_simulator.yaml
index 9228664..bf8dad7 100644
--- a/src/tools/ivigenerator/templates/backend_simulator.yaml
+++ b/src/tools/ivigenerator/templates/backend_simulator.yaml
@@ -11,6 +11,7 @@ backend_simulator:
- "qml/{{module|qml_type|replace('.', '/')}}/simulation/plugins.qmltypes": "common/simulation.qmltypes.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/simulation/qmldir": "common/qmldir.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/plugins.qmltypes": "common/plugins.qmltypes.tpl"
+ - "qml/{{module|qml_type|replace('.', '/')}}/designer/{{module.module_name|lower}}.metainfo": "common/designer.metainfo.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/qmldir": "common/qmldir.tpl"
interface:
documents:
diff --git a/src/tools/ivigenerator/templates/common/designer.metainfo.tpl b/src/tools/ivigenerator/templates/common/designer.metainfo.tpl
new file mode 100644
index 0000000..ba9e9c6
--- /dev/null
+++ b/src/tools/ivigenerator/templates/common/designer.metainfo.tpl
@@ -0,0 +1,81 @@
+{#
+# Copyright (C) 2020 The Qt Company Ltd.
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:LGPL-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite 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 Lesser General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU Lesser
+# General Public License version 3 as published by the Free Software
+# Foundation and appearing in the file LICENSE.LGPL3 included in the
+# packaging of this file. Please review the following information to
+# ensure the GNU Lesser General Public License version 3 requirements
+# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+#
+# GNU General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU
+# General Public License version 2.0 or (at your option) the GNU General
+# Public license version 3 or any later version approved by the KDE Free
+# Qt Foundation. The licenses are as published by the Free Software
+# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+# 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-2.0.html and
+# https://www.gnu.org/licenses/gpl-3.0.html.
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: LGPL-3.0
+#}
+{% import 'common/qtivi_macros.j2' as ivi %}
+{% set module_qml_name = (module|qml_type).split('.')[-1]|upperfirst %}
+{% set default_category_name = module_qml_name %}
+{% if module.tags.designer and module.tags.designer.categoryName %}
+{% set default_category_name = module.tags.designer.categoryName %}
+{% endif %}
+
+MetaInfo {
+{% for interface in module.interfaces %}
+{% set category_name = default_category_name %}
+{% if interface.tags.designer and interface.tags.designer.categoryName %}
+{% set category_name = interface.tags.designer.categoryName %}
+{% endif %}
+{% set name = interface|qml_type %}
+{% if interface.tags.designer and interface.tags.designer.name %}
+{% set name = interface.tags.designer.name %}
+{% endif %}
+
+ Type {
+ name: "{{module|qml_type}}.{{interface|qml_type}}"
+{% if interface.tags.designer and interface.tags.designer.typeIcon %}
+ icon: "{{interface.tags.designer.typeIcon}}"
+{% endif %}
+
+ Hints {
+ visibleInNavigator: true
+ canBeDroppedInNavigator: true
+ canBeDroppedInFormEditor: false
+ }
+
+ ItemLibraryEntry {
+ name: "{{name}}"
+ category: "{{category_name}}"
+{% if interface.tags.designer and interface.tags.designer.libraryIcon %}
+ libraryIcon: "{{interface.tags.designer.libraryIcon}}"
+{% endif %}
+ version: "{{module.majorVersion}}.{{module.minorVersion}}"
+ requiredImport: "{{module|qml_type}}"
+ }
+ }
+
+{% endfor %}
+}
diff --git a/src/tools/ivigenerator/templates/frontend.yaml b/src/tools/ivigenerator/templates/frontend.yaml
index fdab347..7aec967 100644
--- a/src/tools/ivigenerator/templates/frontend.yaml
+++ b/src/tools/ivigenerator/templates/frontend.yaml
@@ -9,6 +9,7 @@ frontend:
- '{{module.module_name|lower}}modulefactory.cpp': 'modulefactory.cpp.tpl'
- '{{srcBase|lower}}.pri': 'module.pri.tpl'
- 'qml/{{module|qml_type|replace(".", "/")}}/plugins.qmltypes': 'common/plugins.qmltypes.tpl'
+ - "qml/{{module|qml_type|replace('.', '/')}}/designer/{{module.module_name|lower}}.metainfo": "common/designer.metainfo.tpl"
- 'qml/{{module|qml_type|replace(".", "/")}}/qmldir': 'common/qmldir.tpl'
interface:
documents:
diff --git a/src/tools/ivigenerator/templates/qmlplugin.yaml b/src/tools/ivigenerator/templates/qmlplugin.yaml
index ba6d505..368b4c1 100644
--- a/src/tools/ivigenerator/templates/qmlplugin.yaml
+++ b/src/tools/ivigenerator/templates/qmlplugin.yaml
@@ -4,6 +4,8 @@ qmlplugin:
- "plugin.cpp": "plugin.cpp.tpl"
- "{{srcBase|lower}}.pri": "module.pri.tpl"
- "plugins.qmltypes": "common/plugins.qmltypes.tpl"
+ - "designer/{{module.module_name|lower}}.metainfo": "common/designer.metainfo.tpl"
- "qmldir": "qmldir_plugin.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/plugins.qmltypes": "common/plugins.qmltypes.tpl"
+ - "qml/{{module|qml_type|replace('.', '/')}}/designer/{{module.module_name|lower}}.metainfo": "common/designer.metainfo.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/qmldir": "qmldir_plugin.tpl"
diff --git a/src/tools/ivigenerator/templates/qmlplugin/module.pri.tpl b/src/tools/ivigenerator/templates/qmlplugin/module.pri.tpl
index 4bd7d05..c9598ae 100644
--- a/src/tools/ivigenerator/templates/qmlplugin/module.pri.tpl
+++ b/src/tools/ivigenerator/templates/qmlplugin/module.pri.tpl
@@ -49,4 +49,5 @@ SOURCES += \
$$PWD/plugin.cpp \
AUX_QML_FILES += $$PWD/qmldir \
- $$PWD/plugins.qmltypes
+ $$PWD/plugins.qmltypes \
+ $$PWD/designer/{{module.module_name|lower}}.metainfo
diff --git a/src/tools/ivigenerator/templates/server_qtro_simulator.yaml b/src/tools/ivigenerator/templates/server_qtro_simulator.yaml
index b85de86..5563460 100644
--- a/src/tools/ivigenerator/templates/server_qtro_simulator.yaml
+++ b/src/tools/ivigenerator/templates/server_qtro_simulator.yaml
@@ -11,6 +11,7 @@ server_qtro_simulator:
- "qml/{{module|qml_type|replace('.', '/')}}/simulation/plugins.qmltypes": "common/simulation.qmltypes.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/simulation/qmldir": "common/qmldir.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/plugins.qmltypes": "common/plugins.qmltypes.tpl"
+ - "qml/{{module|qml_type|replace('.', '/')}}/designer/{{module.module_name|lower}}.metainfo": "common/designer.metainfo.tpl"
- "qml/{{module|qml_type|replace('.', '/')}}/qmldir": "common/qmldir.tpl"
interface:
documents: