mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive pictures: Recognize video files
When generating thumbnails, test for video files. If it is, use a dummy-thumbnail. Write only the type (video), but no image to the thumbnail cache, for forward-compatibility. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9a844a075c
commit
b28dba6087
5 changed files with 83 additions and 47 deletions
|
@ -2,6 +2,7 @@
|
|||
#ifndef IMAGEDOWNLOADER_H
|
||||
#define IMAGEDOWNLOADER_H
|
||||
|
||||
#include "metadata.h"
|
||||
#include <QImage>
|
||||
#include <QFuture>
|
||||
#include <QNetworkReply>
|
||||
|
@ -48,14 +49,24 @@ public slots:
|
|||
signals:
|
||||
void thumbnailChanged(QString filename, QImage thumbnail);
|
||||
private:
|
||||
struct Thumbnail {
|
||||
QImage img;
|
||||
mediatype_t type;
|
||||
};
|
||||
|
||||
Thumbnailer();
|
||||
static void addThumbnailToCache(const Thumbnail &thumbnail, const QString &picture_filename);
|
||||
void recalculate(QString filename);
|
||||
void processItem(QString filename, bool tryDownload);
|
||||
Thumbnail getThumbnailFromCache(const QString &picture_filename);
|
||||
Thumbnail fetchImage(const QString &filename, const QString &originalFilename, bool tryDownload);
|
||||
Thumbnail getHashedImage(const QString &filename, bool tryDownload);
|
||||
|
||||
mutable QMutex lock;
|
||||
QThreadPool pool;
|
||||
QImage failImage; // Shown when image-fetching fails
|
||||
QImage dummyImage; // Shown before thumbnail is fetched
|
||||
QImage videoImage; // Place holder for videos
|
||||
|
||||
QMap<QString,QFuture<void>> workingOn;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue