From 5bce4895cc1fcdc4b318ddb1724333008bc32054 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Wed, 15 Jan 2020 19:46:48 +0100 Subject: mobile-widgets/qml: create units section and move unit_settings Move gridlayout unit_settings to TemplateSection units, without changing anything (apart from adding a visible: attribute). Removed first label in units_settings, since it is the title of the section Signed-off-by: jan Iversen Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/Settings.qml | 96 ++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 55 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index 690c0eb1e..1e3a067b6 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -338,12 +338,48 @@ Kirigami.ScrollablePage { } } - Rectangle { - color: subsurfaceTheme.darkerPrimaryColor - height: 1 - opacity: 0.5 - Layout.fillWidth: true + TemplateSection { + id: sectionUnits + title: qsTr("Units") + + GridLayout { + id: unit_system + visible: sectionUnits.isExpanded + columns: 2 + + TemplateLabel { + 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.unit_system = "imperial" + manager.changesNeedSaving() + manager.refreshDiveList() + } + } + TemplateLabel { + 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.unit_system = "metric" + manager.changesNeedSaving() + manager.refreshDiveList() + } + } + } } + GridLayout { id: gpsPrefs columns: 2 @@ -393,56 +429,6 @@ Kirigami.ScrollablePage { Layout.fillWidth: true } - GridLayout { - id: unit_system - columns: 2 - TemplateLabel { - text: qsTr("Units") - font.pointSize: subsurfaceTheme.headingPointSize - font.weight: Font.Light - Layout.topMargin: Kirigami.Units.largeSpacing - Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 - Layout.columnSpan: 2 - } - - TemplateLabel { - 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.unit_system = "imperial" - manager.changesNeedSaving() - manager.refreshDiveList() - } - } - TemplateLabel { - 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.unit_system = "metric" - manager.changesNeedSaving() - manager.refreshDiveList() - } - } - } - - Rectangle { - color: subsurfaceTheme.darkerPrimaryColor - height: 1 - opacity: 0.5 - Layout.fillWidth: true - } GridLayout { id: filterPrefs columns: 2 -- cgit v1.2.3-70-g09d2