From 7f94f08691efc1ce0e98e72707c3f2022d29fa57 Mon Sep 17 00:00:00 2001 From: Philippe Lelong Date: Tue, 20 Dec 2016 16:35:17 +0100 Subject: Modification for dynamic speed sign (not activated) Signed-off-by: Philippe Lelong --- HomeScreen/qml/Home.qml | 25 +++++++++++++++++++++++-- HomeScreen/qml/images/Home/home.qrc | 1 + HomeScreen/qml/images/Home/sign.png | Bin 0 -> 23369 bytes HomeScreen/src2/usermanagement.cpp | 14 ++++++++++++-- HomeScreen/src2/usermanagement.h | 2 +- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 HomeScreen/qml/images/Home/sign.png 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 @@ Open Trunk.png Install App.png View Online.png + sign.png diff --git a/HomeScreen/qml/images/Home/sign.png b/HomeScreen/qml/images/Home/sign.png new file mode 100644 index 0000000..d0f7213 Binary files /dev/null and b/HomeScreen/qml/images/Home/sign.png 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 #include "applicationmodel.h" -- cgit 1.2.3-korg