mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-31 09:44:50 +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:
parent
85fa86625b
commit
727a1f5ad1
@ -1217,7 +1217,12 @@ CollectionItem *CollectionModel::ItemFromQuery(GroupBy type, bool signal, bool c
|
|||||||
item->metadata.InitFromQuery(row, true);
|
item->metadata.InitFromQuery(row, true);
|
||||||
item->key = item->metadata.title();
|
item->key = item->metadata.title();
|
||||||
item->display_text = item->metadata.TitleWithCompilationArtist();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1358,7 +1363,12 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr
|
|||||||
item->metadata = s;
|
item->metadata = s;
|
||||||
item->key = s.title();
|
item->key = s.title();
|
||||||
item->display_text = s.TitleWithCompilationArtist();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
QVariant data(const CollectionItem *item, int role) const;
|
QVariant data(const CollectionItem *item, int role) const;
|
||||||
bool CompareItems(const CollectionItem *a, const CollectionItem *b) 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;
|
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:
|
private:
|
||||||
CollectionBackend *backend_;
|
CollectionBackend *backend_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user