From a63be142b5ba4d51fe9add1451eb5cdb2f81eb57 Mon Sep 17 00:00:00 2001 From: Jocke Date: Sun, 16 Sep 2018 15:23:59 +0200 Subject: Mobile: add units selection to settings page Add the option for the user to set the desired unit system for Subsurface-mobile regardless of system locale Signed-off-by: Joakim Bygdell Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/Settings.qml | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index ddfc8698d..7c53c966e 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -339,6 +339,56 @@ Kirigami.ScrollablePage { opacity: 0.5 Layout.fillWidth: true } + GridLayout { + id: unit_system + columns: 2 + width: parent.width - Kirigami.Units.gridUnit + Kirigami.Heading { + text: qsTr("Units") + color: subsurfaceTheme.textColor + level: 4 + Layout.topMargin: Kirigami.Units.largeSpacing + Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 + Layout.columnSpan: 2 + } + + Controls.Label { + text: qsTr("Use Imperial Units") + Layout.preferredWidth: gridWidth * 0.75 + } + SsrfSwitch { + id: imperialButton + checked: PrefUnits.unit_system === "imperial" + enabled: PrefUnits.unit_system === "metric" + Layout.preferredWidth: gridWidth * 0.25 + onClicked: { + PrefUnits.set_unit_system("imperial") + manager.changesNeedSaving() + } + } + Controls.Label { + text: qsTr("Use Metric Units") + Layout.preferredWidth: gridWidth * 0.75 + } + SsrfSwitch { + id: metricButtton + checked: PrefUnits.unit_system === "metric" + enabled: PrefUnits.unit_system === "imperial" + Layout.preferredWidth: gridWidth * 0.25 + onClicked: { + PrefUnits.set_unit_system("metric") + manager.changesNeedSaving() + } + } + } + + Rectangle { + color: subsurfaceTheme.darkerPrimaryColor + height: 1 + opacity: 0.5 + Layout.fillWidth: true + } + GridLayout { id: developer columns: 2 -- cgit v1.2.3-70-g09d2