From 0646b41275a3f38926c75d2746b3208805da3a23 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 3 Jun 2018 17:26:44 +0200 Subject: Dive pictures: find moved pictures based on filename Users might have edited their pictures. Therefore, instead of identifying pictures by the hash of the file-content, use the file path. The match between original and new filename is graded by a score. Currently, this is the number of path components that match, starting from the filename. Camparison is case-insensitive. After having identified the matching images, write the caches so that they are saved even if the user doesn't cleanly quit the application. Since the new code uses significantly less resources, it can be run in a single background thread. Thus, the multi-threading can be simplified. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b22b7e265..c0c79b00d 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -701,13 +701,10 @@ void MainWindow::on_actionCloudOnline_triggered() updateCloudOnlineStatus(); } -void learnImageDirs(QStringList dirnames) +static void learnImageDirs(QStringList dirnames) { - QList > futures; - foreach (QString dir, dirnames) { - futures << QtConcurrent::run(learnImages, QDir(dir), 10); - } - DivePictureModel::instance()->updateDivePicturesWhenDone(futures); + learnImages(dirnames, 10); + DivePictureModel::instance()->updateDivePictures(); } void MainWindow::on_actionHash_images_triggered() -- cgit v1.2.3-70-g09d2