Move the currently playing song to the top when the playlist is manually shuffled

Fixes #304
This commit is contained in:
Jonas Kvinge 2020-07-09 20:52:06 +02:00
parent 4208b512f8
commit 42c62206c8
1 changed files with 5 additions and 0 deletions

View File

@ -1654,6 +1654,11 @@ void Playlist::Shuffle() {
PlaylistItemList new_items(items_);
int begin = 0;
if (current_item_index_.isValid()) {
if (new_items[0] != new_items[current_item_index_.row()])
std::swap(new_items[0], new_items[current_item_index_.row()]);
begin = 1;
}
const int count = items_.count();
for (int i = begin; i < count; ++i) {