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 <jani@apache.org>
This commit is contained in:
jan Iversen 2019-02-11 17:09:51 +01:00 committed by Dirk Hohndel
parent fb7920ef58
commit 3aa43f3ea5
8 changed files with 24 additions and 24 deletions

View file

@ -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")

View file

@ -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: {

View file

@ -56,7 +56,7 @@ Item {
}
}
}
SsrfButton {
TemplateButton {
id: gpsButton
anchors.right: parent.right
enabled: gps !== ""

View file

@ -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")

View file

@ -249,7 +249,7 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true
text: qsTr("Anonymize")
}
SsrfButton {
TemplateButton {
text: qsTr("Next")
onClicked: {
if (selectedExport === ExportType.EX_DIVELOGS_DE) {

View file

@ -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: {

View file

@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/qml">
<!-- ********** Templates ********** -->
<file>TemplateButton.qml</file>
<file>TemplateCheckBox.qml</file>
<file>TemplateComboBox.qml</file>
<file>TemplateLabel.qml</file>
@ -36,7 +37,6 @@
<file>CopySettings.qml</file>
<file>ThemeTest.qml</file>
<file>StartPage.qml</file>
<file>SsrfButton.qml</file>
<file>SsrfCheckBox.qml</file>
<file>SsrfSwitch.qml</file>
<file>SsrfTextField.qml</file>