Connection syntax migration (#637)
This commit is contained in:
@@ -64,7 +64,7 @@ AudioScrobbler::AudioScrobbler(Application *app, QObject *parent) :
|
||||
ReloadSettings();
|
||||
|
||||
for (ScrobblerService *service : scrobbler_services_->List()) {
|
||||
connect(service, SIGNAL(ErrorMessage(QString)), SLOT(ErrorReceived(QString)));
|
||||
QObject::connect(service, &ScrobblerService::ErrorMessage, this, &AudioScrobbler::ErrorReceived);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ LastFMImport::LastFMImport(QObject *parent) :
|
||||
|
||||
timer_flush_requests_->setInterval(kRequestsDelay);
|
||||
timer_flush_requests_->setSingleShot(false);
|
||||
connect(timer_flush_requests_, SIGNAL(timeout()), this, SLOT(FlushRequests()));
|
||||
QObject::connect(timer_flush_requests_, &QTimer::timeout, this, &LastFMImport::FlushRequests);
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void LastFMImport::AbortAll() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void LastFMImport::SendGetRecentTracksRequest(GetRecentTracksRequest request) {
|
||||
}
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { GetRecentTracksRequestFinished(reply, request.page); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { GetRecentTracksRequestFinished(reply, request.page); });
|
||||
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ void LastFMImport::GetRecentTracksRequestFinished(QNetworkReply *reply, const in
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
@@ -349,7 +349,7 @@ void LastFMImport::GetRecentTracksRequestFinished(QNetworkReply *reply, const in
|
||||
|
||||
if (page == 0) {
|
||||
lastplayed_total_ = total;
|
||||
UpdateTotal();
|
||||
UpdateTotalCheck();
|
||||
AddGetRecentTracksRequest(1);
|
||||
}
|
||||
else {
|
||||
@@ -392,7 +392,7 @@ void LastFMImport::GetRecentTracksRequestFinished(QNetworkReply *reply, const in
|
||||
emit UpdateLastPlayed(artist, album, title, datetime.toSecsSinceEpoch());
|
||||
}
|
||||
|
||||
UpdateProgress();
|
||||
UpdateProgressCheck();
|
||||
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ void LastFMImport::SendGetTopTracksRequest(GetTopTracksRequest request) {
|
||||
}
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { GetTopTracksRequestFinished(reply, request.page); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { GetTopTracksRequestFinished(reply, request.page); });
|
||||
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ void LastFMImport::GetTopTracksRequestFinished(QNetworkReply *reply, const int p
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
@@ -512,7 +512,7 @@ void LastFMImport::GetTopTracksRequestFinished(QNetworkReply *reply, const int p
|
||||
|
||||
if (page == 0) {
|
||||
playcount_total_ = total;
|
||||
UpdateTotal();
|
||||
UpdateTotalCheck();
|
||||
AddGetTopTracksRequest(1);
|
||||
}
|
||||
else {
|
||||
@@ -547,7 +547,7 @@ void LastFMImport::GetTopTracksRequestFinished(QNetworkReply *reply, const int p
|
||||
if (playcount <= 0) continue;
|
||||
|
||||
emit UpdatePlayCount(artist, title, playcount);
|
||||
UpdateProgress();
|
||||
UpdateProgressCheck();
|
||||
|
||||
}
|
||||
|
||||
@@ -563,14 +563,14 @@ void LastFMImport::GetTopTracksRequestFinished(QNetworkReply *reply, const int p
|
||||
|
||||
}
|
||||
|
||||
void LastFMImport::UpdateTotal() {
|
||||
void LastFMImport::UpdateTotalCheck() {
|
||||
|
||||
if ((!playcount_ || playcount_total_ > 0) && (!lastplayed_ || lastplayed_total_ > 0))
|
||||
emit UpdateTotal(lastplayed_total_, playcount_total_);
|
||||
|
||||
}
|
||||
|
||||
void LastFMImport::UpdateProgress() {
|
||||
void LastFMImport::UpdateProgressCheck() {
|
||||
emit UpdateProgress(lastplayed_received_, playcount_received_);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ class LastFMImport : public QObject {
|
||||
|
||||
void Error(const QString &error, const QVariant &debug = QVariant());
|
||||
|
||||
void UpdateTotal();
|
||||
void UpdateProgress();
|
||||
void UpdateTotalCheck();
|
||||
void UpdateProgressCheck();
|
||||
|
||||
void FinishCheck();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ ListenBrainzScrobbler::ListenBrainzScrobbler(Application *app, QObject *parent)
|
||||
timestamp_(0) {
|
||||
|
||||
refresh_login_timer_.setSingleShot(true);
|
||||
connect(&refresh_login_timer_, SIGNAL(timeout()), SLOT(RequestAccessToken()));
|
||||
QObject::connect(&refresh_login_timer_, &QTimer::timeout, this, &ListenBrainzScrobbler::RequestNewAccessToken);
|
||||
|
||||
ReloadSettings();
|
||||
LoadSession();
|
||||
@@ -87,13 +87,13 @@ ListenBrainzScrobbler::~ListenBrainzScrobbler() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
if (server_) {
|
||||
disconnect(server_, nullptr, this, nullptr);
|
||||
QObject::disconnect(server_, nullptr, this, nullptr);
|
||||
if (server_->isListening()) server_->close();
|
||||
server_->deleteLater();
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void ListenBrainzScrobbler::Authenticate(const bool https) {
|
||||
server_ = nullptr;
|
||||
return;
|
||||
}
|
||||
connect(server_, SIGNAL(Finished()), this, SLOT(RedirectArrived()));
|
||||
QObject::connect(server_, &LocalRedirectServer::Finished, this, &ListenBrainzScrobbler::RedirectArrived);
|
||||
}
|
||||
|
||||
QUrl redirect_url(kOAuthRedirectUrl);
|
||||
@@ -251,7 +251,7 @@ void ListenBrainzScrobbler::RequestAccessToken(const QUrl &redirect_url, const Q
|
||||
QByteArray query = url_query.toString(QUrl::FullyEncoded).toUtf8();
|
||||
QNetworkReply *reply = network_->post(req, query);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { AuthenticateReplyFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { AuthenticateReplyFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ void ListenBrainzScrobbler::AuthenticateReplyFinished(QNetworkReply *reply) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data;
|
||||
@@ -455,7 +455,7 @@ void ListenBrainzScrobbler::UpdateNowPlaying(const Song &song) {
|
||||
|
||||
QUrl url(QString("%1/1/submit-listens").arg(kApiUrl));
|
||||
QNetworkReply *reply = CreateRequest(url, doc);
|
||||
connect(reply, &QNetworkReply::finished, [=] { UpdateNowPlayingRequestFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { UpdateNowPlayingRequestFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ void ListenBrainzScrobbler::UpdateNowPlayingRequestFinished(QNetworkReply *reply
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
@@ -580,7 +580,7 @@ void ListenBrainzScrobbler::Submit() {
|
||||
|
||||
QUrl url(QString("%1/1/submit-listens").arg(kApiUrl));
|
||||
QNetworkReply *reply = CreateRequest(url, doc);
|
||||
connect(reply, &QNetworkReply::finished, [=] { ScrobbleRequestFinished(reply, list); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, list]() { ScrobbleRequestFinished(reply, list); });
|
||||
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ void ListenBrainzScrobbler::ScrobbleRequestFinished(QNetworkReply *reply, QList<
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
|
||||
@@ -78,7 +78,7 @@ class ListenBrainzScrobbler : public ScrobblerService {
|
||||
private slots:
|
||||
void RedirectArrived();
|
||||
void AuthenticateReplyFinished(QNetworkReply *reply);
|
||||
void RequestAccessToken(const QUrl &redirect_url = QUrl(), const QString &code = QString());
|
||||
void RequestNewAccessToken() { RequestAccessToken(); }
|
||||
void UpdateNowPlayingRequestFinished(QNetworkReply *reply);
|
||||
void ScrobbleRequestFinished(QNetworkReply *reply, QList<quint64>);
|
||||
|
||||
@@ -88,6 +88,7 @@ class ListenBrainzScrobbler : public ScrobblerService {
|
||||
|
||||
void AuthError(const QString &error);
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
void RequestAccessToken(const QUrl &redirect_url = QUrl(), const QString &code = QString());
|
||||
void DoSubmit() override;
|
||||
void CheckScrobblePrevSong();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void ScrobblerServices::RemoveService(ScrobblerService *service) {
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
scrobbler_services_.remove(service->name());
|
||||
disconnect(service, nullptr, this, nullptr);
|
||||
QObject::disconnect(service, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
qLog(Debug) << "Unregistered scrobbler service" << service->name();
|
||||
|
||||
@@ -84,13 +84,13 @@ ScrobblingAPI20::~ScrobblingAPI20() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
if (server_) {
|
||||
disconnect(server_, nullptr, this, nullptr);
|
||||
QObject::disconnect(server_, nullptr, this, nullptr);
|
||||
if (server_->isListening()) server_->close();
|
||||
server_->deleteLater();
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void ScrobblingAPI20::Authenticate(const bool https) {
|
||||
server_ = nullptr;
|
||||
return;
|
||||
}
|
||||
connect(server_, SIGNAL(Finished()), this, SLOT(RedirectArrived()));
|
||||
QObject::connect(server_, &LocalRedirectServer::Finished, this, &ScrobblingAPI20::RedirectArrived);
|
||||
}
|
||||
|
||||
QUrlQuery redirect_url_query;
|
||||
@@ -252,7 +252,7 @@ void ScrobblingAPI20::RequestSession(const QString &token) {
|
||||
#endif
|
||||
QNetworkReply *reply = network()->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { AuthenticateReplyFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { AuthenticateReplyFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ void ScrobblingAPI20::AuthenticateReplyFinished(QNetworkReply *reply) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data;
|
||||
@@ -479,7 +479,7 @@ void ScrobblingAPI20::UpdateNowPlaying(const Song &song) {
|
||||
params << Param("albumArtist", song.albumartist());
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { UpdateNowPlayingRequestFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { UpdateNowPlayingRequestFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ void ScrobblingAPI20::UpdateNowPlayingRequestFinished(QNetworkReply *reply) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
@@ -601,7 +601,7 @@ void ScrobblingAPI20::Submit() {
|
||||
if (!batch_ || i <= 0) return;
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { ScrobbleRequestFinished(reply, list); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, list]() { ScrobbleRequestFinished(reply, list); });
|
||||
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, QList<quint6
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
@@ -794,7 +794,7 @@ void ScrobblingAPI20::SendSingleScrobble(ScrobblerCacheItemPtr item) {
|
||||
params << Param("trackNumber", QString::number(item->track_));
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { SingleScrobbleRequestFinished(reply, item->timestamp_); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, item]() { SingleScrobbleRequestFinished(reply, item->timestamp_); });
|
||||
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ void ScrobblingAPI20::SingleScrobbleRequestFinished(QNetworkReply *reply, quint6
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
ScrobblerCacheItemPtr item = cache()->Get(timestamp);
|
||||
@@ -945,7 +945,7 @@ void ScrobblingAPI20::Love() {
|
||||
params << Param("albumArtist", song_playing_.albumartist());
|
||||
|
||||
QNetworkReply *reply = CreateRequest(params);
|
||||
connect(reply, &QNetworkReply::finished, [=] { LoveRequestFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply] { LoveRequestFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -953,7 +953,7 @@ void ScrobblingAPI20::LoveRequestFinished(QNetworkReply *reply) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
|
||||
Reference in New Issue
Block a user