summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-09-25 20:49:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-02 08:04:49 -0700
commitad7ffa0af03718829c62621aceaaac959932ac14 (patch)
tree2795ea847f2f1b0d35866faf3b999f3cd6c78db4 /mobile-widgets
parent6e343c734af619e620962f2ab26862c5c416300a (diff)
downloadsubsurface-ad7ffa0af03718829c62621aceaaac959932ac14.tar.gz
Import: Make DownloadThread a subobject of DiveImportedModel
Currently, desktop and mobile are accessing the DownloadThread and the DiveImportedModel concurrently. This makes a big data flow mess. To achieve a more hierarchical data flow, start by making the DownloadThread a subobject of DiveImportedModel. Start the download by calling a function in DiveImportedModel. Route the finished signal through DiveImportedModel. Thus, the model can reload itself with the new data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml21
1 files changed, 6 insertions, 15 deletions
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index 51c96c044..541b7263c 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -24,18 +24,13 @@ Kirigami.Page {
property alias product: comboProduct.currentIndex
property alias connection: comboConnection.currentIndex
- DCDownloadThread {
- id: downloadThread
+ DCImportModel {
+ id: importModel
- onFinished : {
- if (!table || !sites) {
- console.warn("DCDownloadThread::onFinished(): table or sites is null!")
- return
- }
- importModel.repopulate(table, sites)
+ onDownloadFinished : {
progressBar.visible = false
- if (dcImportModel.rowCount() > 0) {
- console.log(dcImportModel.rowCount() + " dive downloaded")
+ if (rowCount() > 0) {
+ console.log(rowCount() + " dive downloaded")
divesDownloaded = true
} else {
console.log("no new dives downloaded")
@@ -45,10 +40,6 @@ Kirigami.Page {
}
}
- DCImportModel {
- id: importModel
- }
-
ColumnLayout {
anchors.top: parent.top
height: parent.height
@@ -295,7 +286,7 @@ Kirigami.Page {
message += " downloading " + (manager.DC_forceDownload ? "all" : "only new" ) + " dives";
manager.appendTextToLog(message)
progressBar.visible = true
- downloadThread.start()
+ importModel.startDownload()
}
}
SsrfButton {