aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Korkov <akorkov@luxoft.com>2020-03-20 14:25:07 +0300
committerAleksei Korkov <akorkov@luxoft.com>2020-03-27 17:52:50 +0000
commit4827a3b617b20658f61a6886d548902ffaaeae8c (patch)
tree046ca41e271ecd3c1c61c89b591ace50bb594a8c
parent45c26d53735cba7ec831309ac88de77d4bb64d18 (diff)
[climate] fix changing temperature on moving slider
Fixes: AUTOSUITE-1544 Change-Id: Icced4bf6f681651e625affa4b7b25d6fe4d15172 Reviewed-by: Grigorii Zimin <gzimin@luxoft.com> Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
-rw-r--r--apps/com.pelagicore.climate/controls/+lucee/TemperatureLabel.qml8
-rw-r--r--apps/com.pelagicore.climate/controls/TemperatureLabel.qml4
-rw-r--r--apps/com.pelagicore.climate/controls/TemperatureSlider.qml17
-rw-r--r--apps/com.pelagicore.climate/panels/+lucee/ClimateIndicatorPanel.qml4
-rw-r--r--apps/com.pelagicore.climate/panels/ClimateContentPanel.qml13
-rw-r--r--apps/com.pelagicore.climate/panels/ClimateIndicatorPanel.qml4
6 files changed, 32 insertions, 18 deletions
diff --git a/apps/com.pelagicore.climate/controls/+lucee/TemperatureLabel.qml b/apps/com.pelagicore.climate/controls/+lucee/TemperatureLabel.qml
index 9e167460..0c4fcd9f 100644
--- a/apps/com.pelagicore.climate/controls/+lucee/TemperatureLabel.qml
+++ b/apps/com.pelagicore.climate/controls/+lucee/TemperatureLabel.qml
@@ -40,10 +40,10 @@ import shared.Sizes 1.0
RowLayout {
id: root
- property var seat
+ property real seat
Label {
- readonly property int integers: root.seat ? Math.floor(root.seat.localizedValue) : 0
- readonly property int decimals: root.seat ? (root.seat.localizedValue - Math.floor(root.seat.localizedValue)) * 10 : 0
+ readonly property int integers: root.seat ? Math.floor(root.seat) : 0
+ readonly property int decimals: root.seat ? (root.seat - Math.floor(root.seat)) * 10 : 0
Layout.fillHeight: true
textFormat: Text.RichText
@@ -62,7 +62,7 @@ RowLayout {
Layout.topMargin: Sizes.dp(15)
text: {
if (root.seat) {
- return root.seat.measurementSystem === Locale.MetricSystem ? "°C" : "°F";
+ return Qt.locale().measurementSystem === Locale.MetricSystem ? "°C" : "°F";
} else {
return "";
}
diff --git a/apps/com.pelagicore.climate/controls/TemperatureLabel.qml b/apps/com.pelagicore.climate/controls/TemperatureLabel.qml
index 3ef19218..bd4fe1b4 100644
--- a/apps/com.pelagicore.climate/controls/TemperatureLabel.qml
+++ b/apps/com.pelagicore.climate/controls/TemperatureLabel.qml
@@ -39,11 +39,11 @@ import shared.Style 1.0
import shared.Sizes 1.0
Label {
- property var seat
+ property string seat
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Sizes.fontSizeXL
font.weight: Font.DemiBold
opacity: Style.opacityMedium
// Not showing the measurement unit is the fashionable thing to do
- text: seat ? seat.valueString + "°" : ""
+ text: seat ? seat + "°" : ""
}
diff --git a/apps/com.pelagicore.climate/controls/TemperatureSlider.qml b/apps/com.pelagicore.climate/controls/TemperatureSlider.qml
index 06212182..d1da8c8b 100644
--- a/apps/com.pelagicore.climate/controls/TemperatureSlider.qml
+++ b/apps/com.pelagicore.climate/controls/TemperatureSlider.qml
@@ -39,12 +39,21 @@ import shared.Sizes 1.0
Slider {
id: root
- width: Sizes.dp(180)
+ readonly property real handleHeight: handle.height
+ signal sliderReleased()
+
+ Connections {
+ target: root
+ onPressedChanged: {
+ if (!pressed)
+ root.sliderReleased()
+ }
+ }
+
+ width: Sizes.dp(180)
orientation: Qt.Vertical
snapMode: Slider.SnapOnRelease
- live: false
+ live: true
stepSize: 0.5
-
- readonly property real handleHeight: handle.height
}
diff --git a/apps/com.pelagicore.climate/panels/+lucee/ClimateIndicatorPanel.qml b/apps/com.pelagicore.climate/panels/+lucee/ClimateIndicatorPanel.qml
index 557f5c7f..909e844f 100644
--- a/apps/com.pelagicore.climate/panels/+lucee/ClimateIndicatorPanel.qml
+++ b/apps/com.pelagicore.climate/panels/+lucee/ClimateIndicatorPanel.qml
@@ -51,12 +51,12 @@ RowLayout {
TemperatureLabel {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.leftMargin: Sizes.dp(44)
- seat: root.store ? root.store.leftSeat : null
+ seat: root.store ? root.store.leftSeat.localizedValue : null
}
TemperatureLabel {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: Sizes.dp(44)
- seat: root.store ? root.store.rightSeat : null
+ seat: root.store ? root.store.rightSeat.localizedValue : null
}
}
diff --git a/apps/com.pelagicore.climate/panels/ClimateContentPanel.qml b/apps/com.pelagicore.climate/panels/ClimateContentPanel.qml
index 2d1b5090..08519b30 100644
--- a/apps/com.pelagicore.climate/panels/ClimateContentPanel.qml
+++ b/apps/com.pelagicore.climate/panels/ClimateContentPanel.qml
@@ -76,8 +76,9 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
height: Sizes.dp(278)
- leftSeat: root.store ? root.store.leftSeat : null
- rightSeat: root.store ? root.store.rightSeat : null
+ leftSeat: root.store ? root.store.calculateUnitValue(leftTempSlider.value) : null
+ rightSeat: root.store ? root.store.calculateUnitValue(rightTempSlider.value) : null
+
zoneSynchronizationEnabled: root.seatTemperaturesLinked
onDriverSeatTemperatureIncreased: {
if (root.store.leftSeat.value < root.store.leftSeat.maxValue) {
@@ -141,7 +142,9 @@ Item {
anchors.topMargin: Sizes.dp(130) - leftTempSlider.handleHeight/2
anchors.left: parent.left
height: Sizes.dp(1200)
- onMoved: store.leftSeat.setValue(value);
+ onSliderReleased: {
+ root.store.leftSeat.setValue(value);
+ }
}
Connections {
@@ -163,7 +166,9 @@ Item {
anchors.topMargin: Sizes.dp(130) - rightTempSlider.handleHeight/2
anchors.right: parent.right
height: Sizes.dp(1200)
- onMoved: root.store.rightSeat.setValue(value);
+ onSliderReleased: {
+ root.store.rightSeat.setValue(value);
+ }
}
Connections {
diff --git a/apps/com.pelagicore.climate/panels/ClimateIndicatorPanel.qml b/apps/com.pelagicore.climate/panels/ClimateIndicatorPanel.qml
index 7bd08a49..96337143 100644
--- a/apps/com.pelagicore.climate/panels/ClimateIndicatorPanel.qml
+++ b/apps/com.pelagicore.climate/panels/ClimateIndicatorPanel.qml
@@ -58,7 +58,7 @@ RowLayout {
TemperatureLabel {
Layout.leftMargin: Sizes.dp(36)
Layout.rightMargin: Sizes.dp(36)
- seat: root.store ? root.store.leftSeat : null
+ seat: root.store ? root.store.leftSeat.localizedValue : null
}
Image {
Layout.preferredWidth: Sizes.dp(sourceSize.width)
@@ -77,7 +77,7 @@ RowLayout {
TemperatureLabel {
Layout.leftMargin: Sizes.dp(36)
Layout.rightMargin: Sizes.dp(36)
- seat: root.store ? root.store.rightSeat : null
+ seat: root.store ? root.store.rightSeat.localizedValue : null
}
Image {
Layout.preferredWidth: Sizes.dp(sourceSize.width)