2017-04-27 20:24:53 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-11-06 10:39:59 -08:00
|
|
|
#ifndef IMAGEDOWNLOADER_H
|
|
|
|
#define IMAGEDOWNLOADER_H
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
#include <QFuture>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
|
|
|
|
class ImageDownloader : public QObject {
|
|
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
|
|
ImageDownloader(struct picture *picture);
|
2016-03-15 21:31:59 +01:00
|
|
|
~ImageDownloader();
|
2016-01-09 16:29:49 +01:00
|
|
|
void load(bool fromHash);
|
2015-11-06 10:39:59 -08:00
|
|
|
|
|
|
|
private:
|
2018-02-08 22:45:55 +01:00
|
|
|
bool loadFromUrl(const QUrl &); // return true on success
|
|
|
|
void saveImage(QNetworkReply *reply, bool &success);
|
2015-11-06 10:39:59 -08:00
|
|
|
struct picture *picture;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SHashedImage : public QImage {
|
|
|
|
public:
|
|
|
|
SHashedImage(struct picture *picture);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|