aboutsummaryrefslogtreecommitdiffstats
path: root/core/imagedownloader.h
blob: dc42aee4d5aafff9d146d636214f8b350a1d14ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: GPL-2.0
#ifndef IMAGEDOWNLOADER_H
#define IMAGEDOWNLOADER_H

#include <QImage>
#include <QFuture>
#include <QNetworkReply>

class ImageDownloader : public QObject {
	Q_OBJECT;
public:
	ImageDownloader(struct picture *picture);
	~ImageDownloader();
	void load(bool fromHash);

private:
	bool loadFromUrl(const QUrl &);	// return true on success
	void saveImage(QNetworkReply *reply, bool &success);
	struct picture *picture;
};

class SHashedImage : public QImage {
	bool load(const QString &fileName, const char *format=nullptr);
public:
	SHashedImage(struct picture *picture);
};

#endif // IMAGEDOWNLOADER_H