Require Qt 5.9

This commit is contained in:
Jonas Kvinge 2022-01-29 21:33:33 +01:00
parent fd5970b647
commit 63e5d6a94a
36 changed files with 3 additions and 175 deletions

View File

@ -158,7 +158,7 @@ if(DBUS_FOUND AND NOT WIN32)
list(APPEND QT_COMPONENTS DBus)
endif()
set(QT_OPTIONAL_COMPONENTS Test)
set(QT_MIN_VERSION 5.8)
set(QT_MIN_VERSION 5.9)
if(BUILD_WITH_QT6 OR QT_VERSION_MAJOR EQUAL 6)
set(QT_VERSION_MAJOR 6 CACHE STRING "" FORCE)

View File

@ -71,7 +71,7 @@ To build Strawberry from source you need the following installed on your system
* [Boost](https://www.boost.org/)
* [GLib](https://developer.gnome.org/glib/)
* [Protobuf](https://developers.google.com/protocol-buffers/)
* [Qt 5.8 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
* [Qt 5.9 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
* [SQLite 3.9 or newer with FTS5](https://www.sqlite.org)
* [ALSA (Linux required)](https://www.alsa-project.org/)
* [D-Bus (Linux required)](https://www.freedesktop.org/wiki/Software/dbus/)

View File

@ -80,13 +80,11 @@ bool FilesystemMusicStorage::CopyToStorage(const CopyJob &job) {
QFile::rename(cover_src.absoluteFilePath(), cover_dest.absoluteFilePath());
}
// Remove empty directories.
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
QDir remove_dir(src.absolutePath(), QString(), QDir::Name, QDir::NoDotAndDotDot);
while (remove_dir.isEmpty()) {
if (!QDir().rmdir(remove_dir.absolutePath())) break;
remove_dir.cdUp();
}
#endif
}
else {
if (dest.exists() && !job.overwrite_) {

View File

@ -37,10 +37,7 @@
NetworkAccessManager::NetworkAccessManager(QObject *parent)
: QNetworkAccessManager(parent) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
#endif
setCache(new ThreadSafeNetworkDiskCache(this));
}
@ -56,11 +53,7 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR
}
QNetworkRequest new_request(request);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
new_request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
new_request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
new_request.setRawHeader("User-Agent", user_agent);
if (op == QNetworkAccessManager::PostOperation && !new_request.header(QNetworkRequest::ContentTypeHeader).isValid()) {

View File

@ -284,11 +284,7 @@ void AlbumCoverFetcherSearch::FetchMoreImages() {
qLog(Debug) << "Loading" << result.artist << result.album << result.image_url << "from" << result.provider << "with current score" << result.score();
QNetworkRequest req(result.image_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *image_reply = network_->get(req);
QObject::connect(image_reply, &QNetworkReply::finished, this, [this, image_reply]() { ProviderCoverFetchFinished(image_reply); });
pending_image_loads_[image_reply] = result;

View File

@ -476,11 +476,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(Task *task) {
else if (network_->supportedSchemes().contains(cover_url.scheme())) { // Remote URL
qLog(Debug) << "Loading remote cover from" << cover_url;
QNetworkRequest request(cover_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(request);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, cover_url]() { RemoteFetchFinished(reply, cover_url); });
@ -507,11 +503,7 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov
return; // Give up.
}
QNetworkRequest request = reply->request();
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
request.setUrl(redirect.toUrl());
QNetworkReply *redirected_reply = network_->get(request);
QObject::connect(redirected_reply, &QNetworkReply::finished, this, [this, redirected_reply, redirect]() { RemoteFetchFinished(redirected_reply, redirect.toUrl()); });

View File

@ -69,11 +69,7 @@ void CoverFromURLDialog::accept() {
ui_->busy->show();
QNetworkRequest req(QUrl::fromUserInput(ui_->url->text()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
QNetworkReply *reply = network_->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, &CoverFromURLDialog::LoadCoverFromURLFinished);

View File

@ -100,11 +100,7 @@ bool DeezerCoverProvider::StartSearch(const QString &artist, const QString &albu
QUrl url(kApiUrl + QString("/") + resource);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id]() { HandleSearchReply(reply, id); });

View File

@ -173,11 +173,7 @@ QNetworkReply *DiscogsCoverProvider::CreateRequest(QUrl url, const ParamList &pa
url_query.addQueryItem("Signature", QUrl::toPercentEncoding(signature.toBase64()));
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;

View File

@ -114,11 +114,7 @@ bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &albu
QUrl url(kUrl);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QNetworkReply *reply = network_->post(req, url_query.toString(QUrl::FullyEncoded).toUtf8());
replies_ << reply;

View File

@ -100,11 +100,7 @@ void MusicbrainzCoverProvider::SendSearchRequest(const SearchRequest &request) {
QUrl url(kReleaseSearchUrl);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, request]() { HandleSearchReply(reply, request.id); });

View File

@ -78,11 +78,7 @@ bool MusixmatchCoverProvider::StartSearch(const QString &artist, const QString &
QUrl url(QString("https://www.musixmatch.com/album/%1/%2").arg(artist_stripped, album_stripped));
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, false);
#endif

View File

@ -100,11 +100,7 @@ bool QobuzCoverProvider::StartSearch(const QString &artist, const QString &album
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
req.setRawHeader("X-App-Id", service_->app_id().toUtf8());
req.setRawHeader("X-User-Auth-Token", service_->user_auth_token().toUtf8());

View File

@ -234,11 +234,7 @@ void SpotifyCoverProvider::RequestAccessToken(const QString &code, const QUrl &r
QUrl new_url(kOAuthAccessTokenUrl);
QNetworkRequest req(new_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QString auth_header_data = QByteArray::fromBase64(kClientIDB64) + QString(":") + QByteArray::fromBase64(kClientSecretB64);
req.setRawHeader("Authorization", "Basic " + auth_header_data.toUtf8().toBase64());
@ -393,11 +389,7 @@ bool SpotifyCoverProvider::StartSearch(const QString &artist, const QString &alb
QUrl url(kApiUrl + QString("/search"));
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
req.setRawHeader("Authorization", "Bearer " + access_token_.toUtf8());

View File

@ -100,11 +100,7 @@ bool TidalCoverProvider::StartSearch(const QString &artist, const QString &album
QUrl url(TidalService::kApiUrl + QString("/") + resource);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
if (service_->oauth() && !service_->access_token().isEmpty()) req.setRawHeader("authorization", "Bearer " + service_->access_token().toUtf8());
else if (!service_->session_id().isEmpty()) req.setRawHeader("X-Tidal-SessionId", service_->session_id().toUtf8());

View File

@ -74,11 +74,7 @@ bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album
QUrl url(kUrlSearch);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });

View File

@ -66,11 +66,7 @@ bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, con
QUrl url(kUrlSearch);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });

View File

@ -187,11 +187,7 @@ void GeniusLyricsProvider::RequestAccessToken(const QUrl &url, const QUrl &redir
QUrl new_url(kOAuthAccessTokenUrl);
QNetworkRequest req(new_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QByteArray query = new_url_query.toString(QUrl::FullyEncoded).toUtf8();
QNetworkReply *reply = network_->post(req, query);
@ -323,11 +319,7 @@ bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &alb
QUrl url(kUrlSearch);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setRawHeader("Authorization", "Bearer " + access_token_.toUtf8());
QNetworkReply *reply = network_->get(req);
replies_ << reply;
@ -443,11 +435,7 @@ void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id)
search->requests_lyric_.insert(url, lyric);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *new_reply = network_->get(req);
replies_ << new_reply;
QObject::connect(new_reply, &QNetworkReply::finished, this, [this, new_reply, search, url]() { HandleLyricReply(new_reply, search->id, url); });

View File

@ -69,11 +69,7 @@ bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album
QUrl url(kUrlSearch);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });

View File

@ -75,11 +75,7 @@ bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString
QUrl url(QString("https://www.musixmatch.com/lyrics/%1/%2").arg(artist_stripped, title_stripped));
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, false);
#endif

View File

@ -57,11 +57,7 @@ bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album,
QUrl url(kUrlSearch + QString(QUrl::toPercentEncoding(artist)) + "/" + QString(QUrl::toPercentEncoding(title)));
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });

View File

@ -83,11 +83,7 @@ void AcoustidClient::Start(const int id, const QString &fingerprint, int duratio
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id]() { RequestFinished(reply, id); });
requests_[id] = reply;

View File

@ -161,11 +161,7 @@ void MusicBrainzClient::StartDiscIdRequest(const QString &discid) {
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [this, discid, reply]() { DiscIdRequestFinished(discid, reply); });
@ -187,11 +183,7 @@ void MusicBrainzClient::FlushRequests() {
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, request]() { RequestFinished(reply, request.id, request.number); });
requests_.insert(request.id, reply);

View File

@ -63,11 +63,7 @@ QNetworkReply *QobuzBaseRequest::CreateRequest(const QString &ressource_name, co
QUrl url(QobuzService::kApiUrl + QString("/") + ressource_name);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
req.setRawHeader("X-App-Id", app_id().toUtf8());
if (authenticated()) req.setRawHeader("X-User-Auth-Token", user_auth_token().toUtf8());

View File

@ -1180,11 +1180,7 @@ void QobuzRequest::FlushAlbumCoverRequests() {
++album_covers_requests_active_;
QNetworkRequest req(request.url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
album_cover_replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, request]() { AlbumCoverReceived(reply, request.url, request.filename); });

View File

@ -279,11 +279,7 @@ void QobuzService::SendLoginWithCredentials(const QString &app_id, const QString
QUrl url(kAuthUrl);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

View File

@ -121,11 +121,7 @@ QNetworkReply *LastFMImport::CreateRequest(const ParamList &request_params) {
QUrl url(LastFMScrobbler::kApiUrl);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QNetworkReply *reply = network_->get(req);

View File

@ -245,11 +245,7 @@ void ListenBrainzScrobbler::RequestAccessToken(const QUrl &redirect_url, const Q
QUrl session_url(kOAuthAccessTokenUrl);
QNetworkRequest req(session_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QByteArray query = url_query.toString(QUrl::FullyEncoded).toUtf8();
QNetworkReply *reply = network_->post(req, query);
@ -350,11 +346,7 @@ void ListenBrainzScrobbler::AuthenticateReplyFinished(QNetworkReply *reply) {
QNetworkReply *ListenBrainzScrobbler::CreateRequest(const QUrl &url, const QJsonDocument &json_doc) {
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
req.setRawHeader("Authorization", QString("Token %1").arg(user_token_).toUtf8());
QNetworkReply *reply = network_->post(req, json_doc.toJson());

View File

@ -244,11 +244,7 @@ void ScrobblingAPI20::RequestSession(const QString &token) {
session_url.setQuery(session_url_query);
QNetworkRequest req(session_url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network()->get(req);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply]() { AuthenticateReplyFinished(reply); });
@ -380,11 +376,7 @@ QNetworkReply *ScrobblingAPI20::CreateRequest(const ParamList &request_params) {
QUrl url(api_url_);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QByteArray query = url_query.toString(QUrl::FullyEncoded).toUtf8();
QNetworkReply *reply = network()->post(req, query);

View File

@ -51,9 +51,7 @@ SubsonicBaseRequest::SubsonicBaseRequest(SubsonicService *service, QObject *pare
service_(service),
network_(new QNetworkAccessManager) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
network_->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
#endif
}
@ -109,11 +107,7 @@ QNetworkReply *SubsonicBaseRequest::CreateGetRequest(const QString &ressource_na
}
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2());

View File

@ -75,9 +75,7 @@ SubsonicRequest::SubsonicRequest(SubsonicService *service, SubsonicUrlHandler *u
album_covers_received_(0),
no_results_(false) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
network_->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
#endif
}
@ -732,11 +730,7 @@ void SubsonicRequest::FlushAlbumCoverRequests() {
++album_covers_requests_active_;
QNetworkRequest req(request.url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2());

View File

@ -154,9 +154,7 @@ void SubsonicService::SendPingWithCredentials(QUrl url, const QString &username,
if (!network_ || !redirect) {
network_ = std::make_unique<QNetworkAccessManager>();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
network_->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
#endif
ping_redirects_ = 0;
}
@ -201,12 +199,7 @@ void SubsonicService::SendPingWithCredentials(QUrl url, const QString &username,
req.setSslConfiguration(sslconfig);
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)

View File

@ -58,11 +58,7 @@ QNetworkReply *TidalBaseRequest::CreateRequest(const QString &ressource_name, co
QUrl url(TidalService::kApiUrl + QString("/") + ressource_name);
url.setQuery(url_query);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
if (oauth() && !access_token().isEmpty()) req.setRawHeader("authorization", "Bearer " + access_token().toUtf8());
else if (!session_id().isEmpty()) req.setRawHeader("X-Tidal-SessionId", session_id().toUtf8());

View File

@ -142,11 +142,7 @@ void TidalFavoriteRequest::AddFavoritesRequest(const FavoriteType type, const QS
QUrl url(TidalService::kApiUrl + QString("/") + "users/" + QString::number(service_->user_id()) + "/favorites/" + FavoriteText(type));
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
if (oauth() && !access_token().isEmpty()) req.setRawHeader("authorization", "Bearer " + access_token().toUtf8());
else if (!session_id().isEmpty()) req.setRawHeader("X-Tidal-SessionId", session_id().toUtf8());

View File

@ -1133,11 +1133,7 @@ void TidalRequest::FlushAlbumCoverRequests() {
++album_covers_requests_active_;
QNetworkRequest req(request.url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(req);
album_cover_replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, request]() { AlbumCoverReceived(reply, request.album_id, request.url, request.filename); });

View File

@ -405,11 +405,7 @@ void TidalService::RequestAccessToken(const QString &code) {
QUrl url(kOAuthAccessTokenUrl);
QNetworkRequest req(url);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
#else
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QByteArray query = url_query.toString(QUrl::FullyEncoded).toUtf8();
login_errors_.clear();