Qt: Attempt to fix 5.8 build

This commit is contained in:
Vicki Pfau 2022-12-07 02:35:08 -08:00
parent e9ec009836
commit b220c7a68b
2 changed files with 12 additions and 2 deletions

View File

@ -180,6 +180,9 @@ void ForwarderController::downloadBuild(const QUrl& url) {
connectReply(reply, BASE, &ForwarderController::gotBuild);
connect(reply, &QNetworkReply::readyRead, this, [this, reply]() {
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() / 100 != 2) {
return;
}
QByteArray data = reply->readAll();
m_sourceFile.write(data);
});
@ -236,8 +239,13 @@ void ForwarderController::connectReply(QNetworkReply* reply, Download download,
emit buildFailed();
});
connect(reply, &QNetworkReply::finished, this, [this, reply, next]() {
connect(reply, &QNetworkReply::finished, this, [this, reply, download, next]() {
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() / 100 == 3) {
QNetworkReply* newReply = GBAApp::app()->httpGet(reply->header(QNetworkRequest::LocationHeader).toString());
connectReply(newReply, download, next);
} else {
(this->*next)(reply);
}
});
connect(reply, &QNetworkReply::downloadProgress, this, [this, download](qint64 bytesReceived, qint64 bytesTotal) {
emit downloadProgress(download, bytesReceived, bytesTotal);

View File

@ -82,7 +82,9 @@ GBAApp::GBAApp(int& argc, char* argv[], ConfigController* config)
m_configController->updateOption("useDiscordPresence");
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
m_netman.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
#endif
cleanupAfterUpdate();