// 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 icon; in property tooltip; in property danger: false; in property 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 ? Theme.danger-hover : transparent) : (ta.has-hover ? Theme.surface-hover : transparent); border-width: root.danger ? 1px : 0px; border-color: Theme.danger-border; 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 ? Theme.danger : (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 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); } } } } }