aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2019-07-25 12:54:06 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2019-08-01 17:40:11 +0200
commit013230e3101cec6894cd8c187d07a4a9c2fc0053 (patch)
tree4b396247b990474d5b7f402d94163948ba8fe25d
parent434fa38eb6f7e3562bdce5290370933175efb225 (diff)
Add a IVI Generator Tutorial
The tutorial has multiple chapters and shows how to extend a UI step-by-step with a Middleware API using the IVI Generator. Fixes: AUTOSUITE-1155 Fixes: AUTOSUITE-600 Change-Id: Ib18de9e3d53d7163f880a2258173e0b6119ef3af Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r--examples/ivicore/ivicore.pro2
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/chapter1-basics.pro8
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface5
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Cluster.qml99
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp68
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/chapter2-enums-structs.pro8
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface21
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Cluster.qml104
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/main.cpp68
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro20
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/chapter3-simulation-backend.pro12
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/imports/imports.pro24
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster.qface21
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Cluster.qml104
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/main.cpp66
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/backend_simulator.pro23
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml147
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qrc6
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/chapter4-simulation-behavior.pro12
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/imports/imports.pro24
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface23
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Cluster.qml104
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/main.cpp66
-rw-r--r--examples/ivicore/qface-tutorial/chapter4-simulation-behavior/miles.json9
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/backend_qtro/backend_qtro.pro17
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/backend_simulator.pro23
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qml146
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qrc6
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/chapter5-ipc.pro16
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/imports/imports.pro24
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster.qface23
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Cluster.qml104
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/main.cpp66
-rw-r--r--examples/ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/backend_dbus.pro32
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentcluster_dbus.json5
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp255
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.h97
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.cpp73
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.h77
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/backend_simulator.pro23
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qml146
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qrc6
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/chapter6-own-backend.pro16
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/dbus_conversion.h113
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/demo_server.pro24
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.cpp166
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.h111
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.xml55
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/main.cpp74
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/frontend/frontend.pro13
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/imports/imports.pro24
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster.qface23
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Cluster.qml104
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/instrument-cluster.pro19
-rw-r--r--examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/main.cpp66
-rw-r--r--examples/ivicore/qface-tutorial/images/+--.pngbin0 -> 239 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/P-R-N-D.pngbin0 -> 1640 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/dial_cursor.pngbin0 -> 11800 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/dial_cursor_right.pngbin0 -> 4197 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/dial_fill_color.pngbin0 -> 13739 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/dial_fill_color_left.pngbin0 -> 19930 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/dial_pattern.pngbin0 -> 52069 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/fuel.pngbin0 -> 2952 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/fuel_level.pngbin0 -> 8204 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/fuelsymbol_orange.pngbin0 -> 509 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/images.qrc20
-rw-r--r--examples/ivicore/qface-tutorial/images/left_dial.pngbin0 -> 124280 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/mask_overlay.pngbin0 -> 16841 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/middle-bkg.pngbin0 -> 8009 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/middle-circle.pngbin0 -> 10262 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/right_dial.pngbin0 -> 83034 bytes
-rw-r--r--examples/ivicore/qface-tutorial/images/top_bar.pngbin0 -> 6066 bytes
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/Cluster.qml94
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/Dial.qml119
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/Fuel.qml82
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/Label.qml84
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/LeftDial.qml121
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/RightDial.qml228
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/Top.qml131
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/app.qrc11
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/instrument-cluster.pro8
-rw-r--r--examples/ivicore/qface-tutorial/instrument-cluster/main.cpp65
-rw-r--r--examples/ivicore/qface-tutorial/qface-tutorial.pro10
-rw-r--r--src/ivicore/doc/images/examples_qface_tutorial.pngbin0 -> 163657 bytes
-rw-r--r--src/ivicore/doc/images/examples_qface_tutorial_final.gifbin0 -> 395076 bytes
-rw-r--r--src/ivicore/doc/qtivi-project.qdocconf4
-rw-r--r--src/ivicore/doc/src/examples-qface-tutorial.qdoc718
140 files changed, 9520 insertions, 1 deletions
diff --git a/examples/ivicore/ivicore.pro b/examples/ivicore/ivicore.pro
index e5895e5..4d47b4f 100644
--- a/examples/ivicore/ivicore.pro
+++ b/examples/ivicore/ivicore.pro
@@ -6,3 +6,5 @@ qtConfig(ivigenerator) {
qface-ivi-addressbook
}
qtConfig(ivigenerator): qtConfig(remoteobjects): SUBDIRS += qface-ivi-remote
+
+qtConfig(ivigenerator): qtConfig(remoteobjects): SUBDIRS += qface-tutorial
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/chapter1-basics.pro b/examples/ivicore/qface-tutorial/chapter1-basics/chapter1-basics.pro
new file mode 100644
index 0000000..242571e
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/chapter1-basics.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+
+instrument-cluster.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter1-basics/frontend/frontend.pro
new file mode 100644
index 0000000..d80cc92
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter1-basics
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
new file mode 100644
index 0000000..62dc847
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
@@ -0,0 +1,5 @@
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ int speed;
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..cbdd138
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Cluster.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 1")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: 3000
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: 15
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..1e6c3e4
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter1-basics
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter1-basics/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp
new file mode 100644
index 0000000..f291fce
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include "instrumentclustermodule.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ InstrumentClusterModule::registerQmlTypes();
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/chapter2-enums-structs.pro b/examples/ivicore/qface-tutorial/chapter2-enums-structs/chapter2-enums-structs.pro
new file mode 100644
index 0000000..242571e
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/chapter2-enums-structs.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+
+instrument-cluster.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter2-enums-structs/frontend/frontend.pro
new file mode 100644
index 0000000..a899222
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter2-enums-structs
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
new file mode 100644
index 0000000..5e74475
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
@@ -0,0 +1,21 @@
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ readonly int speed;
+ readonly int rpm;
+ readonly real fuel;
+ readonly real temperature;
+ readonly SystemType systemType;
+ readonly Warning currentWarning;
+}
+
+enum SystemType {
+ Imperial,
+ Metric
+}
+
+struct Warning {
+ string color
+ string text
+ string icon
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..1f73533
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Cluster.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 2")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ metricSystem: instrumentCluster.systemType === InstrumentCluster.Metric
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: instrumentCluster.rpm
+ warningColor: instrumentCluster.currentWarning.color
+ warningText: instrumentCluster.currentWarning.text
+ warningIcon: instrumentCluster.currentWarning.icon
+ fuelLevel: instrumentCluster.fuel
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: instrumentCluster.temperature
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..32a9570
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter2-enums-structs
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/main.cpp
new file mode 100644
index 0000000..f291fce
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include "instrumentclustermodule.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ InstrumentClusterModule::registerQmlTypes();
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..ef80b73
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro
@@ -0,0 +1,20 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_simulation)
+DESTDIR = ../qtivi
+
+QT += core ivicore
+CONFIG += ivigenerator plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../instrument-cluster.qface
+PLUGIN_TYPE = qtivi
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter3-simulation-backend
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/chapter3-simulation-backend.pro b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/chapter3-simulation-backend.pro
new file mode 100644
index 0000000..ccb1fdd
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/chapter3-simulation-backend.pro
@@ -0,0 +1,12 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+ backend_simulator \
+ imports \
+
+instrument-cluster.depends = frontend
+backend_simulator.depends = frontend
+imports.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/frontend/frontend.pro
new file mode 100644
index 0000000..28073c8
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter3-simulation-backend
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/imports/imports.pro b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/imports/imports.pro
new file mode 100644
index 0000000..9b26bad
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/imports/imports.pro
@@ -0,0 +1,24 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += ivicore
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = qmlplugin
+QFACE_SOURCES = ../instrument-cluster.qface
+
+load(ivigenerator)
+
+DESTDIR = $$OUT_PWD/$$replace(URI, \\., /)
+
+exists($$OUT_PWD/qmldir) {
+ cpqmldir.files = $$OUT_PWD/qmldir \
+ $$OUT_PWD/plugins.qmltypes
+ cpqmldir.path = $$DESTDIR
+ cpqmldir.CONFIG = no_check_exist
+ COPIES += cpqmldir
+}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter3-simulation-backend/imports
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster.qface
new file mode 100644
index 0000000..e0a1ea3
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster.qface
@@ -0,0 +1,21 @@
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ readonly int speed;
+ readonly int rpm;
+ readonly int fuel;
+ readonly real temperature;
+ readonly SystemType systemType;
+ readonly Warning currentWarning;
+}
+
+enum SystemType {
+ Imperial,
+ Metric
+}
+
+struct Warning {
+ string color
+ string text
+ string icon
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..cd7dd95
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Cluster.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 3")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ metricSystem: instrumentCluster.systemType === InstrumentCluster.Metric
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: instrumentCluster.rpm
+ warningColor: instrumentCluster.currentWarning.color
+ warningText: instrumentCluster.currentWarning.text
+ warningIcon: instrumentCluster.currentWarning.icon
+ fuelLevel: instrumentCluster.fuel
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: instrumentCluster.temperature
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..6cfaacb
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter3-simulation-backend
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/main.cpp
new file mode 100644
index 0000000..57b00b6
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter3-simulation-backend/instrument-cluster/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.addImportPath(app.applicationDirPath() + "/imports");
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..73e020f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/backend_simulator.pro
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_simulation)
+DESTDIR = ../qtivi
+
+QT += core ivicore
+CONFIG += ivigenerator plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../instrument-cluster.qface
+PLUGIN_TYPE = qtivi
+
+RESOURCES += \
+ simulation.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter4-simulation-behavior
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml
new file mode 100644
index 0000000..39c0ca4
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import Example.IVI.InstrumentCluster.simulation 1.0
+
+QtObject {
+ property var settings : IviSimulator.findData(IviSimulator.simulationData, "InstrumentCluster")
+ property bool defaultInitialized: false
+ property LoggingCategory qLcInstrumentCluster: LoggingCategory {
+ name: "example.ivi.instrumentcluster.simulation.instrumentclusterbackend"
+ }
+ property var backend : InstrumentClusterBackend {
+
+ function initialize() {
+ console.log(qLcInstrumentCluster, "INITIALIZE")
+ if (!defaultInitialized) {
+ IviSimulator.initializeDefault(settings, backend)
+ defaultInitialized = true
+ }
+ Base.initialize()
+ }
+
+ property int gearSpeed: 260 / 6
+ property int currentGear: speed / gearSpeed
+ rpm : currentGear >= 1 ? 3000 + (speed % gearSpeed) / gearSpeed * 2000
+ : (speed % gearSpeed) / gearSpeed * 5000
+
+ property var animation: SequentialAnimation {
+ loops: Animation.Infinite
+ running: true
+
+ ParallelAnimation {
+ SequentialAnimation {
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ from: 0
+ to: 80
+ duration: 4000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 50
+ duration: 2000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 200
+ duration: 7000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning("red","LOW FUEL", "images/fuelsymbol_orange.png")
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 0
+ duration: 5000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning()
+ }
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 1
+ to: 0.22
+ duration: 18000
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 0.22
+ to: 1
+ duration: 4000
+ }
+ }
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qrc b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qrc
new file mode 100644
index 0000000..d2b5685
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/simulation"/>
+ <qresource prefix="/">
+ <file>simulation.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/chapter4-simulation-behavior.pro b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/chapter4-simulation-behavior.pro
new file mode 100644
index 0000000..ccb1fdd
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/chapter4-simulation-behavior.pro
@@ -0,0 +1,12 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+ backend_simulator \
+ imports \
+
+instrument-cluster.depends = frontend
+backend_simulator.depends = frontend
+imports.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/frontend/frontend.pro
new file mode 100644
index 0000000..42ae87a
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter4-simulation-behavior
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/imports/imports.pro b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/imports/imports.pro
new file mode 100644
index 0000000..631ab63
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/imports/imports.pro
@@ -0,0 +1,24 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += ivicore
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = qmlplugin
+QFACE_SOURCES = ../instrument-cluster.qface
+
+load(ivigenerator)
+
+DESTDIR = $$OUT_PWD/$$replace(URI, \\., /)
+
+exists($$OUT_PWD/qmldir) {
+ cpqmldir.files = $$OUT_PWD/qmldir \
+ $$OUT_PWD/plugins.qmltypes
+ cpqmldir.path = $$DESTDIR
+ cpqmldir.CONFIG = no_check_exist
+ COPIES += cpqmldir
+}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter4-simulation-behavior/imports
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface
new file mode 100644
index 0000000..f6a5c9f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface
@@ -0,0 +1,23 @@
+@config_simulator: { simulationFile: "qrc:/simulation.qml" }
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ readonly int speed;
+ readonly int rpm;
+ readonly real fuel;
+ @config_simulator: { default: 15 }
+ readonly real temperature;
+ readonly SystemType systemType;
+ readonly Warning currentWarning;
+}
+
+enum SystemType {
+ Imperial,
+ Metric
+}
+
+struct Warning {
+ string color
+ string text
+ string icon
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..db33660
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Cluster.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 4")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ metricSystem: instrumentCluster.systemType === InstrumentCluster.Metric
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: instrumentCluster.rpm
+ warningColor: instrumentCluster.currentWarning.color
+ warningText: instrumentCluster.currentWarning.text
+ warningIcon: instrumentCluster.currentWarning.icon
+ fuelLevel: instrumentCluster.fuel
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: instrumentCluster.temperature
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..e52efd2
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter4-simulation-behavior
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/main.cpp
new file mode 100644
index 0000000..57b00b6
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.addImportPath(app.applicationDirPath() + "/imports");
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/miles.json b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/miles.json
new file mode 100644
index 0000000..98055c3
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter4-simulation-behavior/miles.json
@@ -0,0 +1,9 @@
+
+{
+ "InstrumentCluster": {
+ "systemType": {
+ "type": "enum",
+ "value": "InstrumentClusterModule::Imperial"
+ }
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/backend_qtro/backend_qtro.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_qtro/backend_qtro.pro
new file mode 100644
index 0000000..ad237bc
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_qtro/backend_qtro.pro
@@ -0,0 +1,17 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_qtro)
+DESTDIR = ../qtivi
+
+QT += core ivicore
+CONFIG += ivigenerator plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = backend_qtro
+QFACE_SOURCES = ../instrument-cluster.qface
+PLUGIN_TYPE = qtivi
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..0a1f191
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/backend_simulator.pro
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_simulation)
+DESTDIR = ../qtivi
+
+QT += core ivicore
+CONFIG += ivigenerator plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../instrument-cluster.qface
+PLUGIN_TYPE = qtivi
+
+RESOURCES += \
+ simulation.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qml
new file mode 100644
index 0000000..e052160
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import Example.IVI.InstrumentCluster.simulation 1.0
+
+QtObject {
+ property var settings : IviSimulator.findData(IviSimulator.simulationData, "InstrumentCluster")
+ property bool defaultInitialized: false
+ property LoggingCategory qLcInstrumentCluster: LoggingCategory {
+ name: "example.ivi.instrumentcluster.simulation.instrumentclusterbackend"
+ }
+ property var backend : InstrumentClusterBackend {
+
+ function initialize() {
+ console.log(qLcInstrumentCluster, "INITIALIZE")
+ if (!defaultInitialized) {
+ IviSimulator.initializeDefault(settings, backend)
+ defaultInitialized = true
+ }
+ Base.initialize()
+ }
+
+ property int gearSpeed: 260 / 6
+ property int currentGear: speed / gearSpeed
+ rpm : currentGear >= 1 ? 3000 + (speed % gearSpeed) / gearSpeed * 2000
+ : (speed % gearSpeed) / gearSpeed * 5000
+
+ property var animation: SequentialAnimation {
+ loops: Animation.Infinite
+ running: true
+
+ ParallelAnimation {
+ SequentialAnimation {
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ from: 0
+ to: 80
+ duration: 4000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 50
+ duration: 2000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 200
+ duration: 7000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning("red","LOW FUEL", "images/fuelsymbol_orange.png")
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 0
+ duration: 5000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning()
+ }
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 1
+ to: 0
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 0
+ to: 1
+ duration: 4000
+ }
+ }
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qrc b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qrc
new file mode 100644
index 0000000..d2b5685
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/backend_simulator/simulation.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/simulation"/>
+ <qresource prefix="/">
+ <file>simulation.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/chapter5-ipc.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/chapter5-ipc.pro
new file mode 100644
index 0000000..4409a6d
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/chapter5-ipc.pro
@@ -0,0 +1,16 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+ backend_simulator \
+ backend_qtro \
+ imports \
+ simulation_server \
+
+instrument-cluster.depends = frontend
+backend_simulator.depends = frontend
+backend_qtro.depends = frontend
+imports.depends = frontend
+simulation_server.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/frontend/frontend.pro
new file mode 100644
index 0000000..6560c90
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/imports/imports.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/imports/imports.pro
new file mode 100644
index 0000000..2f11d1f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/imports/imports.pro
@@ -0,0 +1,24 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += ivicore
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = qmlplugin
+QFACE_SOURCES = ../instrument-cluster.qface
+
+load(ivigenerator)
+
+DESTDIR = $$OUT_PWD/$$replace(URI, \\., /)
+
+exists($$OUT_PWD/qmldir) {
+ cpqmldir.files = $$OUT_PWD/qmldir \
+ $$OUT_PWD/plugins.qmltypes
+ cpqmldir.path = $$DESTDIR
+ cpqmldir.CONFIG = no_check_exist
+ COPIES += cpqmldir
+}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc/imports
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster.qface
new file mode 100644
index 0000000..f6a5c9f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster.qface
@@ -0,0 +1,23 @@
+@config_simulator: { simulationFile: "qrc:/simulation.qml" }
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ readonly int speed;
+ readonly int rpm;
+ readonly real fuel;
+ @config_simulator: { default: 15 }
+ readonly real temperature;
+ readonly SystemType systemType;
+ readonly Warning currentWarning;
+}
+
+enum SystemType {
+ Imperial,
+ Metric
+}
+
+struct Warning {
+ string color
+ string text
+ string icon
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..5ca46eb
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Cluster.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 5")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ metricSystem: instrumentCluster.systemType === InstrumentCluster.Metric
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: instrumentCluster.rpm
+ warningColor: instrumentCluster.currentWarning.color
+ warningText: instrumentCluster.currentWarning.text
+ warningIcon: instrumentCluster.currentWarning.icon
+ fuelLevel: instrumentCluster.fuel
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: instrumentCluster.temperature
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..38b428d
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter5-ipc
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/main.cpp
new file mode 100644
index 0000000..57b00b6
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/instrument-cluster/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.addImportPath(app.applicationDirPath() + "/imports");
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro b/examples/ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro
new file mode 100644
index 0000000..43536d2
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro
@@ -0,0 +1,19 @@
+TARGET = chapter5-ipc-server
+DESTDIR = ..
+
+QT = core ivicore
+QT -= gui
+CONFIG += ivigenerator
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = server_qtro_simulator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+RESOURCES += ../backend_simulator/simulation.qrc
+
+QML_IMPORT_PATH = $$OUT_PWD/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter5-ipc/simulation_server
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/backend_dbus.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/backend_dbus.pro
new file mode 100644
index 0000000..3529cf6
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/backend_dbus.pro
@@ -0,0 +1,32 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_dbus)
+DESTDIR = ../qtivi
+
+QT += ivicore dbus
+CONFIG += plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend $$PWD/../demo_server
+
+PLUGIN_TYPE = qtivi
+
+cluster.files = ../demo_server/instrumentcluster.xml
+cluster.header_flags += -i dbus_conversion.h
+
+DBUS_INTERFACES += cluster
+
+HEADERS += \
+ ../demo_server/dbus_conversion.h \
+ instrumentclusterbackend.h \
+ instrumentclusterplugin.h
+
+SOURCES += \
+ instrumentclusterbackend.cpp \
+ instrumentclusterplugin.cpp
+
+OTHER_FILES += \
+ instrumentcluster_dbus.json
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentcluster_dbus.json b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentcluster_dbus.json
new file mode 100644
index 0000000..7461695
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentcluster_dbus.json
@@ -0,0 +1,5 @@
+{
+ "interfaces" : [
+ "Example.IVI.InstrumentCluster.InstrumentCluster"
+ ]
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp
new file mode 100644
index 0000000..6bc8335
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include "instrumentclusterbackend.h"
+
+#include <QDBusConnection>
+
+InstrumentClusterBackend::InstrumentClusterBackend(QObject *parent)
+ : InstrumentClusterBackendInterface(parent)
+ , m_client(nullptr)
+{
+ qDBusRegisterMetaType<Warning>();
+ qDBusRegisterMetaType<InstrumentClusterModule::SystemType>();
+}
+
+void InstrumentClusterBackend::initialize()
+{
+ if (!m_client)
+ setupConnection();
+ if (m_fetchList.isEmpty()) {
+ emit speedChanged(m_speed);
+ emit rpmChanged(m_rpm);
+ emit fuelChanged(m_fuel);
+ emit temperatureChanged(m_temperature);
+ emit systemTypeChanged(m_systemType);
+ emit currentWarningChanged(m_warning);
+ emit initializationDone();
+ }
+}
+
+void InstrumentClusterBackend::setupConnection()
+{
+ qInfo() << "Connecting to the Server";
+ m_client = new ExampleIVIInstrumentClusterInterface("Example.IVI.InstrumentCluster", "/", QDBusConnection::sessionBus());
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::speedChanged,
+ this, &InstrumentClusterBackend::onSpeedChanged);
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::rpmChanged,
+ this, &InstrumentClusterBackend::onRpmChanged);
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::fuelChanged,
+ this, &InstrumentClusterBackend::onFuelChanged);
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::temperatureChanged,
+ this, &InstrumentClusterBackend::onTemperaturChanged);
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::systemTypeChanged,
+ this, &InstrumentClusterBackend::onSystemTypeChanged);
+ connect(m_client, &ExampleIVIInstrumentClusterInterface::currentWarningChanged,
+ this, &InstrumentClusterBackend::onCurrentWarningChanged);
+ fetchSpeed();
+ fetchRpm();
+ fetchFuel();
+ fetchTemperature();
+ fetchSystemType();
+ fetchCurrentWarning();
+}
+
+void InstrumentClusterBackend::fetchSpeed()
+{
+ m_fetchList.append("speed");
+ auto reply = m_client->asyncCall("speed");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<int> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("speed");
+ this->onSpeedChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::fetchRpm()
+{
+ m_fetchList.append("rpm");
+ auto reply = m_client->asyncCall("rpm");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<int> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("rpm");
+ this->onRpmChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::fetchFuel()
+{
+ m_fetchList.append("fuel");
+ auto reply = m_client->asyncCall("fuel");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<int> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("fuel");
+ this->onFuelChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::fetchTemperature()
+{
+ m_fetchList.append("temperature");
+ auto reply = m_client->asyncCall("temperature");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<qreal> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("temperature");
+ this->temperatureChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::fetchSystemType()
+{
+ m_fetchList.append("systemType");
+ auto reply = m_client->asyncCall("systemType");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<InstrumentClusterModule::SystemType> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("systemType");
+ this->onSystemTypeChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::fetchCurrentWarning()
+{
+ m_fetchList.append("currentWarning");
+ auto reply = m_client->asyncCall("currentWarning");
+ auto watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<Warning> reply = *watcher;
+ if (reply.isError()) {
+ qCritical() << reply.error();
+ } else {
+ m_fetchList.removeAll("currentWarning");
+ this->onCurrentWarningChanged(reply.value());
+ watcher->deleteLater();
+ this->checkInitDone();
+ }
+ });
+}
+
+void InstrumentClusterBackend::checkInitDone()
+{
+ if (m_fetchList.isEmpty()) {
+ qInfo() << "All properties initialized";
+ emit initializationDone();
+ }
+}
+
+void InstrumentClusterBackend::onSpeedChanged(int speed)
+{
+ m_speed = speed;
+ emit speedChanged(speed);
+}
+
+void InstrumentClusterBackend::onRpmChanged(int rpm)
+{
+ m_rpm = rpm;
+ emit rpmChanged(rpm);
+}
+
+void InstrumentClusterBackend::onFuelChanged(qreal fuel)
+{
+ m_fuel = fuel;
+ emit fuelChanged(fuel);
+}
+
+void InstrumentClusterBackend::onTemperaturChanged(qreal temperature)
+{
+ m_temperature = temperature;
+ emit temperatureChanged(temperature);
+}
+
+void InstrumentClusterBackend::onSystemTypeChanged(InstrumentClusterModule::SystemType systemType)
+{
+ m_systemType = systemType;
+ emit systemTypeChanged(systemType);
+}
+
+void InstrumentClusterBackend::onCurrentWarningChanged(const Warning &warning)
+{
+ m_warning = warning;
+ emit currentWarningChanged(warning);
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.h b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.h
new file mode 100644
index 0000000..f6f0a5c
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#ifndef INSTRUMENTCLUSTERBACKEND_H
+#define INSTRUMENTCLUSTERBACKEND_H
+
+#include "instrumentclusterbackendinterface.h"
+#include "instrumentcluster_interface.h"
+
+class InstrumentClusterBackend : public InstrumentClusterBackendInterface
+{
+ Q_OBJECT
+public:
+ InstrumentClusterBackend(QObject *parent = nullptr);
+
+public:
+ virtual void initialize() override;
+
+ void setupConnection();
+ void fetchSpeed();
+ void fetchRpm();
+ void fetchFuel();
+ void fetchTemperature();
+ void fetchSystemType();
+ void fetchCurrentWarning();
+ void checkInitDone();
+
+public Q_SLOTS:
+ void onSpeedChanged(int speed);
+ void onRpmChanged(int rpm);
+ void onFuelChanged(qreal fuel);
+ void onTemperaturChanged(qreal temperature);
+ void onSystemTypeChanged(InstrumentClusterModule::SystemType systemType);
+ void onCurrentWarningChanged(const Warning &warning);
+
+private:
+ ExampleIVIInstrumentClusterInterface *m_client;
+ QStringList m_fetchList;
+ int m_speed;
+ int m_rpm;
+ qreal m_fuel;
+ qreal m_temperature;
+ InstrumentClusterModule::SystemType m_systemType;
+ Warning m_warning;
+};
+
+#endif // INSTRUMENTCLUSTERBACKEND_H
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.cpp b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.cpp
new file mode 100644
index 0000000..8c7d65d
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include "instrumentclusterplugin.h"
+
+InstrumentClusterPlugin::InstrumentClusterPlugin(QObject *parent)
+ : QObject(parent)
+ , m_backend(new InstrumentClusterBackend)
+{
+}
+
+QStringList InstrumentClusterPlugin::interfaces() const
+{
+ return QStringList(InstrumentCluster_InstrumentCluster_iid);
+}
+
+QIviFeatureInterface *InstrumentClusterPlugin::interfaceInstance(const QString &interface) const
+{
+ if (interface == InstrumentCluster_InstrumentCluster_iid)
+ return m_backend;
+
+ return nullptr;
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.h b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.h
new file mode 100644
index 0000000..153091c
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#ifndef INSTRUMENTCLUSTERPLUGIN_H
+#define INSTRUMENTCLUSTERPLUGIN_H
+
+#include <QObject>
+#include <QIviServiceInterface>
+#include "instrumentclusterbackend.h"
+
+class InstrumentClusterPlugin : public QObject, public QIviServiceInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "instrumentcluster_dbus.json")
+ Q_INTERFACES(QIviServiceInterface)
+
+public:
+ explicit InstrumentClusterPlugin(QObject *parent = nullptr);
+
+ QStringList interfaces() const override;
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const override;
+
+private:
+ InstrumentClusterBackend *m_backend;
+};
+
+#endif // INSTRUMENTCLUSTERPLUGIN_H
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..e0bf54a
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/backend_simulator.pro
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(instrumentcluster_simulation)
+DESTDIR = ../qtivi
+
+QT += core ivicore
+CONFIG += ivigenerator plugin
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../instrument-cluster.qface
+PLUGIN_TYPE = qtivi
+
+RESOURCES += \
+ simulation.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qml
new file mode 100644
index 0000000..58cac5b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import Example.IVI.InstrumentCluster.simulation 1.0
+
+QtObject {
+ property var settings : IviSimulator.findData(IviSimulator.simulationData, "InstrumentCluster")
+ property bool defaultInitialized: false
+ property LoggingCategory qLcInstrumentCluster: LoggingCategory {
+ name: "example.ivi.instrumentcluster.simulation.instrumentclusterbackend"
+ }
+ property var backend : InstrumentClusterBackend {
+
+ function initialize() {
+ console.log(qLcInstrumentCluster, "INITIALIZE")
+ if (!defaultInitialized) {
+ IviSimulator.initializeDefault(settings, backend)
+ defaultInitialized = true
+ }
+ Base.initialize()
+ }
+
+ property int gearSpeed: 260 / 6
+ property int currentGear: speed / gearSpeed
+ rpm: currentGear >= 1 ? 3000 + (speed % gearSpeed) / gearSpeed * 2000
+ : (speed % gearSpeed) / gearSpeed * 5000
+
+ property var animation: SequentialAnimation {
+ loops: Animation.Infinite
+ running: true
+
+ ParallelAnimation {
+ SequentialAnimation {
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ from: 0
+ to: 80
+ duration: 4000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 50
+ duration: 2000
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 200
+ duration: 7000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning("red","LOW FUEL", "images/fuelsymbol_orange.png")
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "speed"
+ to: 0
+ duration: 5000
+ }
+
+ ScriptAction {
+ script: {
+ backend.currentWarning = InstrumentCluster.warning()
+ }
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 1
+ to: 0
+ }
+ }
+
+ NumberAnimation {
+ target: backend
+ property: "fuel"
+ from: 0
+ to: 1
+ duration: 4000
+ }
+ }
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qrc b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qrc
new file mode 100644
index 0000000..d2b5685
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/backend_simulator/simulation.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/simulation"/>
+ <qresource prefix="/">
+ <file>simulation.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/chapter6-own-backend.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/chapter6-own-backend.pro
new file mode 100644
index 0000000..8658911
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/chapter6-own-backend.pro
@@ -0,0 +1,16 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ frontend \
+ backend_simulator \
+ backend_dbus \
+ imports \
+ demo_server \
+
+instrument-cluster.depends = frontend
+backend_simulator.depends = frontend
+backend_dbus.depends = frontend
+imports.depends = frontend
+demo_server.depends = frontend
+
+OTHER_FILES += instrument-cluster.qface
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/dbus_conversion.h b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/dbus_conversion.h
new file mode 100644
index 0000000..631c4d2
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/dbus_conversion.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#ifndef DBUS_CONVERSION_H
+#define DBUS_CONVERSION_H
+
+#include <QDBusArgument>
+#include "warning.h"
+#include "instrumentclustermodule.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_ALWAYS_INLINE QDBusArgument &operator<<(QDBusArgument &argument, const Warning &data)
+{
+ argument.beginStructure();
+ argument << data.color();
+ argument << data.text();
+ argument << data.icon();
+ argument.endStructure();
+
+ return argument;
+}
+
+Q_ALWAYS_INLINE const QDBusArgument &operator>>(const QDBusArgument &argument, Warning &data)
+{
+ argument.beginStructure();
+ QString color;
+ QString text;
+ QString icon;
+ argument >> color;
+ argument >> text;
+ argument >> icon;
+ data.setColor(color);
+ data.setText(text);
+ data.setIcon(icon);
+ argument.endStructure();
+
+ return argument;
+}
+
+Q_ALWAYS_INLINE QDBusArgument &operator<<(QDBusArgument &argument, InstrumentClusterModule::SystemType data)
+{
+ argument.beginStructure();
+ argument << quint32(data);
+ argument.endStructure();
+
+ return argument;
+}
+
+Q_ALWAYS_INLINE const QDBusArgument &operator>>(const QDBusArgument &argument, InstrumentClusterModule::SystemType &data)
+{
+ argument.beginStructure();
+ quint32 systemType;
+ argument >> systemType;
+ data = InstrumentClusterModule::toSystemType(systemType, nullptr);
+ argument.endStructure();
+
+ return argument;
+}
+
+QT_END_NAMESPACE
+
+#endif // DBUS_CONVERSION_H
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/demo_server.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/demo_server.pro
new file mode 100644
index 0000000..4e6703a
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/demo_server.pro
@@ -0,0 +1,24 @@
+TARGET = chapter6-demo-server
+
+QT += ivicore dbus
+QT -= gui
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+cluster.files = instrumentcluster.xml
+cluster.header_flags += -i dbus_conversion.h
+
+DBUS_ADAPTORS += cluster
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend
+INSTALLS += target
+
+SOURCES += \
+ instrumentcluster.cpp \
+ main.cpp
+
+HEADERS += \
+ instrumentcluster.h \
+ dbus_conversion.h \
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.cpp b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.cpp
new file mode 100644
index 0000000..45c7a03
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include "instrumentcluster.h"
+#include <QThread>
+
+InstrumentCluster::InstrumentCluster(QObject *parent)
+ : QObject(parent)
+ , m_speed(0)
+ , m_rpm(0)
+ , m_fuel(0)
+ , m_temperature(15)
+ , m_systemType(InstrumentClusterModule::Metric)
+{
+ startTimer(100);
+}
+
+int InstrumentCluster::speed() const
+{
+ //QThread::sleep(5);
+ return m_speed;
+}
+
+int InstrumentCluster::rpm() const
+{
+ return m_rpm;
+}
+
+qreal InstrumentCluster::fuel() const
+{
+ return m_fuel;
+}
+
+qreal InstrumentCluster::temperature() const
+{
+ return m_temperature;
+}
+
+InstrumentClusterModule::SystemType InstrumentCluster::systemType() const
+{
+ return m_systemType;
+}
+
+Warning InstrumentCluster::currentWarning() const
+{
+ return m_currentWarning;
+}
+
+void InstrumentCluster::setSpeed(int speed)
+{
+ if (m_speed == speed)
+ return;
+
+ m_speed = speed;
+ emit speedChanged(m_speed);
+}
+
+void InstrumentCluster::setRpm(int rpm)
+{
+ if (m_rpm == rpm)
+ return;
+
+ m_rpm = rpm;
+ emit rpmChanged(m_rpm);
+}
+
+void InstrumentCluster::setFuel(qreal fuel)
+{
+ if (qFuzzyCompare(m_fuel, fuel))
+ return;
+
+ m_fuel = fuel;
+ emit fuelChanged(m_fuel);
+}
+
+void InstrumentCluster::setTemperature(qreal temperature)
+{
+ if (qFuzzyCompare(m_temperature, temperature))
+ return;
+
+ m_temperature = temperature;
+ emit temperatureChanged(m_temperature);
+}
+
+void InstrumentCluster::setSystemType(InstrumentClusterModule::SystemType systemType)
+{
+ if (m_systemType == systemType)
+ return;
+
+ m_systemType = systemType;
+ emit systemTypeChanged(m_systemType);
+}
+
+void InstrumentCluster::setCurrentWarning(const Warning &currentWarning)
+{
+ if (m_currentWarning == currentWarning)
+ return;
+
+ m_currentWarning = currentWarning;
+ emit currentWarningChanged(m_currentWarning);
+}
+
+void InstrumentCluster::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+
+ if (speed() >= 250)
+ setSpeed(0);
+ else
+ setSpeed(speed() + 1);
+
+ if (rpm() >= 5000)
+ setRpm(0);
+ else
+ setRpm(rpm() + 100);
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.h b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.h
new file mode 100644
index 0000000..17ea567
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.h
@@ -0,0 +1,111 @@
+
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#ifndef INSTRUMENTCLUSTER_H
+#define INSTRUMENTCLUSTER_H
+
+#include <QObject>
+#include "warning.h"
+#include "instrumentclustermodule.h"
+
+class InstrumentCluster : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int speed READ speed WRITE setSpeed NOTIFY speedChanged)
+ Q_PROPERTY(int rpm READ rpm WRITE setRpm NOTIFY rpmChanged)
+ Q_PROPERTY(qreal fuel READ fuel WRITE setFuel NOTIFY fuelChanged)
+ Q_PROPERTY(qreal temperature READ temperature WRITE setTemperature NOTIFY temperatureChanged)
+ Q_PROPERTY(InstrumentClusterModule::SystemType systemType READ systemType WRITE setSystemType NOTIFY systemTypeChanged)
+ Q_PROPERTY(Warning currentWarning READ currentWarning WRITE setCurrentWarning NOTIFY currentWarningChanged)
+
+public:
+ explicit InstrumentCluster(QObject *parent = nullptr);
+
+ Q_INVOKABLE int speed() const;
+ Q_INVOKABLE int rpm() const;
+ Q_INVOKABLE qreal fuel() const;
+ Q_INVOKABLE qreal temperature() const;
+ Q_INVOKABLE InstrumentClusterModule::SystemType systemType() const;
+ Q_INVOKABLE Warning currentWarning() const;
+
+signals:
+ void speedChanged(int speed);
+ void rpmChanged(int rpm);
+ void fuelChanged(qreal fuel);
+ void temperatureChanged(qreal temperature);
+ void systemTypeChanged(InstrumentClusterModule::SystemType systemType);
+ void currentWarningChanged(Warning currentWarning);
+
+public slots:
+ void setSpeed(int speed);
+ void setRpm(int rpm);
+ void setFuel(qreal fuel);
+ void setTemperature(qreal temperature);
+ void setSystemType(InstrumentClusterModule::SystemType systemType);
+ void setCurrentWarning(const Warning &currentWarning);
+
+protected:
+ virtual void timerEvent(QTimerEvent *event) override;
+
+private:
+ int m_speed;
+ int m_rpm;
+ qreal m_fuel;
+ qreal m_temperature;
+ InstrumentClusterModule::SystemType m_systemType;
+ Warning m_currentWarning;
+};
+
+#endif // INSTRUMENTCLUSTER_H
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.xml b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.xml
new file mode 100644
index 0000000..8a72b0d
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.xml
@@ -0,0 +1,55 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="Example.IVI.InstrumentCluster">
+ <property name="speed" type="i" access="read"/>
+ <property name="rpm" type="i" access="read"/>
+ <property name="fuel" type="d" access="read"/>
+ <property name="temperature" type="d" access="read"/>
+ <property name="systemType" type="(i)" access="read">
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="InstrumentClusterModule::SystemType"/>
+ </property>
+ <property name="currentWarning" type="(sss)" access="read">
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="Warning"/>
+ </property>
+ <method name="speed" >
+ <arg name="speed" type="i" direction="out"/>
+ </method>
+ <method name="rpm" >
+ <arg name="rpm" type="i" direction="out"/>
+ </method>
+ <method name="fuel" >
+ <arg name="fuel" type="d" direction="out"/>
+ </method>
+ <method name="temperature" >
+ <arg name="temperature" type="d" direction="out"/>
+ </method>
+ <method name="systemType" >
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="InstrumentClusterModule::SystemType"/>
+ <arg name="systemType" type="(i)" direction="out"/>
+ </method>
+ <method name="currentWarning" >
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="Warning"/>
+ <arg name="currentWarning" type="(sss)" direction="out"/>
+ </method>
+ <signal name="speedChanged">
+ <arg name="speed" type="i" direction="out"/>
+ </signal>
+ <signal name="rpmChanged">
+ <arg name="rpm" type="i" direction="out"/>
+ </signal>
+ <signal name="fuelChanged">
+ <arg name="fuel" type="d" direction="out"/>
+ </signal>
+ <signal name="temperatureChanged">
+ <arg name="temperature" type="d" direction="out"/>
+ </signal>
+ <signal name="systemTypeChanged">
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="InstrumentClusterModule::SystemType"/>
+ <arg name="systemType" type="(i)" direction="out"/>
+ </signal>
+ <signal name="currentWarningChanged">
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="Warning"/>
+ <arg name="currentWarning" type="(sss)" direction="out"/>
+ </signal>
+ </interface>
+</node>
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/main.cpp b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/main.cpp
new file mode 100644
index 0000000..c3f3243
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/demo_server/main.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QDBusConnection>
+
+#include "instrumentcluster.h"
+#include "instrumentcluster_adaptor.h"
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ InstrumentCluster cluster;
+ qDBusRegisterMetaType<Warning>();
+ qDBusRegisterMetaType<InstrumentClusterModule::SystemType>();
+
+ InstrumentClusterAdaptor adaptor(&cluster);
+ QDBusConnection connection = QDBusConnection::sessionBus();
+ connection.registerObject("/", &cluster);
+ connection.registerService("Example.IVI.InstrumentCluster");
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/frontend/frontend.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/frontend/frontend.pro
new file mode 100644
index 0000000..a17027e
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/frontend/frontend.pro
@@ -0,0 +1,13 @@
+TARGET = $$qtLibraryTarget(QtIviInstrumentCluster)
+TEMPLATE = lib
+DESTDIR = ..
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB
+CONFIG += ivigenerator
+QFACE_SOURCES = ../instrument-cluster.qface
+
+CONFIG += install_ok # Do not cargo-cult this!
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/imports/imports.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/imports/imports.pro
new file mode 100644
index 0000000..f78be28
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/imports/imports.pro
@@ -0,0 +1,24 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += ivicore
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QFACE_FORMAT = qmlplugin
+QFACE_SOURCES = ../instrument-cluster.qface
+
+load(ivigenerator)
+
+DESTDIR = $$OUT_PWD/$$replace(URI, \\., /)
+
+exists($$OUT_PWD/qmldir) {
+ cpqmldir.files = $$OUT_PWD/qmldir \
+ $$OUT_PWD/plugins.qmltypes
+ cpqmldir.path = $$DESTDIR
+ cpqmldir.CONFIG = no_check_exist
+ COPIES += cpqmldir
+}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend/imports
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster.qface b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster.qface
new file mode 100644
index 0000000..f6a5c9f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster.qface
@@ -0,0 +1,23 @@
+@config_simulator: { simulationFile: "qrc:/simulation.qml" }
+module Example.IVI.InstrumentCluster 1.0
+
+interface InstrumentCluster {
+ readonly int speed;
+ readonly int rpm;
+ readonly real fuel;
+ @config_simulator: { default: 15 }
+ readonly real temperature;
+ readonly SystemType systemType;
+ readonly Warning currentWarning;
+}
+
+enum SystemType {
+ Imperial,
+ Metric
+}
+
+struct Warning {
+ string color
+ string text
+ string icon
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..3833d67
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Cluster.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+import Example.IVI.InstrumentCluster 1.0
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster Chapter 6")
+ visible: true
+ color: "#0c0c0c"
+
+ InstrumentCluster {
+ id: instrumentCluster
+ }
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: instrumentCluster.speed
+ metricSystem: instrumentCluster.systemType === InstrumentCluster.Metric
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: instrumentCluster.rpm
+ warningColor: instrumentCluster.currentWarning.color
+ warningText: instrumentCluster.currentWarning.text
+ warningIcon: instrumentCluster.currentWarning.icon
+ fuelLevel: 1.0//instrumentCluster.fuel
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: instrumentCluster.temperature
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..5245ce9
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,19 @@
+TARGET = chapter6-own-backend
+DESTDIR = ..
+
+QT += qml quick
+CONFIG -= app_bundle
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../../images/images.qrc \
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviInstrumentCluster)
+INCLUDEPATH += $$OUT_PWD/../frontend
+QMAKE_RPATHDIR += $ORIGIN
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../frontend/qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/main.cpp
new file mode 100644
index 0000000..57b00b6
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/chapter6-own-backend/instrument-cluster/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.addImportPath(app.applicationDirPath() + "/imports");
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/images/+--.png b/examples/ivicore/qface-tutorial/images/+--.png
new file mode 100644
index 0000000..9f1ba24
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/+--.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/P-R-N-D.png b/examples/ivicore/qface-tutorial/images/P-R-N-D.png
new file mode 100644
index 0000000..6801f73
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/P-R-N-D.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/dial_cursor.png b/examples/ivicore/qface-tutorial/images/dial_cursor.png
new file mode 100644
index 0000000..79d5b0e
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/dial_cursor.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/dial_cursor_right.png b/examples/ivicore/qface-tutorial/images/dial_cursor_right.png
new file mode 100644
index 0000000..93e4567
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/dial_cursor_right.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/dial_fill_color.png b/examples/ivicore/qface-tutorial/images/dial_fill_color.png
new file mode 100644
index 0000000..2be4959
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/dial_fill_color.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/dial_fill_color_left.png b/examples/ivicore/qface-tutorial/images/dial_fill_color_left.png
new file mode 100644
index 0000000..bc2899c
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/dial_fill_color_left.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/dial_pattern.png b/examples/ivicore/qface-tutorial/images/dial_pattern.png
new file mode 100644
index 0000000..e44b202
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/dial_pattern.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/fuel.png b/examples/ivicore/qface-tutorial/images/fuel.png
new file mode 100644
index 0000000..422f16f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/fuel.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/fuel_level.png b/examples/ivicore/qface-tutorial/images/fuel_level.png
new file mode 100644
index 0000000..7c29998
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/fuel_level.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/fuelsymbol_orange.png b/examples/ivicore/qface-tutorial/images/fuelsymbol_orange.png
new file mode 100644
index 0000000..8518dbb
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/fuelsymbol_orange.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/images.qrc b/examples/ivicore/qface-tutorial/images/images.qrc
new file mode 100644
index 0000000..4a7f626
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/images.qrc
@@ -0,0 +1,20 @@
+<RCC>
+ <qresource prefix="/images">
+ <file>top_bar.png</file>
+ <file>right_dial.png</file>
+ <file>middle-circle.png</file>
+ <file>middle-bkg.png</file>
+ <file>mask_overlay.png</file>
+ <file>left_dial.png</file>
+ <file>fuelsymbol_orange.png</file>
+ <file>fuel_level.png</file>
+ <file>fuel.png</file>
+ <file>dial_pattern.png</file>
+ <file>dial_fill_color_left.png</file>
+ <file>dial_cursor_right.png</file>
+ <file>dial_cursor.png</file>
+ <file>P-R-N-D.png</file>
+ <file>+--.png</file>
+ <file>dial_fill_color.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/images/left_dial.png b/examples/ivicore/qface-tutorial/images/left_dial.png
new file mode 100644
index 0000000..85cd9b1
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/left_dial.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/mask_overlay.png b/examples/ivicore/qface-tutorial/images/mask_overlay.png
new file mode 100644
index 0000000..fe656fa
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/mask_overlay.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/middle-bkg.png b/examples/ivicore/qface-tutorial/images/middle-bkg.png
new file mode 100644
index 0000000..e7da650
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/middle-bkg.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/middle-circle.png b/examples/ivicore/qface-tutorial/images/middle-circle.png
new file mode 100644
index 0000000..b1af2b8
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/middle-circle.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/right_dial.png b/examples/ivicore/qface-tutorial/images/right_dial.png
new file mode 100644
index 0000000..f798e64
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/right_dial.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/images/top_bar.png b/examples/ivicore/qface-tutorial/images/top_bar.png
new file mode 100644
index 0000000..e0c41a5
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/images/top_bar.png
Binary files differ
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/Cluster.qml b/examples/ivicore/qface-tutorial/instrument-cluster/Cluster.qml
new file mode 100644
index 0000000..08ded0c
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/Cluster.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.2
+
+Window {
+ id: root
+
+ width: 1920
+ height: 720
+ title: qsTr("QtIVI Instrument Cluster")
+ visible: true
+ color: "#0c0c0c"
+
+ LeftDial {
+ id: leftDial
+ anchors.left: parent.left
+ anchors.leftMargin: 0.1 * width
+
+ value: 80
+ }
+
+ RightDial {
+ id: rightDial
+ anchors.right: parent.right
+ anchors.rightMargin: 0.1 * width
+
+ value: 3000
+ }
+
+ Top {
+ id: topbar
+ y: 7
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ temperature: 15
+ }
+
+ Image {
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/mask_overlay.png")
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/Dial.qml b/examples/ivicore/qface-tutorial/instrument-cluster/Dial.qml
new file mode 100644
index 0000000..a4b5c3f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/Dial.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 480
+ height: 480
+
+ property real value: 0
+ property int upDuration: 2000
+ property int downDuration: 1000
+ property string fillImage: "images/dial_fill_color_left.png"
+ property string circleRadius: "0.193"
+ property string dialCursor: "images/dial_cursor.png"
+
+ Image {
+ id: meter
+ property real min: -83.5
+ property real max: 157
+ width: root.width
+ height: width - 1
+ rotation: min + (max - min) * root.value
+ source: Qt.resolvedUrl(root.dialCursor)
+ }
+
+ ShaderEffect {
+ anchors.fill: meter
+ property var pattern: Image {
+ source: Qt.resolvedUrl("images/dial_pattern.png")
+ }
+ property var fill: Image {
+ source: Qt.resolvedUrl(root.fillImage)
+ }
+ property real value: root.value
+
+ fragmentShader: "
+#define M_PI 3.141592653589793
+#define INNER " + root.circleRadius + "
+
+varying highp vec2 qt_TexCoord0;
+uniform lowp float qt_Opacity;
+uniform sampler2D pattern;
+uniform sampler2D fill;
+uniform lowp float value;
+
+void main() {
+ lowp vec4 pattern = texture2D(pattern, qt_TexCoord0);
+ lowp vec4 fill = texture2D(fill, qt_TexCoord0);
+
+ lowp vec2 pos = vec2(qt_TexCoord0.x - 0.5, 0.501 - qt_TexCoord0.y);
+ lowp float d = length(pos);
+ lowp float angle = atan(pos.x, pos.y) / (2.0 * M_PI);
+ lowp float v = 0.66 * value - 0.33;
+
+ // Flare pattern
+ lowp vec4 color = mix(pattern, vec4(0.0), smoothstep(v, v + 0.1, angle));
+ // Gradient fill color
+ color += mix(fill, vec4(0.0), step(v, angle));
+ // Punch out the center hole
+ color = mix(vec4(0.0), color, smoothstep(INNER - 0.001, INNER + 0.001, d));
+ // Fade out below 0
+ gl_FragColor = mix(color, vec4(0.0), smoothstep(-0.35, -0.5, angle));
+}
+ "
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/Fuel.qml b/examples/ivicore/qface-tutorial/instrument-cluster/Fuel.qml
new file mode 100644
index 0000000..46e9dee
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/Fuel.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.73 * 720
+ height: width - 1
+
+ property real value: 0
+
+ Item {
+ width: root.value * parent.width
+ height: parent.height
+ clip: true
+ Image {
+ width: root.width
+ height: root.height
+ source: Qt.resolvedUrl("images/fuel_level.png")
+ }
+ }
+
+ Image {
+ id: fuel
+ anchors.fill: parent
+ source: Qt.resolvedUrl("images/fuel.png")
+
+ }
+}
+
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/Label.qml b/examples/ivicore/qface-tutorial/instrument-cluster/Label.qml
new file mode 100644
index 0000000..d574080
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/Label.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ property alias textObject: textElement
+ property alias text: textElement.text
+ property alias font: textElement.font
+ property alias fontSize: textElement.font.pixelSize
+ property alias color: textElement.color
+ property alias textFormat: textElement.textFormat
+ property alias horizontalAlignment: textElement.horizontalAlignment
+ property alias elide: textElement.elide
+ property alias wrapMode: textElement.wrapMode
+ property alias verticalAlignment: textElement.verticalAlignment
+
+ Text {
+ id: textElement
+
+ anchors.fill: parent
+ anchors.margins: 8
+
+ verticalAlignment: Text.AlignVCenter
+
+ font.family: "Source Sans Pro"
+ font.pixelSize: 28
+ font.weight: Font.Light
+
+ color: "white"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/LeftDial.qml b/examples/ivicore/qface-tutorial/instrument-cluster/LeftDial.qml
new file mode 100644
index 0000000..f57b8af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/LeftDial.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtGraphicalEffects 1.0
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property real value: 0.0
+ property bool metricSystem: false
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.98 * width
+ anchors.right: parent.right
+ anchors.rightMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/left_dial.png")
+ }
+
+ Text {
+ id: speedText
+
+ anchors.verticalCenter: overlay.verticalCenter
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.verticalCenterOffset: -7
+ anchors.horizontalCenterOffset: 5
+ font.family: "Source Sans Pro"
+ font.pixelSize: 60
+ font.letterSpacing: 4
+ color: "white"
+ text: root.value
+ }
+
+ Rectangle {
+ width: 60
+ height: 1
+ opacity: 0.4
+ anchors.top: speedText.bottom
+ anchors.topMargin: -8
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ }
+
+ Text {
+ id: mph
+ anchors.top: speedText.bottom
+ anchors.topMargin: -5
+ anchors.horizontalCenter: overlay.horizontalCenter
+ anchors.horizontalCenterOffset: 2
+ font.family: "Source Sans Pro"
+ font.pixelSize: 24
+ color: "white"
+ text: root.metricSystem ? "km/h" : "mph"
+ }
+
+ Dial {
+ width: 0.66 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 2
+ fillImage: "images/dial_fill_color_left.png"
+ value: root.value / 240
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/RightDial.qml b/examples/ivicore/qface-tutorial/instrument-cluster/RightDial.qml
new file mode 100644
index 0000000..4c52a58
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/RightDial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+
+ width: 0.8 * 720
+ height: 720
+
+ property color warningColor: "transparent"
+ property string warningIcon
+ property string warningText
+ property int value
+ property alias fuelLevel: fuelMeter.value
+
+ Item {
+ width: root.width/3
+ height: 0.1 * root.width
+ anchors.bottom: overlay.top
+ anchors.left: parent.left
+ anchors.leftMargin: 0.2 * root.width
+
+ Image {
+ id: gears
+
+ width: 0.2 * root.width
+ height: 0.25 * width
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ source: Qt.resolvedUrl("images/P-R-N-D.png")
+ }
+
+ Image {
+ id: plusMinus
+ anchors.bottom: parent.bottom
+ anchors.left: gears.right
+ anchors.leftMargin: 10
+ source: Qt.resolvedUrl("images/+--.png")
+ }
+ }
+
+ Image {
+ id: overlay
+
+ width: 0.91 * root.width
+ height: 0.99 * width
+
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: Qt.resolvedUrl("images/right_dial.png")
+
+ Rectangle {
+ id: rect
+ width: circle.width + 5
+ height: width
+ radius: width
+ color: "transparent"
+ border.color: root.warningColor
+ border.width: rect.borderWidth
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -3
+
+ property int borderWidth: 3
+
+ SequentialAnimation {
+ running: root.warningColor != "transparent"
+ loops: Animation.Infinite
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 3
+ to: 7
+ duration: 500
+ }
+
+ NumberAnimation {
+
+ target: rect
+ properties: "borderWidth"
+ from: 7
+ to: 3
+ duration: 500
+ }
+
+ onStopped: rect.borderWidth = 3
+
+ }
+ }
+
+ Image {
+ id: circle
+
+ width: root.width/2
+ height: width
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -6
+ anchors.verticalCenterOffset: 0
+ source: Qt.resolvedUrl("images/middle-bkg.png")
+
+ Image {
+ id: circle_overlay
+
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ source: Qt.resolvedUrl("images/middle-circle.png")
+ }
+
+ Image {
+ id: fuelSymbol
+ width: 70
+ height: 70
+ anchors.top: parent.top
+ anchors.topMargin: 55
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: 0
+ source: root.warningIcon
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ Item {
+ width: parent.width
+ height: parent.height/4
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: speedText
+ width: parent.width - 80
+ height: 40
+ radius: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.darker("grey", 1.5) }
+ GradientStop { position: 0.4; color: "#0c0c0c" }
+ }
+
+ Label {
+ width: parent.width
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: text.length > 10 ? 18 : 24
+ font.bold: true
+ text: root.warningText
+ elide: Text.ElideMiddle
+ }
+ }
+ }
+ }
+ }
+
+ Fuel {
+ id: fuelMeter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 0.05 * root.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: -20
+ }
+
+ Dial {
+ id: dial
+
+ width: 0.69 * root.height
+ height: width
+ anchors.centerIn: overlay
+ anchors.verticalCenterOffset: 0
+ anchors.horizontalCenterOffset: -5
+ fillImage: "images/dial_fill_color.png"
+ circleRadius: "0.29"
+ dialCursor: "images/dial_cursor_right.png"
+ value: root.value / 7000
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/Top.qml b/examples/ivicore/qface-tutorial/instrument-cluster/Top.qml
new file mode 100644
index 0000000..b43ef9b
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/Top.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ width: 0.37 * 1920
+ height: 0.12 * 720
+
+ property real temperature: 0
+
+ Image {
+ id: background
+ width: parent.width
+ height: parent.height
+ source: Qt.resolvedUrl("images/top_bar.png")
+ }
+
+ Label {
+ id: timeText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: background.left
+ anchors.leftMargin: 0.2 * background.width
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: Qt.formatTime(currentDate, "hh:mm")
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ timeText.currentDate = new Date();
+ }
+ }
+ }
+
+ Item {
+ id: navigator
+
+ width: 0.25 * background.width
+ height: background.height
+ anchors.verticalCenter: background.verticalCenter
+ anchors.horizontalCenter: background.horizontalCenter
+
+ Row {
+ id: row
+ property int radius: 7
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -16
+ spacing: 8
+
+ Repeater {
+ model: 3
+ delegate: Rectangle {
+ height: row.radius * 2
+ width: row.radius * 2
+ radius: row.radius
+ color: 1 === index ? "white" : "#4d4d4d"
+ }
+ }
+ }
+ }
+
+ Label {
+ id: temperatureText
+ anchors.verticalCenter: background.verticalCenter
+ anchors.left: navigator.right
+ anchors.leftMargin: 15
+
+ font.pixelSize: 0.42 * background.height
+ font.bold: true
+
+ text: root.temperature + "°C"
+ }
+}
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/app.qrc b/examples/ivicore/qface-tutorial/instrument-cluster/app.qrc
new file mode 100644
index 0000000..9794820
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/app.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Cluster.qml</file>
+ <file>Top.qml</file>
+ <file>RightDial.qml</file>
+ <file>LeftDial.qml</file>
+ <file>Dial.qml</file>
+ <file>Fuel.qml</file>
+ <file>Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/instrument-cluster.pro b/examples/ivicore/qface-tutorial/instrument-cluster/instrument-cluster.pro
new file mode 100644
index 0000000..dacdc1f
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/instrument-cluster.pro
@@ -0,0 +1,8 @@
+QT += qml quick
+
+SOURCES = main.cpp
+RESOURCES += app.qrc \
+ ../images/images.qrc \
+
+target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-tutorial/instrument-cluster
+INSTALLS += target
diff --git a/examples/ivicore/qface-tutorial/instrument-cluster/main.cpp b/examples/ivicore/qface-tutorial/instrument-cluster/main.cpp
new file mode 100644
index 0000000..d56f5af
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/instrument-cluster/main.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:///Cluster.qml")));
+
+ return app.exec();
+}
diff --git a/examples/ivicore/qface-tutorial/qface-tutorial.pro b/examples/ivicore/qface-tutorial/qface-tutorial.pro
new file mode 100644
index 0000000..724d501
--- /dev/null
+++ b/examples/ivicore/qface-tutorial/qface-tutorial.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ instrument-cluster \
+ chapter1-basics \
+ chapter2-enums-structs \
+ chapter3-simulation-backend \
+ chapter4-simulation-behavior \
+ chapter5-ipc \
+
+qtHaveModule(dbus): SUBDIRS += chapter6-own-backend
diff --git a/src/ivicore/doc/images/examples_qface_tutorial.png b/src/ivicore/doc/images/examples_qface_tutorial.png
new file mode 100644
index 0000000..318ccea
--- /dev/null
+++ b/src/ivicore/doc/images/examples_qface_tutorial.png
Binary files differ
diff --git a/src/ivicore/doc/images/examples_qface_tutorial_final.gif b/src/ivicore/doc/images/examples_qface_tutorial_final.gif
new file mode 100644
index 0000000..e8a833b
--- /dev/null
+++ b/src/ivicore/doc/images/examples_qface_tutorial_final.gif
Binary files differ
diff --git a/src/ivicore/doc/qtivi-project.qdocconf b/src/ivicore/doc/qtivi-project.qdocconf
index 860e836..be27137 100644
--- a/src/ivicore/doc/qtivi-project.qdocconf
+++ b/src/ivicore/doc/qtivi-project.qdocconf
@@ -15,7 +15,9 @@ sourcedirs += . \
.. \
../../imports/core
imagedirs += images
-exampledirs += ../../../examples
+exampledirs += ../../../examples \
+ $$BUILDDIR/../../examples \
+
examples.fileextensions += *.qface *.yaml
include(../../ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf)
diff --git a/src/ivicore/doc/src/examples-qface-tutorial.qdoc b/src/ivicore/doc/src/examples-qface-tutorial.qdoc
new file mode 100644
index 0000000..a574d94
--- /dev/null
+++ b/src/ivicore/doc/src/examples-qface-tutorial.qdoc
@@ -0,0 +1,718 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Luxoft Sweden AB
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the QtIvi module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL-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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\example ivicore/qface-tutorial
+\brief <<< ADD A GOOD BRIEF HERE >>>
+\ingroup qtivicore-examples
+\title Qt IVI Generator Tutorial
+\image examples_qface_tutorial.png
+
+This tutorial will show you how to extend your QML Application with your own autogenerated
+middleware API. This will be done using a existing QML Instrument Cluster application and consists
+of the following steps:
+
+\list 1
+ \li Basic Interface integration without backend, but with QML plugin ? (extra step ?)
+ \li Extending the Interface, add annotations
+ \li Adding a simulation backend (and simulation annotations) (explain linking)
+ \li Adding a custom simulation behavior
+ \li Adding a simulation server and using it from a qtro_backend
+ \li Developing a production backend which connects to a dbus interface
+\endlist
+
+Before we start the actual Middleware integration, let's take a look at the existing Instrument
+Cluster QML code and all the features it supports and our Middleware API should support as well.
+
+\list
+ \li \c images This folder contains all images used in the QML code
+ \li \c Cluster.qml The main QML file assembling all other QML components together
+ \li \c Dial.qml The base component for showing values like speed or rpm using a needle
+ \li \c Fuel.qml A component to show the actual fuel level
+ \li \c Label.qml A small helper component which sets all common settings used to display Text
+ \li \c LeftDial.qml Shows the current speed using the Dial component and as Text and the current metric (mph or km/h)
+ \li \c RightDial.qml Shows the current rpm and offers a way to show warning indicators.
+ \li \c Top.qml The top bar showing the current Date and the current temperature.
+\endlist
+
+In the following chapters we will integrate the following features:
+\list
+ \li Show the current speed in the left dial
+ \li Show the current rpm in the right dial
+ \li Support to change between different metrics
+ \li Show the current temperature in the top bar
+ \li Show different warnings on the right dial
+ \li Indicate whether the instrument cluster is connected and shows real data
+\endlist
+
+All this will be connected together to simulate a real driving experience and should look like
+this:
+
+\image examples_qface_tutorial_final.gif
+
+\section1 Basic Middlware API with the help of IVI Generator
+
+In this chapter we integrate a Middleware API into the existing Instrument Cluster QML code.
+Instead of manually writing all parts ourself which is done in most other basic QML examples
+(link), we will use the IVI Generator to autogenerate the needed parts.
+
+\section2 Interface Definition Language
+
+To be able to autogenerate the Middleware API the IVI Generator needs some input on what to
+generate. This input is given in form of a Interface Definition Language (IDL) which describes the
+API in a very simple form.
+
+Let's start to define a very simple IDL which provides us with a speed property:
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
+\printuntil }
+
+First, we need to define which module we want to describe. The module acts as a namespace, because
+the IDL file can contain multiple interfaces.
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
+\printuntil module
+
+The most important part of the module is its interface definition.
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
+\skipto interface
+\printuntil }
+
+In this case, we define an interface named InstrumentCluster consisting of one property. Each
+property definition must contain at least a type and a name. Most of the basic types are built-in
+and can be found in the QFace IDL syntax.
+
+\section2 Autogeneration
+
+Now as our first version of the IDL file is ready, it's time to autogenerate API out of it. This is
+done by the IVI Generator tool. Similar to moc this autogeneration is integrated into the qmake
+Build System and is done on compile time. In the following pro file we build a C++ library based on
+our IDL file:
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/frontend/frontend.pro
+\printto CONFIG += install_ok
+
+Most of the qmake file is a standard setup to define a C++ library, using 'lib' TEMPLATE and
+defining the wanted file name in the TARGET variable. The used qtLibraryTarget function helps to
+correctly append the 'd' postfix on the filename for a library providing debugging information.
+Because we need to link this file in the future we set the DESTDIR to the upper directory to make
+this a bit easier (Windows is searching for libraries in the same directory automatically).
+
+To activate the actual IVI Generator integration, the CONFIG needs to have the ivigenerator option.
+By enabling this config the generator will be called during the build process using the qface file
+provided in QFACE_SOURCES. See (link) for more information about the qmake integration.
+
+Because we are building a library which is also supposed to work on Windows it's important to add
+the QT_BUILD_EXAMPLE_IVI_INSTRUMENTCLUSTER_LIB to the DEFINES variable. This makes sure that all
+symbols are exported when building the library, but imported when linking against it. See Creating
+Shared Libraries for more information on this topic.
+
+\section2 What will be autogenerated ?
+
+The ivigenerator is based on generation templates. These templates define what content is generated
+from the IDL file. When no QFACE_FORMAT is defined this will automatically default to use the
+"frontend" template. What a template generates is explained here (link to the frontend template).
+
+In short the 'frontend' template will generate a C++ class derived from QIviAbstractFeature for
+every interface in the IDL file and one module class which helps to register all interfaces to QML
+and which stores global types and functions for. More on that in a later chapter.
+
+To inspect the C++ code yourself, you can either checkout the files in the build folder of your
+library.
+
+The most important file for us right now which is autogenerated is the resulting C++ class for our
+defined interface. It looks like this:
+
+\quotefile ivicore/qface-tutorial/chapter1-basics/frontend/instrumentcluster.h
+
+As you can see does the autogenerated C++ class implement a "speed" property as defined in the IDL
+file. By using the Q_OBJECT macro and Q_PROPERTY the class is already now ready to be used directly
+in your QML code.
+
+\section2 Integrating the frontend library into the QML code
+
+The last part of this chapter is to use the autogenerated frontend library from the QML code. To
+keep this integration simple we follow the standard Qt example way and use a small C++ main
+function which registers our autogenerated types to QML and loads the Instrument Cluster QML code
+into the QQmlApplicationEngine:
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp
+\skipto #include "instrumentclustermodule.h"
+\printuntil }
+
+What's still missing is the actual integration of the InstrumentCluster QML element and connecting
+the speed property to the leftDial. This can be done by instantiating the element first with the id
+instrumentCluster.
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster/Cluster.qml
+\skipto import
+\printuntil InstrumentCluster
+\printuntil }
+\codeline
+
+Now we can create a Binding for the value property of the LeftDial Item to the speed property of
+our InstrumentCluster API.
+
+\printuntil }
+
+\section1 Chapter 2
+
+In the second chapter we will extend our Middleware API with more properties, using enums and
+defining our own struct.
+
+\section2 Defining speed as readonly property
+
+In the previous chapter we defined the speed property in our QFace IDL file in the following way:
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster.qface
+\printuntil }
+
+Because we didn't use any extra specifier this property is defined as being readable and writable.
+For our Instrument Cluster example having a writable speed property doesn't make much sense, as it
+is not supposed to be used to accelerate the car, but just to visualize the current state.
+
+We can define the property to be read only by using the "readonly" keyword.
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
+\printuntil readonly
+\skipto }
+\printuntil }
+
+Starting to build our app again, the build system will recognize the changed qface file and start
+the IVI Generator to generate an updated version of the C++ code. After the IVI Generator is done
+you can open the instrumentcluster.h from within the build folder and you will see that the
+generated C++ property changed to NOT have any setter anymore and by that is now read only.
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/frontend/instrumentcluster.h
+\skipto class Q_EXAMPLE
+\printuntil Q_PROPERTY
+\dots
+\skipto };
+\printuntil };
+
+\section2 Extending the interface
+
+To reach our goal to provide a full simulation for the Instrument Cluster, we need to add more
+properties to our IDL file. Adding additional properties for 'rpm', 'fuel' and 'temperature' should
+be a easy job and result in this:
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
+\printuntil readonly real temperature
+\skipto }
+\printuntil }
+
+You might have noticed that we used a different type for the 'fuel' and 'temperature' properties.
+We use the type real here as we would like to show the temperature as a floating point number and
+the current fuel level between 0 and 1.
+
+\section2 Defining a new enum type
+
+As we like to be able to switch between the metric and the imperial system, we also need to define
+a property for the system we currently use. Using a boolean property would work, but doesn't offer
+a nice API, so we define a new type in the IDL and use it as the type for the new 'system'
+property:
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
+\printuntil readonly SystemType
+\skipto }
+\printuntil enum
+\printuntil }
+
+In the autogenerated code, this will create a enum which is part of the module class. This makes it
+possible that the same enum can be used by multiple classes which are part of the same module:
+
+\quotefile ivicore/qface-tutorial/chapter2-enums-structs/frontend/instrumentclustermodule.h
+
+\section2 Add a new struct
+
+To display warnings on the right dial of the Instrument Cluster we would like to use a struct which
+stores color, icon and text of the warning instead of using 3 independent properties for this.
+Similar to define a interface, we can use the struct keyword in the IDL file:
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
+\skipto struct
+\printuntil }
+
+Using this new struct for as a type for a property works in the same way as when using a enum, the
+final IDL file should now look like this:
+
+\quotefile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster.qface
+
+\section2 Integrating the new properties
+
+Like in the previous chapter, doing the actual integration of the new introduced properties should
+be pretty straightforward by creating Bindings. The rpm property can be directly connected to the
+value property of the rightDial Item and in the same way the temperature property of the top Item
+can be connected. To control what unit is displayed in the left Dial, the leftDial Item provides a
+bool property named metricSystem. As we used a enum in our IDL file we need to convert the value
+first by testing the 'sytemType' property for the 'Metric' value.
+
+\quotefromfile ivicore/qface-tutorial/chapter2-enums-structs/instrument-cluster/Cluster.qml
+\skipto LeftDial
+\printuntil }
+\codeline
+
+Like seen above the enums are part of the module class, which is also exported to QML as
+InstrumentClusterModule. To trigger a warning in the rightDial Item, we can also use 3 bindings to
+connect to the 3 member variables of the struct:
+
+\printuntil }
+
+\section1 Chapter 3
+
+In the previous two chapters we wrote a Middleware API in form of a IDL file and used the IVI
+Generator to autogenerate a C++ API in form of a library. In this chapter we will extend this by
+introducing a simulation backend and use annotations to define default values for our simulation.
+
+\section2 Frontend / Backend Separation
+
+QtIvi and the IVI Generator enables you to write code which use a Frontend / Backend Separation.
+Now what does that actually mean ? The separation is done to split an API from the actual
+implementation of this API. Qt uses this already in a lot of areas, most prominently the underling
+window system technology on the various supported Qt platforms e.g. xcb on linux and cocoa on mac.
+The same separation is done for our Middleware API, where the frontend provides the API in form of
+a library and the backend provides a implementation of this API. This is based on the Dynamic
+backend System of QtIvi which enables to switch between such backends at runtime.
+
+\image feature-backend.png
+
+\section2 Adding a simulation Backend
+
+For our Instrument Cluster we would like to add such a backend to provide actual values. For now we
+would like to just have some simulation behavior as we can't connect it easily to a real car,
+that's why such backends are called "simulation backend". To add such a backend we can use the help
+of the IVI Generator again and let it do the heavy lifting for us and generate one. This is done in
+a similar way as we already generated the library using the 'frontend' template, but we are now
+using the 'backend_simulator' template:
+
+\quotefromfile ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro
+\printto DESTDIR
+\skipto QT
+\printuntil CONFIG
+\skipto QFACE_FORMAT
+\printto CONFIG += install_ok
+
+Like for the frontend library, the project file builds a lib and defines the library name using
+qtLibraryTarget to also support windows debug postfix. One important aspect here is that the
+library name ends with '_simulation' which is a way to tell QtIvi that this is a simulation backend
+and once a 'production' backend is available prefer to use this over the 'simulation'. See <link>
+for more information on this.
+
+Enable the IVI Generator is also done in the same way by using the same QFACE_SOURCE, but defining
+QFACE_FORMAT to 'backend_simulator' to use the correct generation template. In addition we need to
+add 'plugin' into the CONFIG variable to make this library a Qt plugin which can easily be loaded
+at runtime.
+
+\section2 Link settings and how plugins are found.
+
+Trying to build the project file just as it is now, would result in compilation and linking errors.
+The reason for that is, in order to do the Frontend / Backend Separation there needs to be a
+defined interface class which needs to be implemented by the backend and is known to the frontend.
+This interface is called 'backend interface' and is automatically generated as part of the frontend
+library. Because this class provides signals and slots and uses QObject as the base class you need
+to link to the frontend library when you inherit from it. As this is needed for the backend plugin,
+we need to add the following lines in addition:
+
+\quotefromfile ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro
+\skipuntil CONFIG
+\printuntil INCLUDEPATH
+
+Now the project should build fine and create the plugin in your build folder (or the plugin folder
+in case you don't use a shadow build). If you would start the Instrument Cluster again you should
+still the following message:
+
+\badcode
+There is no production backend implementing "Example.IVI.InstrumentCluster.InstrumentCluster" .
+There is no simulation backend implementing "Example.IVI.InstrumentCluster.InstrumentCluster" .
+No suitable ServiceObject found.
+\endcode
+
+This indicates that QtIvi is still not able to find our just created simulation plugin. For this to
+understand you need to know a little bit more about Qts Plugin System and how it it finds plugins.
+Qt searches for it's plugins in multiple directories, the first one is the plugin folder which
+comes with your Qt installation and is called 'plugins'. Within the plugins folder every plugin
+type has it's own sub-folder e.g. 'platforms' for the platform plugins used to talk to the
+underlying platform API and the windowing system. QtIvi searches for its backend plugins in the
+'qtivi' folder. To make sure our simulation backend ends up in such a folder we add the following
+DESTDIR definition.
+
+\quotefromfile ivicore/qface-tutorial/chapter3-simulation-backend/backend_simulator/backend_simulator.pro
+\skipto DESTDIR
+\printuntil DESTDIR
+
+You might wondering how creating a qtivi folder in the upper directory should solve this problem of
+finding the plugin as it's not part of the system plugins folder. As said Qt supports searching in
+multiple folder for such plugins and one of those folders is the path of the executable itself.
+Another way would be to add an additional plugin path using the QCoreApplication::addLibraryPath()
+function or using the QT_PLUGIN_PATH environment variable. See "How to create Qt Plugins" for more
+information about this.
+
+\section2 Exporting the QML types in a QML Plugin
+
+In the first chapter we extended our main.cpp to register all types of our autogenerated Middleware
+API. Although this works fine, in bigger projects it's common to use a QML Plugin instead and be
+able to use qmlscene for the development. Although the code for doing this is relative simple, the
+IVI Generator supports to do this as well and makes it even easier. We already learned in the first
+chapter that for the QML import uri the module name is used. For a QML plugin this is important
+as the QmlEngine expects the plugin on a specific folder following the module name, where every section
+of the module name is a sub-folder. Our project file to generate a QML plugin looks like this:
+
+\quotefromfile ivicore/qface-tutorial/chapter3-simulation-backend/imports/imports.pro
+\printto target.path
+
+All lines until QFACE_SOURCES should be know. We use CONFIG to build a plugin. Define settings for
+the linker to link against our frontend library and use QFACE_FORMAT to define 'qmlplugin' as the
+used generation template. Instead of adding 'ivigenerator' to CONFIG we use the load() function to
+explicitly load the feature, this enables us to use the URI variable which is part of the 'qmlplugin'
+generation template. This URI can be used to define a DESTDIR by replacing all dots with slashes.
+
+In addition to the folder structure the QmlEngine also needs a qmldir file which indicates what
+files are part of the plugin under which uri. See <link> for more information about this. This
+qmldir file as well as a plugins.qmltypes files which provides information about code-completion is
+autogenerated by the IVI Generator, but needs to be put next to the library. To do this we add
+the files to a scope similar to a INSTALL target, but instead add it to the COPIES variable, which
+makes sure the files are copied when building the plugin.
+
+Now the plugin is ready to be used, but our Instrument Cluster application doesn't know where to
+search for it and is still using the old hardcoded registration. We can now remove the linking step
+in the instrument-cluster.pro file and change our main file to the following:
+
+\quotefromfile ivicore/qface-tutorial/chapter1-basics/instrument-cluster/main.cpp
+\skipto #include
+\printuntil }
+
+The important part which was changed is that we added an additional import path by using the
+addImportPath function, which points to the 'imports' folder next to the binary location.
+
+\section1 Chapter 4
+
+So far we created a Middleware API and integrated it into our Instrument Cluster QML code, extended
+it by using a QML plugin and generated a simulation backend. Quite a lot happened in the background
+to support us, but on the UI side not much has changed till now. This chapter is about bringing our
+simulation backend to life by defining sane default values and starting to simulate a real car
+ride.
+
+\section2 Defining default values
+
+We will start by defining default values for our properties. This is done using annotations in our
+qface IDL file. An annotation is a special kind of comment which adds extra data to a interface,
+method, property etc. For this use case we will use the 'config_simulator' annotation. More
+information what other kind of annotations are available can be found here. At the moment the
+temperature of our Instrument Cluster defaults to 0. Lets change this to a spring temperature and
+change it to 15 degree celsius. This is done by adding the following YAML fragment:
+
+\quotefromfile ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface
+\printuntil }
+
+After compiling the plugin again the temperature change should now be reflected in our Instrument
+Cluster. Let's take a look how this actually works. What happened when starting the IVIGenerator is
+that the config_simulator annotation was transformed into a JSON file which is now part of the
+simulation backend build folder. This JSON file looks like this:
+
+\quotefile ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/instrumentcluster.json
+
+So how is this JSON file related to the actual simulation backend code ? The autogenerated
+simulation backend code is using the QIviSimulationEngine. The QIviSimulationEngine reads the JSON
+file and provides it's data to a QML simulation file. A default QML file is also autogenerated and
+loaded from the QIviSimulationEngine. This QML file provides the behavior of what should happen in
+the simulation backend. We will take a look at the QML file and how we can change in the next
+section, let's first see how we can change the default values in a more dynamic fashion.
+
+The QIviSimulationEngine allows us to override which JSON file should be loaded into the engine by
+setting the QTIVI_SIMULATION_DATA_OVERRIDE environment variable. As there can be multiple engines
+running by different backends we need to define which engine we mean. In the autogenerated code
+always the module name is used as the engine specifier. For this chapter we already prepared a
+second JSON file which is part of our source directory. Setting the environment variable like
+follows, will change the systemType to Mph instead of km/h:
+
+\badcode
+QTIVI_SIMULATION_DATA_OVERRIDE=instrumentcluster=<path-to-file>/miles.json
+\endcode
+
+\section2 How to define a QML behavior ?
+
+Before we define our own behavior, let's first take a look on what has been autogenerated already
+for us: There are two QML files. The first file instrumentcluster_simulation.qml is the entry point
+and just instantiates a InstrumentClusterSimulation.qml file. This is done as there can be multiple
+interfaces defined as part of the same module. The InstrumentClusterSimulation.qml file is way more
+interesting:
+
+\quotefile ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/InstrumentClusterSimulation.qml
+
+First there is a 'settings' property, this is initialised with the return value of the
+IviSimulator.findData method, which takes the IviSimulator.simulationData and a string as input.
+The simulationData is the JSON file represented as a JavaScript object. The findData method helps
+us to extract just the data which is of interest for this interface. In this case for the
+"InstrumentCluster". The following properties helps the behavior to know whether the default
+values are set and a LoggingCategory to identify the log output of this simulation file.
+
+Afterwards the actual behavior is defined by instantiating a InstrumentClusterBackend Item and
+extending it with more functions. The InstrumentClusterBackend is our interface towards our
+InstrumentCluster QML frontend class, but other than the frontend the properties are also writable
+to make it possible to change them to provide a useful simulation.
+
+Every time a frontend instance connects to a backend the initialize() function is called. The same
+happens for the QML simulation, as the initialize() C++ function forwards this to the QML instance.
+The same happens for all other functions like setter and getters for properties or the methods. See
+QIviSimulationEngine for more information.
+
+Inside the QML initialize() function we call the IviSimulator.initializeDefault() function, which
+will read the default values from the simulationData object and initialises all properties. This is
+only done once, as we don't want the properties be reset to default when the next frontend instance
+connects to the backend. Last the base implementation is called to make sure the initializationDone
+signal is sent to the frontend.
+
+Similar a setter function is defined for every property. These setter functions use the
+IviSimulator.checkSettings() function which reads specific constraint settings for the property
+from the simulationData and checks whether these constraints are valid for the new value. In case
+the constraints are not valid, the IviSimulator.constraint() function is used to provide a
+meaningful error message to the user.
+
+\section2 Defining our own QML simulation
+
+As explained above does the InstrumentClusterBackend Item provide all the properties of our IDL
+file. This can be used to simulate a behavior by changing the properties to the values we want.
+This simplest form for this would be a value assignment, but this would be rather static and is not
+what we would like to achieve. Instead we use QML Animation objects to change the values over time:
+
+\quotefromfile ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml
+\skipto NumberAnimation
+\printuntil }
+
+This will change the speed property to 80 over 4000 seconds and simulates a accelerating car.
+Extending this to the other properties and by using sequential and parallel animations a full
+simulation could look like this:
+
+\quotefromfile ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml
+\skipto property var animation
+\printuntil property: "fuel"
+\printuntil property: "fuel"
+\printuntil }
+\printuntil }
+
+To also provide a nice simulation for the 'rpm' property, we use a binding which does some calculations
+based on the current speed. The complete simulation file looks like this:
+
+\quotefromfile ivicore/qface-tutorial/chapter4-simulation-behavior/backend_simulator/simulation.qml
+\skipto import
+
+The next step is to tell the IVI Generator and the QIviSimulationEngine about the new simulation file.
+Similar to QML files, the best aproach here is to put the simulation file into a resource file. In
+our example we added a new file called simulation.qrc which contains our simulation.qml using the
+/ prefix.
+
+This location now needs to be added in form of an annotation to our QFace file:
+
+\quotefromfile ivicore/qface-tutorial/chapter4-simulation-behavior/instrument-cluster.qface
+\printuntil module
+\dots
+
+Rebuilding the simulation backend now will embed the simulation file into the plugin and give the
+file to the QIviSimulationEngine, which will start with the simulation once loaded.
+
+\section1 Chapter 5
+
+In this chapter we will extend our Instrument Cluster to use a IPC mechanism and use two processes.
+At the moment the simulation is loaded as a plugin and because of that part of the same service.
+Although this is good enough for a small example application, it is not how it works in modern
+multi-process architectures, where multiple processes need to be able to access the same value and
+react to changes. We could now write a second Application which is using the same Middleware API,
+but instead we can achieve the same thing by just starting the Instrument Cluster twice and check
+whether the animations are in sync, which they are not.
+
+<< gif >> ????
+
+\section2 Adding a QtRemoteObjects integration
+
+The IPC for this example is QtRemoteObjects as the IVI Generator already provides support for this
+out of the box. To use QtRemoteObjects we generate a second plugin, this time it is a "production"
+backend and because of that automatically preferred over the simulation backend we introduced
+before. This is done by the following project file:
+
+\quotefromfile ivicore/qface-tutorial/chapter5-ipc/backend_qtro/backend_qtro.pro
+\printto CONFIG += install_ok
+
+This pro file looks almost identical to the pro file we used for our simulation backend. For now we
+will just highlight what has been changed. The name for the plugin doesn't end with "_simulation"
+to indicate that this is a "production" backend and the QFACE_FORMAT has been changed to
+"backend_qtro" to generate a backend which uses QtRemoteObjects Replicas to connect to a
+QtRemoteObjects Source providing the values.
+
+In addition to a QtRemoteObject based backend, we also need a QtRemoteObject based server. This
+part can also be autogenerated using the IVI Generator in a similar fashion:
+
+\quotefromfile ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro
+\printto target.path
+
+Because we would like to generate a server binary, the TEMPLATE needs to be set to app instead of
+lib and similar to the plugin the server also needs to link against our library as it needs to have
+access to the defined enums, structs and other types. The template we use to generate a simulation
+server is called "server_qtro_simulator".
+
+\section2 Reusing the existing simulation behavior
+
+If you start the server now and then the Instrument Cluster you don't see the simulation anymore,
+which we added in the previous chapter. The reason for this, is that the simulation code is part of
+our simulation backend, but this backend is not used anymore as we added the QtRemoteObjects based
+"production" backend.
+
+Because we used the "server_qtro_simulator" generation template, this can easily be fixed, as the
+generated server code is also using the QIviSimulationEngine and supports to use the same
+simulation file than our simulation backend. We just need to extend the project file in the same
+way as we did before and are also able to use the same resource file for this.
+
+\quotefromfile ivicore/qface-tutorial/chapter5-ipc/simulation_server/simulation_server.pro
+\skipto RESOURCES
+\printuntil RESOURCES
+
+In the same way we can also use the other simulation data JSON file we defined in the previous
+chapter by using the same environment variable. We just need to pass it to the server instead of
+our Instrument Cluster application.
+
+Doing the final test, starting two Instrument Cluster instances should now show the animations in
+sync:
+
+<< gif >> ???
+
+\section1 Chapter 6
+
+In the previous chapter we extended our Instrument Cluster code by using QtRemoteObjects as IPC and
+autogenerated a backend for it, as well as a server providing the simulation. In this chapter we
+would like to manually write our own backend which is using DBus as IPC. For this we already
+prepared a working D-Bus server which provides a very limited simulation.
+
+Let's first take a short look at the server code and see what is done there and then write the
+backend connecting to it.
+
+\section2 D-Bus Server
+
+As said above we will use D-Bus for this chapter and we already have a XML file describing the
+D-Bus interface, similar to our qface IDL:
+
+\quotefile ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.xml
+
+This xml file is used to let qmake generate a base class which is extended by the server with
+actual functionality. See the QtDBus documentation for more information about this works in detail.
+
+Our D-Bus server starts on the session bus on the / path and provides a interface name
+"Example.IVI.InstrumentCluster". To simulate some values, we keep it simple and just use a timer
+event to change the speed value each 100 milliseconds and start at 0 again once the maximum of 250
+is reached. In a similar way the rpm value is increased until 5000. For all other properties we
+simply provide hardcoded values.
+
+\quotefromfile ivicore/qface-tutorial/chapter6-own-backend/demo_server/instrumentcluster.cpp
+\skipto timerEvent
+\printuntil }
+
+\section2 Our own D-Bus Backend
+
+Let's start with a project file for our backend. This is very similar to previous project files,
+but doesn't use the IVI Generator, but instead uses DBUS_INTERFACES to autogenerate some client
+code which sends and receives messages over D-Bus. First we need to define the entry point for our
+plugin. This plugin class needs to derive from QIviServiceInterface and implement two functions:
+
+\list
+ \li \c {QStringList interfaces()} Returns a list of all interfaces supported by this plugin
+ \li \c {QIviFeatureInterface *interfaceInstance(const QString &interface)} Returns a instance of the requested interface
+\endlist
+
+In addition we also need to provide the list of interfaces we support as plugin metadata in form of
+a JSON file which looks like this:
+
+\quotefile ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentcluster_dbus.json
+
+This is needed as it gives QtIvi the chance to know which interfaces a backend supports before
+instantiating it and only load the plugins which are needed for by the app code.
+
+Our plugin code looks like this:
+
+\quotefromfile ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterplugin.cpp
+\skipto #include
+\printuntil eof
+
+In interfaces() we use the IID which is defined in instrumentclusterbackendinterface.h from our
+autogenerated library. In insterfaceInstance() we check for the correct string and return a
+instance of our implemented instrument cluster backend.
+
+This backend will be defined in instrumentclusterbackend.h and derives from
+InstrumentClusterBackendInterface. In our InstrumentClusterBackend class we need to implement all
+pure virtual functions from InstrumentClusterBackendInterface and derived classes. For our example
+this is pretty simple, as we just need to implement the initialize() function. If our IDL would use
+writable properties or methods, we would need to implement these as well. We don't need to
+implement getters for our properties, because QtIvi uses the changed signals during the
+initialization phase to get informed about the current state. Although the generated DBus interface
+class would provides getters to retrieve the properties from our server, it is not recommended to
+use these when developing a backend. These getters are implemented by using synchronous calls, which
+means they will block the event loop until an answer is received by the client. This can lead to
+performance issues and is the reason why we recommend to use async calls instead.
+
+In our backend we define a fetch function for every property which is implemented like this:
+
+\quotefromfile ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp
+\skipto ::fetchSpeed
+\printto ::fetchRpm
+
+First we add the property to a list to know which properties have been fetched successfully. In the
+next step we use the asyncCall() function to call the getter for the 'speed' property and use a
+QDBusPendingCallWatcher to wait for the result. Once the result is ready the lambda will remove the
+property again from our fetchList use the onSpeedChanged() function to store the value and notify
+the frontend about it. As we don't need the watcher anymore we delete it in the next event loop
+run using deleteLater() and call the checkInitDone() function.
+
+The checkInitDone() function is defined as follows:
+
+\quotefromfile ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp
+\skipto ::checkInitDone
+\printto onSpeedChanged
+
+It makes sure the initializationDone() signal is sent to the frontend once all our properties were
+fetched from the server and the initialization is complete.
+
+In addition to retrieving the current state from the server, we also need to inform our frontend
+about every property change. This is done by emitting the corresponding change signal once the
+server changed one of it's properties. For this we define a slot for every property. This slot
+will save the property in our class an emit the change signal:
+
+\quotefromfile ivicore/qface-tutorial/chapter6-own-backend/backend_dbus/instrumentclusterbackend.cpp
+\skipto void InstrumentClusterBackend::onSpeedChanged(int speed)
+\printto onRpmChanged
+
+The same slot is also used during the initialization phase to save and emit the value.
+
+You might think now why saving the value is needed at all and why not just emit the signal. The
+reason for this is that the backend plugin is used directly by every instance of the InstrumentCluster
+class and every instance calls the initialize() function to retrieve the current state. Instead
+of fetching all properties again the second initialize() call will just emit the already saved
+values and the slots will keep them uptodate.
+
+When starting the Instrument Cluster now, our backend should connect to our D-Bus server and now
+look like this:
+
+< gif >
+
+*/