subsurface/core/imagedownloader.h
Berthold Stoeger d9df8c3f47 Debug: Error reporting for SHashedImage loading
Overwrite QImage::load() in SHashedImage so that we can perform better
error reporting.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-01 15:59:46 +03:00

28 lines
638 B
C++

// 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