mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
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:
parent
9af3fbc35f
commit
fe57efb1a8
16 changed files with 596 additions and 350 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue