diff options
author | Lukáš Tinkl <ltinkl@luxoft.com> | 2017-08-01 14:02:19 +0100 |
---|---|---|
committer | Lukáš Tinkl <ltinkl@luxoft.com> | 2017-08-02 11:16:03 +0000 |
commit | c5a173161b934abcdb680930575a16cf4a86a20a (patch) | |
tree | e878a101c112f960a6510164645ea5253c4c113b | |
parent | 49200f6ee2bc13cfb32bdff4f6c9d634a2e1cddc (diff) | |
download | neptune-ui-c5a173161b934abcdb680930575a16cf4a86a20a.tar.gz |
Fix switching Celsius/Fahrenheit temperatures
Additional fixes:
- settings item delegate control itself; checking/unchecking, emitting
the clicked() signal for the parent control itself
- the climate model now keeps its internal values in one unit (Celsius)
- cloud and functions pages no longer break their layout with InputPanel
(virtual keyboard) enabled
- plus some minor cleanups
Change-Id: I279708532885cfe73c98a3b077e6fe55f1994e98
Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
-rw-r--r-- | imports/shared/controls/AppInfoPanel.qml | 3 | ||||
-rw-r--r-- | imports/shared/controls/SettingsItemDelegate.qml | 3 | ||||
-rw-r--r-- | imports/shared/controls/TemperatureSlider.qml | 5 | ||||
-rw-r--r-- | imports/shared/utils/AppUIScreen.qml | 4 | ||||
-rw-r--r-- | imports/system/models/climate/ClimateModel.qml | 20 | ||||
-rw-r--r-- | imports/system/models/settings/SettingsModel.qml | 2 | ||||
-rw-r--r-- | sysui/climate/ClimateBar.qml | 4 | ||||
-rw-r--r-- | sysui/climate/ClimatePane.qml | 2 | ||||
-rw-r--r-- | sysui/cloud/CloudPage.qml | 2 | ||||
-rw-r--r-- | sysui/cloud/Settings/SettingsScreen.qml | 6 | ||||
-rw-r--r-- | sysui/display/FunctionsPage.qml | 2 |
11 files changed, 19 insertions, 34 deletions
diff --git a/imports/shared/controls/AppInfoPanel.qml b/imports/shared/controls/AppInfoPanel.qml index d63670f..e5c8ac4 100644 --- a/imports/shared/controls/AppInfoPanel.qml +++ b/imports/shared/controls/AppInfoPanel.qml @@ -58,11 +58,10 @@ Control { } Label { - id: title Layout.fillWidth: true Layout.fillHeight: true verticalAlignment: Text.AlignVCenter - text: qsTr(root.title.toUpperCase()) + text: root.title.toUpperCase() font.pixelSize: Style.fontSizeXL } } diff --git a/imports/shared/controls/SettingsItemDelegate.qml b/imports/shared/controls/SettingsItemDelegate.qml index c461532..cf7d374 100644 --- a/imports/shared/controls/SettingsItemDelegate.qml +++ b/imports/shared/controls/SettingsItemDelegate.qml @@ -78,7 +78,8 @@ ItemDelegate { visible: root.checkable checked: root.checked onClicked: { - root.checked != root.checked + root.checked = !root.checked + root.clicked() } } diff --git a/imports/shared/controls/TemperatureSlider.qml b/imports/shared/controls/TemperatureSlider.qml index e747cba..b9568bc 100644 --- a/imports/shared/controls/TemperatureSlider.qml +++ b/imports/shared/controls/TemperatureSlider.qml @@ -38,7 +38,6 @@ import controls 1.0 Control { id: root - implicitWidth: Style.hspan(2) implicitHeight: Style.vspan(8) @@ -228,8 +227,4 @@ Control { } } } - - function _clamp(value) { - return Math.round(Math.min(root.maxValue, Math.max(root.minValue, value))*root.roundingMode)/root.roundingMode - } } diff --git a/imports/shared/utils/AppUIScreen.qml b/imports/shared/utils/AppUIScreen.qml index b7e7d3e..e58c069 100644 --- a/imports/shared/utils/AppUIScreen.qml +++ b/imports/shared/utils/AppUIScreen.qml @@ -39,9 +39,9 @@ import utils 1.0 \qmltype AppUIScreen \inqmlmodule utils \inherits ApplicationManagerWindow - \brief AppUIScreen provides base item for developing the applciations. + \brief AppUIScreen provides base item for developing the applications. - AppUIScreen is a QML item which should be a root element for every + AppUIScreen is a QML item which should be a root element for every Neptune application. It provides APIs to interact with the system UI and to position application visual elements. diff --git a/imports/system/models/climate/ClimateModel.qml b/imports/system/models/climate/ClimateModel.qml index 0c67213..4c3946a 100644 --- a/imports/system/models/climate/ClimateModel.qml +++ b/imports/system/models/climate/ClimateModel.qml @@ -44,10 +44,10 @@ QtObject { } property QtObject leftSeat: QtObject { - property real minValue: calculateUnitValue(16) - property real maxValue: calculateUnitValue(28) - property real stepValue: calculateUnitValue(0.5) - property real value: calculateUnitValue(climateControl.zoneAt.FrontLeft.targetTemperature.value) + readonly property real minValue: 16 + readonly property real maxValue: 28 + readonly property real stepValue: 0.5 + property real value: climateControl.zoneAt.FrontLeft.targetTemperature.value property bool heat: climateControl.zoneAt.FrontLeft.seatHeater.value @@ -61,10 +61,10 @@ QtObject { } property QtObject rightSeat: QtObject { - property real minValue: calculateUnitValue(16) - property real maxValue: calculateUnitValue(28) - property real stepValue: calculateUnitValue(0.5) - property real value: calculateUnitValue(climateControl.zoneAt.FrontRight.targetTemperature.value) + readonly property real minValue: 16 + readonly property real maxValue: 28 + readonly property real stepValue: 0.5 + property real value: climateControl.zoneAt.FrontRight.targetTemperature.value property bool heat: climateControl.zoneAt.FrontRight.seatHeater.value @@ -159,7 +159,7 @@ QtObject { } function calculateUnitValue(value) { - // Defualt value is the celsius - return (SettingsModel.unitSystem === "metric") ? value : (Math.round(value * 1.8 + 32)) + // Default value is the celsius + return SettingsModel.metric ? value : Math.round(value * 1.8 + 32) } } diff --git a/imports/system/models/settings/SettingsModel.qml b/imports/system/models/settings/SettingsModel.qml index 6a07eba..5037bd6 100644 --- a/imports/system/models/settings/SettingsModel.qml +++ b/imports/system/models/settings/SettingsModel.qml @@ -37,7 +37,7 @@ QtObject { property bool clusterVisible: true property string unitSystem: "metric" // "metric" or "imp_us" - property bool metric: unitSystem === "metric" + readonly property bool metric: unitSystem === "metric" property ListModel entries: ListModel { ListElement { title: "USER PROFILE"; icon: "profile"; checked: true; hasChildren: true; hasCheck: true } diff --git a/sysui/climate/ClimateBar.qml b/sysui/climate/ClimateBar.qml index df7769a..9d8d9ea 100644 --- a/sysui/climate/ClimateBar.qml +++ b/sysui/climate/ClimateBar.qml @@ -66,7 +66,7 @@ Control { TemperatureLevel { id: tempLevelLeft - value: ClimateModel.leftSeat.value + value: ClimateModel.calculateUnitValue(ClimateModel.leftSeat.value) anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter onClicked: SystemModel.climateExpanded = !SystemModel.climateExpanded @@ -108,7 +108,7 @@ Control { TemperatureLevel { id: tempLevelRight horizontalAlignment: Qt.AlignRight - value: ClimateModel.rightSeat.value + value: ClimateModel.calculateUnitValue(ClimateModel.rightSeat.value) anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter onClicked: SystemModel.climateExpanded = !SystemModel.climateExpanded diff --git a/sysui/climate/ClimatePane.qml b/sysui/climate/ClimatePane.qml index b6e5817..1a07dc5 100644 --- a/sysui/climate/ClimatePane.qml +++ b/sysui/climate/ClimatePane.qml @@ -151,7 +151,6 @@ Item { stepSize: ClimateModel.rightSeat.stepValue onValueChanged: ClimateModel.rightSeat.value = value } - } Spacer { @@ -159,5 +158,4 @@ Item { Layout.fillWidth: true } } - } diff --git a/sysui/cloud/CloudPage.qml b/sysui/cloud/CloudPage.qml index 241c32a..12b9710 100644 --- a/sysui/cloud/CloudPage.qml +++ b/sysui/cloud/CloudPage.qml @@ -38,8 +38,6 @@ import QtQuick.Layouts 1.3 UIPage { id: root - width: Style.hspan(24) - height: Style.vspan(24) header: AppInfoPanel { Layout.fillWidth: true diff --git a/sysui/cloud/Settings/SettingsScreen.qml b/sysui/cloud/Settings/SettingsScreen.qml index b12a6e1..2d3ccbf 100644 --- a/sysui/cloud/Settings/SettingsScreen.qml +++ b/sysui/cloud/Settings/SettingsScreen.qml @@ -33,14 +33,10 @@ import QtQml.Models 2.2 import QtQuick 2.6 import QtQuick.Controls 2.0 -import utils 1.0 - import controls 1.0 import utils 1.0 import models.settings 1.0 import models.application 1.0 -import utils 1.0 - Control { id: root @@ -68,7 +64,7 @@ Control { SettingsItemDelegate { text: "METRIC SYSTEM"; icon: "fees"; checked: true onClicked: { - SettingsModel.unitSystem = checked? "imp_us" : "metric"; + SettingsModel.unitSystem = checked ? "metric" : "imp_us"; } } SettingsItemDelegate { diff --git a/sysui/display/FunctionsPage.qml b/sysui/display/FunctionsPage.qml index f78caee..94284e7 100644 --- a/sysui/display/FunctionsPage.qml +++ b/sysui/display/FunctionsPage.qml @@ -42,8 +42,6 @@ import service.popup 1.0 UIPage { id: root - width: Style.hspan(24) - height: Style.vspan(24) PopupInterface { id: popupInterface |