summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index a4dc09057..6e3c957a6 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -1057,6 +1057,7 @@ void read_hashes()
if (hashfile.open(QIODevice::ReadOnly)) {
QDataStream stream(&hashfile);
stream >> localFilenameOf;
+ stream >> hashOf;
hashfile.close();
}
}
@@ -1067,6 +1068,7 @@ void write_hashes()
if (hashfile.open(QIODevice::WriteOnly)) {
QDataStream stream(&hashfile);
stream << localFilenameOf;
+ stream << hashOf;
hashfile.commit();
} else {
qDebug() << "cannot open" << hashfile.fileName();
@@ -1124,6 +1126,20 @@ void updateHash(struct picture *picture) {
free(old);
}
+void hashPicture(struct picture *picture)
+{
+ learnHash(picture, hashFile(QString(picture->filename)));
+ mark_divelist_changed((true));
+
+}
+
+extern "C" void cache_picture(struct picture *picture)
+{
+ QString filename = picture->filename;
+ if (!hashOf.contains(filename))
+ QtConcurrent::run(hashPicture, picture);
+}
+
void learnImages(const QDir dir, int max_recursions, bool recursed)
{
QDir current(dir);