From 5e34531e326d8f9b67cddd5f5af34265381be0d0 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 23 Nov 2020 17:17:17 +0100 Subject: downloader: wait for download thread Signed-off-by: Robert C. Helling --- qt-models/diveimportedmodel.cpp | 5 +++++ qt-models/diveimportedmodel.h | 1 + 2 files changed, 6 insertions(+) (limited to 'qt-models') 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 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 -- cgit v1.2.3-70-g09d2