diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 1b7602ff8..338e30a58 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -1217,7 +1217,12 @@ CollectionItem *CollectionModel::ItemFromQuery(GroupBy type, bool signal, bool c item->metadata.InitFromQuery(row, true); item->key = item->metadata.title(); item->display_text = item->metadata.TitleWithCompilationArtist(); - item->sort_text = SortTextForSong(item->metadata); + if (item->container_level == 1 && !IsAlbumGrouping(group_by_[0])) { + item->sort_text = SortText(item->metadata.title()); + } + else { + item->sort_text = SortTextForSong(item->metadata); + } break; } @@ -1358,7 +1363,12 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr item->metadata = s; item->key = s.title(); item->display_text = s.TitleWithCompilationArtist(); - item->sort_text = SortTextForSong(s); + if (item->container_level == 1 && !IsAlbumGrouping(group_by_[0])) { + item->sort_text = SortText(s.title()); + } + else { + item->sort_text = SortTextForSong(s); + } break; } diff --git a/src/collection/collectionmodel.h b/src/collection/collectionmodel.h index f2be1b22c..baa825929 100644 --- a/src/collection/collectionmodel.h +++ b/src/collection/collectionmodel.h @@ -251,6 +251,7 @@ class CollectionModel : public SimpleTreeModel { QVariant data(const CollectionItem *item, int role) const; bool CompareItems(const CollectionItem *a, const CollectionItem *b) const; int MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const int cache_size_default) const; + bool IsAlbumGrouping(const GroupBy group_by) const { return group_by == GroupBy_Album || group_by == GroupBy_YearAlbum || group_by == GroupBy_OriginalYearAlbum || group_by == GroupBy_AlbumDisc || group_by == GroupBy_YearAlbumDisc; } private: CollectionBackend *backend_;