From a515eb552976e3d4ef8610856062d39ac5bc6c3b Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 22 Jun 2026 11:01:19 -0600 Subject: [PATCH] fix(slint): wrap long credit lists in Album Info + Track Info modals Album Info expanded-track credits: the roles line now stretches and word-wraps instead of running off the right edge of the modal. Track Info credits: render two independent fixed-width columns (even-index -> left, odd-index -> right) so long name lists wrap and the right column stays aligned on every row, with no height-coupled row gaps; names stay clickable, one per line. Mirror the wrap in the immersive Track Info panel. cc --- crates/qbz-slint/src/info_modals.rs | 11 +++ .../ui/album/AlbumCreditsModal.slint | 4 + .../qbz-slint/ui/album/TrackInfoModal.slint | 88 +++++++++++-------- .../immersive/ImmersiveTrackInfoPanel.slint | 34 ++----- crates/qbz-slint/ui/state.slint | 8 ++ 5 files changed, 82 insertions(+), 63 deletions(-) diff --git a/crates/qbz-slint/src/info_modals.rs b/crates/qbz-slint/src/info_modals.rs index 581dad40c..cd23d1ecc 100644 --- a/crates/qbz-slint/src/info_modals.rs +++ b/crates/qbz-slint/src/info_modals.rs @@ -347,14 +347,22 @@ fn apply_track_info(window: &AppWindow, data: TrackInfoData) { .credits .into_iter() .map(|c| { + let names_line = c.names.join(", "); let names: Vec = c.names.into_iter().map(SharedString::from).collect(); InfoCreditRow { role: c.role.into(), role_raw: c.role_raw.into(), names: ModelRc::new(VecModel::from(names)), + names_line: names_line.into(), } }) .collect(); + // Two independent columns (even -> left, odd -> right) so the modal can + // render natural vertical stacks instead of height-coupled paired rows. + let credits_left: Vec = cells.iter().step_by(2).cloned().collect(); + let credits_right: Vec = + cells.iter().skip(1).step_by(2).cloned().collect(); + let mut pairs: Vec = Vec::new(); let mut iter = cells.into_iter(); while let Some(left) = iter.next() { @@ -370,6 +378,7 @@ fn apply_track_info(window: &AppWindow, data: TrackInfoData) { role: SharedString::new(), role_raw: SharedString::new(), names: ModelRc::new(VecModel::from(Vec::::new())), + names_line: SharedString::new(), }, has_right: false, }), @@ -386,6 +395,8 @@ fn apply_track_info(window: &AppWindow, data: TrackInfoData) { st.set_label_id(data.label_id.into()); st.set_copyright(data.copyright.into()); st.set_credits(ModelRc::new(VecModel::from(pairs))); + st.set_credits_left(ModelRc::new(VecModel::from(credits_left))); + st.set_credits_right(ModelRc::new(VecModel::from(credits_right))); } fn apply_album_credits(window: &AppWindow, data: AlbumCreditsData) { diff --git a/crates/qbz-slint/ui/album/AlbumCreditsModal.slint b/crates/qbz-slint/ui/album/AlbumCreditsModal.slint index da1180756..9864c76b4 100644 --- a/crates/qbz-slint/ui/album/AlbumCreditsModal.slint +++ b/crates/qbz-slint/ui/album/AlbumCreditsModal.slint @@ -134,6 +134,10 @@ component AlbumTrackRow inherits VerticalLayout { text: perf.roles; color: Theme.text-muted; font-size: 13px; + // Fill the row's remaining width and wrap the role list instead + // of letting it run off the right edge of the modal. + horizontal-stretch: 1; + wrap: word-wrap; } } if root.track.copyright != "": Rectangle { height: 8px; } diff --git a/crates/qbz-slint/ui/album/TrackInfoModal.slint b/crates/qbz-slint/ui/album/TrackInfoModal.slint index 7ff89d775..1b7f82b24 100644 --- a/crates/qbz-slint/ui/album/TrackInfoModal.slint +++ b/crates/qbz-slint/ui/album/TrackInfoModal.slint @@ -33,6 +33,9 @@ export component MetaCell inherits VerticalLayout { // Exported so the immersive split Track Info panel can reuse it 1:1. export component CreditCell inherits VerticalLayout { in property cell; + // Fixed cell width handed down by the modal so the two columns stay aligned + // and the value text wraps inside the column instead of dictating its width. + in property col-w: 280px; callback name-clicked(string /* name */, string /* role-raw */); spacing: 6px; Text { @@ -41,31 +44,27 @@ export component CreditCell inherits VerticalLayout { font-size: 11px; font-weight: Typography.semibold; letter-spacing: 0.5px; + width: root.col-w; + wrap: word-wrap; } - Rectangle { - clip: true; - height: names-row.preferred-height; - names-row := HorizontalLayout { - alignment: start; - for name[j] in root.cell.names: HorizontalLayout { - nta := TouchArea { - width: nm.preferred-width; - height: nm.preferred-height; - mouse-cursor: pointer; - clicked => { - root.name-clicked(name, root.cell.role-raw); - } - nm := Text { - text: name; - color: nta.has-hover ? Theme.accent : Theme.text-primary; - font-size: 14px; - } - } - if j < root.cell.names.length - 1: Text { - text: ", "; - color: Theme.text-primary; - font-size: 14px; - } + // One clickable name per line (Slint has no flow layout, so a wrapping row + // of links would clip): keeps click-to-musician AND never overflows. Each + // name wraps within the fixed column width if a single name is very long. + VerticalLayout { + spacing: 2px; + for name in root.cell.names: ta := TouchArea { + width: root.col-w; + height: nmt.preferred-height; + mouse-cursor: pointer; + clicked => { + root.name-clicked(name, root.cell.role-raw); + } + nmt := Text { + text: name; + color: ta.has-hover ? Theme.accent : Theme.text-primary; + font-size: 14px; + width: root.col-w; + wrap: word-wrap; } } } @@ -85,8 +84,13 @@ export component TrackInfoModal inherits Rectangle { } } - Rectangle { + card := Rectangle { width: Math.min(root.width - 40px, 728px); + // Fixed credits-column width: card minus the 24px L/R content padding + // (48) minus the 24px inter-column gutter, halved. Pinning each credit + // cell to this (instead of horizontal-stretch, whose split skews with + // each cell's content width) keeps the right column aligned on every row. + property credits-col-w: (self.width - 48px - 24px) / 2; height: Math.min(root.height * 0.8, card-body.preferred-height); x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; @@ -257,7 +261,7 @@ export component TrackInfoModal inherits Rectangle { Text { text: TrackInfoState.isrc; color: Theme.text-muted; - font-size: 13px; + font-size: 14px; } } if TrackInfoState.isrc == "": Rectangle { horizontal-stretch: 1; } @@ -296,25 +300,35 @@ export component TrackInfoModal inherits Rectangle { background: Theme.surface-elevated; } if TrackInfoState.credits.length > 0: Rectangle { height: 20px; } - if TrackInfoState.credits.length > 0: VerticalLayout { - spacing: 16px; - for pair in TrackInfoState.credits: HorizontalLayout { - spacing: 24px; - CreditCell { - horizontal-stretch: 1; - cell: pair.left; + // Two INDEPENDENT columns (left/right stacks) with + // natural vertical spacing — no height-coupled rows, + // so a column with more names just grows on its own. + if TrackInfoState.credits.length > 0: HorizontalLayout { + spacing: 24px; + alignment: start; + VerticalLayout { + width: card.credits-col-w; + spacing: 20px; + alignment: start; + for entry in TrackInfoState.credits-left: CreditCell { + col-w: card.credits-col-w; + cell: entry; name-clicked(n, r) => { TrackInfoActions.open-musician(n, r); } } - if pair.has-right: CreditCell { - horizontal-stretch: 1; - cell: pair.right; + } + VerticalLayout { + width: card.credits-col-w; + spacing: 20px; + alignment: start; + for entry in TrackInfoState.credits-right: CreditCell { + col-w: card.credits-col-w; + cell: entry; name-clicked(n, r) => { TrackInfoActions.open-musician(n, r); } } - if !pair.has-right: Rectangle { horizontal-stretch: 1; } } } diff --git a/crates/qbz-slint/ui/immersive/ImmersiveTrackInfoPanel.slint b/crates/qbz-slint/ui/immersive/ImmersiveTrackInfoPanel.slint index b477d17e0..5f7ce762c 100644 --- a/crates/qbz-slint/ui/immersive/ImmersiveTrackInfoPanel.slint +++ b/crates/qbz-slint/ui/immersive/ImmersiveTrackInfoPanel.slint @@ -53,32 +53,14 @@ component CreditCellLight inherits VerticalLayout { font-weight: 600; letter-spacing: 0.6px; } - Rectangle { - clip: true; - height: names-row.preferred-height; - names-row := HorizontalLayout { - alignment: start; - for name[j] in root.cell.names: HorizontalLayout { - nta := TouchArea { - width: nm.preferred-width; - height: nm.preferred-height; - mouse-cursor: pointer; - clicked => { - root.name-clicked(name, root.cell.role-raw); - } - nm := Text { - text: name; - color: nta.has-hover ? #b794f6 : #ffffff; - font-size: 14px; - } - } - if j < root.cell.names.length - 1: Text { - text: ", "; - color: #ffffffcc; - font-size: 14px; - } - } - } + // Single wrapping Text (names pre-joined) so a long credit list wraps + // instead of clipping — mirrors the TrackInfoModal CreditCell fix. Slint + // has no flow layout, so per-name click is dropped in favour of wrapping. + Text { + text: root.cell.names-line; + color: #ffffff; + font-size: 14px; + wrap: word-wrap; } } diff --git a/crates/qbz-slint/ui/state.slint b/crates/qbz-slint/ui/state.slint index 80e44a541..248bf5cef 100644 --- a/crates/qbz-slint/ui/state.slint +++ b/crates/qbz-slint/ui/state.slint @@ -536,6 +536,9 @@ export struct InfoCreditRow { // Original (non-localized) role string, passed to the musician-nav hint. role-raw: string, names: [string], + // Names pre-joined with ", " — rendered as a single wrapping Text so a long + // credit list (e.g. 5 producers) wraps instead of clipping at the column edge. + names-line: string, } // A row in the Track Info 2-column credits grid. The Rust side pairs the @@ -587,6 +590,11 @@ export global TrackInfoState { in property label-id; // Paired (2-column) ordered credit cells. in property <[InfoCreditPair]> credits: []; + // Credits split into two independent columns (even-index -> left, + // odd-index -> right) so the modal renders two natural vertical stacks + // instead of height-coupled paired rows (which left vertical gaps). + in property <[InfoCreditRow]> credits-left: []; + in property <[InfoCreditRow]> credits-right: []; in property copyright; }