Skip to content

Commit

Permalink
Moved VehicleService to system model
Browse files Browse the repository at this point in the history
Vehicle service should be part of the system UI
and not available to an app. It is renamed and moved
to system models.

Change-Id: Ic00c4cc1835ab4ec7a134fc60fd6dbacb63944cf
Reviewed-by: Dominik Holland <[email protected]>
  • Loading branch information
Nedim Hadzic committed Oct 6, 2016
1 parent e720488 commit 36c8b83
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 17 deletions.
1 change: 0 additions & 1 deletion imports/shared/service/vehicle/qmldir

This file was deleted.

2 changes: 1 addition & 1 deletion imports/system/models/ApplicationManagerInterface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import QtQuick 2.0
import QtApplicationManager 1.0
import service.navigation 1.0
import service.music 1.0
import service.vehicle 1.0
import "."
import utils 1.0

QtObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
pragma Singleton
import QtQuick 2.0
import utils 1.0
import QtApplicationManager 1.0

QtObject {
id: root

property bool dialAnimation: true
property real speed: 0
property bool dialAnimation: navigationControl.navigationRunning
property real speed: navigationControl.navigationRunning ? navigationControl.navigationSpeed : 0


Behavior on speed {
Expand Down Expand Up @@ -90,9 +91,23 @@ QtObject {
interval: 4000
property bool higherValue: false
onTriggered: {
root.speed = higherValue ? (0) : (120)
if (navigationControl.navigationRunning)
root.speed = higherValue ? (navigationControl.navigationSpeed - 5) : (navigationControl.navigationSpeed +5)
else
root.speed = higherValue ? (0) : (120)
higherValue = !higherValue
}
}

// For simulations we need to communicate with nav app
property QtObject navigationControl: ApplicationIPCInterface {

property real navigationSpeed: 0
property bool navigationRunning: false

Component.onCompleted: {
ApplicationIPCManager.registerInterface(navigationControl, "com.pelagicore.navigation.control", {})
}
}

}
1 change: 1 addition & 0 deletions imports/system/models/qmldir
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
singleton ApplicationManagerInterface 1.0 ApplicationManagerInterface.qml
singleton NotificationModel 1.0 NotificationModel.qml
singleton VehicleModel 1.0 VehicleModel.qml
4 changes: 2 additions & 2 deletions sysui/Cluster/Fuel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
import QtQuick 2.1
import utils 1.0
import controls 1.0
import service.vehicle 1.0
import models 1.0

Item {
id: root

width: 0.73 * Style.clusterHeight
height: width -1

property real value: VehicleService.fuel <= 0.3 ? (VehicleService.fuel + 0.1) : VehicleService.fuel
property real value: VehicleModel.fuel <= 0.3 ? (VehicleModel.fuel + 0.1) : VehicleModel.fuel

Behavior on value {
NumberAnimation {
Expand Down
6 changes: 3 additions & 3 deletions sysui/Cluster/LeftDial.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import QtQuick 2.1
import QtGraphicalEffects 1.0
import utils 1.0
import service.vehicle 1.0
import models 1.0

Item {
id: root
Expand Down Expand Up @@ -80,7 +80,7 @@ Item {
font.pixelSize: 60
font.letterSpacing: 4
color: Style.colorWhite
text: VehicleService.displaySpeed
text: VehicleModel.displaySpeed
}

Rectangle {
Expand Down Expand Up @@ -126,7 +126,7 @@ Item {
anchors.centerIn: overlay
anchors.verticalCenterOffset: 2
fillImage: "cluster/dial_fill_color_left"
value: VehicleService.speed / 240
value: VehicleModel.speed / 240

Tracer {}
}
Expand Down
2 changes: 2 additions & 0 deletions sysui/Cluster/Middle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Item {
ListView {
id: stack
anchors.fill: parent
anchors.bottomMargin: 20
anchors.topMargin: 25
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
highlightMoveDuration: 300
Expand Down
14 changes: 7 additions & 7 deletions sysui/Cluster/RightDial.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import QtQuick 2.1
import utils 1.0
import controls 1.0
import service.vehicle 1.0
import models 1.0
import service.navigation 1.0

Item {
Expand Down Expand Up @@ -102,15 +102,15 @@ Item {
height: width
radius: width
color: "transparent"
border.color: (VehicleService.fuel < 0.4 || NavigationService.traficAlert) ? Style.colorOrange : "white"
border.color: (VehicleModel.fuel < 0.4 || NavigationService.traficAlert) ? Style.colorOrange : "white"
border.width: rect.borderWidth
anchors.centerIn: parent
anchors.horizontalCenterOffset: -3

property int borderWidth: 3

SequentialAnimation {
running: (VehicleService.fuel < 0.4 || NavigationService.traficAlert)
running: (VehicleModel.fuel < 0.4 || NavigationService.traficAlert)
loops: Animation.Infinite
NumberAnimation {

Expand Down Expand Up @@ -160,8 +160,8 @@ Item {
anchors.topMargin: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenterOffset: 5
source: VehicleService.rightDialIcon
scale: VehicleService.rightIconScale
source: VehicleModel.rightDialIcon
scale: VehicleModel.rightIconScale
}

Item {
Expand All @@ -187,7 +187,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 0.05 * root.height
font.bold: true
text: VehicleService.rightDialMainText
text: VehicleModel.rightDialMainText
}
}
}
Expand All @@ -212,6 +212,6 @@ Item {
fillImage: "cluster/dial_fill_color"
circleRadius: "0.29"
dialCursor: "cluster/dial_cursor_right"
value: VehicleService.rightDialValue
value: VehicleModel.rightDialValue
}
}

0 comments on commit 36c8b83

Please sign in to comment.