yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Address feedback

This commit is contained in:
Morph 2023-07-25 21:33:46 -04:00
parent c067046387
commit 01b379fe20
1 changed files with 8 additions and 10 deletions

View File

@ -4,8 +4,10 @@
#include <chrono> #include <chrono>
#include <string> #include <string>
#include <QEventLoop>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <discord_rpc.h> #include <discord_rpc.h>
#include <fmt/format.h> #include <fmt/format.h>
@ -89,19 +91,15 @@ void DiscordImpl::Update() {
std::string icon_name = GetGameString(game_title); std::string icon_name = GetGameString(game_title);
game_url = fmt::format("https://yuzu-emu.org/images/game/boxart/{}.png", icon_name); game_url = fmt::format("https://yuzu-emu.org/images/game/boxart/{}.png", icon_name);
QNetworkAccessManager* manager = new QNetworkAccessManager(); QNetworkAccessManager manager;
QNetworkRequest request; QNetworkRequest request;
request.setUrl(QUrl(QString::fromStdString(game_url))); request.setUrl(QUrl(QString::fromStdString(game_url)));
request.setTransferTimeout(3000); request.setTransferTimeout(3000);
QNetworkReply* rep = manager->get(request); QNetworkReply* reply = manager.head(request);
QEventLoop request_event_loop;
QObject::connect(manager, &QNetworkAccessManager::finished, QObject::connect(reply, &QNetworkReply::finished, &request_event_loop, &QEventLoop::quit);
[this](QNetworkReply* reply) { UpdateGameStatus(reply->error()); }); request_event_loop.exec();
QObject::connect(manager, &QNetworkAccessManager::finished, manager, UpdateGameStatus(reply->error());
&QNetworkAccessManager::deleteLater);
QObject::connect(manager, &QNetworkAccessManager::finished, rep,
&QNetworkReply::deleteLater);
return; return;
} }