feat(slint): TrackItem.is-blacklisted + TrackRow greyout/inert state

cc
This commit is contained in:
vicrodh committed 2026-06-17 00:31:47 -06:00
1 parent 06aba4d403
commit 95629713b3
3 files changed
+93 -13

No files matched your search

@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<svg fill="#ffffff" width="24" height="24" viewBox="0 0 200 200" data-name="Layer 1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"><title/><path d="M177.5,67.4a9.75,9.75,0,0,0-14-1.5c-10.5,8.5-20,14.5-29.5,17.5-9.5,3.5-20.5,5-34,5s-24.5-1.5-34-5-19-9-29.5-17.5c-4.5-3.5-10.5-3-14,1.5s-3,10.5,1.5,14A132.06,132.06,0,0,0,45,95.9l-8.5,14.5c-2.5,5-1,11,3.5,13.5,5,2.5,11,1,13.5-3.5L63,103.9a112.84,112.84,0,0,0,27,4.5v18a10,10,0,0,0,20,0v-18a106.6,106.6,0,0,0,29-5.5l10,17.5a9.86,9.86,0,0,0,17-10l-9-15.5a111.22,111.22,0,0,0,19-13.5C180.5,77.9,181,71.9,177.5,67.4Z"/></svg>

After

Width:  |  Height:  |  Size: 595 B

+85 -13
View File
@@ -18,7 +18,7 @@
import { Theme } from "../foundation/semantic-colors.slint"; import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint"; import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint"; import { Radius } from "../foundation/radius.slint";
import { TrackItem, DragActions, NowPlayingState, NavState } from "../state.slint"; import { TrackItem, DragActions, NowPlayingState, NavState, TooltipState } from "../state.slint";
import { QbzIcon } from "QbzIcon.slint"; import { QbzIcon } from "QbzIcon.slint";
import { TrackPlayCell } from "TrackPlayCell.slint"; import { TrackPlayCell } from "TrackPlayCell.slint";
import { TrackContextMenu } from "TrackContextMenu.slint"; import { TrackContextMenu } from "TrackContextMenu.slint";
@@ -26,8 +26,16 @@ import { QualityBadgeFull } from "QualityBadgeFull.slint";
export component TrackRow inherits Rectangle { export component TrackRow inherits Rectangle {
in property <TrackItem> track; in property <TrackItem> track;
// Fade out when the row is being removed (favorites un-favorite). // Blacklisted rows render dimmed + INERT in place (never removed):
opacity: root.track.removing ? 0.0 : 1.0; // opacity 0.4, no play/drag/menu-play/favorite/download, nav-only menu,
// a blacklist glyph in the number/play cell. Mirrors Tauri's
// `TrackRow.svelte` `.blacklisted` (opacity:0.4; cursor:not-allowed;
// not draggable; click/contextmenu/keydown short-circuit). This is the
// single shared interaction gate every blacklist surface reuses.
property <bool> row-inert: root.track.is-blacklisted;
// Fade out when the row is being removed (favorites un-favorite); a
// blacklisted row that isn't fading dims to 0.4.
opacity: root.track.removing ? 0.0 : (root.row-inert ? 0.4 : 1.0);
animate opacity { duration: 250ms; } animate opacity { duration: 250ms; }
in property <int> index; in property <int> index;
in property <bool> show-artwork: true; in property <bool> show-artwork: true;
@@ -113,6 +121,10 @@ export component TrackRow inherits Rectangle {
// if it's already the current track) — mirrors the play-cell click, // if it's already the current track) — mirrors the play-cell click,
// applied to every TrackRow across the app. // applied to every TrackRow across the app.
double-clicked => { double-clicked => {
// Blacklisted rows are inert — no play (Tauri click short-circuit).
if (root.row-inert) {
return;
}
if (NowPlayingState.has-track && NowPlayingState.track-id == root.track.id) { if (NowPlayingState.has-track && NowPlayingState.track-id == root.track.id) {
NowPlayingState.toggle-play(); NowPlayingState.toggle-play();
} else { } else {
@@ -139,7 +151,7 @@ export component TrackRow inherits Rectangle {
// never overflows past the "..." gutter; vertical overflow at the // never overflows past the "..." gutter; vertical overflow at the
// window bottom matches the existing "..." anchor behavior. // window bottom matches the existing "..." anchor behavior.
if (e.kind == PointerEventKind.down && e.button == PointerEventButton.right if (e.kind == PointerEventKind.down && e.button == PointerEventButton.right
&& root.show-menu && !root.multi-select-mode) { && root.show-menu && !root.multi-select-mode && !root.row-inert) {
root.menu-at-pointer = true; root.menu-at-pointer = true;
root.menu-click-x = ta.mouse-x; root.menu-click-x = ta.mouse-x;
root.menu-click-y = ta.mouse-y; root.menu-click-y = ta.mouse-y;
@@ -174,7 +186,8 @@ export component TrackRow inherits Rectangle {
} }
} }
moved => { moved => {
if (ta.pressed && root.draggable) { // Blacklisted rows are not draggable (Tauri `draggable=false`).
if (ta.pressed && root.draggable && !root.row-inert) {
if (!ta.dragging if (!ta.dragging
&& (Math.abs(root.absolute-position.x - root.x + ta.mouse-x - ta.down-x) > 6px && (Math.abs(root.absolute-position.x - root.x + ta.mouse-x - ta.down-x) > 6px
|| Math.abs(root.absolute-position.y - root.y + ta.mouse-y - ta.down-y) > 6px)) { || Math.abs(root.absolute-position.y - root.y + ta.mouse-y - ta.down-y) > 6px)) {
@@ -276,12 +289,53 @@ export component TrackRow inherits Rectangle {
show-artwork: root.show-artwork; show-artwork: root.show-artwork;
art-size: 36px; art-size: 36px;
number-width: 32px; number-width: 32px;
row-hovered: root.row-hovered && !root.multi-select-mode; row-hovered: root.row-hovered && !root.multi-select-mode && !root.row-inert;
visible: !root.multi-select-mode; // Blacklisted rows swap the play/number cell for the
// blacklist glyph below, so hide the play affordance.
visible: !root.multi-select-mode && !root.row-inert;
play => { play => {
// Inert guard (the cell is hidden when inert, but keep
// the action gated regardless).
if (root.row-inert) {
return;
}
root.media-action("track", root.track.id, "play"); root.media-action("track", root.track.id, "play");
} }
} }
// Blacklist glyph — replaces the number/play affordance on a
// blacklisted (dimmed, inert) row. A bare hover TouchArea drives
// the shared tooltip ("Artist is blacklisted") without making
// the cell interactive (no play). Mirrors Tauri's number-cell
// Ban icon with title="Artist is blacklisted" (TrackRow.svelte).
if root.row-inert: Rectangle {
width: parent.width;
height: parent.height;
QbzIcon {
source: @image-url("../assets/icons/blind-eye.svg");
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: Theme.text-muted;
}
blacklist-ta := TouchArea {
mouse-cursor: not-allowed;
changed has-hover => {
if (self.has-hover) {
TooltipState.text = @tr("Artist is blacklisted");
// Anchor on the glyph cell itself (centre-x,
// top-y), matching the CircleAction tooltip
// convention (window coords).
TooltipState.anchor-x = self.absolute-position.x + self.width / 2;
TooltipState.anchor-y = self.absolute-position.y;
TooltipState.show = true;
} else {
TooltipState.show = false;
}
}
}
}
if root.multi-select-mode: Rectangle { if root.multi-select-mode: Rectangle {
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
@@ -486,7 +540,7 @@ export component TrackRow inherits Rectangle {
// Favorite — filled accent heart when favorited, outline heart // Favorite — filled accent heart when favorited, outline heart
// otherwise. Click toggles (handled in Rust, which flips // otherwise. Click toggles (handled in Rust, which flips
// `is-favorite` optimistically so this updates immediately). // `is-favorite` optimistically so this updates immediately).
if root.show-favorite: VerticalLayout { if root.show-favorite && !root.row-inert: VerticalLayout {
alignment: center; alignment: center;
Rectangle { Rectangle {
width: 28px; width: 28px;
@@ -514,8 +568,11 @@ export component TrackRow inherits Rectangle {
} }
} }
// Heart-slot placeholder (column-grid alignment, see the // Heart-slot placeholder (column-grid alignment, see the
// reserve-favorite doc above). // reserve-favorite doc above). Also reserved when a show-favorite
if !root.show-favorite && root.reserve-favorite: Rectangle { // surface hides the heart on a blacklisted row, so the dimmed row
// keeps the same duration/quality grid as its siblings.
if (!root.show-favorite && root.reserve-favorite)
|| (root.show-favorite && root.row-inert): Rectangle {
width: 28px; width: 28px;
} }
// Offline cache — a stateful affordance reflecting cache-status: // Offline cache — a stateful affordance reflecting cache-status:
@@ -526,7 +583,7 @@ export component TrackRow inherits Rectangle {
// Shown when the surface enables it OR the track has active state, so // Shown when the surface enables it OR the track has active state, so
// a downloading/ready copy surfaces its status even where the button // a downloading/ready copy surfaces its status even where the button
// isn't enabled by default. // isn't enabled by default.
if root.show-download || root.track.cache-status > 0: VerticalLayout { if (root.show-download || root.track.cache-status > 0) && !root.row-inert: VerticalLayout {
alignment: center; alignment: center;
Rectangle { Rectangle {
width: 28px; width: 28px;
@@ -572,6 +629,12 @@ export component TrackRow inherits Rectangle {
} }
} }
} }
// Offline-slot placeholder on a blacklisted row whose surface would
// otherwise show the offline button — keeps the dimmed row's grid
// aligned with its download-bearing siblings.
if root.row-inert && (root.show-download || root.track.cache-status > 0): Rectangle {
width: 28px;
}
// Source indicator (Local Library) — a subtle per-source glyph shown // Source indicator (Local Library) — a subtle per-source glyph shown
// instead of the favorite/offline columns. local -> hard-drive // instead of the favorite/offline columns. local -> hard-drive
@@ -598,8 +661,11 @@ export component TrackRow inherits Rectangle {
} }
} }
// Context menu. // Context menu. Suppressed on a blacklisted (inert) row — Tauri's
if root.show-menu: VerticalLayout { // shared TrackRow short-circuits contextmenu and renders no block
// menu item; the per-list wrappers (VTL / Album / Playlist) do the
// nav-only reduction, not this shared primitive.
if root.show-menu && !root.row-inert: VerticalLayout {
alignment: center; alignment: center;
Rectangle { Rectangle {
width: 32px; width: 32px;
@@ -626,6 +692,12 @@ export component TrackRow inherits Rectangle {
} }
} }
} }
// Menu-slot placeholder on a blacklisted row whose surface has the
// "..." menu — keeps the dimmed row's trailing edge aligned with
// its interactive siblings.
if root.show-menu && root.row-inert: Rectangle {
width: 32px;
}
} }
// True for rows whose source is Qobuz-backed (Qobuz surfaces + offline // True for rows whose source is Qobuz-backed (Qobuz surfaces + offline
+6
View File
@@ -358,6 +358,12 @@ export struct TrackItem {
// "qobuz" | "local" | "plex" | "" — drives the Local Library source // "qobuz" | "local" | "plex" | "" — drives the Local Library source
// indicator (shown instead of the favorite/offline columns). // indicator (shown instead of the favorite/offline columns).
source: string, source: string,
// Artist-blacklist greyout: when true the row renders dimmed + inert
// (no play/drag/favorite/download, nav-only menu) with a blacklist
// glyph in the number/play cell. Stamped per-row by the controllers
// (Task 6) from the user's blacklisted-artist set; never set on local
// / Plex rows. Defaults false (Slint struct fields zero-init).
is-blacklisted: bool,
// Fading out (un-favorited in the favorites view) before removal. // Fading out (un-favorited in the favorites view) before removal.
removing: bool, removing: bool,
// Offline-cache status: 0 none, 1 queued, 2 downloading, 3 ready, 4 failed. // Offline-cache status: 0 none, 1 queued, 2 downloading, 3 ready, 4 failed.