CollectionModel: Use song sort text if any group by is set to album
Fixes #1573
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -201,6 +201,8 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
||||
|
||||
bool CompareItems(const CollectionItem *a, const CollectionItem *b) const;
|
||||
|
||||
bool HasParentAlbumGroupBy(CollectionItem *item) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void TotalSongCountUpdated(const int count);
|
||||
void TotalArtistCountUpdated(const int count);
|
||||
|
||||
Reference in New Issue
Block a user