From 4ca40bc15262193cec29f1aea02ac6964634b88c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 30 Dec 2020 18:09:39 -0800 Subject: [PATCH] mobile/UI: consolidate to a single check box It was very odd that we had two slightly different styled check boxes. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveDetailsEdit.qml | 2 +- .../qml/DownloadFromDiveComputer.qml | 2 +- mobile-widgets/qml/DownloadedDiveDelegate.qml | 2 +- mobile-widgets/qml/SsrfCheckBox.qml | 29 ------------------- mobile-widgets/qml/TemplateCheckBox.qml | 11 ++++--- mobile-widgets/qml/mobile-resources.qrc | 1 - 6 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 mobile-widgets/qml/SsrfCheckBox.qml diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index f4550b3b4..ededf8196 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -192,7 +192,7 @@ Item { text: qsTr("Use current\nGPS location:") visible: manager.locationServiceAvailable } - SsrfCheckBox { + TemplateCheckBox { id: checkboxGPS visible: manager.locationServiceAvailable onCheckedChanged: { diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index 47d6f78d7..3346ad5c0 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -401,7 +401,7 @@ Kirigami.Page { Layout.fillWidth: true Layout.topMargin: 0 spacing: Kirigami.Units.smallSpacing - SsrfCheckBox { + TemplateCheckBox { id: forceAll checked: manager.DC_forceDownload enabled: forceAllLabel.visible diff --git a/mobile-widgets/qml/DownloadedDiveDelegate.qml b/mobile-widgets/qml/DownloadedDiveDelegate.qml index 6a3136975..6408d9bd2 100644 --- a/mobile-widgets/qml/DownloadedDiveDelegate.qml +++ b/mobile-widgets/qml/DownloadedDiveDelegate.qml @@ -34,7 +34,7 @@ Kirigami.AbstractListItem { NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 } NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } } - SsrfCheckBox { + TemplateCheckBox { id: diveIsSelected checked: innerListItem.selected; width: childrenRect.width + 4 * Kirigami.Units.smallSpacing; diff --git a/mobile-widgets/qml/SsrfCheckBox.qml b/mobile-widgets/qml/SsrfCheckBox.qml deleted file mode 100644 index e110dc5f0..000000000 --- a/mobile-widgets/qml/SsrfCheckBox.qml +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -import QtQuick 2.6 -import QtQuick.Controls 2.2 -import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 2.4 as Kirigami - -CheckBox { - id: root - indicator: Rectangle { - implicitWidth: 20 * PrefDisplay.mobile_scale - implicitHeight: 20 * PrefDisplay.mobile_scale - x: root.leftPadding - y: parent.height / 2 - height / 2 - radius: 4 - border.color: root.down ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor - border.width: 2 - color: subsurfaceTheme.backgroundColor - - Rectangle { - width: 12 * PrefDisplay.mobile_scale - height: 12 * PrefDisplay.mobile_scale - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - radius: 3 - color: root.down ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor - visible: root.checked - } - } -} diff --git a/mobile-widgets/qml/TemplateCheckBox.qml b/mobile-widgets/qml/TemplateCheckBox.qml index 85aa0bef1..1ae48eb8b 100644 --- a/mobile-widgets/qml/TemplateCheckBox.qml +++ b/mobile-widgets/qml/TemplateCheckBox.qml @@ -6,23 +6,22 @@ import org.kde.kirigami 2.4 as Kirigami CheckBox { id: cb - indicator: Rectangle { implicitWidth: Kirigami.Units.gridUnit implicitHeight: Kirigami.Units.gridUnit x: cb.leftPadding y: parent.height / 2 - height / 2 - radius: 3 + radius: 4 + border.color: cb.down ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor + border.width: 2 color: subsurfaceTheme.backgroundColor - border.color: subsurfaceTheme.textColor - Rectangle { width: parent.width / 2 height: width x: width / 2 y: width / 2 - radius: 2 - color: subsurfaceTheme.textColor + radius: 3 + color: cb.down ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor visible: cb.checked } } diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index debafd80b..00ef4f868 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -44,7 +44,6 @@ StartPage.qml RecoverCache.qml - SsrfCheckBox.qml SsrfSwitch.qml SsrfTextField.qml