diff --git a/app/backend/autoupdatechecker.cpp b/app/backend/autoupdatechecker.cpp index 9d4809eb..a8a1bbe7 100644 --- a/app/backend/autoupdatechecker.cpp +++ b/app/backend/autoupdatechecker.cpp @@ -40,7 +40,11 @@ void AutoUpdateChecker::start() // We'll get a callback when this is finished QUrl url("https://moonlight-stream.org/updates/qt.json"); QNetworkRequest request(url); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true); +#else + request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); +#endif m_Nam.get(request); #endif } diff --git a/app/settings/mappingfetcher.cpp b/app/settings/mappingfetcher.cpp index bc989ac2..07d4314a 100644 --- a/app/settings/mappingfetcher.cpp +++ b/app/settings/mappingfetcher.cpp @@ -29,8 +29,18 @@ void MappingFetcher::start() QUrl url("https://moonlight-stream.org/SDL_GameControllerDB/gamecontrollerdb.txt"); QNetworkRequest request(url); - request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true); +#else + request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); +#endif + + // Qt 5.12 introduced QNetworkRequest::IfModifiedSinceHeader. We _could_ implement it + // by hand (including QDateTime conversion to the correct string form) for earlier Qt + // versions, but that's a pain and this is just an optimization anyway. We'll do a bit + // of extra work on those legacy Qt versions by fetching the GCDB each time we launch. +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) // Only download the file if it's newer than what we have QFileInfo existingFileInfo = Path::getCacheFileInfo("gamecontrollerdb.txt"); if (existingFileInfo.exists()) { @@ -41,6 +51,7 @@ void MappingFetcher::start() Path::deleteCacheFile("gamecontrollerdb.txt"); } } +#endif // We'll get a callback when this is finished m_Nam.get(request);