diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-03-26 22:53:44 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-30 13:04:01 -0700 |
commit | ec0de544504232be448a0cc8f047805199170ba5 (patch) | |
tree | 6abd12cdce07fc1524b8ab07c8c8db5fcb148e01 /qt-ui | |
parent | 57192063c45db1e943bda9ff284f85570a2efd0d (diff) | |
download | subsurface-ec0de544504232be448a0cc8f047805199170ba5.tar.gz |
Make the image hashing non-blocking again
...it had become blocking with 1e3700c1
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 8147e7f3a..76cfc8550 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -319,6 +319,15 @@ void MainWindow::on_actionSaveAs_triggered() file_save_as(); } +void learnImageDirs(QStringList dirnames) +{ + QList<QFuture<void> > futures; + foreach (QString dir, dirnames) { + futures << QtConcurrent::run(learnImages, QDir(dir), 10, false); + } + DivePictureModel::instance()->updateDivePicturesWhenDone(futures); +} + void MainWindow::on_actionHash_images_triggered() { QFileDialog dialog(this, tr("Traverse image directories"), lastUsedDir(), filter()); @@ -327,15 +336,11 @@ void MainWindow::on_actionHash_images_triggered() dialog.setLabelText(QFileDialog::Accept, tr("Scan")); dialog.setLabelText(QFileDialog::Reject, tr("Cancel")); QStringList dirnames; - QList<QFuture<void> > futures; if (dialog.exec()) dirnames = dialog.selectedFiles(); if (dirnames.isEmpty()) return; - foreach (QString dir, dirnames) { - futures << QtConcurrent::run(learnImages, QDir(dir), 10, false); - } - DivePictureModel::instance()->updateDivePicturesWhenDone(futures); + QtConcurrent::run(learnImageDirs,dirnames); } ProfileWidget2 *MainWindow::graphics() const |