Move lyrics providers to own thread
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
@@ -53,7 +54,9 @@ OVHLyricsProvider::~OVHLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool OVHLyricsProvider::StartSearch(const int id, const LyricsSearchRequest &request) {
|
||||
void OVHLyricsProvider::StartSearch(const int id, const LyricsSearchRequest &request) {
|
||||
|
||||
Q_ASSERT(QThread::currentThread() != qApp->thread());
|
||||
|
||||
QUrl url(QString::fromLatin1(kUrlSearch) + QString::fromLatin1(QUrl::toPercentEncoding(request.artist)) + QLatin1Char('/') + QString::fromLatin1(QUrl::toPercentEncoding(request.title)));
|
||||
QNetworkRequest req(url);
|
||||
@@ -62,12 +65,8 @@ bool OVHLyricsProvider::StartSearch(const int id, const LyricsSearchRequest &req
|
||||
replies_ << reply;
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, request]() { HandleSearchReply(reply, id, request); });
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void OVHLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const LyricsSearchRequest &request) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
|
||||
Reference in New Issue
Block a user