feat(slint): favorites albums group-by (Off / A-Z / Artist)

Add a group QbzSelect to the Albums toolbar. derive_albums buckets the
filtered set by artist name or by the title's first letter (# for
non-alphabetic), sections ordered alphabetically, rendered through the
shared AlbumCollectionView grouped path. albums-shown carries the
post-filter count so the count line + no-match state stay correct in
grouped mode.

cc
This commit is contained in:
vicrodh committed 2026-05-27 07:05:17 -06:00
1 parent 66a9f9da22
commit 39b7b6d2f1
4 files changed
+107 -8

No files matched your search

@@ -486,7 +486,7 @@ export component FavoritesView inherits Rectangle {
alignment: center;
horizontal-stretch: 1;
Text {
text: FavoritesState.albums-visible.length
text: FavoritesState.albums-shown
+ (FavoritesState.albums-search != ""
? " / " + FavoritesState.albums.length
: "")
@@ -505,6 +505,24 @@ export component FavoritesView inherits Rectangle {
}
}
}
VerticalLayout {
alignment: center;
QbzSelect {
menu-width: 150px;
options: [
@tr("Group: Off"),
@tr("Group: A-Z"),
@tr("Group: Artist"),
];
current-index: FavoritesState.albums-group-mode == "off" ? 0
: FavoritesState.albums-group-mode == "alpha" ? 1
: 2;
selected(i) => {
FavoritesActions.albums-set-group(
i == 0 ? "off" : i == 1 ? "alpha" : "artist");
}
}
}
VerticalLayout {
alignment: center;
QbzSelect {
@@ -563,7 +581,7 @@ export component FavoritesView inherits Rectangle {
font-size: Typography.body;
}
if FavoritesState.albums.length > 0
&& FavoritesState.albums-visible.length == 0: Text {
&& FavoritesState.albums-shown == 0: Text {
text: @tr("No albums match your search.");
color: Theme.text-muted;
font-size: Typography.body;
@@ -571,8 +589,9 @@ export component FavoritesView inherits Rectangle {
AlbumCollectionView {
albums: FavoritesState.albums-visible;
grouped: FavoritesState.albums-grouped;
view-mode: FavoritesState.albums-view-mode;
is-grouped: false;
is-grouped: FavoritesState.albums-group-mode != "off";
show-source: false;
open-album(id) => {
root.open-album(id);