2017-04-27 18:24:53 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-11-06 18:39:59 +00: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 20:31:59 +00:00
|
|
|
~ImageDownloader();
|
2016-01-09 15:29:49 +00:00
|
|
|
void load(bool fromHash);
|
2015-11-06 18:39:59 +00:00
|
|
|
|
|
|
|
private:
|
2018-02-08 21:45:55 +00:00
|
|
|
bool loadFromUrl(const QUrl &); // return true on success
|
|
|
|
void saveImage(QNetworkReply *reply, bool &success);
|
2015-11-06 18:39:59 +00:00
|
|
|
struct picture *picture;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SHashedImage : public QImage {
|
2018-03-30 05:57:30 +00:00
|
|
|
bool load(const QString &fileName, const char *format=nullptr);
|
2015-11-06 18:39:59 +00:00
|
|
|
public:
|
|
|
|
SHashedImage(struct picture *picture);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|