aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
authorGravatar Jocke <j.bygdell@gmail.com>2018-09-16 15:23:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-19 14:41:03 -0700
commita63be142b5ba4d51fe9add1451eb5cdb2f81eb57 (patch)
tree5727e5807bfd8853f6044734423953e1372be6ac /mobile-widgets/qml
parentc11a4e4633e4b7c53f1f170efa0a03a853461a43 (diff)
downloadsubsurface-a63be142b5ba4d51fe9add1451eb5cdb2f81eb57.tar.gz
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 <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/Settings.qml50
1 files changed, 50 insertions, 0 deletions
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
@@ -340,6 +340,56 @@ Kirigami.ScrollablePage {
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
width: parent.width - Kirigami.Units.gridUnit