diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2019-03-21 13:33:35 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2019-04-01 16:17:10 +0000 |
commit | fdb9b87a029e8b32b424a9957d0c04e5f7eb8352 (patch) | |
tree | 3909af878619052be0f2e6fcebe4b809d95183fe /src | |
parent | f550b2304355ac024d8816a3baa5d6336749aee7 (diff) | |
download | qtivi-fdb9b87a029e8b32b424a9957d0c04e5f7eb8352.tar.gz |
Remove the QtSimulator integration
This removes the QtSimulator code in the autogenerated simulator
backends and the control_panel template.
The simulation can now be scripted using the QIviSimulationEngine.
Change-Id: I40330e9454f700278cbf6ac960f602385642b524
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'src')
24 files changed, 2 insertions, 1369 deletions
diff --git a/src/ivicore/configure.json b/src/ivicore/configure.json index a86a389..5be3e8d 100644 --- a/src/ivicore/configure.json +++ b/src/ivicore/configure.json @@ -7,7 +7,6 @@ "ivigenerator": { "type": "enum", "values": [ "no", "qt", "system" ] }, "qface": { "type": "enum", "values": [ "no", "qt", "system" ] }, "host-tools-only": "boolean", - "force-ivigenerator-qtsimulator": "boolean", "force-ivigenerator-qtremoteobjects": "boolean" } }, @@ -75,11 +74,6 @@ "condition": "input.host-tools-only == 'yes'", "output": [ "privateFeature" ] }, - "simulator": { - "label": "QtSimulator Support", - "condition": "module.simulator || input.force-ivigenerator-qtsimulator == 'yes'", - "output": [ "publicFeature" ] - }, "remoteobjects": { "label": "QtRemoteObjects Support", "condition": "module.remoteobjects || input.force-ivigenerator-qtremoteobjects == 'yes'", @@ -107,12 +101,6 @@ E.g. by running the following command: }, { "type": "warning", - "condition": "!features.simulator", - "message": "Cannot enable the QtSimulator Support because the QtSimulator module is not installed. -The QtSimulator Support is needed for the communication between the simulation backends and its control panel(controller)." - }, - { - "type": "warning", "condition": "!features.remoteobjects", "message": "Cannot enable the QtRemoteObjects features because the QtRemoteObjects module is not installed." } @@ -134,7 +122,6 @@ The QtSimulator Support is needed for the communication between the simulation b ] }, "ivigenerator", - "simulator", "remoteobjects" ] }, diff --git a/src/ivicore/doc/qtivi-project.qdocconf b/src/ivicore/doc/qtivi-project.qdocconf index b8703d7..860e836 100644 --- a/src/ivicore/doc/qtivi-project.qdocconf +++ b/src/ivicore/doc/qtivi-project.qdocconf @@ -60,7 +60,7 @@ qhp.QtIvi.subprojects.examples.sortPages = true tagfile = qtivi.tags -depends += qtcore qtwidgets qtdoc qtquick qtqml qtautomotivesuite qtsimulator qtremoteobjects +depends += qtcore qtwidgets qtdoc qtquick qtqml qtautomotivesuite qtremoteobjects navigation.homepage = "Qt Automotive Suite" navigation.landingpage = "Qt IVI" diff --git a/src/ivicore/doc/src/configuration.qdoc b/src/ivicore/doc/src/configuration.qdoc index f8cbad1..b6cdab2 100644 --- a/src/ivicore/doc/src/configuration.qdoc +++ b/src/ivicore/doc/src/configuration.qdoc @@ -50,15 +50,6 @@ summary". \li The IVI Generator provides tooling to generate source code out of IDL files. The IVI Generator comes with a set of templates for specific generation use-cases. \row - \li QtSimulator Support - \keyword feature-qtsimulator - \li QtSimulator module - \li The QtSimulator Support is needed for the communication between the simulation backends and - their control panel (controller). It enhances the built-in templates by also generating - the needed code for the simulation backends to communicate over QtSimulator. In addition, - it also provides a new template to generate a controller application to communicate with - the simulation backend. -\row \li QtRemoteObjects Support \keyword feature-qtremoteobjects \li QtRemoteObjects module diff --git a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc index 9588006..ca72f14 100644 --- a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc +++ b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc @@ -63,7 +63,6 @@ The options and parameters are: \list \li \c frontend \li \c backend_simulator - \li \c control_panel \li \c backend_qtro \li \c server_qtro \li \c <folder> @@ -101,11 +100,6 @@ of projects with a given IDL file: \li Generates a simulation backend for the API first generated by the \c frontend option. This backend serves as a mock implementation. \row - \li \l {Control Panel} {control_panel} - \target control-panel-template - \li Generates a controller application, consisting of a UI and a C++ plugin, that communicate - with the simulation backend generated from the same QFace file using QtSimulator. - \row \li \l {QtRemoteObjects Backend} {backend_qtro} \target backend-qtro-template \li Generates a QtRemoteObjects based backend client for the API first generated by the @@ -411,52 +405,6 @@ QML files. \li Interface-specific QML simulation files. \endtable -\section2 Control Panel - -The control_panel template is only available if the QtSimulator module was found. Please see the -\l{feature-qtsimulator}{Configuration Page} for more information. - -\note Currently the control_panel template doesn't support all qface features. At the moment models -and structs are NOT supported. - -\table - \header - \li File name - \li Purpose - \row - \li "main.cpp" - \li Launcher code loading the QML code and exporting the C++ interface. - \row - \li "main.qml" - \li Main QML file containing the code to load the Control UIs for every interface. - \row - \li "qml.qrc" - \li QRC file for all QML code. - \row - \li "FlagControl.qml" - \li UI Element to control a flag inside a interface. - \row - \li "EnumControl.qml" - \li UI Element to control a enum inside a interface. - \row - \li "{{module|lower|replace('.', '-')}}.pri" - \li A standard Qt \c{.pri} file that contains all the generated files. Use this \c{.pri} - file to include the generated files into a qmake project. - \row - \li "{{module.module_name|lower}}global.h" - \li Standard file with global EXPORT defines. - \row - \li "{{module.module_name|lower}}module.h/cpp" - \li Files defining a module class used for module global variables and types. - \row - \li "{{interface|lower}}.h/cpp" - \li C++ code retrieving and forwarding the state using QtSimulator. - \row - \li "{{module.module_name|lower}}ControlUi.qml" - \li Control UI for this interface. Contains a interface to control every - property and method and log calls to signals. -\endtable - \section2 QtRemoteObjects Backend The backend_qtro template is only available if the QtRemoteObjects module was found. Despite the diff --git a/src/src.pro b/src/src.pro index 0f72fbe..4d9d65e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -50,15 +50,6 @@ QT_FOR_CONFIG += geniviextras geniviextras-private ivicore ivicore-private ivive src_tools_vehiclefunctions-simulation-server.target = sub-vehiclefunctions-simulation-server SUBDIRS += src_tools_vehiclefunctions-simulation-server } - - qtConfig(simulator):qtHaveModule(simulator) { - src_tools_ivivehiclefunctions-controller.subdir = tools/vehiclefunctions-controller - src_tools_ivivehiclefunctions-controller.depends += ivicore - !qtConfig(system-ivigenerator): src_tools_ivivehiclefunctions-controller.depends += sub-ivigenerator - else: src_tools_ivivehiclefunctions-controller.depends += ivicore - src_tools_ivivehiclefunctions-controller.target = sub-ivivehiclefunctions-controller - SUBDIRS += src_tools_ivivehiclefunctions-controller - } } } diff --git a/src/tools/ivigenerator/common/backend_simulation.cpp.tpl b/src/tools/ivigenerator/common/backend_simulation.cpp.tpl index 3ac6ca0..0c1273e 100644 --- a/src/tools/ivigenerator/common/backend_simulation.cpp.tpl +++ b/src/tools/ivigenerator/common/backend_simulation.cpp.tpl @@ -48,10 +48,6 @@ #include <QDebug> #include <QtIviCore/QIviSimulationEngine> -{% if 'simulator' in features %} -#include <QtSimulator> -{% endif %} - {% for property in interface.properties %} {% if property.type.is_model %} {% include "pagingmodel_simulation.cpp.tpl" %} @@ -112,9 +108,6 @@ QT_BEGIN_NAMESPACE {% if interface_zoned %} , m_zones(new QQmlPropertyMap(this)) {% endif %} -{% if 'simulator' in features %} - , mWorker(nullptr) -{% endif %} { //In some cases the engine is unused, this doesn't do any harm if it is still used Q_UNUSED(engine) @@ -186,24 +179,6 @@ void {{class}}::initialize() } {% endif %} -{% if 'simulator' in features %} - mConnection = new QSimulatorConnection(QStringLiteral("{{interface}}"), QVersionNumber(1, 0, 0)); - mConnection->addPeerInfo(QStringLiteral("versionInfo"), QStringLiteral("1.0.0")); - mConnection->addPeerInfo(QStringLiteral("name"), QStringLiteral("{{class}}")); - QString hostname = QSimulatorConnection::simulatorHostName(false); - if (hostname.isEmpty()) { - qWarning() << "SIMULATOR_HOSTNAME environment variable not set! Disabling the QtSimulator connection"; - return; - } - qWarning() << "Connecting to QtSimulator Device:" << hostname; - mWorker = mConnection->connectToHost(hostname, 0xbeef+3); - if (!mWorker) { - qWarning() << "Couldn't connect to QtSimulator Device:" << hostname; - return; - } - - mWorker->addReceiver(this); -{% endif %} emit initializationDone(); } @@ -304,11 +279,6 @@ void {{class}}::addZone(const QString &zone) Q_UNUSED(zone); {% endif %} -{% if 'simulator' in features %} - if (mWorker) - mWorker->call("{{operation}}" {% if function_parameters is not equalto "" %}, {{function_parameters}} {% endif %}); -{% endif %} - qWarning() << "Not implemented!"; //Fake that the reply always succeeded diff --git a/src/tools/ivigenerator/common/backend_simulation.h.tpl b/src/tools/ivigenerator/common/backend_simulation.h.tpl index d778772..5a838f5 100644 --- a/src/tools/ivigenerator/common/backend_simulation.h.tpl +++ b/src/tools/ivigenerator/common/backend_simulation.h.tpl @@ -63,11 +63,6 @@ QT_BEGIN_NAMESPACE -{% if 'simulator' in features %} -class QSimulatorConnection; -class QSimulatorConnectionWorker; -{% endif %} - class QIviSimulationEngine; {% if interface_zoned %} @@ -184,11 +179,6 @@ protected: {% if interface_zoned %} QQmlPropertyMap *m_zones; {% endif %} - -{% if 'simulator' in features %} - QSimulatorConnection *mConnection; - QSimulatorConnectionWorker *mWorker; -{% endif %} }; QT_END_NAMESPACE diff --git a/src/tools/ivigenerator/generate.py b/src/tools/ivigenerator/generate.py index 7e07a87..72cd57c 100755 --- a/src/tools/ivigenerator/generate.py +++ b/src/tools/ivigenerator/generate.py @@ -64,7 +64,7 @@ Filters.classPrefix = '' currentQFaceSrcFile = '' builtin_config = {} -IVI_DEFAULT_TEMPLATES = ['frontend', 'backend_simulator', 'generation_validator', 'control_panel', 'backend_qtro', 'server_qtro', 'server_qtro_simulator', 'test'] +IVI_DEFAULT_TEMPLATES = ['frontend', 'backend_simulator', 'generation_validator', 'backend_qtro', 'server_qtro', 'server_qtro_simulator', 'test'] def jinjaTrace(): """ diff --git a/src/tools/ivigenerator/ivigenerator.pro b/src/tools/ivigenerator/ivigenerator.pro index 9f28262..76ccc96 100644 --- a/src/tools/ivigenerator/ivigenerator.pro +++ b/src/tools/ivigenerator/ivigenerator.pro @@ -65,21 +65,6 @@ templates_generation_validator.files += \ templates_generation_validator/validationstatus.h.tpl templates_generation_validator.path = $$[QT_HOST_BINS]/ivigenerator/templates_generation_validator -templates_control_panel.files += \ - templates_control_panel/EnumControl.qml.tpl \ - templates_control_panel/FlagControl.qml.tpl \ - templates_control_panel/global.h.tpl \ - templates_control_panel/interface.cpp.tpl \ - templates_control_panel/interface.h.tpl \ - templates_control_panel/interface.qml.tpl \ - templates_control_panel/main.cpp.tpl \ - templates_control_panel/main.qml.tpl \ - templates_control_panel/module.cpp.tpl \ - templates_control_panel/module.h.tpl \ - templates_control_panel/qml.qrc.tpl \ - templates_control_panel/ui.pri.tpl -templates_control_panel.path = $$[QT_HOST_BINS]/ivigenerator/templates_control_panel - templates_backend_qtro.files += \ templates_backend_qtro/backend.cpp.tpl \ templates_backend_qtro/backend.h.tpl \ @@ -124,11 +109,6 @@ generator.files += \ generator.path = $$[QT_HOST_BINS]/ivigenerator -qtConfig(simulator) { - generator.files += templates_control_panel.yaml - INSTALLS += templates_control_panel -} - qtConfig(remoteobjects) { generator.files += templates_backend_qtro.yaml \ templates_server_qtro.yaml \ diff --git a/src/tools/ivigenerator/templates_control_panel.yaml b/src/tools/ivigenerator/templates_control_panel.yaml deleted file mode 100644 index 31aa682..0000000 --- a/src/tools/ivigenerator/templates_control_panel.yaml +++ /dev/null @@ -1,27 +0,0 @@ -generate_rules: - module_rules: - - dest_file: 'main.cpp' - template_file: 'main.cpp.tpl' - - dest_file: 'main.qml' - template_file: 'main.qml.tpl' - - dest_file: 'qml.qrc' - template_file: 'qml.qrc.tpl' - - dest_file: "{{srcBase|lower}}.pri" - template_file: "ui.pri.tpl" - - dest_file: "{{module.module_name|lower}}global.h" - template_file: "global.h.tpl" - - dest_file: "{{module.module_name|lower}}module.h" - template_file: "module.h.tpl" - - dest_file: "{{module.module_name|lower}}module.cpp" - template_file: "module.cpp.tpl" - - dest_file: "FlagControl.qml" - template_file: "FlagControl.qml.tpl" - - dest_file: "EnumControl.qml" - template_file: "EnumControl.qml.tpl" - interface_rules: - - dest_file: '{{interface}}ControlUi.qml' - template_file: 'interface.qml.tpl' - - dest_file: '{{interface|lower}}.cpp' - template_file: 'interface.cpp.tpl' - - dest_file: '{{interface|lower}}.h' - template_file: 'interface.h.tpl' diff --git a/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl b/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl deleted file mode 100644 index 9f517e6..0000000 --- a/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl +++ /dev/null @@ -1,31 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.1 - -ComboBox { - id: root - - property var value: 0 - - FontMetrics { - font: root.font - id: _metrics - } - - Binding { - target: root - property: "value" - value: model.get(currentIndex).value - } - - onValueChanged: { - for(var i=0; i<model.count; i++) { - if (model.get(i).value == value) { - //Make the ComboBox as big as it's content - root.implicitWidth = _metrics.boundingRect(model.get(i).key).width + 100 - currentIndex = i; - return; - } - } - console.warn("Couldn't find the value in the EnumControl model: " + value); - } -} diff --git a/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl b/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl deleted file mode 100644 index 9e5abc6..0000000 --- a/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl +++ /dev/null @@ -1,29 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.1 - -RowLayout { - id: root - property alias model: repeater.model - property int value - property string textRole - - spacing: 2 - - Repeater { - id: repeater - RowLayout { - Text { text: model[textRole] } - CheckBox { - id: checkBox - checked: root.value & model.value; - onClicked: { - if (checked) - root.value |= model.value - else - root.value &= ~model.value - } - } - } - } -} diff --git a/src/tools/ivigenerator/templates_control_panel/global.h.tpl b/src/tools/ivigenerator/templates_control_panel/global.h.tpl deleted file mode 100644 index f2be24c..0000000 --- a/src/tools/ivigenerator/templates_control_panel/global.h.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{# -# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -# 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 -#} -{% set exportsymbol = '{0}'.format(module.module_name|upper) %} -{% set oncedefine = '{0}GLOBAL_H_'.format(exportsymbol) %} -{% include 'generated_comment.cpp.tpl' %} - -#ifndef {{oncedefine}} -#define {{oncedefine}} - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -#ifndef QT_STATIC -# if defined(QT_BUILD_{{exportsymbol}}_LIB) -# define Q_QT{{exportsymbol}}_EXPORT Q_DECL_EXPORT -# else -# define Q_QT{{exportsymbol}}_EXPORT Q_DECL_IMPORT -# endif -#else -# define Q_QT{{exportsymbol}}_EXPORT -#endif - -QT_END_NAMESPACE - -#endif // {{oncedefine}} diff --git a/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl deleted file mode 100644 index bea74d4..0000000 --- a/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl +++ /dev/null @@ -1,268 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG. -# 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 'qtivi_macros.j2' as ivi %} -{% set class = '{0}'.format(interface) %} -{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %} -{% include 'generated_comment.cpp.tpl' %} - -#include "{{class|lower}}.h" - -#include <QQmlEngine> -#include <QDebug> -#include <QtSimulator> - -namespace { -const QString INITIAL_MAIN_ZONE = "MainZone"; -} - -QT_BEGIN_NAMESPACE - -{% if interface.tags.config.zoned %} -{{class}}::{{class}}(const QString &zone, QObject *parent) - : QObject(parent) - {% for property in interface.properties %} - , m_{{ property }}({{property|default_value}}) - {% endfor %} - , m_currentZone(zone) -{ - if (!zone.isEmpty()) { - return; - } - - //Add ourself to the available zones to make it available to the UI and still keep the code clean - m_zoneHash.insert(INITIAL_MAIN_ZONE, this); - m_zoneMap.insert(INITIAL_MAIN_ZONE, QVariant::fromValue(this)); - - {% set zones = interface.tags.config_simulator.zones if interface.tags.config_simulator else {} %} - {% for zone_id in zones %} - addZone(QLatin1String("{{zone_id}}")); - {% for property in interface.properties %} - {% if not property.type.is_model %} - {% if property.tags.config_simulator and property.tags.config_simulator.zoned %} - m_zoneHash[QLatin1String("{{zone_id}}")]->m_{{property}} = {{property|default_value(zone_id)}}; - {% endif %} - {% endif %} - {% endfor %} - {% endfor %} -{% else %} -{{class}}::{{class}}(QObject *parent) - : QObject(parent) -{ -{% endif %} - QVariantMap peerInfo{{ '{{' }}"control_panel",""{{ '}}' }}; - QSimulatorServer *server = {{module.module_name}}Module::simulationServer(); - server->registerServer("{{interface}}", QVersionNumber(1, 0, 0), peerInfo, [=](QSimulatorConnectionWorker *client) { - m_worker = client; - connect(m_worker, &QSimulatorConnectionWorker::disconnected, this, [=]() { - qDebug() << "DISCONNECTED"; - //Deleting it on the mainZone is enough as QPointer does the rest of the work for us. - m_worker = 0; - }); - m_worker->addReceiver(this); - qDebug() << "connected: " << client->peerInfo(); -{% if interface.tags.config.zoned %} - auto i = m_zoneHash.constBegin(); - while (i != m_zoneHash.constEnd()) { - i.value()->m_worker = client; -{% for property in interface.properties %} -{% if not property.type.is_model %} -{% set function_name = property|setter_name %} -{% if property.readonly or property.const %} -{% set function_name = property.name + 'Changed' %} -{% endif %} - m_worker->call("{{function_name}}", i.value()->m_{{property}}, i.value()->m_currentZone); -{% endif %} -{% endfor %} - ++i; - } -{% else %} -{% for property in interface.properties %} -{% if not property.type.is_model %} -{% set function_name = property|setter_name %} -{% if property.readonly or property.const %} -{% set function_name = property.name + 'Changed' %} -{% endif %} - m_worker->call("{{function_name}}", m_{{property}}); -{% endif %} -{% endfor %} -{% endif %} - }); -} - -{{class}}::~{{class}}() -{ -} - -void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion, const QString& qmlName) -{ -{% if 'singleton' in interface.tags %} - qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}", {{class|lower}}_singletontype_provider); -{% else %} - qmlRegisterType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, qmlName.toLatin1()); -{% endif %} -} - -{% if interface.tags.config.zoned %} -void {{class}}::addZone(const QString &newZone) -{ - if (!m_currentZone.isEmpty()) { - qWarning("Adding a new zone is only possible from the root zone."); - return; - } - - if (m_zoneHash.contains(newZone)) - return; - - {{class}} *zoneObject = new {{class}}(newZone, this); - zoneObject->m_worker = m_worker; - m_zoneHash.insert(newZone, zoneObject); - m_zoneMap.insert(newZone, QVariant::fromValue(zoneObject)); - - emit zonesChanged(); -} - -QStringList {{class}}::zones() const -{ - return m_zoneMap.keys(); -} - - -QString {{class}}::currentZone() const -{ - return m_currentZone; -} - -QVariantMap {{class}}::zoneAt() const -{ - return m_zoneMap; -} -{% endif %} - -{% for property in interface.properties %} -{% if not property.type.is_model %} -{{ivi.prop_getter(property, class)}} -{ - return m_{{property}}; -} - -{{ivi.prop_setter(property, class)}} -{ - if (m_{{property}} == {{property}}) - return; - m_{{property}} = {{property}}; - emit {{property}}Changed({{property}}); - auto w = worker(); - if (w) -{% set function_name = property|setter_name %} -{% if property.readonly or property.const %} -{% set function_name = property.name + 'Changed' %} -{% endif %} -{% if interface.tags.config.zoned %} - w->call("{{function_name}}", {{property}}, m_currentZone); -{% else %} - w->call("{{function_name}}", {{property}}); -{% endif %} -} - -{% if interface.tags.config.zoned %} -{{ivi.prop_setter(property, class, true)}} -{ - QString z = zone; - if (z.isEmpty()) - z = INITIAL_MAIN_ZONE; - - if (!m_zoneMap.contains(z)) { - return; - } - - // the setter cannot be used as it would update the simulation connection - // and by this create a async loop - if (m_zoneHash[z]->m_{{property}} == {{property}}) - return; - m_zoneHash[z]->m_{{property}} = {{property}}; - emit m_zoneHash[z]->{{property}}Changed({{property}}); -} -{% endif %} - -{% endif %} -{% endfor %} - -{% for signal in interface.signals %} -{{ivi.signal(signal, class)}} -{ - auto w = worker(); - if (w) - w->call("{{signal}}", {{signal.parameters|join(', ')}}{% if interface.tags.config.zoned %}, m_currentZone{% endif %}); -} - -{% endfor %} - -{% if interface_zoned %} -{% for operation in interface.operations %} -void {{class}}::{{operation}}({{ivi.join_params(operation, zoned=true)}}) -{ - QString z = zone; - if (z.isEmpty()) - z = INITIAL_MAIN_ZONE; - - if (!m_zoneMap.contains(z)) { - return; - } - - emit m_zoneHash[z]->{{operation}}({{operation.parameters|join(', ')}}); -} -{% endfor %} -{% endif %} - -QSimulatorConnectionWorker *{{class}}::worker() -{ -{% if interface.tags.config.zoned %} - if (m_currentZone.isEmpty()) - return m_worker; - {{class}}* globalZone = qobject_cast<{{class}}*>(parent()); - if (globalZone) - return globalZone->m_worker; - return nullptr; -{% else %} - return m_worker; -{% endif %} -} - -QT_END_NAMESPACE diff --git a/src/tools/ivigenerator/templates_control_panel/interface.h.tpl b/src/tools/ivigenerator/templates_control_panel/interface.h.tpl deleted file mode 100644 index 7c86740..0000000 --- a/src/tools/ivigenerator/templates_control_panel/interface.h.tpl +++ /dev/null @@ -1,147 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG. -# 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 'qtivi_macros.j2' as ivi %} -{% set class = '{0}'.format(interface) %} -{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %} -{% set exportsymbol = 'Q_QT{0}_EXPORT'.format(module.module_name|upper) %} -{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %} -{% include 'generated_comment.cpp.tpl' %} - -#ifndef {{oncedefine}} -#define {{oncedefine}} - -#include "{{module.module_name|lower}}module.h" - -#include <QObject> -#include <QHash> -#include <QVariantMap> - -QT_BEGIN_NAMESPACE - -class {{class}}Private; -class {{class}}BackendInterface; -class QSimulatorConnectionWorker; - -class {{exportsymbol}} {{class}} : public QObject { - Q_OBJECT -{% if interface_zoned %} - Q_PROPERTY(QString currentZone READ currentZone NOTIFY currentZoneChanged) - Q_PROPERTY(QStringList zones READ zones NOTIFY zonesChanged) - Q_PROPERTY(QVariantMap zoneAt READ zoneAt NOTIFY zonesChanged) -{% endif %} -{% for property in interface.properties %} -{% if not property.type.is_model %} - Q_PROPERTY({{property|return_type}} {{property}} READ {{property|getter_name}} WRITE {{property|setter_name}} NOTIFY {{property}}Changed) -{% endif %} -{% endfor %} - Q_CLASSINFO("IviPropertyDomains", "{{ interface.properties|json_domain|replace("\"", "\\\"") }}") -public: -{% if interface_zoned %} - explicit {{class}}(const QString &zone = QString(), QObject *parent = nullptr); -{% else %} - explicit {{class}}(QObject *parent = nullptr); -{% endif %} - ~{{class}}(); - - static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0, const QString& qmlName = ""); - -{% if interface_zoned %} - Q_INVOKABLE void addZone(const QString& newZone); - QString currentZone() const; - QStringList zones() const; - QVariantMap zoneAt() const; -{% endif %} -{% for property in interface.properties %} -{% if not property.type.is_model %} - {{ivi.prop_getter(property)}}; -{% endif %} -{% endfor %} - -public Q_SLOTS: -{% for property in interface.properties %} -{% if not property.type.is_model %} - {{ivi.prop_setter(property)}}; -{% if interface_zoned %} - {{ivi.prop_setter(property, zoned = true)}}; -{% endif %} -{% endif %} -{% endfor %} -{% for signal in interface.signals %} - {{ivi.signal(signal)}}; -{% endfor %} - -Q_SIGNALS: -{% for operation in interface.operations %} - void {{operation}}({{ivi.join_params(operation)}}); -{% endfor %} -{% if interface_zoned %} - void currentZoneChanged(); - void zonesChanged(); -{% endif %} -{% for property in interface.properties %} -{% if not property.type.is_model %} - {{ivi.prop_notify(property)}}; -{% endif %} -{% endfor %} - -private Q_SLOTS: -{% if interface_zoned %} -{% for operation in interface.operations %} - void {{operation}}({{ivi.join_params(operation, zoned=true)}}); -{% endfor %} -{% endif %} -private: - QSimulatorConnectionWorker *worker(); -{% for property in interface.properties %} -{% if not property.type.is_model %} - {{ property|return_type }} m_{{ property }}; -{% endif %} -{% endfor %} -{% if interface_zoned %} - QHash<QString,{{class}}*> m_zoneHash; - QVariantMap m_zoneMap; - QString m_currentZone; -{% endif %} - QSimulatorConnectionWorker *m_worker; -}; - -QT_END_NAMESPACE - -#endif // {{oncedefine}} diff --git a/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl b/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl deleted file mode 100644 index 450f854..0000000 --- a/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl +++ /dev/null @@ -1,190 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG -# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -# 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 -#} -{% include "generated_comment.cpp.tpl" %} -{% set backend_obj = '{0}{1}Id'.format(interface, 'Object') %} -{% set backend_obj = backend_obj[0].lower() + backend_obj[1:] %} -import QtQuick 2.7 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.1 -import QtIvi.ControlPanel 1.0 - -Flickable { - id: {{interface|lowerfirst}} - flickableDirection: Flickable.VerticalFlick - clip: true - ScrollBar.vertical: ScrollBar {} - contentHeight: layout.childrenRect.height - - {{interface|qml_type}} { - id: {{backend_obj}} - } - -{% if interface.tags.config.zoned %} - property {{interface|qml_type}} currentZoneObject: {{backend_obj}}.zoneAt[comboZones.displayText] -{% endif %} - - ColumnLayout { - id: layout - anchors.fill: parent -{% if interface.tags.config.zoned %} - RowLayout { - Text { - text: "Zone: " - } - ComboBox { - width: 250 - id: comboZones - editable: true - model: {{backend_obj}}.zones - currentIndex: {{backend_obj}}.zones.indexOf("MainZone") - } - Button { - text:"+" - width: 20 - height: 20 - onClicked: { - var zoneName = comboZones.editText; - {{backend_obj}}.addZone(zoneName) - } - } - } -{% endif %} - - ToolSeparator { - Layout.fillWidth: true - orientation: Qt.Horizontal - } - -{% for property in interface.properties %} -{% if interface.tags.config.zoned %} -{% set backend_obj = 'currentZoneObject' %} -{% endif %} - RowLayout { - height: 30 - Layout.fillWidth: true - Text { - text: "{{property|upperfirst}}: " - } - - Connections { - target: {{property|lowerfirst}}Control - on{{property|qml_binding_property|upperfirst}}Changed: { - {{backend_obj}}.{{property}} = {{property|lowerfirst}}Control.{{property|qml_binding_property}} - } - } - - Binding { - target: {{property|lowerfirst}}Control - property: "{{property|qml_binding_property}}" - value: {{backend_obj}}.{{property}} - } - - {{property|qml_control(backend_obj)}} - } -{% endfor %} -{% if interface.signals|count %} - ToolSeparator { - orientation: Qt.Horizontal - Layout.fillWidth: true - } - - Text { - text: "Signals" - } -{% for signal in interface.signals %} - // Button for signal call - RowLayout { - spacing: 2 - height: 20 - Button { - text: "{{signal}}" - onClicked: {{backend_obj}}.{{signal}}({{signal|qml_control_signal_parameters}}); - } -{% for param in signal.parameters %} - Text { - text: "{{param}}" - } - {{param|qml_control(backend_obj)}} - -{% endfor%} - } -{% endfor %} -{% endif %} -{% if interface.operations|count %} - - ToolSeparator { - orientation: Qt.Horizontal - Layout.fillWidth: true - } - - Text { - text: "Operations" - } - - TextArea { - id: operationArea - readOnly: true - placeholderText: "The called operations will be logged here" - Layout.fillWidth: true - } -{% for operation in interface.operations %} -{% if interface.tags.config.zoned %} -{% set backend_obj = 'currentZoneObject' %} -{% endif %} - Connections { - target: {{backend_obj}} - on{{operation|upperfirst}}: { - operationArea.text += "{{operation}}(" -{% for parameter in operation.parameters %} - + "{{parameter}}: " + {{parameter}} -{% endfor %} - + ")\n" - } - } -{% endfor %} -{% endif %} - Item { - //spacer - Layout.fillHeight: true - } - } -} diff --git a/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl deleted file mode 100644 index 3eb02d5..0000000 --- a/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl +++ /dev/null @@ -1,74 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG -# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -# 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 -#} -{% include "generated_comment.cpp.tpl" %} - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QCommandLineParser> - -#include "{{module.module_name|lower}}module.h" -{% for iface in module.interfaces %} -#include "{{iface|lower}}.h" -{% endfor %} - - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - QCoreApplication::setApplicationName("{{module}} Control Panel"); - QCoreApplication::setApplicationVersion("{{module.version}}"); - - QCommandLineParser parser; - parser.setApplicationDescription("{{module}} Control Panel for controlling {{module}} simulation backends"); - parser.addHelpOption(); - parser.addVersionOption(); - parser.process(app); - - {{module.module_name}}Module::registerTypes(); -{% for interface in module.interfaces %} - {{interface}}::registerQmlTypes(QLatin1String("QtIvi.ControlPanel"), 1, 0, - QLatin1String("{{interface|qml_type}}")); -{% endfor %} - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/src/tools/ivigenerator/templates_control_panel/main.qml.tpl b/src/tools/ivigenerator/templates_control_panel/main.qml.tpl deleted file mode 100644 index 184d16f..0000000 --- a/src/tools/ivigenerator/templates_control_panel/main.qml.tpl +++ /dev/null @@ -1,79 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG -# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -# 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 -#} -{% include "generated_comment.cpp.tpl" %} - -import QtQuick 2.7 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.3 -import QtIvi.ControlPanel 1.0 - -ApplicationWindow { - visible: true - width: 640 - height: 800 - title: qsTr("QtIVI {{module.module_name}}") - - ColumnLayout { - anchors.fill: parent - anchors.margins: 5 - - TabBar { - id: bar - Layout.fillWidth: true - {% for interface in module.interfaces %} - TabButton { - text: "{{interface|qml_type}}" - } - {% endfor %} - } - - StackLayout { - Layout.fillWidth: true - currentIndex: bar.currentIndex - {% for interface in module.interfaces %} - {{interface}}ControlUi { - id: {{interface|lowerfirst}} - } - {% endfor %} - } - } -} diff --git a/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl deleted file mode 100644 index 19ad7cb..0000000 --- a/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl +++ /dev/null @@ -1,144 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG. -# 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 'qtivi_macros.j2' as ivi %} -{% set class = '{0}Module'.format(module.module_name) %} -{% include 'generated_comment.cpp.tpl' %} - -#include "{{class|lower}}.h" -{% for interface in module.interfaces %} -#include "{{interface|lower}}.h" -{% endfor %} -#include <QQmlEngine> -#include <QDebug> -#include <QDataStream> -#include <QtSimulator> - -QT_BEGIN_NAMESPACE - -/*! \internal */ -QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*) -{ - return nullptr; //new {{class}}Factory(); -} - -/*! - \class {{class}} - \inmodule {{module}} - -{{ ivi.format_comments(module.comment) }} -*/ -{{class}}::{{class}}(QObject *parent) - : QObject(parent) -{ -} - -{% for enum in module.enums %} -{{class}}::{{enum}} {{class}}::to{{enum}}(quint8 v, bool *ok) { - if (ok) { - *ok = true; - } - switch (v) { -{% for member in enum.members %} - case {{member.value}}: return {{member.name}}; -{% endfor %} - default: - if (ok) { - *ok = false; - } - return {{enum.members|first}}; - } -} -{% endfor %} - -/*! \internal */ -void {{class}}::registerTypes() -{ -{% for enum in module.enums %} - qRegisterMetaType<{{class}}::{{enum|flag_type}}>(); - qRegisterMetaTypeStreamOperators<{{class}}::{{enum|flag_type}}>(); -{% endfor %} -} - -/*! \internal */ -void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion) -{ - qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, - "{{module.module_name}}Module", - {{class|lower}}_singletontype_provider); -{% for interface in module.interfaces %} - {{interface}}::registerQmlTypes(uri, majorVersion, minorVersion); -{% endfor %} -} - -QSimulatorServer *{{class}}::simulationServer() -{ - static QSimulatorServer *server = nullptr; - - if (!server) { - server = new QSimulatorServer; - QString error; - server->startServer(0xbeef+3, &error); - if (!error.isEmpty()) - qWarning("ERROR: %s", qPrintable(error)); - } - - return server; -} - -{% for enum in module.enums %} -QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var) -{ - out << (quint8)var; - return out; -} -QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var) -{ - bool ok; - quint8 val; - in >> val; - var = {{class}}::to{{enum}}(val, &ok); - if (!ok) { - qWarning() << "Received an invalid enum value for type {{class}}::{{enum|flag_type}}, value =" << var; - } - return in; -} -{% endfor %} - -QT_END_NAMESPACE diff --git a/src/tools/ivigenerator/templates_control_panel/module.h.tpl b/src/tools/ivigenerator/templates_control_panel/module.h.tpl deleted file mode 100644 index b129895..0000000 --- a/src/tools/ivigenerator/templates_control_panel/module.h.tpl +++ /dev/null @@ -1,87 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG. -# 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 -#} -{% set exportsymbol = 'Q_QT{0}_EXPORT'.format(module.module_name|upper) %} -{% set class = '{0}Module'.format(module.module_name) %} -{% set oncedefine = '{0}_H_'.format(class|upper) %} -{% include 'generated_comment.cpp.tpl' %} - -#ifndef {{oncedefine}} -#define {{oncedefine}} - -#include "{{module.module_name|lower}}global.h" -#include <QObject> - -QT_BEGIN_NAMESPACE -class QSimulatorServer; - -class {{exportsymbol}} {{class}} : public QObject { - Q_OBJECT -public: - {{class}}(QObject *parent=0); - -{% for enum in module.enums %} - enum {{enum}} { - {% for member in enum.members %} - {{member.name}} = {{member.value}}, {{member.comment}} - {% endfor %} - }; -{% if enum.is_flag %} - Q_DECLARE_FLAGS({{enum|flag_type}}, {{enum}}) - Q_FLAG({{enum|flag_type}}) -{% else %} - Q_ENUM({{enum}}) -{% endif %} - static {{enum}} to{{enum}}(quint8 v, bool *ok); -{% endfor %} - - static void registerTypes(); - static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0); - - static QSimulatorServer *simulationServer(); -}; - -{% for enum in module.enums %} -QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var); -QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var); -{% endfor %} - -QT_END_NAMESPACE - -#endif // {{oncedefine}} diff --git a/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl b/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl deleted file mode 100644 index 837dc6e..0000000 --- a/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl +++ /dev/null @@ -1,50 +0,0 @@ -{# -# Copyright (C) 2019 Luxoft Sweden AB -# Copyright (C) 2018 Pelagicore AG -# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -# 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 -#} -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>EnumControl.qml</file> - <file>FlagControl.qml</file> -{% for interface in module.interfaces %} - <file>{{interface}}ControlUi.qml</file> -{% endfor %} - </qresource> -</RCC> diff --git a/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl b/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl deleted file mode 100644 index f96eacc..0000000 --- a/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################# -## This is an auto-generated file. -## Do not edit! All changes made to it will be lost. -############################################################################# - -DEFINES += QT_BUILD_{{module.module_name|upper}}_LIB - -SOURCES += \ - $$PWD/main.cpp \ -{% for interface in module.interfaces %} - $$PWD/{{interface|lower}}.cpp \ -{% endfor %} - $$PWD/{{module.module_name|lower}}module.cpp - -HEADERS += \ -{% for interface in module.interfaces %} - $$PWD/{{interface|lower}}.h \ -{% endfor %} - $$PWD/{{module.module_name|lower}}module.h \ - $$PWD/{{module.module_name|lower}}global.h - -RESOURCES += $$PWD/qml.qrc -QT *= simulator diff --git a/src/tools/ivigenerator/templates_server_qtro_simulator/server.pri.tpl b/src/tools/ivigenerator/templates_server_qtro_simulator/server.pri.tpl index 4148df8..f13e202 100644 --- a/src/tools/ivigenerator/templates_server_qtro_simulator/server.pri.tpl +++ b/src/tools/ivigenerator/templates_server_qtro_simulator/server.pri.tpl @@ -42,9 +42,6 @@ ############################################################################# QT += remoteobjects -{% if 'simulator' in features %} -QT += simulator -{% endif %} HEADERS += \ {% for interface in module.interfaces %} diff --git a/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro b/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro deleted file mode 100644 index 08a1545..0000000 --- a/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro +++ /dev/null @@ -1,10 +0,0 @@ -TARGET = ivivehiclefunctions-controller -TEMPLATE = app -CONFIG += ivigenerator - -QT += core quick - -load(qt_tool) - -QFACE_FORMAT = control_panel -QFACE_SOURCES = ../../ivivehiclefunctions/ivivehiclefunctions.qface |