Files
qbz/crates/qbz-slint/ui/primitives/MultiSelectBar.slint
T
vicrodh 999ded11ff feat(slint): post-lyrics UI polish sweep + correctness fixes
- TrackRow: Korean/CJK titles render via layout-assigned width+height
  (SongCard parity, never femtovg-measured); explicit "E" badge hugs the
  title text; duration + position number dropped to 13px so they read
  smaller than the 14px title.
- AlbumView: label/awards rail 214->160px with smaller card/icon/padding
  and centered headings in the compact rail; removed the dark right gutter
  (full-width Flickable, content clears the scrollbar via the 32px page
  padding); column headers homologated to Playlist casing (Title/Duration/
  Quality), same in LocalAlbumView.
- ArtistView: network sidebar auto-collapses on ShellState.content-
  constrained (the AlbumView signal) and no longer re-opens on artist->
  artist navigation (reset_network_sidebar respects the constraint).
- Hero titles homologated to Typography.section (18px) across MyQBZ detail,
  Musician, Label releases, Artists-by-location, Offline Manager.
- Lyrics: Qobuz || LRCLIB parallel fetch, next-track prefetch, source
  footer, asymmetric line fade.

cc
2026-06-11 22:03:46 -06:00

101 lines
3.4 KiB
Plaintext

// Multi-select bulk action bar — a "N selected" count label plus a row
// of action buttons driven by a [BulkAction] model, so the bar's chrome
// lives in one place. Shared by PlaylistView and the Favorites tracks
// tab. Emits the chosen action's id via `action(id)`; the surrounding
// view maps that id to a command. ADR-008: these are bordered/hover
// buttons, not pills.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { QbzIcon } from "QbzIcon.slint";
import { BulkAction, TooltipState } from "../state.slint";
// One action button — an ICON with a hover tooltip (the action's label).
// Borderless hover for a normal action, red-bordered for a danger action,
// dimmed + non-interactive when it needs a selection and there is none.
component BulkButton inherits Rectangle {
in property <image> icon;
in property <string> tooltip;
in property <bool> danger: false;
in property <bool> enabled-when: true;
callback clicked();
width: 34px;
height: 30px;
border-radius: Radius.sm;
opacity: root.enabled-when ? 1.0 : 0.4;
background: root.danger
? (ta.has-hover ? #ef444433 : transparent)
: (ta.has-hover ? Theme.surface-hover : transparent);
border-width: root.danger ? 1px : 0px;
border-color: #ef4444;
QbzIcon {
source: root.icon;
width: 16px;
height: 16px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: root.danger
? #ef4444
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
}
ta := TouchArea {
mouse-cursor: root.enabled-when ? pointer : default;
clicked => {
if (root.enabled-when) {
root.clicked();
}
}
// Shared tooltip bubble (same channel as CircleAction), so each
// icon explains itself on hover.
changed has-hover => {
if (self.has-hover && root.tooltip != "") {
TooltipState.text = root.tooltip;
TooltipState.anchor-x = root.absolute-position.x + root.width / 2;
TooltipState.anchor-y = root.absolute-position.y;
TooltipState.show = true;
} else if (!self.has-hover) {
TooltipState.show = false;
}
}
}
}
export component MultiSelectBar inherits Rectangle {
in property <int> selected-count: 0;
in property <[BulkAction]> actions;
callback action(string);
height: 44px;
border-radius: 8px;
background: Theme.surface-elevated;
HorizontalLayout {
padding-left: 14px;
padding-right: 10px;
spacing: 6px;
Text {
text: root.selected-count + " " + @tr("selected");
color: Theme.text-secondary;
font-size: Typography.body;
vertical-alignment: center;
horizontal-stretch: 1;
}
for act in root.actions: VerticalLayout {
alignment: center;
BulkButton {
icon: act.icon;
tooltip: act.label;
danger: act.danger;
enabled-when: !act.needs-selection || root.selected-count > 0;
clicked => {
root.action(act.id);
}
}
}
}
}