subsurface/subsurface-core/imagedownloader.h
Robert C. Helling 8a59d78faa When handing off a picture to a worker thread, copy it first
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>
2016-03-16 07:46:28 -07:00

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