From d5590929b1e8d6ca05c4cf46cff5494bebe08c92 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sat, 5 Jul 2025 19:42:39 -0700 Subject: [PATCH] [PictureLoader] Fix status bar not updating --- cockatrice/src/client/ui/picture_loader/picture_loader.cpp | 3 +-- .../src/client/ui/picture_loader/picture_loader_worker.cpp | 2 +- .../src/client/ui/picture_loader/picture_loader_worker.h | 2 +- .../client/ui/picture_loader/picture_loader_worker_work.cpp | 2 ++ .../client/ui/picture_loader/picture_loader_worker_work.h | 5 +++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader.cpp b/cockatrice/src/client/ui/picture_loader/picture_loader.cpp index 0c9cebcf8..d4ab551cd 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader.cpp +++ b/cockatrice/src/client/ui/picture_loader/picture_loader.cpp @@ -37,8 +37,7 @@ PictureLoader::PictureLoader() : QObject(nullptr) } connect(worker, &PictureLoaderWorker::imageLoadQueued, statusBar, &PictureLoaderStatusBar::addQueuedImageLoad); - connect(worker, &PictureLoaderWorker::imageLoadSuccessful, statusBar, - &PictureLoaderStatusBar::addSuccessfulImageLoad); + connect(worker, &PictureLoaderWorker::requestSucceeded, statusBar, &PictureLoaderStatusBar::addSuccessfulImageLoad); } PictureLoader::~PictureLoader() diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader_worker.cpp b/cockatrice/src/client/ui/picture_loader/picture_loader_worker.cpp index c7378fb27..b4234e33b 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader_worker.cpp +++ b/cockatrice/src/client/ui/picture_loader/picture_loader_worker.cpp @@ -82,7 +82,7 @@ QNetworkReply *PictureLoaderWorker::makeRequest(const QUrl &url, PictureLoaderWo // Check for cached redirects QUrl cachedRedirect = getCachedRedirect(url); if (!cachedRedirect.isEmpty()) { - emit imageLoadSuccessful(url); + emit requestSucceeded(url); return makeRequest(cachedRedirect, worker); } diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader_worker.h b/cockatrice/src/client/ui/picture_loader/picture_loader_worker.h index f5b0a3507..8516307dd 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader_worker.h +++ b/cockatrice/src/client/ui/picture_loader/picture_loader_worker.h @@ -72,7 +72,7 @@ signals: void imageLoadEnqueued(const CardInfoPtr &card); void imageLoaded(CardInfoPtr card, const QImage &image); void imageLoadQueued(const QUrl &url, const CardInfoPtr &card, const QString &setName); - void imageLoadSuccessful(const QUrl &url); + void requestSucceeded(const QUrl &url); }; #endif // PICTURE_LOADER_WORKER_H diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp index 38c8f14cb..31c84c332 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp +++ b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp @@ -23,6 +23,7 @@ PictureLoaderWorkerWork::PictureLoaderWorkerWork(const PictureLoaderWorker *work connect(this, &PictureLoaderWorkerWork::urlRedirected, worker, &PictureLoaderWorker::cacheRedirect); connect(this, &PictureLoaderWorkerWork::cachedUrlInvalidated, worker, &PictureLoaderWorker::removedCachedUrl); connect(this, &PictureLoaderWorkerWork::imageLoaded, worker, &PictureLoaderWorker::handleImageLoaded); + connect(this, &PictureLoaderWorkerWork::requestSucceeded, worker, &PictureLoaderWorker::requestSucceeded); // Hook up signals to settings connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged())); @@ -97,6 +98,7 @@ void PictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply) handleFailedReply(reply); } else { handleSuccessfulReply(reply); + emit requestSucceeded(reply->url()); } reply->deleteLater(); diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.h b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.h index 9e79a72d5..bc49e7185 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.h +++ b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.h @@ -53,6 +53,11 @@ signals: * Note that this object will delete itself as this signal is emitted. */ void imageLoaded(CardInfoPtr card, const QImage &image); + + /** + * Emitted when a request did not return a 400 or 500 response + */ + void requestSucceeded(const QUrl &url); void requestImageDownload(const QUrl &url, PictureLoaderWorkerWork *instance); void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl);