Load remote images

When loading an image by filename and by hash fails, try to interpret
the filename as URL and download the image.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-03-02 16:18:16 +01:00 committed by Dirk Hohndel
parent 869ddc915d
commit 6b3b50cc2f
5 changed files with 107 additions and 3 deletions

View file

@ -5,6 +5,7 @@
#include <QListView>
#include <QThread>
#include <QFuture>
#include <QNetworkReply>
typedef QPair<QString, QByteArray> SHashedFilename;
@ -18,6 +19,18 @@ public:
SHashedImage(struct picture *picture);
};
class ImageDownloader : public QObject {
Q_OBJECT;
public:
ImageDownloader(struct picture *picture);
void load();
private:
struct picture *picture;
QNetworkAccessManager manager;
private slots:
void saveImage(QNetworkReply *reply);
};
class DivePictureModel : public QAbstractTableModel {
Q_OBJECT
public: