mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
[PictureLoader] Fix status bar not updating
This commit is contained in:
parent
0b9b39fef7
commit
d5590929b1
5 changed files with 10 additions and 4 deletions
|
|
@ -37,8 +37,7 @@ PictureLoader::PictureLoader() : QObject(nullptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(worker, &PictureLoaderWorker::imageLoadQueued, statusBar, &PictureLoaderStatusBar::addQueuedImageLoad);
|
connect(worker, &PictureLoaderWorker::imageLoadQueued, statusBar, &PictureLoaderStatusBar::addQueuedImageLoad);
|
||||||
connect(worker, &PictureLoaderWorker::imageLoadSuccessful, statusBar,
|
connect(worker, &PictureLoaderWorker::requestSucceeded, statusBar, &PictureLoaderStatusBar::addSuccessfulImageLoad);
|
||||||
&PictureLoaderStatusBar::addSuccessfulImageLoad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureLoader::~PictureLoader()
|
PictureLoader::~PictureLoader()
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ QNetworkReply *PictureLoaderWorker::makeRequest(const QUrl &url, PictureLoaderWo
|
||||||
// Check for cached redirects
|
// Check for cached redirects
|
||||||
QUrl cachedRedirect = getCachedRedirect(url);
|
QUrl cachedRedirect = getCachedRedirect(url);
|
||||||
if (!cachedRedirect.isEmpty()) {
|
if (!cachedRedirect.isEmpty()) {
|
||||||
emit imageLoadSuccessful(url);
|
emit requestSucceeded(url);
|
||||||
return makeRequest(cachedRedirect, worker);
|
return makeRequest(cachedRedirect, worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ signals:
|
||||||
void imageLoadEnqueued(const CardInfoPtr &card);
|
void imageLoadEnqueued(const CardInfoPtr &card);
|
||||||
void imageLoaded(CardInfoPtr card, const QImage &image);
|
void imageLoaded(CardInfoPtr card, const QImage &image);
|
||||||
void imageLoadQueued(const QUrl &url, const CardInfoPtr &card, const QString &setName);
|
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
|
#endif // PICTURE_LOADER_WORKER_H
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ PictureLoaderWorkerWork::PictureLoaderWorkerWork(const PictureLoaderWorker *work
|
||||||
connect(this, &PictureLoaderWorkerWork::urlRedirected, worker, &PictureLoaderWorker::cacheRedirect);
|
connect(this, &PictureLoaderWorkerWork::urlRedirected, worker, &PictureLoaderWorker::cacheRedirect);
|
||||||
connect(this, &PictureLoaderWorkerWork::cachedUrlInvalidated, worker, &PictureLoaderWorker::removedCachedUrl);
|
connect(this, &PictureLoaderWorkerWork::cachedUrlInvalidated, worker, &PictureLoaderWorker::removedCachedUrl);
|
||||||
connect(this, &PictureLoaderWorkerWork::imageLoaded, worker, &PictureLoaderWorker::handleImageLoaded);
|
connect(this, &PictureLoaderWorkerWork::imageLoaded, worker, &PictureLoaderWorker::handleImageLoaded);
|
||||||
|
connect(this, &PictureLoaderWorkerWork::requestSucceeded, worker, &PictureLoaderWorker::requestSucceeded);
|
||||||
|
|
||||||
// Hook up signals to settings
|
// Hook up signals to settings
|
||||||
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||||
|
|
@ -97,6 +98,7 @@ void PictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
|
||||||
handleFailedReply(reply);
|
handleFailedReply(reply);
|
||||||
} else {
|
} else {
|
||||||
handleSuccessfulReply(reply);
|
handleSuccessfulReply(reply);
|
||||||
|
emit requestSucceeded(reply->url());
|
||||||
}
|
}
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ signals:
|
||||||
* Note that this object will delete itself as this signal is emitted.
|
* Note that this object will delete itself as this signal is emitted.
|
||||||
*/
|
*/
|
||||||
void imageLoaded(CardInfoPtr card, const QImage &image);
|
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 requestImageDownload(const QUrl &url, PictureLoaderWorkerWork *instance);
|
||||||
|
|
||||||
void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl);
|
void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue