1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-18 19:50:38 +01:00

Sort songs in collection by song title instead of track if previous

grouping is not the album.

Fixes #295
This commit is contained in:
Jonas Kvinge 2020-05-06 22:14:59 +02:00
parent 85fa86625b
commit 727a1f5ad1
2 changed files with 13 additions and 2 deletions

View File

@ -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;
}

View File

@ -251,6 +251,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
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_;