mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Only attempt to download each picture once
Otherwise we keep downloading the same image multiple times instead of new images. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4a9b97e4a9
commit
c2c0cb48d2
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "qthelper.h"
|
||||
#include "imagedownloader.h"
|
||||
#include <unistd.h>
|
||||
#include <QString>
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
|
@ -75,10 +76,17 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
|
|||
|
||||
}
|
||||
|
||||
QSet<QString> queuedPictures;
|
||||
QMutex pictureQueueMutex;
|
||||
|
||||
void loadPicture(struct picture *picture, bool fromHash)
|
||||
{
|
||||
if (!picture)
|
||||
return;
|
||||
QMutexLocker locker(&pictureQueueMutex);
|
||||
if (queuedPictures.contains(QString(picture->filename)))
|
||||
return;
|
||||
queuedPictures.insert(QString(picture->filename));
|
||||
ImageDownloader download(picture);
|
||||
download.load(fromHash);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue