mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 21:20:19 +00:00
e32ae20ca3
This was broken when introducing loading images from the server. Now it first tries the server and if that fails tries the actual URL. Still, the image does not show up immediately, since the DivePictureModel is unavailable to the image downloader to be told to update the images. This needs to be fixed but in the mean time, the image is shown when the dive is reselected (possibly on the next run) since it is then loaded from the cache. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
34 lines
631 B
C++
34 lines
631 B
C++
#ifndef IMAGEDOWNLOADER_H
|
|
#define IMAGEDOWNLOADER_H
|
|
|
|
#include <QImage>
|
|
#include <QFuture>
|
|
#include <QNetworkReply>
|
|
|
|
typedef QPair<QString, QByteArray> SHashedFilename;
|
|
|
|
extern QUrl cloudImageURL(const char *hash);
|
|
|
|
|
|
class ImageDownloader : public QObject {
|
|
Q_OBJECT;
|
|
public:
|
|
ImageDownloader(struct picture *picture);
|
|
~ImageDownloader();
|
|
void load(bool fromHash);
|
|
|
|
private:
|
|
struct picture *picture;
|
|
QNetworkAccessManager manager;
|
|
bool loadFromHash;
|
|
|
|
private slots:
|
|
void saveImage(QNetworkReply *reply);
|
|
};
|
|
|
|
class SHashedImage : public QImage {
|
|
public:
|
|
SHashedImage(struct picture *picture);
|
|
};
|
|
|
|
#endif // IMAGEDOWNLOADER_H
|