feat(slint): stamp is-blacklisted on album/playlist/favorites/suggest rows; protect local+Plex; nav-only menu on blacklisted rows

cc
This commit is contained in:
vicrodh committed 2026-06-17 00:44:47 -06:00
1 parent 95629713b3
commit 6566b507de
13 files changed
+150 -41

No files matched your search

@@ -38,6 +38,20 @@ export component TrackContextMenu inherits PopupWindow {
in property <bool> track-info-action: true;
in property <bool> go-album-action: root.qobuz-actions;
in property <bool> go-artist-action: root.qobuz-actions;
// Nav-only reduction (blacklisted/inert rows, Task 6 step C): hides every
// transient / mutating / destructive entry (play, play-next, queue, radio,
// favorite, mixtape, add/remove-playlist, share, offline) and keeps only
// navigation + info (Go to album / Go to artist / Track info). Mirrors
// Tauri keeping a reduced nav-only menu on a blacklisted row so the user
// can still reach the album/artist/track-info from the "..." menu — only
// playback/queue is denied. Default off, so every other surface is
// unchanged.
in property <bool> nav-only: false;
// Track Info shows on a nav-only row even when it's not a Qobuz-block row,
// so a blacklisted row keeps the info entry; otherwise it rides the Qobuz
// block as before.
property <bool> show-track-info:
root.track-info-action && (root.nav-only || root.qobuz-actions);
// The row's offline-cache status (TrackItem.cache-status): when cached
// (3) the single "Make available offline" entry swaps for the
// Refresh / Remove pair — Tauri's ready-state submenu, rendered flat
@@ -46,64 +60,69 @@ export component TrackContextMenu inherits PopupWindow {
callback media-action(string, string, string);
width: 224px;
// 3 transient + optional favorite/mixtape/add-to-playlist/remove +
// optional go-to pair + the Qobuz block (3 fixed + 1-or-2 offline
// Nav-only (blacklisted): only Go to album / Go to artist / Track info.
// Otherwise: 3 transient + optional favorite/mixtape/add-to-playlist/remove
// + optional go-to pair + the Qobuz block (3 fixed + 1-or-2 offline
// entries + optional track info).
height: (3
+ (root.favorite-action ? 1 : 0)
+ (root.mixtape-action ? 1 : 0)
+ (root.playlist-action ? 1 : 0)
+ (root.remove-from-playlist-action ? 1 : 0)
+ (root.go-album-action ? 1 : 0)
+ (root.go-artist-action ? 1 : 0)
+ (root.qobuz-actions
? 3 + (root.cache-status == 3 ? 2 : 1) + (root.track-info-action ? 1 : 0)
: 0)) * 30px;
height: (root.nav-only
? ((root.go-album-action ? 1 : 0)
+ (root.go-artist-action ? 1 : 0)
+ (root.show-track-info ? 1 : 0))
: (3
+ (root.favorite-action ? 1 : 0)
+ (root.mixtape-action ? 1 : 0)
+ (root.playlist-action ? 1 : 0)
+ (root.remove-from-playlist-action ? 1 : 0)
+ (root.go-album-action ? 1 : 0)
+ (root.go-artist-action ? 1 : 0)
+ (root.qobuz-actions
? 3 + (root.cache-status == 3 ? 2 : 1) + (root.track-info-action ? 1 : 0)
: 0))) * 30px;
ContextMenu {
ContextMenuItem {
if !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/play.svg");
label: @tr("Play now");
clicked => {
root.media-action("track", root.track-id, "play");
}
}
ContextMenuItem {
if !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/list-plus.svg");
label: @tr("Play next");
clicked => {
root.media-action("track", root.track-id, "play-next");
}
}
ContextMenuItem {
if !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/list-end.svg");
label: @tr("Add to queue");
clicked => {
root.media-action("track", root.track-id, "queue");
}
}
if root.qobuz-actions: ContextMenuItem {
if root.qobuz-actions && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/radio.svg");
label: @tr("Create radio");
clicked => {
root.media-action("track", root.track-id, "create-radio");
}
}
if root.favorite-action: ContextMenuItem {
if root.favorite-action && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/heart.svg");
label: @tr("Add to library");
clicked => {
root.media-action("track", root.track-id, "favorite");
}
}
if root.mixtape-action: ContextMenuItem {
if root.mixtape-action && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/cassette-tape.svg");
label: @tr("Add to mixtape");
clicked => {
root.media-action("track", root.track-id, "add-to-mixtape");
}
}
if root.playlist-action: ContextMenuItem {
if root.playlist-action && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/list-music.svg");
label: @tr("Add to playlist");
clicked => {
@@ -112,7 +131,7 @@ export component TrackContextMenu inherits PopupWindow {
}
// Remove from playlist (danger) — playlist detail only, after Add
// to playlist (Tauri group order, spec §1.3 #8).
if root.remove-from-playlist-action: ContextMenuItem {
if root.remove-from-playlist-action && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/trash-2.svg");
label: @tr("Remove from playlist");
danger: true;
@@ -120,14 +139,14 @@ export component TrackContextMenu inherits PopupWindow {
root.media-action("track", root.track-id, "remove-from-playlist");
}
}
if root.qobuz-actions: ContextMenuItem {
if root.qobuz-actions && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/link.svg");
label: @tr("Share Qobuz link");
clicked => {
root.media-action("track", root.track-id, "share-qobuz");
}
}
if root.qobuz-actions: ContextMenuItem {
if root.qobuz-actions && !root.nav-only: ContextMenuItem {
icon: @image-url("../assets/icons/link.svg");
label: @tr("Share Song.link");
clicked => {
@@ -138,21 +157,21 @@ export component TrackContextMenu inherits PopupWindow {
// submenu, flat per spec §3.5): not cached -> Make available
// offline; cached -> Refresh + Remove (icons 1:1 with Tauri's
// RefreshCw / Trash2).
if root.qobuz-actions && root.cache-status != 3: ContextMenuItem {
if root.qobuz-actions && !root.nav-only && root.cache-status != 3: ContextMenuItem {
icon: @image-url("../assets/icons/cloud-download.svg");
label: @tr("Make available offline");
clicked => {
root.media-action("track", root.track-id, "download");
}
}
if root.qobuz-actions && root.cache-status == 3: ContextMenuItem {
if root.qobuz-actions && !root.nav-only && root.cache-status == 3: ContextMenuItem {
icon: @image-url("../assets/icons/refresh-cw.svg");
label: @tr("Refresh offline copy");
clicked => {
root.media-action("track", root.track-id, "recache");
}
}
if root.qobuz-actions && root.cache-status == 3: ContextMenuItem {
if root.qobuz-actions && !root.nav-only && root.cache-status == 3: ContextMenuItem {
icon: @image-url("../assets/icons/trash-2.svg");
label: @tr("Remove offline copy");
danger: true;
@@ -174,7 +193,7 @@ export component TrackContextMenu inherits PopupWindow {
root.media-action("track", root.track-id, "go-to-artist");
}
}
if root.qobuz-actions && root.track-info-action: ContextMenuItem {
if root.show-track-info: ContextMenuItem {
icon: @image-url("../assets/icons/info.svg");
label: @tr("Track info");
clicked => {
+17 -15
View File
@@ -147,11 +147,14 @@ export component TrackRow inherits Rectangle {
// Right-click opens the same context menu at the pointer (Tauri's
// contextmenu mode, spec §3.5). Suppressed in multi-select mode
// (Tauri parity: row right-click toggles nothing there) and on
// menu-less rows (ephemeral). x clamps to the row so the menu
// never overflows past the "..." gutter; vertical overflow at the
// window bottom matches the existing "..." anchor behavior.
// menu-less rows (ephemeral). A blacklisted (inert) row STILL
// opens it — reduced to nav-only (Go to album/artist, Track info)
// via track-menu.nav-only below, so the user keeps navigation.
// x clamps to the row so the menu never overflows past the "..."
// gutter; vertical overflow at the window bottom matches the
// existing "..." anchor behavior.
if (e.kind == PointerEventKind.down && e.button == PointerEventButton.right
&& root.show-menu && !root.multi-select-mode && !root.row-inert) {
&& root.show-menu && !root.multi-select-mode) {
root.menu-at-pointer = true;
root.menu-click-x = ta.mouse-x;
root.menu-click-y = ta.mouse-y;
@@ -661,11 +664,13 @@ export component TrackRow inherits Rectangle {
}
}
// Context menu. Suppressed on a blacklisted (inert) row — Tauri's
// 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 {
// Context menu trigger. KEPT on a blacklisted (inert) row — the menu
// it opens is reduced to nav-only (Go to album/artist, Track info) via
// track-menu.nav-only, so the row still offers navigation while every
// play/queue/mutating entry is gone. Mirrors Tauri keeping a reduced
// nav-only menu on a blacklisted row (the T5 deviation that hid the
// whole menu is reverted here).
if root.show-menu: VerticalLayout {
alignment: center;
Rectangle {
width: 32px;
@@ -692,12 +697,6 @@ 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
@@ -714,6 +713,9 @@ export component TrackRow inherits Rectangle {
: parent.width - self.width - 12px;
y: root.menu-at-pointer ? root.menu-click-y : 48px;
track-id: root.track.id;
// Blacklisted (inert) rows get the nav-only reduction: only Go to
// album / Go to artist / Track info, no play/queue/mutating entries.
nav-only: root.row-inert;
// Per-source menu logic: the Qobuz block (radio, share, offline,
// go-to, track-info) only for Qobuz/offline rows, and never on
// library surfaces (force-local-menu — its arms are dead on library