mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/export: fix horrendous user interface
This should never have been merged as it was. The UI was atrocious and the functionality was by and large untested. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d8cc2b57b2
commit
d6c47ad362
1 changed files with 96 additions and 73 deletions
|
@ -7,7 +7,7 @@ import QtQuick.Dialogs 1.3
|
||||||
import org.subsurfacedivelog.mobile 1.0
|
import org.subsurfacedivelog.mobile 1.0
|
||||||
import org.kde.kirigami 2.4 as Kirigami
|
import org.kde.kirigami 2.4 as Kirigami
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
TemplatePage {
|
||||||
title: qsTr("Export Divelog information")
|
title: qsTr("Export Divelog information")
|
||||||
|
|
||||||
property int selectedExport: ExportType.EX_DIVES_XML
|
property int selectedExport: ExportType.EX_DIVES_XML
|
||||||
|
@ -28,82 +28,93 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog {
|
GridLayout {
|
||||||
id: uploadDialog
|
id: uploadDialog
|
||||||
title: radioGroup.current.text
|
visible: false
|
||||||
standardButtons: StandardButton.Apply | StandardButton.Cancel
|
anchors {
|
||||||
|
top: parent.top
|
||||||
GridLayout {
|
left: parent.left
|
||||||
rowSpacing: Kirigami.Units.smallSpacing * 2
|
right: parent.right
|
||||||
columnSpacing: Kirigami.Units.smallSpacing
|
margins: Kirigami.Units.gridUnit / 2
|
||||||
columns: 2
|
}
|
||||||
|
rowSpacing: Kirigami.Units.smallSpacing * 2
|
||||||
Text {
|
columnSpacing: Kirigami.Units.smallSpacing
|
||||||
id: textUserID
|
columns: 3
|
||||||
text: qsTr("User ID")
|
TemplateLabel {
|
||||||
}
|
text: qsTr("Export credentials")
|
||||||
TextField {
|
Layout.columnSpan: 3
|
||||||
id: fieldUserID
|
}
|
||||||
Layout.fillWidth: true
|
TemplateLabel {
|
||||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
id: textUserID
|
||||||
}
|
text: qsTr("User ID")
|
||||||
Text {
|
}
|
||||||
id: textPassword
|
TemplateTextField {
|
||||||
text: qsTr("Password:")
|
id: fieldUserID
|
||||||
}
|
Layout.columnSpan: 2
|
||||||
TextField {
|
Layout.fillWidth: true
|
||||||
id: fieldPassword
|
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||||
Layout.fillWidth: true
|
}
|
||||||
inputMethodHints: Qt.ImhSensitiveData |
|
TemplateLabel {
|
||||||
Qt.ImhHiddenText |
|
id: textPassword
|
||||||
Qt.ImhNoAutoUppercase
|
text: qsTr("Password:")
|
||||||
echoMode: TextInput.PasswordEchoOnEdit
|
}
|
||||||
}
|
TemplateTextField {
|
||||||
CheckBox {
|
id: fieldPassword
|
||||||
id: fieldPrivate
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Private")
|
inputMethodHints: Qt.ImhSensitiveData |
|
||||||
}
|
Qt.ImhHiddenText |
|
||||||
ProgressBar {
|
Qt.ImhNoAutoUppercase
|
||||||
id: progress
|
echoMode: TextInput.PasswordEchoOnEdit
|
||||||
value: 0.0
|
}
|
||||||
}
|
TemplateCheckBox {
|
||||||
Text {
|
id: fieldPrivate
|
||||||
id: statusText
|
visible: selectedExport === ExportType.EX_DIVESHARE
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
text: qsTr("Private")
|
||||||
wrapMode: Text.Wrap
|
}
|
||||||
}
|
ProgressBar {
|
||||||
|
id: progress
|
||||||
|
value: 0.0
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
}
|
||||||
|
TemplateLabel {
|
||||||
|
id: statusText
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.columnSpan: 3
|
||||||
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
onApply: {
|
TemplateButton {
|
||||||
if (selectedExport === ExportType.EX_DIVELOGS_DE) {
|
text: qsTr("Export")
|
||||||
if (fieldUserID.text !== PrefCloudStorage.divelogde_user) {
|
onClicked: {
|
||||||
PrefCloudStorage.divelogde_user = fieldUserID.text
|
if (selectedExport === ExportType.EX_DIVELOGS_DE) {
|
||||||
|
if (fieldUserID.text !== PrefCloudStorage.divelogde_user) {
|
||||||
|
PrefCloudStorage.divelogde_user = fieldUserID.text
|
||||||
|
}
|
||||||
|
if (fieldPassword.text !== PrefCloudStorage.divelogde_pass)
|
||||||
|
PrefCloudStorage.divelogde_pass = fieldPassword.text
|
||||||
|
manager.exportToWEB(selectedExport, fieldUserID.text, fieldPassword.text, anonymize.checked)
|
||||||
|
} else {
|
||||||
|
if (fieldUserID.text !== PrefCloudStorage.diveshare_uid) {
|
||||||
|
PrefCloudStorage.diveshare_uid = fieldUserID.text
|
||||||
|
}
|
||||||
|
PrefCloudStorage.diveshare_private = fieldPrivate.checked
|
||||||
|
manager.exportToWEB(selectedExport, fieldUserID.text, fieldPassword.text, fieldPrivate.checked)
|
||||||
}
|
}
|
||||||
if (fieldPassword.text !== PrefCloudStorage.divelogde_pass)
|
|
||||||
PrefCloudStorage.divelogde_pass = fieldPassword.text
|
|
||||||
manager.exportToWEB(selectedExport, fieldUserID.text, fieldPassword.text, anonymize.checked)
|
|
||||||
} else {
|
|
||||||
if (fieldUserID.text !== PrefCloudStorage.diveshare_uid) {
|
|
||||||
PrefCloudStorage.diveshare_uid = fieldUserID.text
|
|
||||||
}
|
|
||||||
PrefCloudStorage.diveshare_private = fieldPrivate.checked
|
|
||||||
manager.exportToWEB(selectedExport, fieldUserID.text, fieldPassword.text, fieldPrivate.checked)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onRejected: {
|
TemplateButton {
|
||||||
pageStack.pop()
|
text: qsTr("Cancel")
|
||||||
close()
|
onClicked: {
|
||||||
|
pageStack.pop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: manager
|
target: manager
|
||||||
onUploadFinish: {
|
onUploadFinish: {
|
||||||
if (success) {
|
if (success) {
|
||||||
pageStack.pop()
|
pageStack.pop()
|
||||||
uploadDialog.close()
|
|
||||||
}
|
}
|
||||||
statusText.text = text
|
statusText.text = text
|
||||||
progress.value = 0
|
progress.value = 0
|
||||||
|
@ -119,9 +130,11 @@ Kirigami.ScrollablePage {
|
||||||
// export really doesn't make sense on Android
|
// export really doesn't make sense on Android
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: exportSelection
|
||||||
|
visible: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 1
|
spacing: 3
|
||||||
Layout.margins: 10
|
Layout.margins: Kirigami.Units.gridUnit / 2
|
||||||
|
|
||||||
ExclusiveGroup { id: radioGroup }
|
ExclusiveGroup { id: radioGroup }
|
||||||
RadioButton {
|
RadioButton {
|
||||||
|
@ -173,12 +186,22 @@ Kirigami.ScrollablePage {
|
||||||
explain.text = qsTr("Send the dive data to dive-share.appspot.com website.")
|
explain.text = qsTr("Send the dive data to dive-share.appspot.com website.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Rectangle {
|
||||||
|
width: 1
|
||||||
|
height: Kirigami.Units.gridUnit
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
TemplateLabel {
|
||||||
id: explain
|
id: explain
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
CheckBox {
|
Rectangle {
|
||||||
|
width: 1
|
||||||
|
height: Kirigami.Units.gridUnit
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
TemplateCheckBox {
|
||||||
id: anonymize
|
id: anonymize
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Anonymize")
|
text: qsTr("Anonymize")
|
||||||
|
@ -195,17 +218,17 @@ Kirigami.ScrollablePage {
|
||||||
fieldPassword.text = PrefCloudStorage.divelogde_pass
|
fieldPassword.text = PrefCloudStorage.divelogde_pass
|
||||||
anonymize.visible = false
|
anonymize.visible = false
|
||||||
statusText.text = ""
|
statusText.text = ""
|
||||||
fieldPrivate.visible = false
|
exportSelection.visible = false
|
||||||
uploadDialog.open()
|
uploadDialog.visible = true
|
||||||
} else if (selectedExport === ExportType.EX_DIVESHARE) {
|
} else if (selectedExport === ExportType.EX_DIVESHARE) {
|
||||||
textUserID.visible = true
|
textUserID.visible = true
|
||||||
fieldUserID.visible = true
|
fieldUserID.visible = true
|
||||||
fieldUserID.text = PrefCloudStorage.diveshare_uid
|
fieldUserID.text = PrefCloudStorage.diveshare_uid
|
||||||
fieldPrivate.visible = true
|
fieldPrivate.visible = true
|
||||||
fieldPrivate.checked = PrefCloudStorage.diveshare_private
|
fieldPrivate.checked = PrefCloudStorage.diveshare_private
|
||||||
|
exportSelection.visible = false
|
||||||
textPassword.visible = false
|
textPassword.visible = false
|
||||||
fieldPassword.visible = false
|
uploadDialog.visible = true
|
||||||
uploadDialog.open()
|
|
||||||
} else if (Qt.platform.os !== "android") {
|
} else if (Qt.platform.os !== "android") {
|
||||||
saveAsDialog.open()
|
saveAsDialog.open()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue