summaryrefslogtreecommitdiffstats
path: root/core/imagedownloader.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-03-11 10:19:08 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-05-13 13:52:35 -0700
commitb450c155fd78e304f07549c35667dc4e6349ec32 (patch)
tree6de785a326156429455cf3c2119a3bed822f6d2a /core/imagedownloader.h
parentafe20ce029a0194e1a8e9e8fbc6f32da1cfdec75 (diff)
downloadsubsurface-b450c155fd78e304f07549c35667dc4e6349ec32.tar.gz
Dive pictures: Move thumbnail-size to Thumbnailer class
The size of the to-be-created thumbnails was passed from DivePictureModel to Thumbnailer. This became more and more bothersome, because the size had to be stored with the request. Calling from Thumbnailer into DivePictureModel was not an option, since this is not linked to all tests. Therefore, move these functions to the Thumbnailer class. Since the maximum thumbnail size is now known to the thumbnailer, the dummy and failure images can be precalculated, which makes switching between dives faster. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/imagedownloader.h')
-rw-r--r--core/imagedownloader.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/imagedownloader.h b/core/imagedownloader.h
index d8e9d2d7d..92edea0b6 100644
--- a/core/imagedownloader.h
+++ b/core/imagedownloader.h
@@ -28,18 +28,23 @@ public:
// Schedule a thumbnail for fetching or calculation.
// Returns a placehlder thumbnail. The actual thumbnail will be sent
// via a signal later.
- QImage fetchThumbnail(PictureEntry &entry, int size);
+ QImage fetchThumbnail(PictureEntry &entry);
// If we change dive, clear all unfinished thumbnail creations
void clearWorkQueue();
+ static int maxThumbnailSize();
+ static int defaultThumbnailSize();
+ static int thumbnailSize(double zoomLevel);
signals:
void thumbnailChanged(QString filename, QImage thumbnail);
private:
Thumbnailer();
- void processItem(QString filename, int size);
+ void processItem(QString filename);
mutable QMutex lock;
QThreadPool pool;
+ QImage failImage; // Shown when image-fetching fails
+ QImage dummyImage; // Shown before thumbnail is fetched
QMap<QString,QFuture<void>> workingOn;
};