From 2368f3371bbdb587888d5f04095623c7b8b2ac2e Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 9 Nov 2015 16:48:12 +0100 Subject: Store Thumbnails with image hashes This drastically improves the time it takes to select a dive with several pictures at the expense of longer startup and bigger hash files. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-models/divepicturemodel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'qt-models') diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 1f37423e2..d61af3c5e 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -5,19 +5,21 @@ #include +extern QHash thumbnailCache; + + SPixmap scaleImages(picturepointer picture) { - static QHash cache; SPixmap ret; ret.first = picture; - if (cache.contains(picture->filename) && !cache.value(picture->filename).isNull()) { - ret.second = cache.value(picture->filename); + if (thumbnailCache.contains(picture->filename) && !thumbnailCache.value(picture->filename).isNull()) { + ret.second = thumbnailCache.value(picture->filename); } else { int dim = defaultIconMetrics().sz_pic; QImage p = SHashedImage(picture); if(!p.isNull()) { p = p.scaled(dim, dim, Qt::KeepAspectRatio); - cache.insert(picture->filename, p); + thumbnailCache.insert(picture->filename, p); } ret.second = p; } -- cgit v1.2.3-70-g09d2