Replace emit with Q_EMIT

This commit is contained in:
Jonas Kvinge
2024-08-25 01:06:30 +02:00
parent cb0db8750f
commit 8da616491d
158 changed files with 891 additions and 891 deletions

View File

@@ -171,13 +171,13 @@ void SpotifyFavoriteRequest::AddFavoritesReply(QNetworkReply *reply, const Favor
switch (type) {
case FavoriteType_Artists:
emit ArtistsAdded(songs);
Q_EMIT ArtistsAdded(songs);
break;
case FavoriteType_Albums:
emit AlbumsAdded(songs);
Q_EMIT AlbumsAdded(songs);
break;
case FavoriteType_Songs:
emit SongsAdded(songs);
Q_EMIT SongsAdded(songs);
break;
}
@@ -290,13 +290,13 @@ void SpotifyFavoriteRequest::RemoveFavoritesReply(QNetworkReply *reply, const Fa
switch (type) {
case FavoriteType_Artists:
emit ArtistsRemoved(songs);
Q_EMIT ArtistsRemoved(songs);
break;
case FavoriteType_Albums:
emit AlbumsRemoved(songs);
Q_EMIT AlbumsRemoved(songs);
break;
case FavoriteType_Songs:
emit SongsRemoved(songs);
Q_EMIT SongsRemoved(songs);
break;
}

View File

@@ -126,7 +126,7 @@ SpotifyRequest::~SpotifyRequest() {
void SpotifyRequest::Process() {
if (!service_->authenticated()) {
emit UpdateStatus(query_id_, tr("Authenticating..."));
Q_EMIT UpdateStatus(query_id_, tr("Authenticating..."));
return;
}
@@ -209,8 +209,8 @@ void SpotifyRequest::Search(const int query_id, const QString &search_text) {
void SpotifyRequest::GetArtists() {
emit UpdateStatus(query_id_, tr("Receiving artists..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Receiving artists..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddArtistsRequest();
}
@@ -263,8 +263,8 @@ void SpotifyRequest::FlushArtistsRequests() {
void SpotifyRequest::GetAlbums() {
emit UpdateStatus(query_id_, tr("Receiving albums..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Receiving albums..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddAlbumsRequest();
}
@@ -317,8 +317,8 @@ void SpotifyRequest::FlushAlbumsRequests() {
void SpotifyRequest::GetSongs() {
emit UpdateStatus(query_id_, tr("Receiving songs..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Receiving songs..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddSongsRequest();
}
@@ -372,8 +372,8 @@ void SpotifyRequest::FlushSongsRequests() {
void SpotifyRequest::ArtistsSearch() {
emit UpdateStatus(query_id_, tr("Searching..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Searching..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddArtistsSearchRequest();
}
@@ -386,8 +386,8 @@ void SpotifyRequest::AddArtistsSearchRequest(const int offset) {
void SpotifyRequest::AlbumsSearch() {
emit UpdateStatus(query_id_, tr("Searching..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Searching..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddAlbumsSearchRequest();
}
@@ -400,8 +400,8 @@ void SpotifyRequest::AddAlbumsSearchRequest(const int offset) {
void SpotifyRequest::SongsSearch() {
emit UpdateStatus(query_id_, tr("Searching..."));
emit UpdateProgress(query_id_, 0);
Q_EMIT UpdateStatus(query_id_, tr("Searching..."));
Q_EMIT UpdateProgress(query_id_, 0);
AddSongsSearchRequest();
}
@@ -474,7 +474,7 @@ void SpotifyRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_
}
if (offset_requested == 0) {
emit UpdateProgress(query_id_, GetProgress(artists_received_, artists_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(artists_received_, artists_total_));
}
QJsonValue value_items = ExtractItems(obj_artists);
@@ -528,7 +528,7 @@ void SpotifyRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_
}
artists_received_ += artists_received;
if (offset_requested != 0) emit UpdateProgress(query_id_, GetProgress(artists_total_, artists_received_));
if (offset_requested != 0) Q_EMIT UpdateProgress(query_id_, GetProgress(artists_total_, artists_received_));
ArtistsFinishCheck(limit_requested, offset, artists_received);
@@ -556,9 +556,9 @@ void SpotifyRequest::ArtistsFinishCheck(const int limit, const int offset, const
artist_albums_requests_pending_.clear();
if (artist_albums_requests_total_ > 0) {
if (artist_albums_requests_total_ == 1) emit UpdateStatus(query_id_, tr("Receiving albums for %1 artist...").arg(artist_albums_requests_total_));
else emit UpdateStatus(query_id_, tr("Receiving albums for %1 artists...").arg(artist_albums_requests_total_));
emit UpdateProgress(query_id_, 0);
if (artist_albums_requests_total_ == 1) Q_EMIT UpdateStatus(query_id_, tr("Receiving albums for %1 artist...").arg(artist_albums_requests_total_));
else Q_EMIT UpdateStatus(query_id_, tr("Receiving albums for %1 artists...").arg(artist_albums_requests_total_));
Q_EMIT UpdateProgress(query_id_, 0);
}
}
@@ -610,7 +610,7 @@ void SpotifyRequest::ArtistAlbumsReplyReceived(QNetworkReply *reply, const Artis
--artist_albums_requests_active_;
++artist_albums_requests_received_;
emit UpdateProgress(query_id_, GetProgress(artist_albums_requests_received_, artist_albums_requests_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(artist_albums_requests_received_, artist_albums_requests_total_));
AlbumsReceived(reply, artist, 0, offset_requested);
}
@@ -813,7 +813,7 @@ void SpotifyRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_a
if (type_ == Type::FavouriteAlbums || type_ == Type::SearchAlbums) {
albums_received_ += albums_received;
emit UpdateProgress(query_id_, GetProgress(albums_received_, albums_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(albums_received_, albums_total_));
}
AlbumsFinishCheck(artist_artist, limit_requested, offset, albums_total, albums_received);
@@ -862,9 +862,9 @@ void SpotifyRequest::AlbumsFinishCheck(const Artist &artist, const int limit, co
album_songs_requests_pending_.clear();
if (album_songs_requests_total_ > 0) {
if (album_songs_requests_total_ == 1) emit UpdateStatus(query_id_, tr("Receiving songs for %1 album...").arg(album_songs_requests_total_));
else emit UpdateStatus(query_id_, tr("Receiving songs for %1 albums...").arg(album_songs_requests_total_));
emit UpdateProgress(query_id_, 0);
if (album_songs_requests_total_ == 1) Q_EMIT UpdateStatus(query_id_, tr("Receiving songs for %1 album...").arg(album_songs_requests_total_));
else Q_EMIT UpdateStatus(query_id_, tr("Receiving songs for %1 albums...").arg(album_songs_requests_total_));
Q_EMIT UpdateProgress(query_id_, 0);
}
}
@@ -922,7 +922,7 @@ void SpotifyRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const Artist
--album_songs_requests_active_;
++album_songs_requests_received_;
if (offset_requested == 0) {
emit UpdateProgress(query_id_, GetProgress(album_songs_requests_received_, album_songs_requests_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(album_songs_requests_received_, album_songs_requests_total_));
}
SongsReceived(reply, artist, album, 0, offset_requested);
@@ -1028,7 +1028,7 @@ void SpotifyRequest::SongsReceived(QNetworkReply *reply, const Artist &artist, c
if (type_ == Type::FavouriteSongs || type_ == Type::SearchSongs) {
songs_received_ += songs_received;
emit UpdateProgress(query_id_, GetProgress(songs_received_, songs_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(songs_received_, songs_total_));
}
SongsFinishCheck(artist, album, limit_requested, offset_requested, songs_total, songs_received);
@@ -1209,9 +1209,9 @@ void SpotifyRequest::GetAlbumCovers() {
AddAlbumCoverRequest(song);
}
if (album_covers_requests_total_ == 1) emit UpdateStatus(query_id_, tr("Receiving album cover for %1 album...").arg(album_covers_requests_total_));
else emit UpdateStatus(query_id_, tr("Receiving album covers for %1 albums...").arg(album_covers_requests_total_));
emit UpdateProgress(query_id_, 0);
if (album_covers_requests_total_ == 1) Q_EMIT UpdateStatus(query_id_, tr("Receiving album cover for %1 album...").arg(album_covers_requests_total_));
else Q_EMIT UpdateStatus(query_id_, tr("Receiving album covers for %1 albums...").arg(album_covers_requests_total_));
Q_EMIT UpdateProgress(query_id_, 0);
StartRequests();
@@ -1272,7 +1272,7 @@ void SpotifyRequest::AlbumCoverReceived(QNetworkReply *reply, const QString &alb
if (finished_) return;
emit UpdateProgress(query_id_, GetProgress(album_covers_requests_received_, album_covers_requests_total_));
Q_EMIT UpdateProgress(query_id_, GetProgress(album_covers_requests_received_, album_covers_requests_total_));
if (!album_covers_requests_sent_.contains(album_id)) {
AlbumCoverFinishCheck();
@@ -1374,16 +1374,16 @@ void SpotifyRequest::FinishCheck() {
finished_ = true;
if (no_results_ && songs_.isEmpty()) {
if (IsSearch())
emit Results(query_id_, SongMap(), tr("No match."));
Q_EMIT Results(query_id_, SongMap(), tr("No match."));
else
emit Results(query_id_, SongMap(), QString());
Q_EMIT Results(query_id_, SongMap(), QString());
}
else {
if (songs_.isEmpty() && errors_.isEmpty()) {
emit Results(query_id_, songs_, tr("Data missing error"));
Q_EMIT Results(query_id_, songs_, tr("Data missing error"));
}
else {
emit Results(query_id_, songs_, ErrorsToHTML(errors_));
Q_EMIT Results(query_id_, songs_, ErrorsToHTML(errors_));
}
}
}

View File

@@ -194,7 +194,7 @@ void SpotifyService::ExitReceived() {
QObject::disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully exited.";
wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) emit ExitFinished();
if (wait_for_exit_.isEmpty()) Q_EMIT ExitFinished();
}
@@ -496,8 +496,8 @@ void SpotifyService::AccessTokenRequestFinished(QNetworkReply *reply) {
qLog(Debug) << "Spotify: Authentication was successful, login expires in" << expires_in_;
emit LoginComplete(true);
emit LoginSuccess();
Q_EMIT LoginComplete(true);
Q_EMIT LoginSuccess();
}
@@ -514,7 +514,7 @@ void SpotifyService::ResetArtistsRequest() {
void SpotifyService::GetArtists() {
if (!authenticated()) {
emit ArtistsResults(SongMap(), tr("Not authenticated with Spotify."));
Q_EMIT ArtistsResults(SongMap(), tr("Not authenticated with Spotify."));
ShowConfig();
return;
}
@@ -533,24 +533,24 @@ void SpotifyService::GetArtists() {
void SpotifyService::ArtistsResultsReceived(const int id, const SongMap &songs, const QString &error) {
Q_UNUSED(id);
emit ArtistsResults(songs, error);
Q_EMIT ArtistsResults(songs, error);
ResetArtistsRequest();
}
void SpotifyService::ArtistsUpdateStatusReceived(const int id, const QString &text) {
Q_UNUSED(id);
emit ArtistsUpdateStatus(text);
Q_EMIT ArtistsUpdateStatus(text);
}
void SpotifyService::ArtistsProgressSetMaximumReceived(const int id, const int max) {
Q_UNUSED(id);
emit ArtistsProgressSetMaximum(max);
Q_EMIT ArtistsProgressSetMaximum(max);
}
void SpotifyService::ArtistsUpdateProgressReceived(const int id, const int progress) {
Q_UNUSED(id);
emit ArtistsUpdateProgress(progress);
Q_EMIT ArtistsUpdateProgress(progress);
}
void SpotifyService::ResetAlbumsRequest() {
@@ -566,7 +566,7 @@ void SpotifyService::ResetAlbumsRequest() {
void SpotifyService::GetAlbums() {
if (!authenticated()) {
emit AlbumsResults(SongMap(), tr("Not authenticated with Spotify."));
Q_EMIT AlbumsResults(SongMap(), tr("Not authenticated with Spotify."));
ShowConfig();
return;
}
@@ -585,24 +585,24 @@ void SpotifyService::GetAlbums() {
void SpotifyService::AlbumsResultsReceived(const int id, const SongMap &songs, const QString &error) {
Q_UNUSED(id);
emit AlbumsResults(songs, error);
Q_EMIT AlbumsResults(songs, error);
ResetAlbumsRequest();
}
void SpotifyService::AlbumsUpdateStatusReceived(const int id, const QString &text) {
Q_UNUSED(id);
emit AlbumsUpdateStatus(text);
Q_EMIT AlbumsUpdateStatus(text);
}
void SpotifyService::AlbumsProgressSetMaximumReceived(const int id, const int max) {
Q_UNUSED(id);
emit AlbumsProgressSetMaximum(max);
Q_EMIT AlbumsProgressSetMaximum(max);
}
void SpotifyService::AlbumsUpdateProgressReceived(const int id, const int progress) {
Q_UNUSED(id);
emit AlbumsUpdateProgress(progress);
Q_EMIT AlbumsUpdateProgress(progress);
}
void SpotifyService::ResetSongsRequest() {
@@ -618,7 +618,7 @@ void SpotifyService::ResetSongsRequest() {
void SpotifyService::GetSongs() {
if (!authenticated()) {
emit SongsResults(SongMap(), tr("Not authenticated with Spotify."));
Q_EMIT SongsResults(SongMap(), tr("Not authenticated with Spotify."));
ShowConfig();
return;
}
@@ -637,24 +637,24 @@ void SpotifyService::GetSongs() {
void SpotifyService::SongsResultsReceived(const int id, const SongMap &songs, const QString &error) {
Q_UNUSED(id);
emit SongsResults(songs, error);
Q_EMIT SongsResults(songs, error);
ResetSongsRequest();
}
void SpotifyService::SongsUpdateStatusReceived(const int id, const QString &text) {
Q_UNUSED(id);
emit SongsUpdateStatus(text);
Q_EMIT SongsUpdateStatus(text);
}
void SpotifyService::SongsProgressSetMaximumReceived(const int id, const int max) {
Q_UNUSED(id);
emit SongsProgressSetMaximum(max);
Q_EMIT SongsProgressSetMaximum(max);
}
void SpotifyService::SongsUpdateProgressReceived(const int id, const int progress) {
Q_UNUSED(id);
emit SongsUpdateProgress(progress);
Q_EMIT SongsUpdateProgress(progress);
}
int SpotifyService::Search(const QString &text, StreamingSearchView::SearchType type) {
@@ -678,7 +678,7 @@ int SpotifyService::Search(const QString &text, StreamingSearchView::SearchType
void SpotifyService::StartSearch() {
if (!authenticated()) {
emit SearchResults(pending_search_id_, SongMap(), tr("Not authenticated with Spotify."));
Q_EMIT SearchResults(pending_search_id_, SongMap(), tr("Not authenticated with Spotify."));
ShowConfig();
return;
}
@@ -726,7 +726,7 @@ void SpotifyService::SendSearch() {
void SpotifyService::SearchResultsReceived(const int id, const SongMap &songs, const QString &error) {
emit SearchResults(id, songs, error);
Q_EMIT SearchResults(id, songs, error);
search_request_.reset();
}
@@ -742,8 +742,8 @@ void SpotifyService::LoginError(const QString &error, const QVariant &debug) {
}
if (debug.isValid()) qLog(Debug) << debug;
emit LoginFailure(error_html);
emit LoginComplete(false);
Q_EMIT LoginFailure(error_html);
Q_EMIT LoginComplete(false);
login_errors_.clear();