summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/app.qrc1
-rw-r--r--app/main.cpp3
-rw-r--r--app/qml/InfoWindow.qml101
-rw-r--r--app/qml/Main.qml44
-rw-r--r--app/qml/TbtBoard.qml17
-rwxr-xr-x[-rw-r--r--]autobuild/agl/autobuild0
-rw-r--r--package/config.xml1
7 files changed, 157 insertions, 10 deletions
diff --git a/app/app.qrc b/app/app.qrc
index 7ffb6e2..0f1bb81 100644
--- a/app/app.qrc
+++ b/app/app.qrc
@@ -3,6 +3,7 @@
<file>qml/qmldir</file>
<file>qml/Main.qml</file>
<file>qml/MapWindow.qml</file>
+ <file>qml/InfoWindow.qml</file>
<file>qml/TbtBoard.qml</file>
</qresource>
</RCC>
diff --git a/app/main.cpp b/app/main.cpp
index 108ce08..eb00109 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -10,6 +10,7 @@
#include <qlibwindowmanager.h>
#include <qlibhomescreen.h>
#include <navigation.h>
+#include <signalcomposer.h>
#include "navigation_client.h"
#include "qcheapruler.hpp"
@@ -89,6 +90,8 @@ int main(int argc, char *argv[])
Navigation *navigation = new Navigation(bindingAddress, context);
+ context->setContextProperty("SignalComposer", new SignalComposer(bindingAddress, context));
+
engine.load(QUrl(QStringLiteral("qrc:qml/Main.qml")));
QObject *root = engine.rootObjects().first();
diff --git a/app/qml/InfoWindow.qml b/app/qml/InfoWindow.qml
new file mode 100644
index 0000000..4acba5d
--- /dev/null
+++ b/app/qml/InfoWindow.qml
@@ -0,0 +1,101 @@
+import QtQuick 2.9
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+
+Rectangle {
+ id: infoWindow
+
+ anchors.fill: parent
+ color: "black"
+
+ property date now: new Date
+ Timer {
+ interval: 100; running: true; repeat: true;
+ onTriggered: parent.now = new Date
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 0
+
+ Text {
+ Layout.fillWidth: true
+ Layout.fillHeight: false
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: parent.height / 10
+
+ text: now.toLocaleString(Qt.locale("en_US"), 'h:mm A')
+ font.pixelSize: 40
+ color: "white"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ padding: 0
+ }
+
+ Text {
+ id: speedText
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: parent.height / 10
+
+ text: tbtnavi.vehicleSpeed.toFixed(0)
+ color: "white"
+ font.pixelSize: 280
+ // Slight hack to shrink the border around the text by tweaking
+ // the line height, note that it is font size dependent
+ lineHeight: 0.8
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ padding: 0
+ }
+ Text {
+ id: speedLabel
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+
+ text: "MPH"
+ color: "white"
+ font.pixelSize: 32
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ padding: 0
+ }
+
+ Text {
+ id: rpmText
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: parent.height / 16
+
+ text: tbtnavi.engineSpeed.toFixed(0)
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ padding: 0
+ }
+ Text {
+ id: rpmLabel
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+
+ text: "RPM"
+ color: "white"
+ font.pixelSize: 32
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ padding: 0
+ }
+
+ // Use height filling rectangle to push things together,
+ // saving tinkering with minimum/preferred heights
+ Rectangle {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ color: "black"
+ }
+ }
+}
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
+ }
}
}
diff --git a/app/qml/TbtBoard.qml b/app/qml/TbtBoard.qml
index cf6f537..ccec5fd 100644
--- a/app/qml/TbtBoard.qml
+++ b/app/qml/TbtBoard.qml
@@ -163,16 +163,17 @@ Item {
// Set distance
function do_setDistance(dis) {
- if(dis > 1000)
- {
- distanceBoard.text = (dis / 1000).toFixed(1) + " km"
- }
- else
- {
- distanceBoard.text = dis + " m"
+ if(dis > 1000) {
+ distanceBoard.text = (dis / 1000).toFixed(1) + " km"
+ } else {
+ distanceBoard.text = dis + " m"
}
- distance.text = (((dis/100).toFixed(0))*100) +"m"
+ if(dis > 0) {
+ distance.text = (((dis/100).toFixed(0))*100) +"m"
+ } else {
+ distance.text = ""
+ }
}
//set turnInstructions
diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild
index e87a1c3..e87a1c3 100644..100755
--- a/autobuild/agl/autobuild
+++ b/autobuild/agl/autobuild
diff --git a/package/config.xml b/package/config.xml
index 37f6067..65a66c5 100644
--- a/package/config.xml
+++ b/package/config.xml
@@ -10,6 +10,7 @@
<param name="windowmanager" value="ws"/>
<param name="homescreen" value="ws"/>
<param name="navigation" value="ws"/>
+ <param name="signal-composer" value="ws"/>
</feature>
<feature name="urn:AGL:widget:required-permission">
<param name="urn:AGL:permission::public:no-htdocs" value="required" />