summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-03-26 22:53:44 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-30 13:04:01 -0700
commitec0de544504232be448a0cc8f047805199170ba5 (patch)
tree6abd12cdce07fc1524b8ab07c8c8db5fcb148e01 /qt-ui
parent57192063c45db1e943bda9ff284f85570a2efd0d (diff)
downloadsubsurface-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.cpp15
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