Connection syntax migration (#637)
This commit is contained in:
@@ -53,7 +53,7 @@ AuddLyricsProvider::~AuddLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
#endif
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, title); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });
|
||||
|
||||
//qLog(Debug) << "AudDLyrics: Sending request for" << url;
|
||||
|
||||
@@ -96,7 +96,7 @@ void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QJsonArray json_result = ExtractResult(reply, artist, title);
|
||||
|
||||
@@ -62,4 +62,3 @@ class AuddLyricsProvider : public JsonLyricsProvider {
|
||||
};
|
||||
|
||||
#endif // AUDDLYRICSPROVIDER_H
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ ChartLyricsProvider::~ChartLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, con
|
||||
#endif
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, title); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });
|
||||
|
||||
//qLog(Debug) << "ChartLyrics: Sending request for" << url;
|
||||
|
||||
@@ -88,7 +88,7 @@ void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
|
||||
|
||||
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) {
|
||||
|
||||
@@ -77,7 +77,7 @@ GeniusLyricsProvider::~GeniusLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void GeniusLyricsProvider::Authenticate() {
|
||||
server_ = nullptr;
|
||||
return;
|
||||
}
|
||||
connect(server_, SIGNAL(Finished()), this, SLOT(RedirectArrived()));
|
||||
QObject::connect(server_, &LocalRedirectServer::Finished, this, &GeniusLyricsProvider::RedirectArrived);
|
||||
}
|
||||
|
||||
code_verifier_ = Utilities::CryptographicRandomString(44);
|
||||
@@ -198,8 +198,8 @@ void GeniusLyricsProvider::RequestAccessToken(const QUrl &url, const QUrl &redir
|
||||
|
||||
QNetworkReply *reply = network_->post(req, query);
|
||||
replies_ << reply;
|
||||
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(HandleLoginSSLErrors(QList<QSslError>)));
|
||||
connect(reply, &QNetworkReply::finished, [=] { AccessTokenRequestFinished(reply); });
|
||||
QObject::connect(reply, &QNetworkReply::sslErrors, this, &GeniusLyricsProvider::HandleLoginSSLErrors);
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { AccessTokenRequestFinished(reply); });
|
||||
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
|
||||
|
||||
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) {
|
||||
@@ -333,7 +333,7 @@ bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &alb
|
||||
req.setRawHeader("Authorization", "Bearer " + access_token_.toUtf8());
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id]() { HandleSearchReply(reply, id); });
|
||||
|
||||
//qLog(Debug) << "GeniusLyrics: Sending request for" << url;
|
||||
|
||||
@@ -347,7 +347,7 @@ void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
if (!requests_search_.contains(id)) return;
|
||||
@@ -454,7 +454,7 @@ void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
|
||||
#endif
|
||||
QNetworkReply *new_reply = network_->get(req);
|
||||
replies_ << new_reply;
|
||||
connect(new_reply, &QNetworkReply::finished, [=] { HandleLyricReply(new_reply, search->id, url); });
|
||||
QObject::connect(new_reply, &QNetworkReply::finished, [this, new_reply, search, url]() { HandleLyricReply(new_reply, search->id, url); });
|
||||
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ void GeniusLyricsProvider::HandleLyricReply(QNetworkReply *reply, const int sear
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
if (!requests_search_.contains(search_id)) return;
|
||||
|
||||
@@ -48,7 +48,7 @@ LoloLyricsProvider::~LoloLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
#endif
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, title); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });
|
||||
|
||||
//qLog(Debug) << "LoloLyrics: Sending request for" << url;
|
||||
|
||||
@@ -91,7 +91,7 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QString failure_reason;
|
||||
|
||||
@@ -34,11 +34,10 @@ LyricsFetcher::LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent)
|
||||
: QObject(parent),
|
||||
lyrics_providers_(lyrics_providers),
|
||||
next_id_(0),
|
||||
request_starter_(new QTimer(this))
|
||||
{
|
||||
request_starter_(new QTimer(this)) {
|
||||
|
||||
request_starter_->setInterval(500);
|
||||
connect(request_starter_, SIGNAL(timeout()), SLOT(StartRequests()));
|
||||
QObject::connect(request_starter_, &QTimer::timeout, this, &LyricsFetcher::StartRequests);
|
||||
|
||||
}
|
||||
|
||||
@@ -93,8 +92,8 @@ void LyricsFetcher::StartRequests() {
|
||||
LyricsFetcherSearch *search = new LyricsFetcherSearch(request, this);
|
||||
active_requests_.insert(request.id, search);
|
||||
|
||||
connect(search, SIGNAL(SearchFinished(quint64, LyricsSearchResults)), SLOT(SingleSearchFinished(quint64, LyricsSearchResults)));
|
||||
connect(search, SIGNAL(LyricsFetched(quint64, QString, QString)), SLOT(SingleLyricsFetched(quint64, QString, QString)));
|
||||
QObject::connect(search, &LyricsFetcherSearch::SearchFinished, this, &LyricsFetcher::SingleSearchFinished);
|
||||
QObject::connect(search, &LyricsFetcherSearch::LyricsFetched, this, &LyricsFetcher::SingleLyricsFetched);
|
||||
|
||||
search->Start(lyrics_providers_);
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ class LyricsFetcher : public QObject {
|
||||
void AddRequest(const LyricsSearchRequest &req);
|
||||
|
||||
signals:
|
||||
void LyricsFetched(const quint64 request_id, const QString &provider, const QString &lyrics);
|
||||
void SearchFinished(const quint64 request_id, const LyricsSearchResults &results);
|
||||
void LyricsFetched(quint64 request_id, QString provider, QString lyrics);
|
||||
void SearchFinished(quint64 request_id, LyricsSearchResults results);
|
||||
|
||||
private slots:
|
||||
void SingleSearchFinished(const quint64 request_id, const LyricsSearchResults &results);
|
||||
|
||||
@@ -41,7 +41,7 @@ LyricsFetcherSearch::LyricsFetcherSearch(const LyricsSearchRequest &request, QOb
|
||||
request_(request),
|
||||
cancel_requested_(false) {
|
||||
|
||||
QTimer::singleShot(kSearchTimeoutMs, this, SLOT(TerminateSearch()));
|
||||
QTimer::singleShot(kSearchTimeoutMs, this, &LyricsFetcherSearch::TerminateSearch);
|
||||
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void LyricsFetcherSearch::Start(LyricsProviders *lyrics_providers) {
|
||||
|
||||
for (LyricsProvider *provider : lyrics_providers_sorted) {
|
||||
if (!provider->is_enabled() || !provider->IsAuthenticated()) continue;
|
||||
connect(provider, SIGNAL(SearchFinished(quint64, LyricsSearchResults)), SLOT(ProviderSearchFinished(quint64, LyricsSearchResults)));
|
||||
QObject::connect(provider, &LyricsProvider::SearchFinished, this, &LyricsFetcherSearch::ProviderSearchFinished);
|
||||
const int id = lyrics_providers->NextId();
|
||||
const bool success = provider->StartSearch(request_.artist, request_.album, request_.title, id);
|
||||
if (success) pending_requests_[id] = provider;
|
||||
@@ -151,4 +151,3 @@ bool LyricsFetcherSearch::ProviderCompareOrder(LyricsProvider *a, LyricsProvider
|
||||
bool LyricsFetcherSearch::LyricsSearchResultCompareScore(const LyricsSearchResult &a, const LyricsSearchResult &b) {
|
||||
return a.score < b.score;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ class LyricsFetcherSearch : public QObject {
|
||||
void Cancel();
|
||||
|
||||
signals:
|
||||
void SearchFinished(const quint64, const LyricsSearchResults &results);
|
||||
void LyricsFetched(const quint64, const QString &provider, const QString &lyrics);
|
||||
void SearchFinished(quint64, LyricsSearchResults results);
|
||||
void LyricsFetched(quint64, QString provider, QString lyrics);
|
||||
|
||||
private slots:
|
||||
void ProviderSearchFinished(const quint64 id, const LyricsSearchResults &results);
|
||||
|
||||
@@ -60,7 +60,7 @@ class LyricsProvider : public QObject {
|
||||
void AuthenticationComplete(bool, QStringList = QStringList());
|
||||
void AuthenticationSuccess();
|
||||
void AuthenticationFailure(QStringList);
|
||||
void SearchFinished(const quint64 id, const LyricsSearchResults &results);
|
||||
void SearchFinished(quint64 id, LyricsSearchResults results);
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
@@ -69,4 +69,4 @@ class LyricsProvider : public QObject {
|
||||
bool authentication_required_;
|
||||
};
|
||||
|
||||
#endif // LYRICSPROVIDER_H
|
||||
#endif // LYRICSPROVIDER_H
|
||||
|
||||
@@ -95,7 +95,7 @@ void LyricsProviders::AddProvider(LyricsProvider *provider) {
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
lyrics_providers_.insert(provider, provider->name());
|
||||
connect(provider, SIGNAL(destroyed()), SLOT(ProviderDestroyed()));
|
||||
QObject::connect(provider, &LyricsProvider::destroyed, this, &LyricsProviders::ProviderDestroyed);
|
||||
}
|
||||
|
||||
provider->set_order(++NextOrderId);
|
||||
|
||||
@@ -46,7 +46,7 @@ MusixmatchLyricsProvider::~MusixmatchLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -86,7 +86,7 @@ bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString
|
||||
#endif
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, album, title); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, album, title]() { HandleSearchReply(reply, id, artist, album, title); });
|
||||
|
||||
qLog(Debug) << "MusixmatchLyrics: Sending request for" << artist_stripped << title_stripped << url;
|
||||
|
||||
@@ -102,7 +102,7 @@ void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const qui
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
LyricsSearchResults results;
|
||||
|
||||
@@ -45,7 +45,7 @@ OVHLyricsProvider::~OVHLyricsProvider() {
|
||||
|
||||
while (!replies_.isEmpty()) {
|
||||
QNetworkReply *reply = replies_.takeFirst();
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
}
|
||||
@@ -65,7 +65,7 @@ bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album,
|
||||
#endif
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, title); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, title]() { HandleSearchReply(reply, id, artist, title); });
|
||||
|
||||
//qLog(Debug) << "OVHLyrics: Sending request for" << url;
|
||||
|
||||
@@ -79,7 +79,7 @@ void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
disconnect(reply, nullptr, this, nullptr);
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(reply);
|
||||
|
||||
@@ -57,4 +57,3 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
||||
};
|
||||
|
||||
#endif // OVHLYRICSPROVIDER_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user