diff options
Diffstat (limited to 'core/imagedownloader.h')
-rw-r--r-- | core/imagedownloader.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/imagedownloader.h b/core/imagedownloader.h index 337185869..d8e9d2d7d 100644 --- a/core/imagedownloader.h +++ b/core/imagedownloader.h @@ -5,6 +5,7 @@ #include <QImage> #include <QFuture> #include <QNetworkReply> +#include <QThreadPool> class ImageDownloader : public QObject { Q_OBJECT @@ -18,6 +19,31 @@ private: QString filename; }; +class PictureEntry; +class Thumbnailer : public QObject { + Q_OBJECT +public: + static Thumbnailer *instance(); + + // 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); + + // If we change dive, clear all unfinished thumbnail creations + void clearWorkQueue(); +signals: + void thumbnailChanged(QString filename, QImage thumbnail); +private: + Thumbnailer(); + void processItem(QString filename, int size); + + mutable QMutex lock; + QThreadPool pool; + + QMap<QString,QFuture<void>> workingOn; +}; + QImage getHashedImage(const QString &filename); #endif // IMAGEDOWNLOADER_H |