From 21066f75ee05302fb960a57952e41aeb1d6dc4a4 Mon Sep 17 00:00:00 2001 From: Nedim Hadzic Date: Mon, 5 Dec 2016 16:25:54 +0100 Subject: Updated cluster right dial layout * Removed unused elements and properties. They were project specific * Exposed properties to apps in order to manipulate looks for the simulation * Updated right dial layout Change-Id: I3eae3f50d2871e218370d6f1ea685c6998625fe7 Reviewed-by: Dominik Holland --- imports/system/models/VehicleModel.qml | 59 +++++++++++----------------------- sysui/Cluster/RightDial.qml | 9 +++--- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/imports/system/models/VehicleModel.qml b/imports/system/models/VehicleModel.qml index 9010d2d..9f03bd7 100644 --- a/imports/system/models/VehicleModel.qml +++ b/imports/system/models/VehicleModel.qml @@ -39,51 +39,17 @@ QtObject { property bool dialAnimation: true property real speed: navigationControl.navigationRunning ? navigationControl.navigationSpeed : 0 - - - Behavior on speed { - SmoothedAnimation { - velocity: 6 - duration : 5000 - easing.overshoot: 0 - } - } + property string rightDialBorderColor: navigationControl.dialBorderColor + property bool warningDialAnimation: navigationControl.activateWarning readonly property real rightDialValue: root.speed * 0.0031 property int displaySpeed: speed property real fuel: 0.5 // fuel precentage min 0.0; max 1.0; - property string rightDialIcon: Style.gfx("cluster/my_position") - property string rightDialMainText: "0.6mi" - property string rightDialSubText: "Service in\n200mi" - property real rightIconScale: 1 - property var gasStationEvent - property bool gasStationUpdateActive: false - property Timer fuelTimer: Timer { - interval: 5000 - onTriggered: { - root.fuel = 0.2 - root.rightDialIcon = Style.gfx("livedrive/fuel_orange") - root.rightIconScale = 1.4 - root.rightDialMainText = "Low Fuel" - root.rightDialSubText = "Estimation: 5mi" - if (root.gasStationEvent) { - root.gasStationEvent.priority = 1 - fuelEventTimer.start() - } - } - } - - property Timer fuelEventTimer: Timer { - interval: 4000 - onTriggered: { - root.rightDialIcon = Style.gfx("livedrive/fuel_orange") - root.rightIconScale = 1.4 - root.rightDialMainText = root.gasStationEvent.distanceFromStart + "m" - root.rightDialSubText = "SHELL\n2$/Gl" - root.gasStationUpdateActive = true - } - } + property string rightDialIcon: navigationControl.rightDialIcon + property string rightDialMainText: navigationControl.mainText + property string rightDialSubText: navigationControl.subText + property real rightIconScale: 2 property Timer timer: Timer { running: root.dialAnimation @@ -102,10 +68,23 @@ QtObject { property real navigationSpeed: 0 property bool navigationRunning: false + property bool activateWarning: false + property string dialBorderColor: Style.colorWhite + property string rightDialIcon: Style.gfx("cluster/my_position") + property string mainText: "0.6mi" + property string subText: "Service in 300km" Component.onCompleted: { ApplicationIPCManager.registerInterface(navigationControl, "com.pelagicore.navigation.control", {}) } } + Behavior on speed { + SmoothedAnimation { + velocity: 6 + duration : 5000 + easing.overshoot: 0 + } + } + } diff --git a/sysui/Cluster/RightDial.qml b/sysui/Cluster/RightDial.qml index faaf94b..bd89b37 100644 --- a/sysui/Cluster/RightDial.qml +++ b/sysui/Cluster/RightDial.qml @@ -102,7 +102,7 @@ Item { height: width radius: width color: "transparent" - border.color: (VehicleModel.fuel < 0.4 || NavigationService.traficAlert) ? Style.colorOrange : "white" + border.color: VehicleModel.rightDialBorderColor border.width: rect.borderWidth anchors.centerIn: parent anchors.horizontalCenterOffset: -3 @@ -110,7 +110,7 @@ Item { property int borderWidth: 3 SequentialAnimation { - running: (VehicleModel.fuel < 0.4 || NavigationService.traficAlert) + running: VehicleModel.warningDialAnimation loops: Animation.Infinite NumberAnimation { @@ -157,7 +157,7 @@ Item { Image { id: fuelSymbol anchors.top: parent.top - anchors.topMargin: 20 + anchors.topMargin: 60 anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenterOffset: 5 source: VehicleModel.rightDialIcon @@ -185,9 +185,10 @@ Item { width: parent.width anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter - font.pixelSize: 0.05 * root.height + font.pixelSize: text.length > 10 ? Style.fontSizeS : Style.fontSizeM font.bold: true text: VehicleModel.rightDialMainText + elide: Text.ElideMiddle } } } -- cgit v1.2.1