Replace emit with Q_EMIT
This commit is contained in:
@@ -184,7 +184,7 @@ AlbumCoverImageResult AlbumCoverChoiceController::LoadImageFromFile(Song *song)
|
||||
QFile file(cover_file);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qLog(Error) << "Failed to open cover file" << cover_file << "for reading:" << file.errorString();
|
||||
emit Error(tr("Failed to open cover file %1 for reading: %2").arg(cover_file, file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to open cover file %1 for reading: %2").arg(cover_file, file.errorString()));
|
||||
return AlbumCoverImageResult();
|
||||
}
|
||||
AlbumCoverImageResult result;
|
||||
@@ -192,7 +192,7 @@ AlbumCoverImageResult AlbumCoverChoiceController::LoadImageFromFile(Song *song)
|
||||
file.close();
|
||||
if (result.image_data.isEmpty()) {
|
||||
qLog(Error) << "Cover file" << cover_file << "is empty.";
|
||||
emit Error(tr("Cover file %1 is empty.").arg(cover_file));
|
||||
Q_EMIT Error(tr("Cover file %1 is empty.").arg(cover_file));
|
||||
return AlbumCoverImageResult();
|
||||
}
|
||||
|
||||
@@ -264,13 +264,13 @@ void AlbumCoverChoiceController::SaveCoverToFileManual(const Song &song, const A
|
||||
QFile file(save_filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
qLog(Error) << "Failed to open cover file" << save_filename << "for writing:" << file.errorString();
|
||||
emit Error(tr("Failed to open cover file %1 for writing: %2").arg(save_filename, file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to open cover file %1 for writing: %2").arg(save_filename, file.errorString()));
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
if (file.write(result.image_data) <= 0) {
|
||||
qLog(Error) << "Failed writing cover to file" << save_filename << file.errorString();
|
||||
emit Error(tr("Failed writing cover to file %1: %2").arg(save_filename, file.errorString()));
|
||||
Q_EMIT Error(tr("Failed writing cover to file %1: %2").arg(save_filename, file.errorString()));
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void AlbumCoverChoiceController::SaveCoverToFileManual(const Song &song, const A
|
||||
else {
|
||||
if (!result.image.save(save_filename)) {
|
||||
qLog(Error) << "Failed writing cover to file" << save_filename;
|
||||
emit Error(tr("Failed writing cover to file %1.").arg(save_filename));
|
||||
Q_EMIT Error(tr("Failed writing cover to file %1.").arg(save_filename));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ bool AlbumCoverChoiceController::DeleteCover(Song *song, const bool unset) {
|
||||
else {
|
||||
success = false;
|
||||
qLog(Error) << "Failed to delete cover file" << art_automatic << file.errorString();
|
||||
emit Error(tr("Failed to delete cover file %1: %2").arg(art_automatic, file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to delete cover file %1: %2").arg(art_automatic, file.errorString()));
|
||||
}
|
||||
}
|
||||
else song->clear_art_automatic();
|
||||
@@ -398,7 +398,7 @@ bool AlbumCoverChoiceController::DeleteCover(Song *song, const bool unset) {
|
||||
else {
|
||||
success = false;
|
||||
qLog(Error) << "Failed to delete cover file" << art_manual << file.errorString();
|
||||
emit Error(tr("Failed to delete cover file %1: %2").arg(art_manual, file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to delete cover file %1: %2").arg(art_manual, file.errorString()));
|
||||
}
|
||||
}
|
||||
else song->clear_art_manual();
|
||||
@@ -539,7 +539,7 @@ void AlbumCoverChoiceController::AlbumCoverFetched(const quint64 id, const Album
|
||||
SaveCoverAutomatic(&song, result);
|
||||
}
|
||||
|
||||
emit AutomaticCoverSearchDone();
|
||||
Q_EMIT AutomaticCoverSearchDone();
|
||||
|
||||
}
|
||||
|
||||
@@ -683,13 +683,13 @@ QUrl AlbumCoverChoiceController::SaveCoverToFileAutomatic(const Song::Source sou
|
||||
}
|
||||
else {
|
||||
qLog(Error) << "Failed to write cover to file" << file.fileName() << file.errorString();
|
||||
emit Error(tr("Failed to write cover to file %1: %2").arg(file.fileName(), file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to write cover to file %1: %2").arg(file.fileName(), file.errorString()));
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
else {
|
||||
qLog(Error) << "Failed to open cover file" << file.fileName() << "for writing:" << file.errorString();
|
||||
emit Error(tr("Failed to open cover file %1 for writing: %2").arg(file.fileName(), file.errorString()));
|
||||
Q_EMIT Error(tr("Failed to open cover file %1 for writing: %2").arg(file.fileName(), file.errorString()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -830,7 +830,7 @@ void AlbumCoverChoiceController::SaveEmbeddedCoverFinished(TagReaderReply *reply
|
||||
SaveArtEmbeddedToSong(&song, art_embedded);
|
||||
}
|
||||
else {
|
||||
emit Error(tr("Could not save cover to file %1.").arg(song.url().toLocalFile()));
|
||||
Q_EMIT Error(tr("Could not save cover to file %1.").arg(song.url().toLocalFile()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void AlbumCoverExporter::AddJobsToPool() {
|
||||
void AlbumCoverExporter::CoverExported() {
|
||||
|
||||
++exported_;
|
||||
emit AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
Q_EMIT AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
AddJobsToPool();
|
||||
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void AlbumCoverExporter::CoverExported() {
|
||||
void AlbumCoverExporter::CoverSkipped() {
|
||||
|
||||
++skipped_;
|
||||
emit AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
Q_EMIT AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
AddJobsToPool();
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void AlbumCoverFetcher::SingleSearchFinished(const quint64 request_id, const Cov
|
||||
AlbumCoverFetcherSearch *search = active_requests_.take(request_id);
|
||||
|
||||
search->deleteLater();
|
||||
emit SearchFinished(request_id, results, search->statistics());
|
||||
Q_EMIT SearchFinished(request_id, results, search->statistics());
|
||||
|
||||
}
|
||||
|
||||
@@ -155,6 +155,6 @@ void AlbumCoverFetcher::SingleCoverFetched(const quint64 request_id, const Album
|
||||
AlbumCoverFetcherSearch *search = active_requests_.take(request_id);
|
||||
|
||||
search->deleteLater();
|
||||
emit AlbumCoverFetched(request_id, result, search->statistics());
|
||||
Q_EMIT AlbumCoverFetched(request_id, result, search->statistics());
|
||||
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ void AlbumCoverFetcherSearch::AllProvidersFinished() {
|
||||
|
||||
// If we only wanted to do the search then we're done
|
||||
if (request_.search) {
|
||||
emit SearchFinished(request_.id, results_);
|
||||
Q_EMIT SearchFinished(request_.id, results_);
|
||||
return;
|
||||
}
|
||||
|
||||
// No results?
|
||||
if (results_.isEmpty()) {
|
||||
statistics_.missing_images_++;
|
||||
emit AlbumCoverFetched(request_.id, AlbumCoverImageResult());
|
||||
Q_EMIT AlbumCoverFetched(request_.id, AlbumCoverImageResult());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ void AlbumCoverFetcherSearch::SendBestImage() {
|
||||
statistics_.missing_images_++;
|
||||
}
|
||||
|
||||
emit AlbumCoverFetched(request_.id, result);
|
||||
Q_EMIT AlbumCoverFetched(request_.id, result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ void AlbumCoverLoader::Exit() {
|
||||
|
||||
Q_ASSERT(QThread::currentThread() == thread());
|
||||
moveToThread(original_thread_);
|
||||
emit ExitFinished();
|
||||
Q_EMIT ExitFinished();
|
||||
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ void AlbumCoverLoader::FinishTask(TaskPtr task, const AlbumCoverLoaderResult::Ty
|
||||
}
|
||||
}
|
||||
|
||||
emit AlbumCoverLoaded(task->id, AlbumCoverLoaderResult(task->success, task->result_type, task->album_cover, image_scaled, task->art_manual_updated, task->art_automatic_updated));
|
||||
Q_EMIT AlbumCoverLoaded(task->id, AlbumCoverLoaderResult(task->success, task->result_type, task->album_cover, image_scaled, task->art_manual_updated, task->art_automatic_updated));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -932,7 +932,7 @@ void AlbumCoverManager::AlbumDoubleClicked(const QModelIndex &idx) {
|
||||
}
|
||||
|
||||
void AlbumCoverManager::AddSelectedToPlaylist() {
|
||||
emit AddToPlaylist(GetMimeDataForAlbums(ui_->albums->selectionModel()->selectedIndexes()));
|
||||
Q_EMIT AddToPlaylist(GetMimeDataForAlbums(ui_->albums->selectionModel()->selectedIndexes()));
|
||||
}
|
||||
|
||||
void AlbumCoverManager::LoadSelectedToPlaylist() {
|
||||
@@ -940,7 +940,7 @@ void AlbumCoverManager::LoadSelectedToPlaylist() {
|
||||
SongMimeData *mimedata = GetMimeDataForAlbums(ui_->albums->selectionModel()->selectedIndexes());
|
||||
if (mimedata) {
|
||||
mimedata->clear_first_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
Q_EMIT AddToPlaylist(mimedata);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1060,7 +1060,7 @@ void AlbumCoverManager::SaveEmbeddedCoverFinished(TagReaderReply *reply, AlbumIt
|
||||
}
|
||||
|
||||
if (!reply->is_successful()) {
|
||||
emit Error(tr("Could not save cover to file %1.").arg(url.toLocalFile()));
|
||||
Q_EMIT Error(tr("Could not save cover to file %1.").arg(url.toLocalFile()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,6 @@ void CoverExportRunnable::ExportCover() {
|
||||
|
||||
}
|
||||
|
||||
void CoverExportRunnable::EmitCoverExported() { emit CoverExported(); }
|
||||
void CoverExportRunnable::EmitCoverExported() { Q_EMIT CoverExported(); }
|
||||
|
||||
void CoverExportRunnable::EmitCoverSkipped() { emit CoverSkipped(); }
|
||||
void CoverExportRunnable::EmitCoverSkipped() { Q_EMIT CoverSkipped(); }
|
||||
|
||||
@@ -126,7 +126,7 @@ void CurrentAlbumCoverLoader::AlbumCoverReady(const quint64 id, AlbumCoverLoader
|
||||
last_song_.set_art_automatic(result.art_automatic_updated);
|
||||
}
|
||||
|
||||
emit AlbumCoverLoaded(last_song_, result);
|
||||
emit ThumbnailLoaded(last_song_, thumbnail_url, result.image_scaled);
|
||||
Q_EMIT AlbumCoverLoaded(last_song_, result);
|
||||
Q_EMIT ThumbnailLoaded(last_song_, thumbnail_url, result.image_scaled);
|
||||
|
||||
}
|
||||
|
||||
@@ -197,19 +197,19 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonValue value_data = ExtractData(data);
|
||||
if (!value_data.isArray()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonArray array_data = value_data.toArray();
|
||||
if (array_data.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -298,12 +298,12 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
|
||||
}
|
||||
|
||||
if (results.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
}
|
||||
else {
|
||||
CoverProviderSearchResults cover_results = results.values();
|
||||
std::stable_sort(cover_results.begin(), cover_results.end(), AlbumCoverFetcherSearch::CoverProviderSearchResultCompareNumber);
|
||||
emit SearchFinished(id, cover_results);
|
||||
Q_EMIT SearchFinished(id, cover_results);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
|
||||
search->results.append(result);
|
||||
}
|
||||
|
||||
emit SearchResults(search->id, search->results);
|
||||
Q_EMIT SearchResults(search->id, search->results);
|
||||
search->results.clear();
|
||||
|
||||
EndSearch(search, release.id);
|
||||
@@ -457,7 +457,7 @@ void DiscogsCoverProvider::EndSearch(SharedPtr<DiscogsCoverSearchContext> search
|
||||
}
|
||||
if (search->requests_release_.count() <= 0) {
|
||||
requests_search_.remove(search->id);
|
||||
emit SearchFinished(search->id, search->results);
|
||||
Q_EMIT SearchFinished(search->id, search->results);
|
||||
}
|
||||
|
||||
if (queue_release_requests_.isEmpty() && queue_search_requests_.isEmpty()) {
|
||||
|
||||
@@ -133,13 +133,13 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(data);
|
||||
if (json_obj.isEmpty()) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,25 +151,25 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
int error = json_obj[QLatin1String("error")].toInt();
|
||||
QString message = json_obj[QLatin1String("message")].toString();
|
||||
Error(QStringLiteral("Error: %1: %2").arg(QString::number(error), message));
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Error(QStringLiteral("Json reply is missing results."), json_obj);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value_results.isObject()) {
|
||||
Error(QStringLiteral("Json results is not a object."), value_results);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj_results = value_results.toObject();
|
||||
if (obj_results.isEmpty()) {
|
||||
Error(QStringLiteral("Json results object is empty."), value_results);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
}
|
||||
else {
|
||||
Error(QStringLiteral("Json results object is missing albummatches."), obj_results);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -191,35 +191,35 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
}
|
||||
else {
|
||||
Error(QStringLiteral("Json results object is missing trackmatches."), obj_results);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!value_matches.isObject()) {
|
||||
Error(QStringLiteral("Json albummatches or trackmatches is not an object."), value_matches);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj_matches = value_matches.toObject();
|
||||
if (obj_matches.isEmpty()) {
|
||||
Error(QStringLiteral("Json albummatches or trackmatches object is empty."), value_matches);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonValue value_type;
|
||||
if (!obj_matches.contains(type)) {
|
||||
Error(QStringLiteral("Json object is missing %1.").arg(type), obj_matches);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
value_type = obj_matches[type];
|
||||
|
||||
if (!value_type.isArray()) {
|
||||
Error(QStringLiteral("Json album value in albummatches object is not an array."), value_type);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
const QJsonArray array_type = value_type.toArray();
|
||||
@@ -284,7 +284,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
cover_result.image_size = QSize(300, 300);
|
||||
results << cover_result;
|
||||
}
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -130,13 +130,13 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(data);
|
||||
if (json_obj.isEmpty()) {
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,20 +148,20 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
else {
|
||||
Error(QStringLiteral("Json reply is missing releases."), json_obj);
|
||||
}
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
return;
|
||||
}
|
||||
QJsonValue value_releases = json_obj[QLatin1String("releases")];
|
||||
|
||||
if (!value_releases.isArray()) {
|
||||
Error(QStringLiteral("Json releases is not an array."), value_releases);
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
return;
|
||||
}
|
||||
const QJsonArray array_releases = value_releases.toArray();
|
||||
|
||||
if (array_releases.isEmpty()) {
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
cover_result.image_url = url;
|
||||
results.append(cover_result);
|
||||
}
|
||||
emit SearchFinished(search_id, results);
|
||||
Q_EMIT SearchFinished(search_id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -358,20 +358,20 @@ void OpenTidalCoverProvider::HandleSearchReply(QNetworkReply *reply, SearchReque
|
||||
search_requests_queue_.prepend(search_request);
|
||||
}
|
||||
else {
|
||||
emit SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_obj.contains(QLatin1String("albums")) || !json_obj[QLatin1String("albums")].isArray()) {
|
||||
qLog(Debug) << "OpenTidal: Json object is missing albums.";
|
||||
emit SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
const QJsonArray array_albums = json_obj[QLatin1String("albums")].toArray();
|
||||
if (array_albums.isEmpty()) {
|
||||
emit SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ void OpenTidalCoverProvider::HandleSearchReply(QNetworkReply *reply, SearchReque
|
||||
}
|
||||
}
|
||||
|
||||
emit SearchFinished(search_request->id, results);
|
||||
Q_EMIT SearchFinished(search_request->id, results);
|
||||
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ void OpenTidalCoverProvider::FinishAllSearches() {
|
||||
|
||||
while (!search_requests_queue_.isEmpty()) {
|
||||
SearchRequestPtr search_request = search_requests_queue_.dequeue();
|
||||
emit SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(search_request->id, CoverProviderSearchResults());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,13 +168,13 @@ void QobuzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(data);
|
||||
if (json_obj.isEmpty()) {
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,27 +187,27 @@ void QobuzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
}
|
||||
else {
|
||||
Error(QStringLiteral("Json reply is missing albums and tracks object."), json_obj);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value_type.isObject()) {
|
||||
Error(QStringLiteral("Json albums or tracks is not a object."), value_type);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
QJsonObject obj_type = value_type.toObject();
|
||||
|
||||
if (!obj_type.contains(QLatin1String("items"))) {
|
||||
Error(QStringLiteral("Json albums or tracks object does not contain items."), obj_type);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
QJsonValue value_items = obj_type[QLatin1String("items")];
|
||||
|
||||
if (!value_items.isArray()) {
|
||||
Error(QStringLiteral("Json albums or track object items is not a array."), value_items);
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
const QJsonArray array_items = value_items.toArray();
|
||||
@@ -273,7 +273,7 @@ void QobuzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
results << cover_result;
|
||||
|
||||
}
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -178,32 +178,32 @@ void SpotifyCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id,
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(data);
|
||||
if (json_obj.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_obj.contains(extract) || !json_obj[extract].isObject()) {
|
||||
Error(QStringLiteral("Json object is missing %1 object.").arg(extract), json_obj);
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
json_obj = json_obj[extract].toObject();
|
||||
|
||||
if (!json_obj.contains(QLatin1String("items")) || !json_obj[QLatin1String("items")].isArray()) {
|
||||
Error(QStringLiteral("%1 object is missing items array.").arg(extract), json_obj);
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
const QJsonArray array_items = json_obj[QLatin1String("items")].toArray();
|
||||
if (array_items.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ void SpotifyCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id,
|
||||
}
|
||||
|
||||
}
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -170,30 +170,30 @@ void TidalCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
QByteArray data = GetReplyData(reply);
|
||||
if (data.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject json_obj = ExtractJsonObj(data);
|
||||
if (json_obj.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_obj.contains(QLatin1String("items"))) {
|
||||
Error(QStringLiteral("Json object is missing items."), json_obj);
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
QJsonValue value_items = json_obj[QLatin1String("items")];
|
||||
|
||||
if (!value_items.isArray()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
const QJsonArray array_items = value_items.toArray();
|
||||
if (array_items.isEmpty()) {
|
||||
emit SearchFinished(id, CoverProviderSearchResults());
|
||||
Q_EMIT SearchFinished(id, CoverProviderSearchResults());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void TidalCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
}
|
||||
|
||||
}
|
||||
emit SearchFinished(id, results);
|
||||
Q_EMIT SearchFinished(id, results);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user