mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-29 13:40:20 +00:00
8a59d78faa
as otherwise we crash when the picture is freed before the worker thread (to load from the net or to compute hashes) is finished Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
33 lines
611 B
C++
33 lines
611 B
C++
#ifndef IMAGEDOWNLOADER_H
|
|
#define IMAGEDOWNLOADER_H
|
|
|
|
#include <QImage>
|
|
#include <QFuture>
|
|
#include <QNetworkReply>
|
|
|
|
typedef QPair<QString, QByteArray> SHashedFilename;
|
|
|
|
extern QUrl cloudImageURL(const char *hash);
|
|
|
|
|
|
class ImageDownloader : public QObject {
|
|
Q_OBJECT;
|
|
public:
|
|
ImageDownloader(struct picture *picture);
|
|
~ImageDownloader();
|
|
void load(bool fromHash);
|
|
|
|
private:
|
|
struct picture *picture;
|
|
QNetworkAccessManager manager;
|
|
|
|
private slots:
|
|
void saveImage(QNetworkReply *reply);
|
|
};
|
|
|
|
class SHashedImage : public QImage {
|
|
public:
|
|
SHashedImage(struct picture *picture);
|
|
};
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|