aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-29 19:19:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-03 04:02:00 -0800
commit9f34f4f97d6b355dbb670da488e43c5e7f1cd9e7 (patch)
tree2a7758934790b46f0cbb3793c94a1a6b3994ab9f /mobile-widgets
parent113cb1acc0b6b44b416272ae417a3f35fba2cc83 (diff)
downloadsubsurface-9f34f4f97d6b355dbb670da488e43c5e7f1cd9e7.tar.gz
Mobile: disconnect model while updating dive list
If the dive list is connected to the model while the model is updated with the downloaded dives, sometimes the UI hangs completely. Disconnecting the model and then reconnecting it does add a fairly noticeable delay on longer dive lists, so there are tradeoffs here. Of course the obvious solution is to make reconnecting the model faster... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml13
-rw-r--r--mobile-widgets/qml/main.qml9
2 files changed, 20 insertions, 2 deletions
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index a916a372e..c5a67f551 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -385,19 +385,28 @@ Kirigami.Page {
text: qsTr("Accept")
bottomPadding: Kirigami.Units.gridUnit / 2
onClicked: {
+ manager.appendTextToLog("Save downloaded dives that were selected")
busy = true
rootItem.showBusy()
- manager.appendTextToLog("Save downloaded dives that were selected")
+ manager.appendTextToLog("temporary disconnecting dive list model")
+ diveList.diveListModel = null
+ manager.appendTextToLog("Record dives")
importModel.recordDives()
manager.saveChangesLocal()
+ manager.appendTextToLog("resetting model and refreshing the dive list")
diveModel.resetInternalData()
manager.refreshDiveList()
+ manager.appendTextToLog("pageStack popping Download page")
pageStack.pop()
- pageStack.push(diveList)
+ manager.appendTextToLog("setting up the dive list model again")
+ diveList.diveListModel = diveModel
+ manager.appendTextToLog("pageStack switching to dive list")
+ showDiveList()
download.text = qsTr("Download")
busy = false
rootItem.hideBusy()
divesDownloaded = false
+ manager.appendTextToLog("switch to dive list has completed")
}
}
Controls.Label {
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index a31604a12..2ac521ec4 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -103,7 +103,16 @@ Kirigami.ApplicationWindow {
pageStack.push(mapPage)
else
pageStack.currentIndex = i
+ }
+ function showDiveList() {
+ if (globalDrawer.drawerOpen)
+ globalDrawer.close()
+ var i=pageIndex(diveList)
+ if (i === -1)
+ pageStack.push(diveList)
+ else
+ pageStack.currentIndex = i
}
function pageIndex(pageToFind) {