CollectionModel: Use song sort text if any group by is set to album

Fixes #1573
This commit is contained in:
Jonas Kvinge
2024-10-06 14:39:14 +02:00
parent c58207dd2f
commit a8d1bf7e73
2 changed files with 16 additions and 1 deletions

View File

@@ -781,7 +781,7 @@ void CollectionModel::CreateSongItem(const Song &song, CollectionItem *parent) {
void CollectionModel::SetSongItemData(CollectionItem *item, const Song &song) {
item->display_text = song.TitleWithCompilationArtist();
item->sort_text = IsAlbumGroupBy(options_active_.group_by[item->parent->container_level]) ? SortTextForSong(song) : SortText(song.title());
item->sort_text = HasParentAlbumGroupBy(item->parent) ? SortTextForSong(song) : SortText(song.title());
item->metadata = song;
}
@@ -1434,6 +1434,19 @@ bool CollectionModel::CompareItems(const CollectionItem *a, const CollectionItem
}
bool CollectionModel::HasParentAlbumGroupBy(CollectionItem *item) const {
while (item && item != root_) {
if (item->container_level >= 0 && item->container_level <= 2 && IsAlbumGroupBy(options_active_.group_by[item->container_level])) {
return true;
}
item = item->parent;
}
return false;
}
qint64 CollectionModel::MaximumCacheSize(Settings *s, const char *size_id, const char *size_unit_id, const qint64 cache_size_default) {
qint64 size = s->value(size_id, cache_size_default).toInt();