From 941e139a18fab2d934e12078c4ba6c575a7bf2cd Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Wed, 12 Feb 2020 23:44:08 -0800 Subject: [PATCH] Replace closures with connect variant. Qt5 introduced new connect variants that allow calling a functor. A lambda can replace the user of the Closure class in this case. --- src/songinfo/songkickconcerts.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/songinfo/songkickconcerts.cpp b/src/songinfo/songkickconcerts.cpp index dc44d5f0c..4870eecc2 100644 --- a/src/songinfo/songkickconcerts.cpp +++ b/src/songinfo/songkickconcerts.cpp @@ -26,7 +26,6 @@ #include #include -#include "core/closure.h" #include "core/logging.h" #include "songkickconcertwidget.h" #include "ui/iconloader.h" @@ -62,8 +61,8 @@ void SongkickConcerts::FetchInfo(int id, const Song& metadata) { QNetworkRequest request(url); QNetworkReply* reply = network_.get(request); - NewClosure(reply, SIGNAL(finished()), this, - SLOT(ArtistSearchFinished(QNetworkReply*, int)), reply, id); + connect(reply, &QNetworkReply::finished, + [=] { this->ArtistSearchFinished(reply, id); }); } void SongkickConcerts::ArtistSearchFinished(QNetworkReply* reply, int id) { @@ -111,8 +110,8 @@ void SongkickConcerts::FetchSongkickCalendar(const QString& artist_id, int id) { url.setQuery(url_query); qLog(Debug) << url; QNetworkReply* reply = network_.get(QNetworkRequest(url)); - NewClosure(reply, SIGNAL(finished()), this, - SLOT(CalendarRequestFinished(QNetworkReply*, int)), reply, id); + connect(reply, &QNetworkReply::finished, + [=] { this->CalendarRequestFinished(reply, id); }); } void SongkickConcerts::CalendarRequestFinished(QNetworkReply* reply, int id) {