Use const reference for AlbumCoverLoaderResult
This commit is contained in:
@@ -2316,16 +2316,14 @@ void Playlist::UpdateScrobblePoint(const qint64 seek_point_nanosec) {
|
||||
|
||||
}
|
||||
|
||||
void Playlist::AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResultPtr result) {
|
||||
|
||||
if (!result) return;
|
||||
void Playlist::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result) {
|
||||
|
||||
// Update art_manual for local songs that are not in the collection.
|
||||
if (((result->type == AlbumCoverLoaderResult::Type::Manual && result->album_cover->cover_url.isLocalFile()) || result->type == AlbumCoverLoaderResult::Type::ManuallyUnset) && (song.source() == Song::Source::LocalFile || song.source() == Song::Source::CDDA || song.source() == Song::Source::Device)) {
|
||||
if (((result.type == AlbumCoverLoaderResult::Type::Manual && result.album_cover.cover_url.isLocalFile()) || result.type == AlbumCoverLoaderResult::Type::ManuallyUnset) && (song.source() == Song::Source::LocalFile || song.source() == Song::Source::CDDA || song.source() == Song::Source::Device)) {
|
||||
PlaylistItemPtr item = current_item();
|
||||
if (item && item->Metadata() == song && (!item->Metadata().art_manual_is_valid() || (result->type == AlbumCoverLoaderResult::Type::ManuallyUnset && !item->Metadata().has_manually_unset_cover()))) {
|
||||
qLog(Debug) << "Updating art manual for local song" << song.title() << song.album() << song.title() << "to" << result->album_cover->cover_url << "in playlist.";
|
||||
item->SetArtManual(result->album_cover->cover_url);
|
||||
if (item && item->Metadata() == song && (!item->Metadata().art_manual_is_valid() || (result.type == AlbumCoverLoaderResult::Type::ManuallyUnset && !item->Metadata().has_manually_unset_cover()))) {
|
||||
qLog(Debug) << "Updating art manual for local song" << song.title() << song.album() << song.title() << "to" << result.album_cover.cover_url << "in playlist.";
|
||||
item->SetArtManual(result.album_cover.cover_url);
|
||||
ScheduleSaveAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ class Playlist : public QAbstractListModel {
|
||||
void RepopulateDynamicPlaylist();
|
||||
void TurnOffDynamicPlaylist();
|
||||
|
||||
void AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResultPtr result);
|
||||
void AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result);
|
||||
|
||||
signals:
|
||||
void RestoreFinished();
|
||||
|
||||
@@ -1461,21 +1461,11 @@ void PlaylistView::Stopped() {
|
||||
|
||||
}
|
||||
|
||||
void PlaylistView::AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResultPtr result) {
|
||||
void PlaylistView::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result) {
|
||||
|
||||
AlbumCoverImageResultPtr album_cover;
|
||||
if (result) {
|
||||
album_cover = result->album_cover;
|
||||
}
|
||||
if ((song != Song() && song_playing_ == Song()) || result.album_cover.image == current_song_cover_art_) return;
|
||||
|
||||
if ((song != Song() && song_playing_ == Song()) || (!album_cover && current_song_cover_art_.isNull()) || (album_cover && album_cover->image == current_song_cover_art_)) return;
|
||||
|
||||
if (album_cover) {
|
||||
current_song_cover_art_ = album_cover->image;
|
||||
}
|
||||
else {
|
||||
current_song_cover_art_ = QImage();
|
||||
}
|
||||
current_song_cover_art_ = result.album_cover.image;
|
||||
|
||||
if (background_image_type_ == AppearanceSettingsPage::BackgroundImageType::Album) {
|
||||
if (song.art_automatic().isEmpty() && song.art_manual().isEmpty()) {
|
||||
|
||||
@@ -183,7 +183,7 @@ class PlaylistView : public QTreeView {
|
||||
void Playing();
|
||||
void Stopped();
|
||||
void SongChanged(const Song &song);
|
||||
void AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResultPtr result = AlbumCoverLoaderResultPtr());
|
||||
void AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result = AlbumCoverLoaderResult());
|
||||
void DynamicModeChanged(const bool dynamic);
|
||||
void SetRatingLockStatus(const bool state);
|
||||
void RatingHoverIn(const QModelIndex &idx, const QPoint pos);
|
||||
|
||||
Reference in New Issue
Block a user