diff options
author | Scott Murray <scott.murray@konsulko.com> | 2020-01-15 10:53:13 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2020-01-17 16:50:05 +0000 |
commit | 59d23c161921890425e8d2e91441381d0fef0a32 (patch) | |
tree | 3a89fa7e2afd3d7314379015dcd48b3456d53a43 /app/qml/Main.qml | |
parent | ac85ae4ce0a2e5c3bd433db2882422a86539b203 (diff) |
Add info page selected by steering wheel eventhalibut_8.0.6halibut_8.0.5halibut/8.0.6halibut/8.0.58.0.68.0.5halibut
Add a information window that can be switched to based on the
"event.info" event from signal composer that the steering wheel
"Info" button results in. For now, it simply displays the vehicle
and engine speed in numeric form in a larger font, and a small
time display. The speeds are also driven by the corresponding
signal composer events that are hooked to the underlying CAN
messages.
Bug-AGL: SPEC-3109
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Ibe66ecdb94b854d4ebc7f98ad7e1bf01fc615f1a
Diffstat (limited to 'app/qml/Main.qml')
-rw-r--r-- | app/qml/Main.qml | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/app/qml/Main.qml b/app/qml/Main.qml index 346cded..7c83f37 100644 --- a/app/qml/Main.qml +++ b/app/qml/Main.qml @@ -4,22 +4,62 @@ import QtQuick.Controls 2.2 import "qrc:/qml" ApplicationWindow { - id: window + id: tbtnavi title: "Turn By Turn Navigation Demo" height: 720 width: 640 visible: true + property double vehicleSpeed: 0 + property double engineSpeed: 0 + + Connections { + target: SignalComposer + + onSignalEvent: { + //console.log ("Received uid = " + uid + ", value = " + value) + if (uid === "event.info" && value === "true") { + console.log ("Switching views!") + console.log ("currentIndex = " + container.currentIndex) + if (container.currentIndex === 0) { + console.log ("Switching to info") + container.currentIndex = 1 + } else if (container.currentIndex === 1) { + console.log ("Switching to map") + container.currentIndex = 0 + } + } else if (uid === "event.vehicle.speed") { + var speed_tmp = parseFloat(value) + if(units == "km/h") { + speed_tmp /= 1.609 + } + vehicleSpeed = speed_tmp + } else if (uid === "event.engine.speed") { + engineSpeed = parseFloat(value) + } + } + } + Item { + id: container anchors.centerIn: parent width: parent.width height: parent.height + property int currentIndex: 0 + MapWindow { - id: mapwindow + visible: parent.currentIndex === 0 + opacity: parent.currentIndex === 0 ? 1.0 : 0.0 anchors.fill: parent objectName: "mapwindow" } + + InfoWindow { + visible: parent.currentIndex === 1 + opacity: parent.currentIndex === 1 ? 1.0 : 0.0 + anchors.fill: parent + } } } |