mobile/statistics: add a statistics page on mobile

This adds a reasonably flexibile mobile page that tries to do the right
thing for both portrait and landscape mode. In order to get the most out
of a mobile screen, it's implemented in a way that always gives it the
full screen (it does so by emptying out the page stack and being the
only page shown - brutal, but effective).

This commit also contains a bunch of other random cleanups that didn't
really justify being in separate commits.

Parts of this was written by Berthold, hence the double SOB.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Dirk Hohndel 2021-01-04 15:47:33 +01:00
parent d77f254328
commit eb2b0f0a3e
5 changed files with 229 additions and 3 deletions

View file

@ -88,6 +88,9 @@ Kirigami.ApplicationWindow {
for (var i=pageStack.depth; i>1; i--) {
pageStack.pop()
}
if (pageStack.currentItem !== diveList) {
showDiveList()
}
detailsWindow.endEditMode()
}
@ -96,6 +99,15 @@ Kirigami.ApplicationWindow {
}
function showPage(page) {
if (page === statistics) {
manager.appendTextToLog("switching to statistics page, clearing out stack")
pageStack.clear()
}
if (pageStack.currentItem === statistics) {
manager.appendTextToLog("switching away from statistics page, clearing out stack")
pageStack.clear()
}
if (page !== mapPage)
hackToOpenMap = 0 // we really want a different page
if (globalDrawer.drawerOpen)
@ -440,6 +452,12 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
}
},
Kirigami.Action {
text: qsTr("Statistics")
onTriggered: {
showPage(statistics)
}
},
Kirigami.Action {
icon {
name: ":/icons/ic_settings.svg"
@ -859,9 +877,13 @@ if you have network connectivity and want to sync your data to cloud storage."),
visible: false
}
StatisticsPage {
id: statistics
visible: false
}
Settings {
id: settingsWindow
visible: false
}
CopySettings {