summaryrefslogtreecommitdiffstats
path: root/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch')
-rw-r--r--meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch166
1 files changed, 166 insertions, 0 deletions
diff --git a/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch
new file mode 100644
index 000000000..36f9d7b3b
--- /dev/null
+++ b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/0008-Add-simple-Qt-QML-example.patch
@@ -0,0 +1,166 @@
+From 7c452ae1228b01a3db697b5a74c9dee60dcfe352 Mon Sep 17 00:00:00 2001
+From: Petr Nechaev <petr.nechaev@cogentembedded.com>
+Date: Mon, 3 Aug 2015 14:17:40 +0300
+Subject: [PATCH 8/9] Add simple Qt-QML example
+
+The example requires qtdeclarative. It outputs values of basic vehicle
+properties.
+---
+ plugins/dbus/amb-qt/CMakeLists.txt | 6 +++++
+ plugins/dbus/amb-qt/Meter.qml | 46 +++++++++++++++++++++++++++++++++++++
+ plugins/dbus/amb-qt/qtquicktest.cpp | 12 ++++++++++
+ plugins/dbus/amb-qt/qtquicktest.qml | 35 ++++++++++++++++++++++++++++
+ plugins/dbus/amb-qt/qtquicktest.qrc | 6 +++++
+ 5 files changed, 105 insertions(+)
+ create mode 100644 plugins/dbus/amb-qt/Meter.qml
+ create mode 100644 plugins/dbus/amb-qt/qtquicktest.cpp
+ create mode 100644 plugins/dbus/amb-qt/qtquicktest.qml
+ create mode 100644 plugins/dbus/amb-qt/qtquicktest.qrc
+
+diff --git a/plugins/dbus/amb-qt/CMakeLists.txt b/plugins/dbus/amb-qt/CMakeLists.txt
+index 42b7fb4..99f691b 100644
+--- a/plugins/dbus/amb-qt/CMakeLists.txt
++++ b/plugins/dbus/amb-qt/CMakeLists.txt
+@@ -31,10 +31,16 @@ target_link_libraries(ambqtquick amb-qt ${QT_LIBRARIES} -L${CMAKE_CURRENT_BINARY
+ add_executable(ambtestclient test.cpp)
+ target_link_libraries(ambtestclient amb amb-qt ${QT_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${gio_LIBRARIES})
+
++qt5_add_resources(ambqtquicktest_RESOURCES qtquicktest.qrc)
++add_executable(ambqtquicktest qtquicktest.cpp ${ambqtquicktest_RESOURCES})
++target_link_libraries(ambqtquicktest amb amb-qt ${QT_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
++qt5_use_modules(ambqtquicktest Quick Core)
++
+ install (TARGETS amb-qt LIBRARY DESTINATION lib${LIB_SUFFIX})
+
+ install (FILES ${ambqt_headers} DESTINATION ${INCLUDE_INSTALL_DIR}/ COMPONENT Devel)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/qmldir DESTINATION ${LIB_INSTALL_DIR}/qt5/qml/amb COMPONENT Devel)
+ install (TARGETS ambqtquick DESTINATION ${LIB_INSTALL_DIR}/qt5/qml/amb)
+ install (TARGETS ambtestclient RUNTIME DESTINATION bin)
++install (TARGETS ambqtquicktest RUNTIME DESTINATION bin)
+ endif(qt_bindings)
+diff --git a/plugins/dbus/amb-qt/Meter.qml b/plugins/dbus/amb-qt/Meter.qml
+new file mode 100644
+index 0000000..370e4da
+--- /dev/null
++++ b/plugins/dbus/amb-qt/Meter.qml
+@@ -0,0 +1,46 @@
++/*
++Copyright (C) 2015 Cogent Embedded Inc.
++
++This library is free software; you can redistribute it and/or
++modify it under the terms of the GNU Lesser General Public
++License as published by the Free Software Foundation; either
++version 2.1 of the License, or (at your option) any later version.
++
++This library is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++Lesser General Public License for more details.
++
++You should have received a copy of the GNU Lesser General Public
++License along with this library; if not, write to the Free Software
++Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++*/
++import QtQuick 2.0
++import amb 0.1
++
++Row {
++
++ property string name
++ onNameChanged: {
++ // we use objectName.propertyName format
++ var parts = name.split(".");
++ prop.objectName = parts[0];
++ prop.propertyName = parts.length >= 2 ? parts[1] : "Value";
++ prop.connect();
++ }
++
++ spacing: 10
++ Text {
++ text: parent.name
++ font.pointSize: 14
++ width: 300 // this is a guess
++ }
++ Text {
++ text: qsTr("%1").arg(prop.value)
++ font.pointSize: 14
++ }
++
++ AutomotivePropertyItem {
++ id: prop
++ }
++}
+diff --git a/plugins/dbus/amb-qt/qtquicktest.cpp b/plugins/dbus/amb-qt/qtquicktest.cpp
+new file mode 100644
+index 0000000..4735d57
+--- /dev/null
++++ b/plugins/dbus/amb-qt/qtquicktest.cpp
+@@ -0,0 +1,12 @@
++#include <QGuiApplication>
++#include <QQmlApplicationEngine>
++
++int main(int argc, char *argv[])
++{
++ QGuiApplication app(argc, argv);
++
++ QQmlApplicationEngine engine;
++ engine.load(QUrl(QStringLiteral("qrc:/qtquicktest.qml")));
++
++ return app.exec();
++}
+diff --git a/plugins/dbus/amb-qt/qtquicktest.qml b/plugins/dbus/amb-qt/qtquicktest.qml
+new file mode 100644
+index 0000000..70cd846
+--- /dev/null
++++ b/plugins/dbus/amb-qt/qtquicktest.qml
+@@ -0,0 +1,35 @@
++/*
++Copyright (C) 2015 Cogent Embedded Inc.
++
++This library is free software; you can redistribute it and/or
++modify it under the terms of the GNU Lesser General Public
++License as published by the Free Software Foundation; either
++version 2.1 of the License, or (at your option) any later version.
++
++This library is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++Lesser General Public License for more details.
++
++You should have received a copy of the GNU Lesser General Public
++License along with this library; if not, write to the Free Software
++Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++*/
++import QtQuick 2.0
++import QtQuick.Window 2.0
++
++Window {
++ visible: true
++ width: 500
++ height: 400
++
++ Column {
++ anchors.fill: parent;
++
++ Meter { name: "VehicleSpeed.Speed"}
++ Meter { name: "EngineSpeed.Speed"}
++ Meter { name: "SteeringWheel.Angle"}
++ Meter { name: "ThrottlePosition.Value"}
++ Meter { name: "BrakeOperation.BrakePressure"}
++ }
++}
+diff --git a/plugins/dbus/amb-qt/qtquicktest.qrc b/plugins/dbus/amb-qt/qtquicktest.qrc
+new file mode 100644
+index 0000000..998ec70
+--- /dev/null
++++ b/plugins/dbus/amb-qt/qtquicktest.qrc
+@@ -0,0 +1,6 @@
++<RCC>
++ <qresource prefix="/">
++ <file>qtquicktest.qml</file>
++ <file>Meter.qml</file>
++ </qresource>
++</RCC>
+--
+1.9.1
+