summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imports/shared/service/climate/ClimateService.qml69
-rw-r--r--imports/shared/service/climate/ClimateStateMachine.qml2
-rw-r--r--sysui/Climate/ClimateBar.qml25
-rw-r--r--sysui/Climate/Ventilation.qml9
4 files changed, 44 insertions, 61 deletions
diff --git a/imports/shared/service/climate/ClimateService.qml b/imports/shared/service/climate/ClimateService.qml
index ae8ce20..37e7480 100644
--- a/imports/shared/service/climate/ClimateService.qml
+++ b/imports/shared/service/climate/ClimateService.qml
@@ -49,17 +49,13 @@ QtObject {
property bool heat: climateControl.zoneAt.FrontLeft.seatHeater.value
- onValueChanged: climateControl.zoneAt.FrontLeft.targetTemperature.value = value
- onHeatChanged: climateControl.zoneAt.FrontLeft.seatHeater.value = heat
- }
- property Connections leftSeatTargetTempConnections: Connections {
- target: climateControl.zoneAt.FrontLeft.targetTemperature
- onValueChanged: leftSeat.value =
- calculateUnitValue(climateControl.zoneAt.FrontLeft.targetTemperature.value)
- }
- property Connections leftSeatHeaterConnections: Connections {
- target: climateControl.zoneAt.FrontLeft.seatHeater
- onValueChanged: leftSeat.heat = climateControl.zoneAt.FrontLeft.seatHeater.value
+ function setValue(newValue) {
+ climateControl.zoneAt.FrontLeft.targetTemperature.value = newValue
+ }
+
+ function setHeat(newHeat) {
+ climateControl.zoneAt.FrontLeft.seatHeater.value = newHeat
+ }
}
property QtObject rightSeat: QtObject {
@@ -70,36 +66,39 @@ QtObject {
property bool heat: climateControl.zoneAt.FrontRight.seatHeater.value
- onValueChanged: climateControl.zoneAt.FrontRight.targetTemperature.value = value
- onHeatChanged: climateControl.zoneAt.FrontRight.seatHeater.value = heat
- }
- property Connections rightSeatTargetTempConnections: Connections {
- target: climateControl.zoneAt.FrontRight.targetTemperature
- onValueChanged: rightSeat.value =
- calculateUnitValue(climateControl.zoneAt.FrontRight.targetTemperature.value)
- }
- property Connections rightSeatHeaterConnections: Connections {
- target: climateControl.zoneAt.FrontRight.seatHeater
- onValueChanged: rightSeat.heat = climateControl.zoneAt.FrontRight.seatHeater.value
+ function setValue(newValue) {
+ climateControl.zoneAt.FrontRight.targetTemperature.value = newValue
+ }
+
+ function setHeat(newHeat) {
+ climateControl.zoneAt.FrontRight.seatHeater.value = newHeat
+ }
}
property QtObject frontHeat: QtObject {
property string symbol: "front"
property bool enabled: true
+
+ function setEnabled(newEnabled) {
+ enabled = newEnabled;
+ }
}
property QtObject rearHeat: QtObject {
property string symbol: "rear"
property bool enabled: true
+
+ function setEnabled(newEnabled) {
+ enabled = newEnabled;
+ }
}
property QtObject airCondition: QtObject {
property string symbol: "ac"
property bool enabled: climateControl.airConditioning.value
- onEnabledChanged: {
- climateControl.airConditioning.value = enabled;
- enabled = Qt.binding(function() { return climateControl.airConditioning.value; });
+ function setEnabled(newEnabled) {
+ climateControl.airConditioning.value = newEnabled;
}
}
@@ -107,24 +106,26 @@ QtObject {
property string symbol: "air_quality"
property bool enabled: climateControl.recirculationMode.value == ClimateControl.RecirculationOn
- onEnabledChanged: {
- climateControl.recirculationMode.value = enabled ? ClimateControl.RecirculationOn : ClimateControl.RecirculationOff;
- enabled = Qt.binding(function() { return climateControl.recirculationMode.value == ClimateControl.RecirculationOn });
+ function setEnabled(newEnabled) {
+ climateControl.recirculationMode.value = newEnabled ? ClimateControl.RecirculationOn : ClimateControl.RecirculationOff;
}
}
property QtObject eco: QtObject {
property string symbol: "eco"
property bool enabled: false
+
+ function setEnabled(newEnabled) {
+ enabled = newEnabled;
+ }
}
property QtObject steeringWheelHeat: QtObject {
property string symbol: "stearing_wheel"
property bool enabled: climateControl.steeringWheelHeater.value >= 5
- onEnabledChanged: {
- climateControl.steeringWheelHeater.value = enabled ? 10 : 0;
- enabled = Qt.binding(function() { return climateControl.steeringWheelHeater.value >= 5 });
+ function setEnabled(newEnabled) {
+ climateControl.steeringWheelHeater.value = newEnabled ? 10 : 0;
}
}
@@ -136,10 +137,8 @@ QtObject {
property string tempSuffix: SettingsService.metric ? "°C" : "°F"
property int ventilationLevels: 7 // 6 + off (0)
- onVentilationChanged: climateControl.fanSpeedLevel.value = ventilation
- property Connections fanSpeedLevelConnections: Connections {
- target: climateControl.fanSpeedLevel
- onValueChanged: ventilation = climateControl.fanSpeedLevel.value
+ function setVentilation(newVentilation) {
+ climateControl.fanSpeedLevel.value = newVentilation;
}
property QtObject stateMachine: ClimateStateMachine {
diff --git a/imports/shared/service/climate/ClimateStateMachine.qml b/imports/shared/service/climate/ClimateStateMachine.qml
index 2b36520..bfc9925 100644
--- a/imports/shared/service/climate/ClimateStateMachine.qml
+++ b/imports/shared/service/climate/ClimateStateMachine.qml
@@ -73,7 +73,7 @@ QtObject {
id: airConditionOn
onEntered: {
climateControl.airConditioning.value = true
- steeringWheelHeat.enabled = false
+ steeringWheelHeat.setEnabled(false)
}
DSM.SignalTransition {
targetState: airConditionOff
diff --git a/sysui/Climate/ClimateBar.qml b/sysui/Climate/ClimateBar.qml
index f391b6c..a300400 100644
--- a/sysui/Climate/ClimateBar.qml
+++ b/sysui/Climate/ClimateBar.qml
@@ -89,7 +89,7 @@ UIElement {
vspan: root.collapsedVspan
name: "seat_left"
active: ClimateService.leftSeat.heat
- onClicked: ClimateService.leftSeat.heat = !active
+ onClicked: ClimateService.leftSeat.setHeat(!active)
anchors.left: tempLevelLeft.right
anchors.verticalCenter: parent.verticalCenter
}
@@ -108,7 +108,7 @@ UIElement {
vspan: root.collapsedVspan
name: "seat_right"
active: ClimateService.rightSeat.heat
- onClicked: ClimateService.rightSeat.heat = !active
+ onClicked: ClimateService.rightSeat.setHeat(!active)
anchors.right: tempLevelRight.left
anchors.verticalCenter: parent.verticalCenter
}
@@ -135,7 +135,7 @@ UIElement {
maxValue: ClimateService.leftSeat.maxValue
value: ClimateService.leftSeat.value
stepValue: ClimateService.leftSeat.stepValue
- onValueChanged: ClimateService.leftSeat.value = value
+ onValueChanged: ClimateService.leftSeat.setValue(value)
}
Spacer {
@@ -161,11 +161,7 @@ UIElement {
vspan: 2
levels: ClimateService.ventilationLevels
currentLevel: ClimateService.ventilation
- onCurrentLevelChanged: ClimateService.ventilation = currentLevel
- Connections {
- target: ClimateService
- onVentilationChanged: ventilation.currentLevel = ClimateService.ventilation
- }
+ onNewLevelRequested: ClimateService.setVentilation(newLevel)
}
Spacer {
@@ -184,7 +180,7 @@ UIElement {
vspan: 5
symbolName: modelData.symbol
active: modelData.enabled
- onClicked: modelData.enabled = !modelData.enabled
+ onClicked: modelData.setEnabled(!modelData.enabled)
}
}
}
@@ -203,7 +199,7 @@ UIElement {
maxValue: ClimateService.rightSeat.maxValue
value: ClimateService.rightSeat.value
stepValue: ClimateService.rightSeat.stepValue
- onValueChanged: ClimateService.rightSeat.value = value
+ onValueChanged: ClimateService.rightSeat.setValue(value)
}
}
@@ -214,13 +210,4 @@ UIElement {
}
}
- Connections {
- target: ClimateService.leftSeat
- onValueChanged: leftTempSlider.value = ClimateService.leftSeat.value
- }
-
- Connections {
- target: ClimateService.rightSeat
- onValueChanged: rightTempSlider.value = ClimateService.rightSeat.value
- }
}
diff --git a/sysui/Climate/Ventilation.qml b/sysui/Climate/Ventilation.qml
index c6f4bfa..f71f80e 100644
--- a/sysui/Climate/Ventilation.qml
+++ b/sysui/Climate/Ventilation.qml
@@ -40,16 +40,13 @@ UIElement {
property int levels
property int currentLevel
- property bool _updateInProgress: false
+ onCurrentLevelChanged: view.currentIndex = currentLevel;
- onCurrentLevelChanged: if (!_updateInProgress) updateLevelInternal(currentLevel);
+ signal newLevelRequested(int newLevel)
function updateLevelInternal(newLevel) {
var boundedLevel = Math.max(0, Math.min(levels - 1, newLevel));
- _updateInProgress = true;
- currentLevel = boundedLevel;
- _updateInProgress = false;
- view.currentIndex = boundedLevel;
+ newLevelRequested( boundedLevel );
}
MouseArea {