@@ -1637,7 +1637,7 @@ void Playlist::ItemsLoaded() {
|
|||||||
|
|
||||||
// Should we gray out deleted songs asynchronously on startup?
|
// Should we gray out deleted songs asynchronously on startup?
|
||||||
if (greyout) {
|
if (greyout) {
|
||||||
(void)QtConcurrent::run(&Playlist::InvalidateDeletedSongs, this);
|
InvalidateDeletedSongs();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT PlaylistLoaded();
|
Q_EMIT PlaylistLoaded();
|
||||||
@@ -1921,18 +1921,6 @@ void Playlist::ReloadItems(const QList<int> &rows) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::ReloadItemsBlocking(const QList<int> &rows) {
|
|
||||||
|
|
||||||
for (const int row : rows) {
|
|
||||||
PlaylistItemPtr item = item_at(row);
|
|
||||||
const Song old_metadata = item->Metadata();
|
|
||||||
item->Reload();
|
|
||||||
QPersistentModelIndex idx = index(row, 0);
|
|
||||||
ItemReloadComplete(idx, old_metadata, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Playlist::Shuffle() {
|
void Playlist::Shuffle() {
|
||||||
|
|
||||||
PlaylistItemPtrList new_items(items_);
|
PlaylistItemPtrList new_items(items_);
|
||||||
@@ -2312,8 +2300,8 @@ void Playlist::InvalidateDeletedSongs() {
|
|||||||
PlaylistItemPtr item = items_.value(row);
|
PlaylistItemPtr item = items_.value(row);
|
||||||
const Song song = item->Metadata();
|
const Song song = item->Metadata();
|
||||||
|
|
||||||
if (song.url().isLocalFile()) {
|
if (song.url().isValid() && song.url().isLocalFile()) {
|
||||||
bool exists = QFile::exists(song.url().toLocalFile());
|
const bool exists = QFile::exists(song.url().toLocalFile());
|
||||||
|
|
||||||
if (!exists && !item->HasForegroundColor(kInvalidSongPriority)) {
|
if (!exists && !item->HasForegroundColor(kInvalidSongPriority)) {
|
||||||
// Gray out the song if it's not there
|
// Gray out the song if it's not there
|
||||||
@@ -2328,12 +2316,7 @@ void Playlist::InvalidateDeletedSongs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!invalidated_rows.isEmpty()) {
|
if (!invalidated_rows.isEmpty()) {
|
||||||
if (QThread::currentThread() == thread()) {
|
ReloadItems(invalidated_rows);
|
||||||
ReloadItems(invalidated_rows);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ReloadItemsBlocking(invalidated_rows);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,14 +239,12 @@ class Playlist : public QAbstractListModel {
|
|||||||
// song will be reloaded to even out the situation because obviously something has changed.
|
// song will be reloaded to even out the situation because obviously something has changed.
|
||||||
// This returns true if this playlist had current item when the method was invoked.
|
// This returns true if this playlist had current item when the method was invoked.
|
||||||
bool ApplyValidityOnCurrentSong(const QUrl &url, bool valid);
|
bool ApplyValidityOnCurrentSong(const QUrl &url, bool valid);
|
||||||
// Grays out and reloads all deleted songs in all playlists. Also, "ungreys" those songs which were once deleted but now got restored somehow.
|
|
||||||
void InvalidateDeletedSongs();
|
|
||||||
// Removes from the playlist all local files that don't exist anymore.
|
// Removes from the playlist all local files that don't exist anymore.
|
||||||
void RemoveDeletedSongs();
|
void RemoveDeletedSongs();
|
||||||
|
|
||||||
void StopAfter(const int row);
|
void StopAfter(const int row);
|
||||||
void ReloadItems(const QList<int> &rows);
|
void ReloadItems(const QList<int> &rows);
|
||||||
void ReloadItemsBlocking(const QList<int> &rows);
|
|
||||||
void InformOfCurrentSongChange(const bool minor);
|
void InformOfCurrentSongChange(const bool minor);
|
||||||
|
|
||||||
// Just emits the dataChanged() signal so the mood column is repainted.
|
// Just emits the dataChanged() signal so the mood column is repainted.
|
||||||
@@ -354,6 +352,9 @@ class Playlist : public QAbstractListModel {
|
|||||||
void TurnOnDynamicPlaylist(PlaylistGeneratorPtr gen);
|
void TurnOnDynamicPlaylist(PlaylistGeneratorPtr gen);
|
||||||
void InsertDynamicItems(const int count);
|
void InsertDynamicItems(const int count);
|
||||||
|
|
||||||
|
// Grays out and reloads all deleted songs in all playlists. Also, "ungreys" those songs which were once deleted but now got restored somehow.
|
||||||
|
void InvalidateDeletedSongs();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void TracksAboutToBeDequeued(const QModelIndex&, const int begin, const int end);
|
void TracksAboutToBeDequeued(const QModelIndex&, const int begin, const int end);
|
||||||
void TracksDequeued();
|
void TracksDequeued();
|
||||||
|
|||||||
Reference in New Issue
Block a user