Skip to content

Commit

Permalink
Wire up airflow directions to the backend
Browse files Browse the repository at this point in the history
It wasn't connected before, now changes are propagated both ways,
and even the list of available airflow configurations comes from
the backend.

Change-Id: I69e61fd795014c2e3f0f98832b828a302ace5d34
Reviewed-by: Jaroslaw Kubik <[email protected]>
Reviewed-by: Nedim Hadzic <[email protected]>
Reviewed-by: Dominik Holland <[email protected]>
  • Loading branch information
Andreas Hartmetz authored and Gagi2k committed Jan 26, 2017
1 parent e7d5352 commit 40e26b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
10 changes: 10 additions & 0 deletions imports/shared/service/climate/ClimateService.qml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ QtObject {
climateControl.fanSpeedLevel.value = newVentilation;
}

property QtObject airflowDirections: QtObject {
property int directions: climateControl.airflowDirections.value
property var availableDirections: climateControl.airflowDirections.availableValues
onDirectionsChanged: climateControl.airflowDirections.value = directions
}
property Connections airflowDirectionsConnections: Connections {
target: climateControl.airflowDirections
onValueChanged: airflowDirections.directions = climateControl.airflowDirections.value
}

property QtObject stateMachine: ClimateStateMachine {
climateControl: root.climateControl
doorsOpen: eco.enabled // TODO use QtIVI doors/window state for this eventually
Expand Down
23 changes: 14 additions & 9 deletions sysui/Climate/AirFlow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

import QtQuick 2.1
import QtGraphicalEffects 1.0
import QtIvi.VehicleFunctions 1.0
import service.climate 1.0
import utils 1.0

UIElement {
Expand All @@ -42,19 +44,22 @@ UIElement {
PathView {
id: view

property int directions: ClimateService.airflowDirections.directions
property var availableDirections: ClimateService.airflowDirections.availableDirections

// currentIndex is updated by dragging items around *and* by explicitly setting it from
// an onClicked() handler, so keeping all the bindings working is tricky. This works.
onDirectionsChanged: currentIndex = availableDirections.indexOf(directions)
Component.onCompleted: currentIndex = availableDirections.indexOf(directions)
onCurrentIndexChanged: ClimateService.airflowDirections.directions = availableDirections[currentIndex]

width: Style.hspan(6)
height: Style.vspan(3)
anchors.centerIn: parent

clip: true

currentIndex: 1

model: ListModel {
ListElement { up: 1; down: 0 }
ListElement { up: 0; down: 1 }
ListElement { up: 1; down: 1 }
}
model: availableDirections

snapMode: PathView.SnapOneItem
preferredHighlightBegin: 0.5
Expand All @@ -70,7 +75,7 @@ UIElement {
anchors.horizontalCenterOffset: -Style.padding
source: Style.symbolXS("arrow")
rotation: 90
visible: model.up
visible: view.availableDirections[index] & ClimateControl.Dashboard
}

Image {
Expand All @@ -87,7 +92,7 @@ UIElement {
anchors.verticalCenterOffset: 12
source: Style.symbolXS("arrow")
rotation: 90
visible: model.down
visible: view.availableDirections[index] & ClimateControl.Floor
}

MouseArea {
Expand Down

0 comments on commit 40e26b2

Please sign in to comment.