downloader: wait for download thread

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2020-11-23 17:17:17 +01:00 committed by Dirk Hohndel
parent eac59a79d8
commit 5e34531e32
3 changed files with 7 additions and 0 deletions

View file

@ -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();
}

View file

@ -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();

View file

@ -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