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 {
|
2018-03-06 10:38:21 +01:00
|
|
|
Q_OBJECT
|
2015-11-06 10:39:59 -08:00
|
|
|
public:
|
2018-03-07 16:37:31 +01:00
|
|
|
ImageDownloader(const QString &filename);
|
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);
|
2018-03-07 16:37:31 +01:00
|
|
|
QString filename;
|
2015-11-06 10:39:59 -08:00
|
|
|
};
|
|
|
|
|
2018-03-07 16:37:31 +01:00
|
|
|
QImage getHashedImage(const QString &filename);
|
2015-11-06 10:39:59 -08:00
|
|
|
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|