From 975b277bdb8e7837f8f47f86064272a482804978 Mon Sep 17 00:00:00 2001 From: Santi Date: Fri, 31 Jul 2015 21:38:06 -0300 Subject: [PATCH 1/2] Sort by album considers discs and tracks --- src/playlist/playlist.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 49c73a63f..013f45db5 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1402,8 +1402,18 @@ void Playlist::sort(int column, Qt::SortOrder order) { if (dynamic_playlist_ && current_item_index_.isValid()) begin += current_item_index_.row() + 1; - qStableSort(begin, new_items.end(), + if (column == Column_Album) { + // 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( new PlaylistUndoCommands::SortItems(this, column, order, new_items)); From 5518dc82502eed6319bfc896c1b87648a0911b5a Mon Sep 17 00:00:00 2001 From: Santi Date: Sat, 1 Aug 2015 14:45:04 -0300 Subject: [PATCH 2/2] make format --- src/playlist/playlist.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 013f45db5..fb69f5d6e 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1404,15 +1404,15 @@ void Playlist::sort(int column, Qt::SortOrder order) { if (column == Column_Album) { // 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)); + 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)); + qStableSort(begin, new_items.end(), + std::bind(&Playlist::CompareItems, column, order, _1, _2)); } undo_stack_->push(