Connection syntax migration (#637)
This commit is contained in:
@@ -101,7 +101,7 @@ QNetworkReply *SubsonicBaseRequest::CreateGetRequest(const QString &ressource_na
|
||||
#endif
|
||||
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(HandleSSLErrors(QList<QSslError>)));
|
||||
QObject::connect(reply, &QNetworkReply::sslErrors, this, &SubsonicBaseRequest::HandleSSLErrors);
|
||||
|
||||
//qLog(Debug) << "Subsonic: Sending request" << url;
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@ SubsonicRequest::~SubsonicRequest() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
if (reply->isRunning()) reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
while (!album_cover_replies_.isEmpty()) {
|
||||
QNetworkReply *reply = album_cover_replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
if (reply->isRunning()) reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void SubsonicRequest::FlushAlbumsRequests() {
|
||||
QNetworkReply *reply;
|
||||
reply = CreateGetRequest(QString("getAlbumList2"), params);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { AlbumsReplyReceived(reply, request.offset); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { AlbumsReplyReceived(reply, request.offset); });
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void SubsonicRequest::AlbumsReplyReceived(QNetworkReply *reply, const int offset
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
--albums_requests_active_;
|
||||
@@ -350,7 +350,7 @@ void SubsonicRequest::FlushAlbumSongsRequests() {
|
||||
ParamList params = ParamList() << Param("id", request.album_id);
|
||||
QNetworkReply *reply = CreateGetRequest(QString("getAlbum"), params);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { AlbumSongsReplyReceived(reply, request.artist_id, request.album_id, request.album_artist); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { AlbumSongsReplyReceived(reply, request.artist_id, request.album_id, request.album_artist); });
|
||||
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const QStrin
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
--album_songs_requests_active_;
|
||||
@@ -743,7 +743,7 @@ void SubsonicRequest::FlushAlbumCoverRequests() {
|
||||
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
album_cover_replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { AlbumCoverReceived(reply, request.url, request.filename); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { AlbumCoverReceived(reply, request.url, request.filename); });
|
||||
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ void SubsonicRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl url, c
|
||||
|
||||
if (album_cover_replies_.contains(reply)) {
|
||||
album_cover_replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -61,10 +61,10 @@ class SubsonicRequest : public SubsonicBaseRequest {
|
||||
void Reset();
|
||||
|
||||
signals:
|
||||
void Results(const SongList &songs, const QString &error);
|
||||
void UpdateStatus(const QString &text);
|
||||
void ProgressSetMaximum(const int max);
|
||||
void UpdateProgress(const int max);
|
||||
void Results(SongList songs, QString error);
|
||||
void UpdateStatus(QString text);
|
||||
void ProgressSetMaximum(int max);
|
||||
void UpdateProgress(int max);
|
||||
|
||||
private slots:
|
||||
void AlbumsReplyReceived(QNetworkReply *reply, const int offset_requested);
|
||||
|
||||
@@ -51,7 +51,7 @@ SubsonicScrobbleRequest::~SubsonicScrobbleRequest() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
if (reply->isRunning()) reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void SubsonicScrobbleRequest::FlushScrobbleRequests() {
|
||||
QNetworkReply *reply;
|
||||
reply = CreateGetRequest(QString("scrobble"), params);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { ScrobbleReplyReceived(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { ScrobbleReplyReceived(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void SubsonicScrobbleRequest::ScrobbleReplyReceived(QNetworkReply *reply) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
--scrobble_requests_active_;
|
||||
|
||||
@@ -107,7 +107,7 @@ SubsonicService::~SubsonicService() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
if (reply->isRunning()) reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -118,7 +118,7 @@ SubsonicService::~SubsonicService() {
|
||||
|
||||
void SubsonicService::Exit() {
|
||||
|
||||
connect(collection_backend_, SIGNAL(ExitFinished()), this, SIGNAL(ExitFinished()));
|
||||
QObject::connect(collection_backend_, &CollectionBackend::ExitFinished, this, &SubsonicService::ExitFinished);
|
||||
collection_backend_->ExitAsync();
|
||||
|
||||
}
|
||||
@@ -146,10 +146,10 @@ void SubsonicService::ReloadSettings() {
|
||||
}
|
||||
|
||||
void SubsonicService::SendPing() {
|
||||
SendPing(server_url_, username_, password_);
|
||||
SendPingWithCredentials(server_url_, username_, password_, false);
|
||||
}
|
||||
|
||||
void SubsonicService::SendPing(QUrl url, const QString &username, const QString &password, const bool redirect) {
|
||||
void SubsonicService::SendPingWithCredentials(QUrl url, const QString &username, const QString &password, const bool redirect) {
|
||||
|
||||
if (!redirect) {
|
||||
network_.reset(new QNetworkAccessManager);
|
||||
@@ -199,8 +199,8 @@ void SubsonicService::SendPing(QUrl url, const QString &username, const QString
|
||||
errors_.clear();
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(HandlePingSSLErrors(QList<QSslError>)));
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandlePingReply(reply, url, username, password); });
|
||||
QObject::connect(reply, &QNetworkReply::sslErrors, this, &SubsonicService::HandlePingSSLErrors);
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, url, username, password]() { HandlePingReply(reply, url, username, password); });
|
||||
|
||||
//qLog(Debug) << "Subsonic: Sending request" << url << query;
|
||||
|
||||
@@ -220,7 +220,7 @@ void SubsonicService::HandlePingReply(QNetworkReply *reply, const QUrl &url, con
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError || reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
@@ -246,7 +246,7 @@ void SubsonicService::HandlePingReply(QNetworkReply *reply, const QUrl &url, con
|
||||
if (!redirect_url.isEmpty()) {
|
||||
++ping_redirects_;
|
||||
qLog(Debug) << "Redirecting ping request to" << redirect_url.toString(QUrl::RemoveQuery);
|
||||
SendPing(redirect_url, username, password, true);
|
||||
SendPingWithCredentials(redirect_url, username, password, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -399,8 +399,8 @@ void SubsonicService::Scrobble(const QString &song_id, const bool submission, co
|
||||
void SubsonicService::ResetSongsRequest() {
|
||||
|
||||
if (songs_request_.get()) {
|
||||
disconnect(songs_request_.get(), nullptr, this, nullptr);
|
||||
disconnect(this, nullptr, songs_request_.get(), nullptr);
|
||||
QObject::disconnect(songs_request_.get(), nullptr, this, nullptr);
|
||||
QObject::disconnect(this, nullptr, songs_request_.get(), nullptr);
|
||||
songs_request_.reset();
|
||||
}
|
||||
|
||||
@@ -420,10 +420,10 @@ void SubsonicService::GetSongs() {
|
||||
|
||||
ResetSongsRequest();
|
||||
songs_request_.reset(new SubsonicRequest(this, url_handler_, app_, this));
|
||||
connect(songs_request_.get(), SIGNAL(Results(SongList, QString)), SLOT(SongsResultsReceived(SongList, QString)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateStatus(QString)), SIGNAL(SongsUpdateStatus(QString)));
|
||||
connect(songs_request_.get(), SIGNAL(ProgressSetMaximum(int)), SIGNAL(SongsProgressSetMaximum(int)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateProgress(int)), SIGNAL(SongsUpdateProgress(int)));
|
||||
QObject::connect(songs_request_.get(), &SubsonicRequest::Results, this, &SubsonicService::SongsResultsReceived);
|
||||
QObject::connect(songs_request_.get(), &SubsonicRequest::UpdateStatus, this, &SubsonicService::SongsUpdateStatus);
|
||||
QObject::connect(songs_request_.get(), &SubsonicRequest::ProgressSetMaximum, this, &SubsonicService::SongsProgressSetMaximum);
|
||||
QObject::connect(songs_request_.get(), &SubsonicRequest::UpdateProgress, this, &SubsonicService::SongsUpdateProgress);
|
||||
|
||||
songs_request_->GetAlbums();
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class SubsonicService : public InternetService {
|
||||
public slots:
|
||||
void ShowConfig() override;
|
||||
void SendPing();
|
||||
void SendPing(QUrl url, const QString &username, const QString &password, const bool redirect = false);
|
||||
void SendPingWithCredentials(QUrl url, const QString &username, const QString &password, const bool redirect = false);
|
||||
void GetSongs() override;
|
||||
void ResetSongsRequest() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user