Files
qbz/crates/qbz-slint/ui/primitives/MultiSelectBar.slint
T
vicrodh 82129cff35 feat(slint): LocalLibrary ephemeral folders + Folders tree 1:1 port
Ephemeral folders: open / browse / play a folder without indexing it —
album-grouped pane, CUE seek fast-path (no full re-decode per virtual track),
folder-path persistence + rehydrate, "already playing" add-vs-replace choice
dialog (ephemeral-only), and now-playing / queue / menu gating so an ephemeral
track exposes no persistence actions.

Folders tree brought 1:1 with Tauri:
- Rail header: select-mode, collapse-all, open-ephemeral, tree search.
- Resizable rail (default ~20% narrower; drag handle, min 50% default /
  max 50% of the content area).
- Subfolder cover grid + grid/list toggle, recursive track count, name search;
  compact icon bulk bar (folder-check / play-next / queue / playlist / clear).
- Tree is the default mode; circular checkboxes homologated with TrackRow;
  compact rows (smaller type + icon, no ambiguous trailing count).
- Flat/Tree icon toggle (disc-album / folder-tree), floated right.

Per-source TrackRow context menu (logic, not a blanket trim): Qobuz/offline =
full; local = play/next/queue + add-to-playlist; plex/ephemeral = play/next/
queue only.

App-wide standard: Math.round pixel-snap on icon centering across the UI to
kill sub-pixel blur (CircleAction, header back/forward/collapse, and the rest).
NowPlayingBar context icon -> turntable (frees disc-album for the Folders
toggle). New assets: folder-check, folder-tree, turntable.

cc
2026-06-07 10:12:59 -06:00

84 lines
2.8 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 { BulkAction } from "../state.slint";
// One action button — 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 <string> label;
in property <bool> danger: false;
in property <bool> enabled-when: true;
callback clicked();
width: lbl.preferred-width + 24px;
height: 30px;
border-radius: Radius.sm;
opacity: root.enabled-when ? 1.0 : 0.5;
background: root.danger
? (ta.has-hover ? #ef444433 : transparent)
: (ta.has-hover ? Theme.surface-hover : transparent);
border-width: root.danger ? 1px : 0px;
border-color: #ef4444;
lbl := Text {
text: root.label;
color: root.danger ? #ef4444 : Theme.text-secondary;
font-size: Typography.legal;
font-weight: root.danger ? Typography.medium : Typography.regular;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
}
ta := TouchArea {
mouse-cursor: root.enabled-when ? pointer : default;
clicked => {
if (root.enabled-when) {
root.clicked();
}
}
}
}
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: 12px;
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 {
label: act.label;
danger: act.danger;
enabled-when: !act.needs-selection || root.selected-count > 0;
clicked => {
root.action(act.id);
}
}
}
}
}