From 40e26b22705f1e1ec71edcbc869e9fd9b1cfbe53 Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Thu, 15 Dec 2016 19:48:50 +0100 Subject: Wire up airflow directions to the backend 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 Reviewed-by: Nedim Hadzic Reviewed-by: Dominik Holland --- imports/shared/service/climate/ClimateService.qml | 10 ++++++++++ sysui/Climate/AirFlow.qml | 23 ++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/imports/shared/service/climate/ClimateService.qml b/imports/shared/service/climate/ClimateService.qml index 37e7480..b762ac8 100644 --- a/imports/shared/service/climate/ClimateService.qml +++ b/imports/shared/service/climate/ClimateService.qml @@ -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 diff --git a/sysui/Climate/AirFlow.qml b/sysui/Climate/AirFlow.qml index 50d222a..3d23ab7 100644 --- a/sysui/Climate/AirFlow.qml +++ b/sysui/Climate/AirFlow.qml @@ -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 { @@ -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 @@ -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 { @@ -87,7 +92,7 @@ UIElement { anchors.verticalCenterOffset: 12 source: Style.symbolXS("arrow") rotation: 90 - visible: model.down + visible: view.availableDirections[index] & ClimateControl.Floor } MouseArea { -- cgit v1.2.3