diff options
author | Andreas Hartmetz <andreas.hartmetz@kdab.com> | 2016-12-15 19:48:50 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2017-01-26 09:15:23 +0000 |
commit | 40e26b22705f1e1ec71edcbc869e9fd9b1cfbe53 (patch) | |
tree | 01d0021421da450f2ea8534e15eea9e05b3bec13 | |
parent | e7d535202da4a6c85936d3a344538fb7d720dbf0 (diff) | |
download | neptune-ui-40e26b22705f1e1ec71edcbc869e9fd9b1cfbe53.tar.gz |
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 <jarek@froglogic.com>
Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r-- | imports/shared/service/climate/ClimateService.qml | 10 | ||||
-rw-r--r-- | 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 { |