File speed-limit-sign-instead-of-logo-in-the-middle.patch of Package cluster-dashboard

From 6387911c8576ccafc07ee929040187ae43130418 Mon Sep 17 00:00:00 2001
From: Radoslav Kolev <radoslav.kolev@suse.com>
Date: Thu, 21 Sep 2023 09:37:21 +0300
Subject: [PATCH] Show speed limit sign instead of logo in the middle

---
 app/ValueSource.qml    | 12 ++++++++++++
 app/cluster-gauges.qml | 27 +++++++++++++++++++++------
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/app/ValueSource.qml b/app/ValueSource.qml
index 511a2a1..232c312 100644
--- a/app/ValueSource.qml
+++ b/app/ValueSource.qml
@@ -57,6 +57,7 @@ Item {
     property real speedScaling: mphDisplay == true ? 0.621504 : 1.0
     property real rpm: 1
     property real fuel: 0.85
+    property int speedLimit: 0
     property string gear: {
         var g;
         if (kph < 30) {
@@ -118,6 +119,7 @@ Item {
 	    VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.CruiseCancel")
 	    VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.LaneDepartureWarning")
 	    VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.Info")
+	    VehicleSignals.subscribe("Vehicle.ADAS.SpeedLimitDetection.SpeedLimit")
 	    VehicleSignals.get("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
 	    VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
 	}
@@ -171,6 +173,8 @@ Item {
                 } else if (value === "mi") {
                     valueSource.mphDisplay = true
                 }
+            } else if (path == "Vehicle.ADAS.SpeedLimitDetection.SpeedLimit" ) {
+                valueSource.speedLimit = parseFloat (value)
             }
         }
     }
@@ -225,6 +229,14 @@ Item {
                     to: 6.1
                     duration: 3000
                 }
+                NumberAnimation {
+                    target: valueSource
+                    property: "speedLimit"
+                    easing.type: Easing.InOutSine
+                    from: 10
+                    to: 140
+                    duration: 9000
+                }
             }
             ParallelAnimation {
                 // We changed gears so we lost a bit of speed.
diff --git a/app/cluster-gauges.qml b/app/cluster-gauges.qml
index e4c299b..e7675d7 100644
--- a/app/cluster-gauges.qml
+++ b/app/cluster-gauges.qml
@@ -474,13 +474,28 @@ ApplicationWindow {
         border.width: 4
         border.color: "grey"
 
-        Image {
-            source: './images/Utility_Logo_Grey-01.svg'
-            x: (parent.width - width) / 2
-            y: (parent.height - height) / 2
-            width: parent.width / 2
+        Rectangle {
+            id: redCircle
+            anchors.centerIn: parent
+            width: parent.width - 100
             height: width
-        }
+            radius: width/2
+            border.color: "red"
+            border.width: 50
+            color: "white"
+            visible: (valueSource.speedLimit > 0 && valueSource.speedLimit < 199) ? true : false
+
+            Label {
+                id: speedLimit
+                anchors.centerIn: parent
+                anchors.alignWhenCentered: false
+                text: valueSource.speedLimit
+                font.pixelSize: 244
+
+                color: "black"
+            }
+
+         }
     }
 
     Image {
-- 
2.26.2

openSUSE Build Service is sponsored by