Replace emit with Q_EMIT
This commit is contained in:
@@ -91,26 +91,26 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
Error(QStringLiteral("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
Error(QStringLiteral("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()));
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
const QByteArray data = reply->readAll();
|
||||
if (data.isEmpty()) {
|
||||
Error(QStringLiteral("Empty reply received from server."));
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
const QString content = QString::fromUtf8(data);
|
||||
const QString data_begin = QLatin1String("<script id=\"__NEXT_DATA__\" type=\"application/json\">");
|
||||
const QString data_end = QLatin1String("</script>");
|
||||
if (!content.contains(data_begin) || !content.contains(data_end)) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
qint64 begin_idx = content.indexOf(data_begin);
|
||||
@@ -124,13 +124,13 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
}
|
||||
|
||||
if (content_json.isEmpty()) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
static const QRegularExpression regex_html_tag(QStringLiteral("<[^>]*>"));
|
||||
if (content_json.contains(regex_html_tag)) { // Make sure it's not HTML code.
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,60 +139,60 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
Error(QStringLiteral("Failed to parse json data: %1").arg(error.errorString()));
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
if (json_doc.isEmpty()) {
|
||||
Error(QStringLiteral("Received empty Json document."), data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_doc.isObject()) {
|
||||
Error(QStringLiteral("Json document is not an object."), json_doc);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj_data = json_doc.object();
|
||||
if (obj_data.isEmpty()) {
|
||||
Error(QStringLiteral("Received empty Json object."), json_doc);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!obj_data.contains(QLatin1String("props")) || !obj_data[QLatin1String("props")].isObject()) {
|
||||
Error(QStringLiteral("Json reply is missing props."), obj_data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
obj_data = obj_data[QLatin1String("props")].toObject();
|
||||
|
||||
if (!obj_data.contains(QLatin1String("pageProps")) || !obj_data[QLatin1String("pageProps")].isObject()) {
|
||||
Error(QStringLiteral("Json props is missing pageProps."), obj_data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
obj_data = obj_data[QLatin1String("pageProps")].toObject();
|
||||
|
||||
if (!obj_data.contains(QLatin1String("data")) || !obj_data[QLatin1String("data")].isObject()) {
|
||||
Error(QStringLiteral("Json pageProps is missing data."), obj_data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
obj_data = obj_data[QLatin1String("data")].toObject();
|
||||
|
||||
if (!obj_data.contains(QLatin1String("albumGet")) || !obj_data[QLatin1String("albumGet")].isObject()) {
|
||||
Error(QStringLiteral("Json data is missing albumGet."), obj_data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
obj_data = obj_data[QLatin1String("albumGet")].toObject();
|
||||
|
||||
if (!obj_data.contains(QLatin1String("data")) || !obj_data[QLatin1String("data")].isObject()) {
|
||||
Error(QStringLiteral("Json albumGet reply is missing data."), obj_data);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
obj_data = obj_data[QLatin1String("data")].toObject();
|
||||
@@ -206,7 +206,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
}
|
||||
|
||||
if (result.artist.compare(artist, Qt::CaseInsensitive) != 0 && result.album.compare(album, Qt::CaseInsensitive) != 0) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
}
|
||||
}
|
||||
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user