Playlist: Grey invalid song entries when updating items.
This commit is contained in:
parent
1989e576ed
commit
df45e6efe0
|
@ -173,6 +173,12 @@ Playlist::Playlist(PlaylistBackend* backend, TaskManager* task_manager,
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(kSettingsGroup);
|
||||||
|
|
||||||
|
grey_unfound_ = settings.value("greyoutdeleted", false).toBool();
|
||||||
|
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
qLog(Debug) << "k_max_scrobble_point"
|
qLog(Debug) << "k_max_scrobble_point"
|
||||||
<< (max_play_count_point_nsecs_ / kNsecPerSec);
|
<< (max_play_count_point_nsecs_ / kNsecPerSec);
|
||||||
}
|
}
|
||||||
|
@ -1223,6 +1229,9 @@ void Playlist::UpdateItems(const SongList& songs) {
|
||||||
} else {
|
} else {
|
||||||
new_item = PlaylistItemPtr(new SongPlaylistItem(song));
|
new_item = PlaylistItemPtr(new SongPlaylistItem(song));
|
||||||
}
|
}
|
||||||
|
if (grey_unfound_ && !song.is_valid()) {
|
||||||
|
new_item->SetForegroundColor(kInvalidSongPriority, kInvalidSongColor);
|
||||||
|
}
|
||||||
items_[i] = new_item;
|
items_[i] = new_item;
|
||||||
emit dataChanged(index(i, 0), index(i, ColumnCount - 1));
|
emit dataChanged(index(i, 0), index(i, ColumnCount - 1));
|
||||||
// Also update undo actions
|
// Also update undo actions
|
||||||
|
@ -1626,11 +1635,7 @@ void Playlist::ItemsLoaded(QFuture<PlaylistItemList> future) {
|
||||||
|
|
||||||
emit RestoreFinished();
|
emit RestoreFinished();
|
||||||
|
|
||||||
QSettings s;
|
if (grey_unfound_) {
|
||||||
s.beginGroup(kSettingsGroup);
|
|
||||||
|
|
||||||
// should we gray out deleted songs asynchronously on startup?
|
|
||||||
if (s.value("greyoutdeleted", false).toBool()) {
|
|
||||||
QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs);
|
QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,6 +471,8 @@ class Playlist : public QAbstractListModel {
|
||||||
|
|
||||||
// Cancel async restore if songs are already replaced
|
// Cancel async restore if songs are already replaced
|
||||||
bool cancel_restore_;
|
bool cancel_restore_;
|
||||||
|
|
||||||
|
bool grey_unfound_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// QDataStream& operator <<(QDataStream&, const Playlist*);
|
// QDataStream& operator <<(QDataStream&, const Playlist*);
|
||||||
|
|
Loading…
Reference in New Issue