summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-10 16:39:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-04 02:27:36 +0800
commitf3ef38ca0d6db6f7e022a0e565f7460ed22f431e (patch)
tree66a331547c00a48f2a15882f3f7d22307866f120 /desktop-widgets
parent0646b41275a3f38926c75d2746b3208805da3a23 (diff)
downloadsubsurface-f3ef38ca0d6db6f7e022a0e565f7460ed22f431e.tar.gz
Dive pictures: remove hashes
In the last commits, the canonical-to-local filename map was made independent from the image hashes and the location of moved images was based on filename not hashes. The hashes are now in principle unused (except for conversion of old-style local filename lookups). Therefore, remove the hashes in this commit. This makes addition of images distinctly faster. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.cpp3
-rw-r--r--desktop-widgets/mainwindow.cpp12
2 files changed, 10 insertions, 5 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index ded3acbc7..bf4a5d8cf 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -986,9 +986,8 @@ void DiveListView::loadImageFromURL(QUrl url)
return;
}
- // Since we already downloaded the image we can cache it as well.
QCryptographicHash hash(QCryptographicHash::Sha1);
- hash.addData(imageData);
+ hash.addData(url.toString().toUtf8());
QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first();
QDir dir(path);
if (!dir.exists())
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index c0c79b00d..dcd7aff32 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -701,9 +701,9 @@ void MainWindow::on_actionCloudOnline_triggered()
updateCloudOnlineStatus();
}
-static void learnImageDirs(QStringList dirnames)
+static void learnImageDirs(QStringList dirnames, QVector<QString> imageFilenames)
{
- learnImages(dirnames, 10);
+ learnImages(dirnames, 10, imageFilenames);
DivePictureModel::instance()->updateDivePictures();
}
@@ -720,7 +720,13 @@ void MainWindow::on_actionHash_images_triggered()
dirnames = dialog.selectedFiles();
if (dirnames.isEmpty())
return;
- future = QtConcurrent::run(learnImageDirs,dirnames);
+ QVector<QString> imageFilenames;
+ int i;
+ struct dive *dive;
+ for_each_dive (i, dive)
+ FOR_EACH_PICTURE(dive)
+ imageFilenames.append(QString(picture->filename));
+ future = QtConcurrent::run(learnImageDirs, dirnames, imageFilenames);
MainWindow::instance()->getNotificationWidget()->showNotification(tr("Scanning images...(this can take a while)"), KMessageWidget::Information);
MainWindow::instance()->getNotificationWidget()->setFuture(future);