summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli-downloader.cpp1
-rw-r--r--qt-models/diveimportedmodel.cpp5
-rw-r--r--qt-models/diveimportedmodel.h1
3 files changed, 7 insertions, 0 deletions
diff --git a/cli-downloader.cpp b/cli-downloader.cpp
index 77053c0c7..1cf97f487 100644
--- a/cli-downloader.cpp
+++ b/cli-downloader.cpp
@@ -36,4 +36,5 @@ void cliDownloader(const char *vendor, const char *product, const char *device)
// before we start, remember where the dive_table ended
diveImportedModel->startDownload();
+ diveImportedModel->waitForDownload();
}
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp
index 0e2c07cc6..118b0a419 100644
--- a/qt-models/diveimportedmodel.cpp
+++ b/qt-models/diveimportedmodel.cpp
@@ -144,6 +144,11 @@ void DiveImportedModel::startDownload()
thread.start();
}
+void DiveImportedModel::waitForDownload()
+{
+ thread.wait();
+}
+
std::tuple<struct dive_table, struct dive_site_table, struct device_table> DiveImportedModel::consumeTables()
{
beginResetModel();
diff --git a/qt-models/diveimportedmodel.h b/qt-models/diveimportedmodel.h
index f43057d26..adede9220 100644
--- a/qt-models/diveimportedmodel.h
+++ b/qt-models/diveimportedmodel.h
@@ -28,6 +28,7 @@ public:
int numDives() const;
Q_INVOKABLE void recordDives(int flags = IMPORT_PREFER_IMPORTED | IMPORT_IS_DOWNLOADED);
Q_INVOKABLE void startDownload();
+ Q_INVOKABLE void waitForDownload();
DownloadThread thread;
public