Dive pictures: replace picture struct by QString

In imagedownloader.cpp the only thing we need from the picture struct
is the filename. Therefore, use QStrings instead of the picture struct.
This simplifies memory management.

Remove the clone_picture() function, which is not needed anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-03-07 16:37:31 +01:00 committed by Dirk Hohndel
parent 5d372cfda3
commit f60343eebb
7 changed files with 29 additions and 58 deletions

View file

@ -9,16 +9,15 @@
class ImageDownloader : public QObject {
Q_OBJECT
public:
ImageDownloader(struct picture *picture);
~ImageDownloader();
ImageDownloader(const QString &filename);
void load(bool fromHash);
private:
bool loadFromUrl(const QUrl &); // return true on success
void saveImage(QNetworkReply *reply, bool &success);
struct picture *picture;
QString filename;
};
QImage getHashedImage(struct picture *picture);
QImage getHashedImage(const QString &filename);
#endif // IMAGEDOWNLOADER_H