From 56fc242520b3127c4dbde8277076040a4249a7b6 Mon Sep 17 00:00:00 2001 From: Helder Martins Date: Sun, 27 Jul 2014 23:07:50 +0100 Subject: [PATCH 1/2] complemented condition inside reshuffleindices function to take into account the selected track --- src/playlist/playlist.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 6615be074..64d5762be 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1914,8 +1914,10 @@ void Playlist::ReshuffleIndices() { std::random_shuffle(shuffled_album_keys.begin(), shuffled_album_keys.end()); - // If the user is currently playing a song, force its album to be first. - if (current_virtual_index_ != -1) { + // If the user is currently playing a song, force its album to be first + // Or if the song was not playing but it is selected, force its album + // to be first. + if (current_virtual_index_ != -1 || current_row() != -1) { const QString key = items_[current_row()]->Metadata().AlbumKey(); const int pos = shuffled_album_keys.indexOf(key); if (pos >= 1) { From e4054fad5e8205674b0ceb479aa3ca6cc874fad0 Mon Sep 17 00:00:00 2001 From: Helder Martins Date: Sun, 3 Aug 2014 10:48:01 +0100 Subject: [PATCH 2/2] Clarified comment to be more accurate of what it does --- src/playlist/playlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 64d5762be..104ee654e 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1915,7 +1915,7 @@ void Playlist::ReshuffleIndices() { shuffled_album_keys.end()); // If the user is currently playing a song, force its album to be first - // Or if the song was not playing but it is selected, force its album + // Or if the song was not playing but it was selected, force its album // to be first. if (current_virtual_index_ != -1 || current_row() != -1) { const QString key = items_[current_row()]->Metadata().AlbumKey();