From 81e7d2186837f12ad02eb19dd816cbad33489d66 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Wed, 27 May 2026 16:19:12 -0600 Subject: [PATCH] feat(slint): A-Z alpha index for the Artists sidepanel left list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sidepanel left artist list is now always A-Z grouped (derive_artists groups when group-enabled OR view-mode==sidepanel; the view toggle re-derives) with letter headers, and an AlphaStrip on its right edge jumps the list Flickable proportionally (same approach as the album grouping — not exact, by design). Replaces the flat ListView. cc --- crates/qbz-slint/src/favorites.rs | 5 +- crates/qbz-slint/src/main.rs | 3 ++ .../ui/favorites/FavoritesView.slint | 46 +++++++++++++++---- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/crates/qbz-slint/src/favorites.rs b/crates/qbz-slint/src/favorites.rs index 3733edb8b..39f095cfd 100644 --- a/crates/qbz-slint/src/favorites.rs +++ b/crates/qbz-slint/src/favorites.rs @@ -630,7 +630,10 @@ pub fn derive_artists(window: &AppWindow) { let state = window.global::(); let query_owned = state.get_artists_search().to_lowercase(); let query = query_owned.trim(); - let group = state.get_artists_group_enabled(); + // The sidepanel left list is ALWAYS A-Z grouped (independent of the grid + // group toggle), so it shows letter headers + the alpha jump strip. + let group = state.get_artists_group_enabled() + || state.get_artists_view_mode().as_str() == "sidepanel"; let all = state.get_artists(); // Flat (search-filtered) model. Share `all` when no query so artwork diff --git a/crates/qbz-slint/src/main.rs b/crates/qbz-slint/src/main.rs index 86d97a9c6..251f323f1 100644 --- a/crates/qbz-slint/src/main.rs +++ b/crates/qbz-slint/src/main.rs @@ -4403,6 +4403,9 @@ fn main() -> Result<(), Box> { if v == "grid" { st.set_selected_artist_id("".into()); } + // Rebuild grouped/alpha for the new mode (the sidepanel + // left list is always grouped). + favorites::derive_artists(&w); favorites_prefs::save(&w); } }); diff --git a/crates/qbz-slint/ui/favorites/FavoritesView.slint b/crates/qbz-slint/ui/favorites/FavoritesView.slint index 7ffcb9922..6f209219e 100644 --- a/crates/qbz-slint/ui/favorites/FavoritesView.slint +++ b/crates/qbz-slint/ui/favorites/FavoritesView.slint @@ -1368,20 +1368,48 @@ export component FavoritesView inherits Rectangle { padding-top: 16px; spacing: 0px; - // LEFT: the favorites artist list (self-scrolling). + // LEFT: the favorites artist list, A-Z grouped, with a + // proportional alpha jump strip (like the album grouping). Rectangle { width: 300px; - ListView { - width: 100%; - height: 100%; - for artist[i] in FavoritesState.artists-visible: SidepanelArtistRow { - item: artist; - selected: FavoritesState.selected-artist-id == artist.id; - clicked(id, name) => { - FavoritesActions.select-artist(id, name); + clip: true; + left-flick := Flickable { + viewport-width: self.width; + viewport-height: left-col.preferred-height; + left-col := VerticalLayout { + width: parent.width; + padding-top: 4px; + padding-bottom: 40px; + padding-right: 22px; + spacing: 4px; + alignment: start; + for section[s] in FavoritesState.artists-grouped: VerticalLayout { + spacing: 2px; + Text { + text: section.title; + color: Theme.text-secondary; + font-size: Typography.legal; + font-weight: Typography.semibold; + } + for artist[i] in section.artists: SidepanelArtistRow { + item: artist; + selected: FavoritesState.selected-artist-id == artist.id; + clicked(id, name) => { + FavoritesActions.select-artist(id, name); + } + } } } } + if FavoritesState.artists-alpha.length > 0: AlphaStrip { + x: parent.width - self.width - 2px; + height: 100%; + jumps: FavoritesState.artists-alpha; + jump(ord, idx) => { + left-flick.viewport-y = -(ord / Math.max(1, FavoritesState.artists-alpha.length - 1)) + * Math.max(0, (left-flick.viewport-height - left-flick.height) / 1px) * 1px; + } + } } Rectangle { width: 1px;