mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 23:59:34 -08:00
[PictureLoader] Remove manual multithreading (#6078)
This commit is contained in:
@@ -94,7 +94,7 @@ QNetworkReply *PictureLoaderWorker::makeRequest(const QUrl &url, PictureLoaderWo
|
||||
QNetworkReply *reply = networkManager->get(req);
|
||||
|
||||
// Connect reply handling
|
||||
connect(reply, &QNetworkReply::finished, worker, [reply, worker] { worker->acceptNetworkReply(reply); });
|
||||
connect(reply, &QNetworkReply::finished, worker, [reply, worker] { worker->handleNetworkReply(reply); });
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
@@ -70,15 +70,6 @@ void PictureLoaderWorkerWork::picDownloadFailed()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the reply in another thread.
|
||||
* @param reply The finished reply. Takes ownership of the object
|
||||
*/
|
||||
void PictureLoaderWorkerWork::acceptNetworkReply(QNetworkReply *reply)
|
||||
{
|
||||
QThreadPool::globalInstance()->start([this, reply] { handleNetworkReply(reply); });
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param reply The reply. Takes ownership of the object
|
||||
|
||||
@@ -30,14 +30,13 @@ public:
|
||||
PictureToLoad cardToDownload;
|
||||
|
||||
public slots:
|
||||
void acceptNetworkReply(QNetworkReply *reply);
|
||||
void handleNetworkReply(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
bool picDownload;
|
||||
|
||||
void startNextPicDownload();
|
||||
void picDownloadFailed();
|
||||
void handleNetworkReply(QNetworkReply *reply);
|
||||
void handleFailedReply(const QNetworkReply *reply);
|
||||
void handleSuccessfulReply(QNetworkReply *reply);
|
||||
QImage tryLoadImageFromReply(QNetworkReply *reply);
|
||||
|
||||
Reference in New Issue
Block a user