2015-11-06 18:39:59 +00:00
|
|
|
#ifndef IMAGEDOWNLOADER_H
|
|
|
|
#define IMAGEDOWNLOADER_H
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
#include <QFuture>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
|
|
|
|
typedef QPair<QString, QByteArray> SHashedFilename;
|
|
|
|
|
2016-01-09 15:29:49 +00:00
|
|
|
extern QUrl cloudImageURL(const char *hash);
|
|
|
|
|
|
|
|
|
2015-11-06 18:39:59 +00:00
|
|
|
class ImageDownloader : public QObject {
|
|
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
|
|
ImageDownloader(struct picture *picture);
|
2016-01-09 15:29:49 +00:00
|
|
|
void load(bool fromHash);
|
2015-11-06 18:39:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct picture *picture;
|
|
|
|
QNetworkAccessManager manager;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void saveImage(QNetworkReply *reply);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SHashedImage : public QImage {
|
|
|
|
public:
|
|
|
|
SHashedImage(struct picture *picture);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|