From 3aa43f3ea5a64afdda934fb9a8ff52deecd71db6 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 11 Feb 2019 17:09:51 +0100 Subject: mobile-widgets/qml: add TemplateButton Do "git mv SsrfButton TemplateButton", and search/replace all uses. The general idea of the templates are to secure common layout, but also to isolate the Kirigami parts (slowly) in the templates. Signed-off-by: Jan Iversen --- mobile-widgets/qml/About.qml | 2 +- mobile-widgets/qml/CloudCredentials.qml | 10 +++++----- mobile-widgets/qml/DiveDetailsView.qml | 2 +- mobile-widgets/qml/DownloadFromDiveComputer.qml | 20 ++++++++++---------- mobile-widgets/qml/Export.qml | 2 +- mobile-widgets/qml/Settings.qml | 10 +++++----- mobile-widgets/qml/SsrfButton.qml | 22 ---------------------- mobile-widgets/qml/TemplateButton.qml | 22 ++++++++++++++++++++++ mobile-widgets/qml/mobile-resources.qrc | 2 +- 9 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 mobile-widgets/qml/SsrfButton.qml create mode 100644 mobile-widgets/qml/TemplateButton.qml (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/About.qml b/mobile-widgets/qml/About.qml index 075e3fd47..de1b46022 100644 --- a/mobile-widgets/qml/About.qml +++ b/mobile-widgets/qml/About.qml @@ -56,7 +56,7 @@ Kirigami.ScrollablePage { anchors.horizontalCenter: parent.Center horizontalAlignment: Text.AlignHCenter } - SsrfButton { + TemplateButton { id: copyAppLogToClipboard Layout.alignment: Qt.AlignHCenter text: qsTr("Copy logs to clipboard") diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index 655eaab54..46a97cac7 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -95,7 +95,7 @@ Item { Layout.margins: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing visible: showPin - SsrfButton { + TemplateButton { id: registerpin text: qsTr("Register") onClicked: { @@ -106,7 +106,7 @@ Item { text: "" // Spacer between 2 button groups Layout.fillWidth: true } - SsrfButton { + TemplateButton { id: cancelpin text: qsTr("Cancel") onClicked: { @@ -122,7 +122,7 @@ Item { spacing: Kirigami.Units.smallSpacing visible: !showPin - SsrfButton { + TemplateButton { id: signin_register_normal text: qsTr("Sign-in or Register") onClicked: { @@ -133,7 +133,7 @@ Item { text: "" // Spacer between 2 button groups Layout.fillWidth: true } - SsrfButton { + TemplateButton { id: toNoCloudMode text: qsTr("No cloud mode") onClicked: { @@ -146,7 +146,7 @@ Item { } } } - SsrfButton { + TemplateButton { id: signin_forgot_password text: qsTr("Forgot password?") onClicked: { diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml index fcbcc1fb9..6ea44077d 100644 --- a/mobile-widgets/qml/DiveDetailsView.qml +++ b/mobile-widgets/qml/DiveDetailsView.qml @@ -56,7 +56,7 @@ Item { } } } - SsrfButton { + TemplateButton { id: gpsButton anchors.right: parent.right enabled: gps !== "" diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index 1a6503f12..9d2d04f40 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -245,7 +245,7 @@ Kirigami.Page { } } - SsrfButton { + TemplateButton { id: dc1 visible: PrefDiveComputer.vendor1 !== "" text: PrefDiveComputer.vendor1 + " - " + PrefDiveComputer.product1 @@ -254,7 +254,7 @@ Kirigami.Page { rememberedDCsGrid.setDC(PrefDiveComputer.vendor1, PrefDiveComputer.product1, PrefDiveComputer.device1) } } - SsrfButton { + TemplateButton { id: dc2 visible: PrefDiveComputer.vendor2 !== "" text: PrefDiveComputer.vendor2 + " - " + PrefDiveComputer.product2 @@ -263,7 +263,7 @@ Kirigami.Page { rememberedDCsGrid.setDC(PrefDiveComputer.vendor2, PrefDiveComputer.product2, PrefDiveComputer.device2) } } - SsrfButton { + TemplateButton { id: dc3 visible: PrefDiveComputer.vendor3 !== "" text: PrefDiveComputer.vendor3 + " - " + PrefDiveComputer.product3 @@ -272,7 +272,7 @@ Kirigami.Page { rememberedDCsGrid.setDC(PrefDiveComputer.vendor3, PrefDiveComputer.product3, PrefDiveComputer.device3) } } - SsrfButton { + TemplateButton { id: dc4 visible: PrefDiveComputer.vendor4 !== "" text: PrefDiveComputer.vendor4 + " - " + PrefDiveComputer.product4 @@ -296,7 +296,7 @@ Kirigami.Page { Layout.fillWidth: true Layout.topMargin: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing - SsrfButton { + TemplateButton { id: download text: qsTr("Download") enabled: comboVendor.currentIndex != -1 && comboProduct.currentIndex != -1 && @@ -332,7 +332,7 @@ Kirigami.Page { importModel.startDownload() } } - SsrfButton { + TemplateButton { id:quitbutton text: progressBar.visible ? qsTr("Cancel") : qsTr("Quit") onClicked: { @@ -346,7 +346,7 @@ Kirigami.Page { manager.appendTextToLog("exit DCDownload screen") } } - SsrfButton { + TemplateButton { id:rescanbutton text: qsTr("Rescan") enabled: manager.btEnabled @@ -421,7 +421,7 @@ Kirigami.Page { text: "" // Spacer on the left for hamburger menu width: Kirigami.Units.gridUnit * 2.5 } - SsrfButton { + TemplateButton { id: acceptButton property bool busy: false enabled: divesDownloaded @@ -456,7 +456,7 @@ Kirigami.Page { text: "" // Spacer between 2 button groups Layout.fillWidth: true } - SsrfButton { + TemplateButton { id: select enabled: divesDownloaded text: qsTr("Select All") @@ -465,7 +465,7 @@ Kirigami.Page { importModel.selectAll() } } - SsrfButton { + TemplateButton { id: unselect enabled: divesDownloaded text: qsTr("Unselect All") diff --git a/mobile-widgets/qml/Export.qml b/mobile-widgets/qml/Export.qml index 5ef4c4ce7..a0270a099 100644 --- a/mobile-widgets/qml/Export.qml +++ b/mobile-widgets/qml/Export.qml @@ -249,7 +249,7 @@ Kirigami.ScrollablePage { Layout.fillWidth: true text: qsTr("Anonymize") } - SsrfButton { + TemplateButton { text: qsTr("Next") onClicked: { if (selectedExport === ExportType.EX_DIVELOGS_DE) { diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index a9cd4131c..af64b58be 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -50,7 +50,7 @@ Kirigami.ScrollablePage { text: Backend.cloud_verification_status === Enums.CS_NOCLOUD ? qsTr("Not applicable") : PrefCloudStorage.cloud_storage_email Layout.preferredWidth: gridWidth * 0.60 } - SsrfButton { + TemplateButton { id: changeCloudSettings text: qsTr("Change") onClicked: { @@ -120,7 +120,7 @@ Kirigami.ScrollablePage { text: qsTr("Forget remembered dive computers") Layout.preferredWidth: gridWidth * 0.75 } - SsrfButton { + TemplateButton { id: forgetDCButton text: qsTr("Forget") enabled: PrefDiveComputer.vendor1 !== "" @@ -310,21 +310,21 @@ Kirigami.ScrollablePage { Layout.preferredWidth: gridWidth * 0.8 Layout.columnSpan: 3 spacing: Kirigami.Units.largeSpacing - SsrfButton { + TemplateButton { text: qsTr("smaller") enabled: ThemeNew.currentScale !== 0.85 onClicked: { ThemeNew.currentScale = 0.85 } } - SsrfButton { + TemplateButton { text: qsTr("regular") enabled: ThemeNew.currentScale !== 1.0 onClicked: { ThemeNew.currentScale = 1.0 } } - SsrfButton { + TemplateButton { text: qsTr("larger") enabled: ThemeNew.currentScale !== 1.15 onClicked: { diff --git a/mobile-widgets/qml/SsrfButton.qml b/mobile-widgets/qml/SsrfButton.qml deleted file mode 100644 index 49ca8c0dd..000000000 --- a/mobile-widgets/qml/SsrfButton.qml +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -import QtQuick 2.6 -import QtQuick.Controls 2.2 -import org.kde.kirigami 2.4 as Kirigami - -Button { - id: root - background: Rectangle { - id: buttonBackground - color: root.enabled? (root.pressed ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor) : "gray" - antialiasing: true - radius: Kirigami.Units.smallSpacing * 2 - height: buttonText.height * 2 - } - contentItem: Text { - id: buttonText - text: root.text - font.pointSize: subsurfaceTheme.regularPointSize - anchors.centerIn: buttonBackground - color: root.pressed ? subsurfaceTheme.darkerPrimaryTextColor :subsurfaceTheme.primaryTextColor - } -} diff --git a/mobile-widgets/qml/TemplateButton.qml b/mobile-widgets/qml/TemplateButton.qml new file mode 100644 index 000000000..49ca8c0dd --- /dev/null +++ b/mobile-widgets/qml/TemplateButton.qml @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 +import QtQuick 2.6 +import QtQuick.Controls 2.2 +import org.kde.kirigami 2.4 as Kirigami + +Button { + id: root + background: Rectangle { + id: buttonBackground + color: root.enabled? (root.pressed ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor) : "gray" + antialiasing: true + radius: Kirigami.Units.smallSpacing * 2 + height: buttonText.height * 2 + } + contentItem: Text { + id: buttonText + text: root.text + font.pointSize: subsurfaceTheme.regularPointSize + anchors.centerIn: buttonBackground + color: root.pressed ? subsurfaceTheme.darkerPrimaryTextColor :subsurfaceTheme.primaryTextColor + } +} diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index 8c9c6f1f5..76dfabf33 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -1,6 +1,7 @@ + TemplateButton.qml TemplateCheckBox.qml TemplateComboBox.qml TemplateLabel.qml @@ -36,7 +37,6 @@ CopySettings.qml ThemeTest.qml StartPage.qml - SsrfButton.qml SsrfCheckBox.qml SsrfSwitch.qml SsrfTextField.qml -- cgit v1.2.3-70-g09d2