mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 08:43:24 +00:00
QML UI: allow changing credentials
With the integration of the credentials into the start page the logic for this has changed. Since the code for start page and dive list is actually on the same page, using opacity to switch between the two sub pages (depending on whether we have valid credentials and dives to show), the old way of changing credentials no longer worked. With theis patch the user once again can change their credentials (and change their mind and go back to the dive list). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
055ec05e0f
commit
38f7fd6fbe
3 changed files with 29 additions and 6 deletions
|
@ -83,7 +83,19 @@ Item {
|
||||||
manager.cloudPassword = password.text
|
manager.cloudPassword = password.text
|
||||||
manager.saveCloudPassword = savePassword.checked
|
manager.saveCloudPassword = savePassword.checked
|
||||||
manager.saveCloudCredentials()
|
manager.saveCloudCredentials()
|
||||||
stackView.pop()
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
height: backButton.height
|
||||||
|
width: backButton.width
|
||||||
|
visible: diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID
|
||||||
|
SubsurfaceButton {
|
||||||
|
id: backButton
|
||||||
|
text: "Back to dive list"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
onClicked: {
|
||||||
|
manager.credentialStatus = oldStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@ MobileComponents.Page {
|
||||||
objectName: "DiveList"
|
objectName: "DiveList"
|
||||||
color: MobileComponents.Theme.viewBackgroundColor
|
color: MobileComponents.Theme.viewBackgroundColor
|
||||||
|
|
||||||
|
property int credentialStatus: manager.credentialStatus
|
||||||
|
property int numDives: diveListView.count
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: diveDelegate
|
id: diveDelegate
|
||||||
MobileComponents.ListItem {
|
MobileComponents.ListItem {
|
||||||
|
@ -152,7 +155,10 @@ MobileComponents.Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
id: outerScrollView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
opacity: 0.8 - startPage.opacity
|
||||||
|
visible: opacity > 0
|
||||||
ListView {
|
ListView {
|
||||||
id: diveListView
|
id: diveListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -169,10 +175,7 @@ MobileComponents.Page {
|
||||||
x: MobileComponents.Units.gridUnit / 2
|
x: MobileComponents.Units.gridUnit / 2
|
||||||
height: paintedHeight + MobileComponents.Units.gridUnit / 2
|
height: paintedHeight + MobileComponents.Units.gridUnit / 2
|
||||||
verticalAlignment: Text.AlignBottom
|
verticalAlignment: Text.AlignBottom
|
||||||
|
|
||||||
text: "Dive Log"
|
text: "Dive Log"
|
||||||
opacity: 0.8 - startPage.opacity
|
|
||||||
visible: opacity > 0
|
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: detailsWindow
|
target: detailsWindow
|
||||||
|
@ -183,7 +186,7 @@ MobileComponents.Page {
|
||||||
StartPage {
|
StartPage {
|
||||||
id: startPage
|
id: startPage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: (diveListView.count == 0) ? 1.0 : 0
|
opacity: (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL) ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity { NumberAnimation { duration: MobileComponents.Units.shortDuration } }
|
Behavior on opacity { NumberAnimation { duration: MobileComponents.Units.shortDuration } }
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ MobileComponents.ApplicationWindow {
|
||||||
id: rootItem
|
id: rootItem
|
||||||
title: qsTr("Subsurface-mobile")
|
title: qsTr("Subsurface-mobile")
|
||||||
property bool fullscreen: true
|
property bool fullscreen: true
|
||||||
|
property int oldStatus: -1
|
||||||
|
|
||||||
FontMetrics {
|
FontMetrics {
|
||||||
id: fontMetrics
|
id: fontMetrics
|
||||||
|
@ -38,8 +39,15 @@ MobileComponents.ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Cloud credentials"
|
text: "Cloud credentials"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
stackView.push(cloudCredWindow)
|
|
||||||
detailsWindow.endEditMode()
|
detailsWindow.endEditMode()
|
||||||
|
oldStatus = manager.credentialStatus
|
||||||
|
if (diveList.numDives > 0) {
|
||||||
|
manager.startPageText = "Enter different credentials or return to dive list"
|
||||||
|
} else {
|
||||||
|
manager.startPageText = "Enter valdi cloud storage credentials"
|
||||||
|
}
|
||||||
|
|
||||||
|
manager.credentialStatus = QMLManager.UNKNOWN
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MobileComponents.ActionGroup {
|
MobileComponents.ActionGroup {
|
||||||
|
|
Loading…
Add table
Reference in a new issue