Parallel picture loader (#5977)

* Parallelize picture loader.

* Queue requests instead.

* Include a status bar for the picture loader.

* Save redirect cache on destruction.

* Address comments.

* Let's not overwrite an ambigious variable name.

* Lint.

* Oracle needs the status bar too.

* We actually get a free request if we hit a cached image.

* Fix cmake list.

* toString() the url.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-06-13 01:44:38 +02:00 committed by GitHub
parent 9af3fbc35f
commit fe57efb1a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 596 additions and 350 deletions

View file

@ -7,12 +7,14 @@
#include <QDebug>
#include <QDirIterator>
#include <QFileInfo>
#include <QMainWindow>
#include <QMovie>
#include <QNetworkDiskCache>
#include <QNetworkRequest>
#include <QPainter>
#include <QPixmapCache>
#include <QScreen>
#include <QStatusBar>
#include <QThread>
#include <algorithm>
#include <utility>
@ -27,6 +29,16 @@ PictureLoader::PictureLoader() : QObject(nullptr)
connect(&SettingsCache::instance(), &SettingsCache::picDownloadChanged, this, &PictureLoader::picDownloadChanged);
connect(worker, &PictureLoaderWorker::imageLoaded, this, &PictureLoader::imageLoaded);
statusBar = new PictureLoaderStatusBar(nullptr);
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(QApplication::activeWindow());
if (mainWindow) {
mainWindow->statusBar()->addPermanentWidget(statusBar);
}
connect(worker, &PictureLoaderWorker::imageLoadQueued, statusBar, &PictureLoaderStatusBar::addQueuedImageLoad);
connect(worker, &PictureLoaderWorker::imageLoadSuccessful, statusBar,
&PictureLoaderStatusBar::addSuccessfulImageLoad);
}
PictureLoader::~PictureLoader()