aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Lelong <lelong.ph@meltemus.com>2016-12-20 16:35:17 +0100
committerPhilippe Lelong <lelong.ph@meltemus.com>2016-12-20 16:35:17 +0100
commit7f94f08691efc1ce0e98e72707c3f2022d29fa57 (patch)
treeb80f276c47e293e1ffe7c731efbfc58ef7d43987
parent36a507d476066e7b12b462ec2d48d71447b663ab (diff)
Modification for dynamic speed sign (not activated)sandbox/maitai/forgerock4
Signed-off-by: Philippe Lelong <lelong.ph@meltemus.com>
-rw-r--r--HomeScreen/qml/Home.qml25
-rw-r--r--HomeScreen/qml/images/Home/home.qrc1
-rw-r--r--HomeScreen/qml/images/Home/sign.pngbin0 -> 23369 bytes
-rw-r--r--HomeScreen/src2/usermanagement.cpp14
-rw-r--r--HomeScreen/src2/usermanagement.h2
5 files changed, 37 insertions, 5 deletions
diff --git a/HomeScreen/qml/Home.qml b/HomeScreen/qml/Home.qml
index 423c24c..6657d40 100644
--- a/HomeScreen/qml/Home.qml
+++ b/HomeScreen/qml/Home.qml
@@ -41,8 +41,20 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 20
- source: './images/B14-90.png'
+ source: './images/sign.png'
visible: false
+ Label {
+ id: speedLimit
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ color: "black"
+ text: "50"
+ font.pixelSize: 90
+ font.family: "Roboto"
+ font.bold: true
+ visible: false
+ }
}
Image {
id: flagLanguage
@@ -119,8 +131,17 @@ Item {
animation2.running = true;
}
- function showSign90(show) {
+ function showSign90(show, speed, unit) {
sign90.visible = show
+ if(show) {
+ if(speed.length > 2)
+ speedLimit.font.pixelSize = 60
+ else
+ speedLimit.font.pixelSize = 90
+ speedLimit.text = speed
+ }
+ sign90.source = './images/B14-90.png'
+ speedLimit.visible = false
}
function showVisa(show, num) {
diff --git a/HomeScreen/qml/images/Home/home.qrc b/HomeScreen/qml/images/Home/home.qrc
index 4a02101..84639d3 100644
--- a/HomeScreen/qml/images/Home/home.qrc
+++ b/HomeScreen/qml/images/Home/home.qrc
@@ -28,5 +28,6 @@
<file>Open Trunk.png</file>
<file>Install App.png</file>
<file>View Online.png</file>
+ <file>sign.png</file>
</qresource>
</RCC>
diff --git a/HomeScreen/qml/images/Home/sign.png b/HomeScreen/qml/images/Home/sign.png
new file mode 100644
index 0000000..d0f7213
--- /dev/null
+++ b/HomeScreen/qml/images/Home/sign.png
Binary files differ
diff --git a/HomeScreen/src2/usermanagement.cpp b/HomeScreen/src2/usermanagement.cpp
index 9ea968f..77b14bb 100644
--- a/HomeScreen/src2/usermanagement.cpp
+++ b/HomeScreen/src2/usermanagement.cpp
@@ -54,12 +54,22 @@ void UserManagement::setUser(const User &user)
QMetaObject::invokeMethod(home, "languageChanged");
QMetaObject::invokeMethod(shortcutArea, "languageChanged", Q_ARG(QVariant, user.graphPreferredLanguage));
QMetaObject::invokeMethod(statusArea, "languageChanged", Q_ARG(QVariant, user.graphPreferredLanguage));
- QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, !user.graphActions.contains("Exceed 100 Kph")));
QStringList t;
+ bool noSpeedLimit = true;
foreach(const QString &s, user.graphActions) {
- if(!s.contains("Exceed"))
+ if(!s.contains("Exceed")) {
t.append(s);
+ } else {
+ noSpeedLimit = false;
+ QStringList speed = s.split(" ");
+ if(speed.size() == 3)
+ QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, true),
+ Q_ARG(QVariant, speed.at(1)), Q_ARG(QVariant, speed.at(2)));
+ }
}
+ if(noSpeedLimit)
+ QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, false),
+ Q_ARG(QVariant, QString()), Q_ARG(QVariant, QString()));
QString type = user.policy;
if(user.graphPreferredLanguage == "fr") {
if(type == "Owner")
diff --git a/HomeScreen/src2/usermanagement.h b/HomeScreen/src2/usermanagement.h
index c3a41bc..32db93f 100644
--- a/HomeScreen/src2/usermanagement.h
+++ b/HomeScreen/src2/usermanagement.h
@@ -1,7 +1,7 @@
#ifndef USERMANAGEMENT_H
#define USERMANAGEMENT_H
-//#define REAL_SERVER "ws://localhost:1212/api?token=hello"
+#define REAL_SERVER "ws://localhost:1212/api?token=hello"
#include <QObject>
#include "applicationmodel.h"