diff --git a/src/covers/lastfmcoverprovider.cpp b/src/covers/lastfmcoverprovider.cpp
index d2c81ee8c..a84aea365 100644
--- a/src/covers/lastfmcoverprovider.cpp
+++ b/src/covers/lastfmcoverprovider.cpp
@@ -15,13 +15,15 @@
along with Clementine. If not, see .
*/
-#include "albumcoverfetcher.h"
-#include "coverprovider.h"
#include "lastfmcoverprovider.h"
-#include "internet/lastfmcompat.h"
#include
+#include "albumcoverfetcher.h"
+#include "coverprovider.h"
+#include "core/closure.h"
+#include "internet/lastfmcompat.h"
+
LastFmCoverProvider::LastFmCoverProvider(QObject* parent)
: CoverProvider("last.fm", parent)
{
@@ -33,18 +35,13 @@ bool LastFmCoverProvider::StartSearch(const QString& artist, const QString& albu
params["album"] = album + " " + artist;
QNetworkReply* reply = lastfm::ws::post(params);
- connect(reply, SIGNAL(finished()), SLOT(QueryFinished()));
- pending_queries_[reply] = id;
+ NewClosure(reply, SIGNAL(finished()), this,
+ SLOT(QueryFinished(QNetworkReply*, int)), reply, id);
return true;
}
-void LastFmCoverProvider::QueryFinished() {
- QNetworkReply* reply = qobject_cast(sender());
- if (!reply || !pending_queries_.contains(reply))
- return;
-
- int id = pending_queries_.take(reply);
+void LastFmCoverProvider::QueryFinished(QNetworkReply* reply, int id) {
reply->deleteLater();
CoverSearchResults results;
diff --git a/src/covers/lastfmcoverprovider.h b/src/covers/lastfmcoverprovider.h
index 48eedf6ee..2ba8405d5 100644
--- a/src/covers/lastfmcoverprovider.h
+++ b/src/covers/lastfmcoverprovider.h
@@ -36,7 +36,7 @@ public:
bool StartSearch(const QString& artist, const QString& album, int id);
private slots:
- void QueryFinished();
+ void QueryFinished(QNetworkReply* reply, int id);
private:
QMap pending_queries_;