mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
57192063c4
commit
ec0de54450
1 changed files with 10 additions and 5 deletions
|
@ -319,6 +319,15 @@ void MainWindow::on_actionSaveAs_triggered()
|
||||||
file_save_as();
|
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()
|
void MainWindow::on_actionHash_images_triggered()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this, tr("Traverse image directories"), lastUsedDir(), filter());
|
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::Accept, tr("Scan"));
|
||||||
dialog.setLabelText(QFileDialog::Reject, tr("Cancel"));
|
dialog.setLabelText(QFileDialog::Reject, tr("Cancel"));
|
||||||
QStringList dirnames;
|
QStringList dirnames;
|
||||||
QList<QFuture<void> > futures;
|
|
||||||
if (dialog.exec())
|
if (dialog.exec())
|
||||||
dirnames = dialog.selectedFiles();
|
dirnames = dialog.selectedFiles();
|
||||||
if (dirnames.isEmpty())
|
if (dirnames.isEmpty())
|
||||||
return;
|
return;
|
||||||
foreach (QString dir, dirnames) {
|
QtConcurrent::run(learnImageDirs,dirnames);
|
||||||
futures << QtConcurrent::run(learnImages, QDir(dir), 10, false);
|
|
||||||
}
|
|
||||||
DivePictureModel::instance()->updateDivePicturesWhenDone(futures);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileWidget2 *MainWindow::graphics() const
|
ProfileWidget2 *MainWindow::graphics() const
|
||||||
|
|
Loading…
Add table
Reference in a new issue