mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
QML UI: adapt for latest Kirigami
In commit 50ebdd020e3c of the Kirigami project the syntax with which actions are added to pages has changed. This commit tracks that, adds the new file that was added in Kirigami and also removes the now obsolete context menus (since we have a working back button on iOS now) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fe62da3a6b
commit
c6dbbe1aac
5 changed files with 20 additions and 47 deletions
|
@ -38,17 +38,20 @@ Kirigami.Page {
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "view"
|
name: "view"
|
||||||
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ deleteAction, backAction ] : [ deleteAction ] }
|
PropertyChanges {
|
||||||
|
target: diveDetailsPage;
|
||||||
|
actions {
|
||||||
|
right: deleteAction
|
||||||
|
}
|
||||||
|
}
|
||||||
PropertyChanges { target: detailsEditScroll; opened: false }
|
PropertyChanges { target: detailsEditScroll; opened: false }
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "edit"
|
name: "edit"
|
||||||
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
|
|
||||||
PropertyChanges { target: detailsEditScroll; opened: true }
|
PropertyChanges { target: detailsEditScroll; opened: true }
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "add"
|
name: "add"
|
||||||
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
|
|
||||||
PropertyChanges { target: detailsEditScroll; opened: true }
|
PropertyChanges { target: detailsEditScroll; opened: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,28 +73,7 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property QtObject cancelAction: Kirigami.Action {
|
actions.main: Action {
|
||||||
text: state === "edit" ? "Cancel edit" : "Cancel dive add"
|
|
||||||
iconName: "dialog-cancel"
|
|
||||||
onTriggered: {
|
|
||||||
contextDrawer.close()
|
|
||||||
if (state === "add")
|
|
||||||
returnTopPage()
|
|
||||||
else
|
|
||||||
endEditMode()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property QtObject backAction: Action {
|
|
||||||
text: "Back to dive list"
|
|
||||||
iconName: "go-previous"
|
|
||||||
onTriggered: {
|
|
||||||
contextDrawer.close()
|
|
||||||
returnTopPage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mainAction: Action {
|
|
||||||
iconName: state !== "view" ? "document-save" : "document-edit"
|
iconName: state !== "view" ? "document-save" : "document-edit"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (state === "edit" || state === "add") {
|
if (state === "edit" || state === "add") {
|
||||||
|
|
|
@ -216,10 +216,10 @@ Kirigami.ScrollablePage {
|
||||||
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
page.mainAction = page.saveAction
|
page.actions.main = page.saveAction
|
||||||
title = "Cloud credentials"
|
title = "Cloud credentials"
|
||||||
} else {
|
} else {
|
||||||
page.mainAction = page.addDiveAction
|
page.actions.main = page.addDiveAction
|
||||||
title = "Dive list"
|
title = "Dive list"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,18 +15,6 @@ Kirigami.ScrollablePage {
|
||||||
objectName: "gpsList"
|
objectName: "gpsList"
|
||||||
title: "GPS Fixes"
|
title: "GPS Fixes"
|
||||||
|
|
||||||
/* this can be done by hitting the back key
|
|
||||||
contextualActions: [
|
|
||||||
Action {
|
|
||||||
text: "Close GPS list"
|
|
||||||
iconName: "dialog-cancel"
|
|
||||||
onTriggered: {
|
|
||||||
stackView.pop()
|
|
||||||
contextDrawer.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
*/
|
|
||||||
Component {
|
Component {
|
||||||
id: gpsDelegate
|
id: gpsDelegate
|
||||||
Kirigami.SwipeListItem {
|
Kirigami.SwipeListItem {
|
||||||
|
|
|
@ -9,14 +9,16 @@ import org.subsurfacedivelog.mobile 1.0
|
||||||
Kirigami.Page {
|
Kirigami.Page {
|
||||||
|
|
||||||
title: "Preferences"
|
title: "Preferences"
|
||||||
mainAction: Action {
|
actions {
|
||||||
text: "Save"
|
main: Action {
|
||||||
iconName: "document-save"
|
text: "Save"
|
||||||
onTriggered: {
|
iconName: "document-save"
|
||||||
manager.distanceThreshold = distanceThreshold.text
|
onTriggered: {
|
||||||
manager.timeThreshold = timeThreshold.text
|
manager.distanceThreshold = distanceThreshold.text
|
||||||
manager.savePreferences()
|
manager.timeThreshold = timeThreshold.text
|
||||||
stackView.pop()
|
manager.savePreferences()
|
||||||
|
stackView.pop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<file alias="org/kde/kirigami/private/EdgeShadow.qml">kirigami/private/EdgeShadow.qml</file>
|
<file alias="org/kde/kirigami/private/EdgeShadow.qml">kirigami/private/EdgeShadow.qml</file>
|
||||||
<file alias="org/kde/kirigami/private/MenuIcon.qml">kirigami/private/MenuIcon.qml</file>
|
<file alias="org/kde/kirigami/private/MenuIcon.qml">kirigami/private/MenuIcon.qml</file>
|
||||||
<file alias="org/kde/kirigami/private/PageStack.js">kirigami/private/PageStack.js</file>
|
<file alias="org/kde/kirigami/private/PageStack.js">kirigami/private/PageStack.js</file>
|
||||||
|
<file alias="org/kde/kirigami/private/PageActionPropertyGroup.qml">kirigami/private/PageActionPropertyGroup.qml</file>
|
||||||
<file alias="org/kde/kirigami/private/PassiveNotification.qml">kirigami/private/PassiveNotification.qml</file>
|
<file alias="org/kde/kirigami/private/PassiveNotification.qml">kirigami/private/PassiveNotification.qml</file>
|
||||||
<file alias="org/kde/kirigami/private/RefreshableScrollView.qml">kirigami/private/RefreshableScrollView.qml</file>
|
<file alias="org/kde/kirigami/private/RefreshableScrollView.qml">kirigami/private/RefreshableScrollView.qml</file>
|
||||||
<file alias="org/kde/kirigami/icons/go-next.svg">kirigami/icons/go-next.svg</file>
|
<file alias="org/kde/kirigami/icons/go-next.svg">kirigami/icons/go-next.svg</file>
|
||||||
|
|
Loading…
Reference in a new issue