Merge pull request #4972 from santigl/master

Playlist sort by album considers disc and track numbers
This commit is contained in:
John Maguire 2015-08-03 14:05:44 +01:00
commit 10860b70ae

View File

@ -1402,8 +1402,18 @@ void Playlist::sort(int column, Qt::SortOrder order) {
if (dynamic_playlist_ && current_item_index_.isValid()) if (dynamic_playlist_ && current_item_index_.isValid())
begin += current_item_index_.row() + 1; begin += current_item_index_.row() + 1;
qStableSort(begin, new_items.end(), if (column == Column_Album) {
std::bind(&Playlist::CompareItems, column, order, _1, _2)); // When sorting by album, also take into account discs and tracks.
qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems,
Column_Track, order, _1, _2));
qStableSort(begin, new_items.end(),
std::bind(&Playlist::CompareItems, Column_Disc, order, _1, _2));
qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems,
Column_Album, order, _1, _2));
} else {
qStableSort(begin, new_items.end(),
std::bind(&Playlist::CompareItems, column, order, _1, _2));
}
undo_stack_->push( undo_stack_->push(
new PlaylistUndoCommands::SortItems(this, column, order, new_items)); new PlaylistUndoCommands::SortItems(this, column, order, new_items));