From e97fb3d5c0eb141bfa2bc26e63704475da46ffdc Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Tue, 2 Jan 2018 13:29:56 +0000 Subject: [PATCH] Sort single tracks by title, track artist, then track number, etc. Issue #1155 --- db/librarydb.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db/librarydb.cpp b/db/librarydb.cpp index 7ba4e2b71..035b24362 100644 --- a/db/librarydb.cpp +++ b/db/librarydb.cpp @@ -183,6 +183,17 @@ static bool albumsSortModified(const LibraryDb::Album &a, const LibraryDb::Album static bool songSort(const Song &a, const Song &b) { + if (Song::SingleTracks==a.type && Song::SingleTracks==b.type) { + int cmp=a.title.localeAwareCompare(b.title); + if (0!=cmp) { + return cmp<0; + } + a.artist.localeAwareCompare(b.artist); + if (0!=cmp) { + return cmp<0; + } + } + if (a.disc!=b.disc) { return a.disc LibraryDb::getTracks(const QString &artistId, const QString &albumId // qSort(songs.begin(), songs.end(), songsSortModified); // break; default: + qSort(songs.begin(), songs.end(), songSort); break; } return songs;