feat(blacklist): album-block context menu + manager Albums tab; albumview polish
Phase 2 (Slint UI + wiring) for album-level blocking, plus the album-view
enhancements that share these files.
Album blacklist UI:
- "Block this album" in all three album menus: the page-header menu as a
Block/Unblock toggle (gated to Qobuz via AlbumState), and the AlbumCard +
AlbumListRow grid menus (one-way, drop-on-reload; local/Plex excluded).
Menu heights bumped for the extra item.
- Blacklist Manager gains an Artists | Albums tab bar (segmented, ADR-008);
an AlbumRow with a cover thumbnail (blind-eye fallback) + title + artist +
"Added {date}"; tab-aware controls (shared enable toggle, per-tab search /
Clear-All / count) and confirm modal. Settings row retitled "Blacklist",
status shows both counts.
- state.slint: BlacklistedAlbumItem + album-items/album-count/active-tab on
BlacklistState; set-tab/album-select/remove-album/clear-all-albums/
block-album on BlacklistActions; AlbumState.is-album-blocked.
- main.rs: ("album","block"/"unblock") arm (header, resolves display fields
from AlbumState); 5 album BlacklistActions callbacks; seed_blacklist_status
pushes album_count.
- blacklist_manager.rs: album build/push + set_tab/block_album/remove_album/
clear_all_albums; covers resolve async via a new ArtworkTarget::BlacklistAlbum
through spawn_loads.
Album-view enhancements (same files):
- E1: full credited-artist header line with localized roles, each name a
clickable artist link (Album.artists drove this; was interpreter-only).
- E3: classical work-header composer name is now a clickable artist link
(work title + composer id/name split through TrackData/TrackItem).
i18n: es (Mexican) for all new strings; de/fr/pt/ru/ja fall back to English
pending a translator pass.
cargo check -p qbz green (Slint codegen + bin).
cc
This commit is contained in:
21 files changed
+930
-65
No files matched your search
@@ -4134,3 +4134,60 @@ msgstr "Un cliente nativo de streaming de música para Linux, diseñado para aud
|
|||||||
|
|
||||||
msgid "Built with Slint, and powered by Rodio and Symphonia. With thanks to Qobuz, MusicBrainz, Song.link/Odesli, LRCLIB, lyrics.ovh, Lucide, and Kawarp."
|
msgid "Built with Slint, and powered by Rodio and Symphonia. With thanks to Qobuz, MusicBrainz, Song.link/Odesli, LRCLIB, lyrics.ovh, Lucide, and Kawarp."
|
||||||
msgstr "Construido con Slint, e impulsado por Rodio y Symphonia. Con agradecimientos a Qobuz, MusicBrainz, Song.link/Odesli, LRCLIB, lyrics.ovh, Lucide y Kawarp."
|
msgstr "Construido con Slint, e impulsado por Rodio y Symphonia. Con agradecimientos a Qobuz, MusicBrainz, Song.link/Odesli, LRCLIB, lyrics.ovh, Lucide y Kawarp."
|
||||||
|
|
||||||
|
# Album blacklist (album-level blocking)
|
||||||
|
msgid "Block this album"
|
||||||
|
msgstr "Bloquear este álbum"
|
||||||
|
|
||||||
|
msgid "Unblock album"
|
||||||
|
msgstr "Desbloquear álbum"
|
||||||
|
|
||||||
|
msgid "Album \"{}\" blocked"
|
||||||
|
msgstr "Álbum \"{}\" bloqueado"
|
||||||
|
|
||||||
|
msgid "Album \"{}\" unblocked"
|
||||||
|
msgstr "Álbum \"{}\" desbloqueado"
|
||||||
|
|
||||||
|
msgid "Failed to block album"
|
||||||
|
msgstr "No se pudo bloquear el álbum"
|
||||||
|
|
||||||
|
msgid "Failed to unblock album"
|
||||||
|
msgstr "No se pudo desbloquear el álbum"
|
||||||
|
|
||||||
|
msgid "{} albums"
|
||||||
|
msgstr "{} álbumes"
|
||||||
|
|
||||||
|
msgid "No blocked albums"
|
||||||
|
msgstr "No hay álbumes bloqueados"
|
||||||
|
|
||||||
|
msgid "To block an album, open its menu and choose Block this album."
|
||||||
|
msgstr "Para bloquear un álbum, abre su menú y elige Bloquear este álbum."
|
||||||
|
|
||||||
|
msgid "Blocked albums are hidden from search, discovery, and listings — even when their artist is allowed."
|
||||||
|
msgstr "Los álbumes bloqueados se ocultan de la búsqueda, el descubrimiento y los listados, aunque su artista esté permitido."
|
||||||
|
|
||||||
|
msgid "This will remove all {} blocked albums. This cannot be undone."
|
||||||
|
msgstr "Esto quitará los {} álbumes bloqueados. No se puede deshacer."
|
||||||
|
|
||||||
|
msgid "{} artists, {} albums blocked"
|
||||||
|
msgstr "{} artistas, {} álbumes bloqueados"
|
||||||
|
|
||||||
|
msgid "{} artists, {} albums blocked (disabled)"
|
||||||
|
msgstr "{} artistas, {} álbumes bloqueados (desactivado)"
|
||||||
|
|
||||||
|
msgid "Failed to clear album blacklist"
|
||||||
|
msgstr "No se pudo limpiar la lista de álbumes bloqueados"
|
||||||
|
|
||||||
|
msgid "Conductor"
|
||||||
|
msgstr "Director"
|
||||||
|
|
||||||
|
msgid "Orchestra"
|
||||||
|
msgstr "Orquesta"
|
||||||
|
|
||||||
|
msgid "Featured Artist"
|
||||||
|
msgstr "Artista invitado"
|
||||||
|
|
||||||
|
msgid "Removed {} album from blacklist"
|
||||||
|
msgid_plural "Removed {} albums from blacklist"
|
||||||
|
msgstr[0] "Se eliminó {} álbum de la lista negra"
|
||||||
|
msgstr[1] "Se eliminaron {} álbumes de la lista negra"
|
||||||
@@ -342,24 +342,43 @@ export component AlbumPageView inherits Rectangle {
|
|||||||
overflow: elide;
|
overflow: elide;
|
||||||
}
|
}
|
||||||
Rectangle { height: 4px; }
|
Rectangle { height: 4px; }
|
||||||
|
// Full credited-artist line (E1): every contributor with its
|
||||||
|
// role (e.g. "Faust • Melnikov • Mozart (compositor)"), each
|
||||||
|
// name a clickable link to its artist page. Falls back to the
|
||||||
|
// single interpreter when the album carries no artists[] list.
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
artist-area := TouchArea {
|
for credit[idx] in AlbumState.artists: HorizontalLayout {
|
||||||
width: artist-text.preferred-width;
|
if idx > 0: Text {
|
||||||
height: artist-text.preferred-height;
|
text: " • ";
|
||||||
mouse-cursor: pointer;
|
color: Theme.text-secondary;
|
||||||
clicked => {
|
|
||||||
root.open-artist(AlbumState.artist-id);
|
|
||||||
}
|
|
||||||
artist-text := Text {
|
|
||||||
text: AlbumState.artist;
|
|
||||||
// Same color as the surrounding metadata,
|
|
||||||
// bold to read as a link.
|
|
||||||
color: artist-area.has-hover
|
|
||||||
? Theme.text-primary
|
|
||||||
: Theme.text-secondary;
|
|
||||||
font-size: Typography.heading;
|
font-size: Typography.heading;
|
||||||
font-weight: Typography.bold;
|
font-weight: Typography.bold;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
credit-area := TouchArea {
|
||||||
|
width: credit-text.preferred-width;
|
||||||
|
height: credit-text.preferred-height;
|
||||||
|
mouse-cursor: credit.id != "" ? pointer : default;
|
||||||
|
enabled: credit.id != "";
|
||||||
|
clicked => {
|
||||||
|
root.open-artist(credit.id);
|
||||||
|
}
|
||||||
|
credit-text := Text {
|
||||||
|
text: credit.name;
|
||||||
|
color: credit-area.has-hover && credit.id != ""
|
||||||
|
? Theme.text-primary
|
||||||
|
: Theme.text-secondary;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
font-weight: Typography.bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if credit.role != "": Text {
|
||||||
|
text: " (" + credit.role + ")";
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
font-weight: 400;
|
||||||
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,6 +567,7 @@ export component AlbumPageView inherits Rectangle {
|
|||||||
y: 38px;
|
y: 38px;
|
||||||
album-id: AlbumState.id;
|
album-id: AlbumState.id;
|
||||||
fully-cached: AlbumState.album-fully-cached;
|
fully-cached: AlbumState.album-fully-cached;
|
||||||
|
is-blocked: AlbumState.is-album-blocked;
|
||||||
media-action(k, i, a) => {
|
media-action(k, i, a) => {
|
||||||
root.media-action(k, i, a);
|
root.media-action(k, i, a);
|
||||||
}
|
}
|
||||||
@@ -847,14 +867,48 @@ export component AlbumPageView inherits Rectangle {
|
|||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
padding-top: 14px;
|
padding-top: 14px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
|
alignment: start;
|
||||||
Text {
|
Text {
|
||||||
text: track.work-header;
|
text: track.work-header;
|
||||||
color: Theme.text-primary;
|
color: Theme.text-primary;
|
||||||
font-size: Typography.body;
|
font-size: Typography.body;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
wrap: word-wrap;
|
vertical-alignment: center;
|
||||||
horizontal-alignment: left;
|
}
|
||||||
horizontal-stretch: 1;
|
// " (Composer)" — the composer name links to its
|
||||||
|
// artist page (E3). Hidden when the work carries
|
||||||
|
// no composer.
|
||||||
|
if track.work-composer-name != "": Text {
|
||||||
|
text: " (";
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
font-weight: 700;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
if track.work-composer-name != "": composer-ta := TouchArea {
|
||||||
|
width: composer-text.preferred-width;
|
||||||
|
height: composer-text.preferred-height;
|
||||||
|
mouse-cursor: track.work-composer-id != "" ? pointer : default;
|
||||||
|
enabled: track.work-composer-id != "";
|
||||||
|
clicked => {
|
||||||
|
root.media-action("artist", track.work-composer-id, "open");
|
||||||
|
}
|
||||||
|
composer-text := Text {
|
||||||
|
text: track.work-composer-name;
|
||||||
|
color: composer-ta.has-hover && track.work-composer-id != ""
|
||||||
|
? Theme.text-primary
|
||||||
|
: Theme.text-secondary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
font-weight: 700;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if track.work-composer-name != "": Text {
|
||||||
|
text: ")";
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
font-weight: 700;
|
||||||
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ 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 { Spacing } from "../foundation/spacing.slint";
|
import { Spacing } from "../foundation/spacing.slint";
|
||||||
import { AlbumCardItem, NavState, TooltipState } from "../state.slint";
|
import { AlbumCardItem, NavState, TooltipState, BlacklistActions } from "../state.slint";
|
||||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||||
import { QualityBadge } from "../primitives/QualityBadge.slint";
|
import { QualityBadge } from "../primitives/QualityBadge.slint";
|
||||||
import { ContextMenu } from "../primitives/ContextMenu.slint";
|
import { ContextMenu } from "../primitives/ContextMenu.slint";
|
||||||
@@ -340,7 +340,8 @@ export component AlbumCard inherits Rectangle {
|
|||||||
x: 26px;
|
x: 26px;
|
||||||
y: 56px;
|
y: 56px;
|
||||||
width: 196px;
|
width: 196px;
|
||||||
height: 142px;
|
// 6 items max (Open/Play/Play-next/Queue + favorite + block).
|
||||||
|
height: 6 * 33px + 10px;
|
||||||
ContextMenu {
|
ContextMenu {
|
||||||
ContextMenuItem {
|
ContextMenuItem {
|
||||||
icon: @image-url("../assets/icons/library-big.svg");
|
icon: @image-url("../assets/icons/library-big.svg");
|
||||||
@@ -377,6 +378,15 @@ export component AlbumCard inherits Rectangle {
|
|||||||
root.media-action("album", root.album.id, "favorite");
|
root.media-action("album", root.album.id, "favorite");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Block this album (album blacklist) — Qobuz cards only.
|
||||||
|
// One-way: a blocked album drops from the grid on reload.
|
||||||
|
if root.album.source != "local" && root.album.source != "plex": ContextMenuItem {
|
||||||
|
icon: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
label: @tr("Block this album");
|
||||||
|
clicked => {
|
||||||
|
BlacklistActions.block-album(root.album.id, root.album.title, root.album.artist, root.album.artwork-url);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,15 @@ export component AlbumContextMenu inherits PopupWindow {
|
|||||||
in property <string> album-id;
|
in property <string> album-id;
|
||||||
// Every track of the album already has a ready offline copy.
|
// Every track of the album already has a ready offline copy.
|
||||||
in property <bool> fully-cached: false;
|
in property <bool> fully-cached: false;
|
||||||
|
// Whether THIS album is on the album blacklist (drives the block toggle).
|
||||||
|
in property <bool> is-blocked: false;
|
||||||
callback media-action(string, string, string);
|
callback media-action(string, string, string);
|
||||||
|
|
||||||
width: 224px;
|
width: 224px;
|
||||||
// 7 rows x 33px + 3 separators x 1px + ContextMenu's 5/5 padding. The
|
// 8 rows x 33px + 4 separators x 1px + ContextMenu's 5/5 padding. The
|
||||||
// offline row swaps label/action on `fully-cached` — count is constant.
|
// offline row swaps label/action on `fully-cached` (count constant); the
|
||||||
height: 7 * 33px + 3 * 1px + 10px;
|
// block row swaps label/action on `is-blocked` (count constant).
|
||||||
|
height: 8 * 33px + 4 * 1px + 10px;
|
||||||
|
|
||||||
ContextMenu {
|
ContextMenu {
|
||||||
ContextMenuItem {
|
ContextMenuItem {
|
||||||
@@ -98,5 +101,23 @@ export component AlbumContextMenu inherits PopupWindow {
|
|||||||
root.media-action("album", root.album-id, "recache");
|
root.media-action("album", root.album-id, "recache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle { height: 1px; background: Theme.border-subtle; }
|
||||||
|
// Album blacklist toggle (surgical, album-id only — independent of the
|
||||||
|
// artist blacklist). Main.rs resolves the title/artist/cover from
|
||||||
|
// AlbumState (this is the open album) when blocking.
|
||||||
|
if !root.is-blocked: ContextMenuItem {
|
||||||
|
icon: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
label: @tr("Block this album");
|
||||||
|
clicked => {
|
||||||
|
root.media-action("album", root.album-id, "block");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if root.is-blocked: ContextMenuItem {
|
||||||
|
icon: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
label: @tr("Unblock album");
|
||||||
|
clicked => {
|
||||||
|
root.media-action("album", root.album-id, "unblock");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,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 { AlbumCardItem } from "../state.slint";
|
import { AlbumCardItem, BlacklistActions } from "../state.slint";
|
||||||
import { QbzIcon } from "QbzIcon.slint";
|
import { QbzIcon } from "QbzIcon.slint";
|
||||||
import { QualityBadgeFull } from "QualityBadgeFull.slint";
|
import { QualityBadgeFull } from "QualityBadgeFull.slint";
|
||||||
import { ContextMenu } from "ContextMenu.slint";
|
import { ContextMenu } from "ContextMenu.slint";
|
||||||
@@ -382,7 +382,8 @@ export component AlbumListRow inherits Rectangle {
|
|||||||
x: -170px;
|
x: -170px;
|
||||||
y: 34px;
|
y: 34px;
|
||||||
width: 196px;
|
width: 196px;
|
||||||
height: 142px;
|
// 6 items max (Open/Play/Play-next/Queue/favorite + block).
|
||||||
|
height: 6 * 33px + 10px;
|
||||||
ContextMenu {
|
ContextMenu {
|
||||||
ContextMenuItem {
|
ContextMenuItem {
|
||||||
icon: @image-url("../assets/icons/library-big.svg");
|
icon: @image-url("../assets/icons/library-big.svg");
|
||||||
@@ -423,6 +424,14 @@ export component AlbumListRow inherits Rectangle {
|
|||||||
root.media-action("album", root.album.id, "favorite");
|
root.media-action("album", root.album.id, "favorite");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Block this album (album blacklist) — Qobuz rows only.
|
||||||
|
if root.album.source != "local" && root.album.source != "plex": ContextMenuItem {
|
||||||
|
icon: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
label: @tr("Block this album");
|
||||||
|
clicked => {
|
||||||
|
BlacklistActions.block-album(root.album.id, root.album.title, root.album.artist, root.album.artwork-url);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,117 @@ component ArtistRow inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One blocked-album row (parallel to ArtistRow, with a cover thumbnail).
|
||||||
|
component AlbumRow inherits Rectangle {
|
||||||
|
in property <string> album-title;
|
||||||
|
in property <string> artist-name;
|
||||||
|
in property <string> added-display;
|
||||||
|
in property <image> cover-image;
|
||||||
|
property <bool> hovered: ta.has-hover || rm-ta.has-hover;
|
||||||
|
callback select();
|
||||||
|
callback remove();
|
||||||
|
callback hover-changed(bool);
|
||||||
|
height: 64px;
|
||||||
|
border-radius: Radius.md;
|
||||||
|
background: root.hovered ? Theme.surface-elevated : Theme.surface-card;
|
||||||
|
|
||||||
|
changed hovered => {
|
||||||
|
root.hover-changed(self.hovered);
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalLayout {
|
||||||
|
padding-left: 16px;
|
||||||
|
padding-right: 8px;
|
||||||
|
spacing: 12px;
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
horizontal-stretch: 1;
|
||||||
|
ta := TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
clicked => {
|
||||||
|
root.select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 12px;
|
||||||
|
// 48x48 cover with a blind-eye fallback (shows through until the
|
||||||
|
// network cover resolves, or when none exists).
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Rectangle {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
clip: true;
|
||||||
|
background: Theme.surface-elevated;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
|
tint: Theme.text-muted;
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
source: root.cover-image;
|
||||||
|
image-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
spacing: 2px;
|
||||||
|
Text {
|
||||||
|
text: root.album-title;
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
font-weight: Typography.medium;
|
||||||
|
overflow: elide;
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: root.artist-name;
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
overflow: elide;
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: @tr("Added {}", root.added-display);
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
overflow: elide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Rectangle {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: rm-ta.has-hover ? Theme.danger-bg : transparent;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/x.svg");
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
|
tint: rm-ta.has-hover ? Theme.danger : Theme.text-muted;
|
||||||
|
}
|
||||||
|
rm-ta := TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
clicked => {
|
||||||
|
root.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export component BlacklistManagerView inherits Rectangle {
|
export component BlacklistManagerView inherits Rectangle {
|
||||||
background: Theme.surface-main;
|
background: Theme.surface-main;
|
||||||
|
|
||||||
@@ -168,7 +279,7 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Artist Blacklist");
|
text: @tr("Blacklist");
|
||||||
color: Theme.text-primary;
|
color: Theme.text-primary;
|
||||||
font-size: Typography.section;
|
font-size: Typography.section;
|
||||||
font-weight: Typography.bold;
|
font-weight: Typography.bold;
|
||||||
@@ -176,10 +287,76 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description.
|
// Tab bar — Artists | Albums (segmented, no pills per ADR-008).
|
||||||
|
HorizontalLayout {
|
||||||
|
vertical-stretch: 0;
|
||||||
|
spacing: 0;
|
||||||
|
alignment: start;
|
||||||
|
Rectangle {
|
||||||
|
width: tabs-row.preferred-width + 8px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: Theme.surface-elevated;
|
||||||
|
tabs-row := HorizontalLayout {
|
||||||
|
x: 4px;
|
||||||
|
width: self.preferred-width;
|
||||||
|
height: 100%;
|
||||||
|
padding: 4px;
|
||||||
|
spacing: 4px;
|
||||||
|
// Artists tab.
|
||||||
|
Rectangle {
|
||||||
|
width: artists-lbl.preferred-width + 28px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: BlacklistState.active-tab == 0
|
||||||
|
? Theme.surface-card
|
||||||
|
: (artists-ta.has-hover ? Theme.surface-hover : transparent);
|
||||||
|
artists-lbl := Text {
|
||||||
|
text: @tr("Artists");
|
||||||
|
color: BlacklistState.active-tab == 0 ? Theme.text-primary : Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
font-weight: Typography.medium;
|
||||||
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
|
}
|
||||||
|
artists-ta := TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
clicked => {
|
||||||
|
BlacklistActions.set-tab(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Albums tab.
|
||||||
|
Rectangle {
|
||||||
|
width: albums-lbl.preferred-width + 28px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: BlacklistState.active-tab == 1
|
||||||
|
? Theme.surface-card
|
||||||
|
: (albums-ta.has-hover ? Theme.surface-hover : transparent);
|
||||||
|
albums-lbl := Text {
|
||||||
|
text: @tr("Albums");
|
||||||
|
color: BlacklistState.active-tab == 1 ? Theme.text-primary : Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
font-weight: Typography.medium;
|
||||||
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
|
}
|
||||||
|
albums-ta := TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
clicked => {
|
||||||
|
BlacklistActions.set-tab(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description (per tab).
|
||||||
Text {
|
Text {
|
||||||
vertical-stretch: 0;
|
vertical-stretch: 0;
|
||||||
text: @tr("Blacklisted artists are hidden from search results, radio, suggestions, and similar artists.");
|
text: BlacklistState.active-tab == 0
|
||||||
|
? @tr("Blacklisted artists are hidden from search results, radio, suggestions, and similar artists.")
|
||||||
|
: @tr("Blocked albums are hidden from search, discovery, and listings — even when their artist is allowed.");
|
||||||
color: Theme.text-muted;
|
color: Theme.text-muted;
|
||||||
font-size: Typography.body;
|
font-size: Typography.body;
|
||||||
wrap: word-wrap;
|
wrap: word-wrap;
|
||||||
@@ -295,8 +472,8 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear-All — only when there is something to clear (full count).
|
// Clear-All — only when the active tab has something to clear.
|
||||||
if BlacklistState.count > 0: Rectangle {
|
if (BlacklistState.active-tab == 0 ? BlacklistState.count : BlacklistState.album-count) > 0: Rectangle {
|
||||||
width: clear-all-row.preferred-width + 28px;
|
width: clear-all-row.preferred-width + 28px;
|
||||||
height: 34px;
|
height: 34px;
|
||||||
border-radius: Radius.sm;
|
border-radius: Radius.sm;
|
||||||
@@ -340,7 +517,9 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
Text {
|
Text {
|
||||||
text: @tr("{} artists", BlacklistState.count);
|
text: BlacklistState.active-tab == 0
|
||||||
|
? @tr("{} artists", BlacklistState.count)
|
||||||
|
: @tr("{} albums", BlacklistState.album-count);
|
||||||
color: Theme.text-muted;
|
color: Theme.text-muted;
|
||||||
font-size: Typography.legal;
|
font-size: Typography.legal;
|
||||||
horizontal-alignment: right;
|
horizontal-alignment: right;
|
||||||
@@ -401,8 +580,8 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) Empty blacklist.
|
// 2) Empty blacklist (Artists tab).
|
||||||
if !BlacklistState.loading && BlacklistState.count == 0: VerticalLayout {
|
if BlacklistState.active-tab == 0 && !BlacklistState.loading && BlacklistState.count == 0: VerticalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
spacing: 12px;
|
spacing: 12px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
@@ -434,8 +613,8 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) No search results (full list non-empty, filtered empty).
|
// 3) No search results (Artists tab; full list non-empty, filtered empty).
|
||||||
if !BlacklistState.loading && BlacklistState.count > 0 && BlacklistState.items.length == 0: VerticalLayout {
|
if BlacklistState.active-tab == 0 && !BlacklistState.loading && BlacklistState.count > 0 && BlacklistState.items.length == 0: VerticalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
spacing: 12px;
|
spacing: 12px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
@@ -461,7 +640,7 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
// 4) The list. Use Flickable + the shared custom scrollbar so the
|
// 4) The list. Use Flickable + the shared custom scrollbar so the
|
||||||
// scrollbar can reveal on list/gutter hover; std ScrollView does
|
// scrollbar can reveal on list/gutter hover; std ScrollView does
|
||||||
// not expose hover-controlled scrollbar visibility.
|
// not expose hover-controlled scrollbar visibility.
|
||||||
if !BlacklistState.loading && BlacklistState.items.length > 0: Rectangle {
|
if BlacklistState.active-tab == 0 && !BlacklistState.loading && BlacklistState.items.length > 0: Rectangle {
|
||||||
list-flick := Flickable {
|
list-flick := Flickable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -498,6 +677,103 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
hover-active: root.list-hover-rows > 0;
|
hover-active: root.list-hover-rows > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Albums tab branches -------------------------------------
|
||||||
|
// 2b) Empty (no blocked albums).
|
||||||
|
if BlacklistState.active-tab == 1 && !BlacklistState.loading && BlacklistState.album-count == 0: VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
spacing: 12px;
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/blind-eye.svg");
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
tint: Theme.text-muted;
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: @tr("No blocked albums");
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: @tr("To block an album, open its menu and choose Block this album.");
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
horizontal-alignment: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3b) No search results (albums).
|
||||||
|
if BlacklistState.active-tab == 1 && !BlacklistState.loading && BlacklistState.album-count > 0 && BlacklistState.album-items.length == 0: VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
spacing: 12px;
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/search.svg");
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
tint: Theme.text-muted;
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: @tr("No results for \"{}\"", BlacklistState.search-query);
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4b) The blocked-albums list.
|
||||||
|
if BlacklistState.active-tab == 1 && !BlacklistState.loading && BlacklistState.album-items.length > 0: Rectangle {
|
||||||
|
album-flick := Flickable {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
viewport-width: self.width;
|
||||||
|
viewport-height: album-content.preferred-height;
|
||||||
|
album-content := VerticalLayout {
|
||||||
|
width: parent.width - 18px;
|
||||||
|
spacing: 4px;
|
||||||
|
for item in BlacklistState.album-items: AlbumRow {
|
||||||
|
album-title: item.album-title;
|
||||||
|
artist-name: item.artist-name;
|
||||||
|
added-display: item.added-display;
|
||||||
|
cover-image: item.cover;
|
||||||
|
select => {
|
||||||
|
BlacklistActions.album-select(item.album-id);
|
||||||
|
}
|
||||||
|
remove => {
|
||||||
|
BlacklistActions.remove-album(item.album-id);
|
||||||
|
}
|
||||||
|
hover-changed(h) => {
|
||||||
|
root.list-hover-rows = h ? root.list-hover-rows + 1 : Math.max(0, root.list-hover-rows - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ListScrollbar {
|
||||||
|
x: parent.width - self.width - 4px;
|
||||||
|
width: 14px;
|
||||||
|
height: 100%;
|
||||||
|
viewport-height: album-flick.viewport-height;
|
||||||
|
visible-height: album-flick.height;
|
||||||
|
viewport-y <=> album-flick.viewport-y;
|
||||||
|
auto-hide: true;
|
||||||
|
hover-active: root.list-hover-rows > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +828,9 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
font-weight: Typography.semibold;
|
font-weight: Typography.semibold;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: @tr("This will remove all {} blacklisted artists. This cannot be undone.", BlacklistState.count);
|
text: BlacklistState.active-tab == 0
|
||||||
|
? @tr("This will remove all {} blacklisted artists. This cannot be undone.", BlacklistState.count)
|
||||||
|
: @tr("This will remove all {} blocked albums. This cannot be undone.", BlacklistState.album-count);
|
||||||
color: Theme.text-secondary;
|
color: Theme.text-secondary;
|
||||||
font-size: Typography.body;
|
font-size: Typography.body;
|
||||||
wrap: word-wrap;
|
wrap: word-wrap;
|
||||||
@@ -608,7 +886,11 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
danger-ta := TouchArea {
|
danger-ta := TouchArea {
|
||||||
mouse-cursor: pointer;
|
mouse-cursor: pointer;
|
||||||
clicked => {
|
clicked => {
|
||||||
BlacklistActions.clear-all();
|
if (BlacklistState.active-tab == 0) {
|
||||||
|
BlacklistActions.clear-all();
|
||||||
|
} else {
|
||||||
|
BlacklistActions.clear-all-albums();
|
||||||
|
}
|
||||||
root.confirm-clear-open = false;
|
root.confirm-clear-open = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,16 +86,16 @@ export component ContentFilteringSettings inherits VerticalLayout {
|
|||||||
alignment: center;
|
alignment: center;
|
||||||
spacing: 3px;
|
spacing: 3px;
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Artist Blacklist");
|
text: @tr("Blacklist");
|
||||||
color: Theme.text-primary;
|
color: Theme.text-primary;
|
||||||
font-size: Typography.body;
|
font-size: Typography.body;
|
||||||
font-weight: Typography.medium;
|
font-weight: Typography.medium;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
// "{count} artist(s) blocked" + "(disabled)" suffix when off.
|
// "{n} artists, {m} albums blocked" + "(disabled)" when off.
|
||||||
text: BlacklistState.enabled
|
text: BlacklistState.enabled
|
||||||
? @tr("{} artist(s) blocked", BlacklistState.count)
|
? @tr("{} artists, {} albums blocked", BlacklistState.count, BlacklistState.album-count)
|
||||||
: @tr("{} artist(s) blocked (disabled)", BlacklistState.count);
|
: @tr("{} artists, {} albums blocked (disabled)", BlacklistState.count, BlacklistState.album-count);
|
||||||
color: Theme.text-muted;
|
color: Theme.text-muted;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -503,15 +503,38 @@ export struct TrackItem {
|
|||||||
// track render flat, with no header). Mirrors the official Qobuz player's
|
// track render flat, with no header). Mirrors the official Qobuz player's
|
||||||
// per-work sections (PR #536); the album view stamps it, all other track
|
// per-work sections (PR #536); the album view stamps it, all other track
|
||||||
// surfaces leave it "" so the row stays flat.
|
// surfaces leave it "" so the row stays flat.
|
||||||
|
//
|
||||||
|
// E3: `work-header` now holds the work TITLE only; the composer is split
|
||||||
|
// out below so its name can be a clickable link to the artist page.
|
||||||
work-header: string,
|
work-header: string,
|
||||||
|
// Classical work composer (E3): rendered as a clickable artist link inside
|
||||||
|
// the work header's parentheses. work-composer-id "" => plain (no link),
|
||||||
|
// and an empty name => no parenthetical at all. Set only on the work
|
||||||
|
// header's leading row, by the album view; "" everywhere else.
|
||||||
|
work-composer-name: string,
|
||||||
|
work-composer-id: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Album detail screen state.
|
// Album detail screen state.
|
||||||
|
// One credited album artist for the header credit line (E1: full
|
||||||
|
// "Artist • Pianist • Composer (compositor)" list, not just the interpreter).
|
||||||
|
export struct ArtistCredit {
|
||||||
|
// Qobuz artist id as a string (clickable → artist page). "" = not clickable.
|
||||||
|
id: string,
|
||||||
|
name: string,
|
||||||
|
// Localized role suffix shown in parens (e.g. "compositor"); "" for the
|
||||||
|
// main artist(s).
|
||||||
|
role: string,
|
||||||
|
}
|
||||||
|
|
||||||
export global AlbumState {
|
export global AlbumState {
|
||||||
in property <string> id;
|
in property <string> id;
|
||||||
in property <string> title;
|
in property <string> title;
|
||||||
|
// Primary interpreter (kept for back-compat: now-playing, fallbacks).
|
||||||
in property <string> artist;
|
in property <string> artist;
|
||||||
in property <string> artist-id;
|
in property <string> artist-id;
|
||||||
|
// Full credited-artist list with roles for the header credit line.
|
||||||
|
in property <[ArtistCredit]> artists: [];
|
||||||
// Network URL of the cover — used by the artwork right-click
|
// Network URL of the cover — used by the artwork right-click
|
||||||
// menu for Open-in-browser and Save-as actions.
|
// menu for Open-in-browser and Save-as actions.
|
||||||
in property <string> artwork-url;
|
in property <string> artwork-url;
|
||||||
@@ -556,6 +579,9 @@ export global AlbumState {
|
|||||||
in property <bool> is-favorite: false;
|
in property <bool> is-favorite: false;
|
||||||
// True while a favorite toggle is in flight (spinner on the heart).
|
// True while a favorite toggle is in flight (spinner on the heart).
|
||||||
in property <bool> favorite-loading: false;
|
in property <bool> favorite-loading: false;
|
||||||
|
// Whether THIS album is blocked (album blacklist). Drives the header menu
|
||||||
|
// toggle ("Block this album" / "Unblock album"). Seeded on open.
|
||||||
|
in property <bool> is-album-blocked: false;
|
||||||
// Multi-select (track selection) mode for the track list. in-out: the
|
// Multi-select (track selection) mode for the track list. in-out: the
|
||||||
// toolbar toggle flips it from the UI; Rust resets it on album change.
|
// toolbar toggle flips it from the UI; Rust resets it on album change.
|
||||||
in-out property <bool> multi-select: false;
|
in-out property <bool> multi-select: false;
|
||||||
@@ -2183,10 +2209,25 @@ export struct BlacklistedArtistItem {
|
|||||||
has-notes: bool,
|
has-notes: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export struct BlacklistedAlbumItem {
|
||||||
|
// Qobuz album id is a STRING (alphanumeric), unlike the artist int id.
|
||||||
|
album-id: string,
|
||||||
|
album-title: string,
|
||||||
|
artist-name: string,
|
||||||
|
// Network cover URL; resolved to `cover` by the artwork pipeline.
|
||||||
|
cover-url: string,
|
||||||
|
cover: image,
|
||||||
|
added-at: int,
|
||||||
|
added-display: string,
|
||||||
|
notes: string,
|
||||||
|
has-notes: bool,
|
||||||
|
}
|
||||||
|
|
||||||
export global BlacklistState {
|
export global BlacklistState {
|
||||||
// The CURRENTLY-VISIBLE rows (already search-filtered by the controller).
|
// The CURRENTLY-VISIBLE rows (already search-filtered by the controller).
|
||||||
in property <[BlacklistedArtistItem]> items: [];
|
in property <[BlacklistedArtistItem]> items: [];
|
||||||
// Global enable flag (default-enabled, mirrors the backend default).
|
// Global enable flag (default-enabled, mirrors the backend default).
|
||||||
|
// Shared by both axes (artists + albums).
|
||||||
in property <bool> enabled: true;
|
in property <bool> enabled: true;
|
||||||
in property <bool> loading: true;
|
in property <bool> loading: true;
|
||||||
// FULL list count (NOT the filtered length) — drives the count badge and
|
// FULL list count (NOT the filtered length) — drives the count badge and
|
||||||
@@ -2196,6 +2237,13 @@ export global BlacklistState {
|
|||||||
// Echoed back so the search input reflects the controller's query (and the
|
// Echoed back so the search input reflects the controller's query (and the
|
||||||
// no-results message can interpolate it).
|
// no-results message can interpolate it).
|
||||||
in property <string> search-query: "";
|
in property <string> search-query: "";
|
||||||
|
|
||||||
|
// --- Album axis (parallel String-keyed list, shown under the Albums tab) ---
|
||||||
|
in property <[BlacklistedAlbumItem]> album-items: [];
|
||||||
|
// FULL blocked-album count (drives the Albums tab badge + empty state).
|
||||||
|
in property <int> album-count: 0;
|
||||||
|
// Active manager tab: 0 = Artists, 1 = Albums.
|
||||||
|
in property <int> active-tab: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export global BlacklistActions {
|
export global BlacklistActions {
|
||||||
@@ -2209,6 +2257,14 @@ export global BlacklistActions {
|
|||||||
callback remove(int /* artist id */);
|
callback remove(int /* artist id */);
|
||||||
callback clear-all();
|
callback clear-all();
|
||||||
callback search-changed(string /* query */);
|
callback search-changed(string /* query */);
|
||||||
|
|
||||||
|
// --- Album axis ---
|
||||||
|
callback set-tab(int /* 0=artists, 1=albums */);
|
||||||
|
callback album-select(string /* album id */);
|
||||||
|
callback remove-album(string /* album id */);
|
||||||
|
callback clear-all-albums();
|
||||||
|
// Block an album from a context menu (id + display fields for the manager).
|
||||||
|
callback block-album(string /* id */, string /* title */, string /* artist */, string /* cover-url */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// === My QBZ — Mixtapes & Collections (read-only index grids) ============
|
// === My QBZ — Mixtapes & Collections (read-only index grids) ============
|
||||||
|
|||||||
+103
-21
@@ -13,7 +13,7 @@ use qbz_models::{Album, Track};
|
|||||||
use slint::{ComponentHandle, Model, ModelRc, VecModel};
|
use slint::{ComponentHandle, Model, ModelRc, VecModel};
|
||||||
|
|
||||||
use crate::artwork::{ArtworkJob, ArtworkTarget};
|
use crate::artwork::{ArtworkJob, ArtworkTarget};
|
||||||
use crate::{AlbumCardItem, AlbumState, AppWindow, DiscoverSection, TrackItem};
|
use crate::{AlbumCardItem, AlbumState, AppWindow, ArtistCredit, DiscoverSection, TrackItem};
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
/// The current album's full, unfiltered track list — kept so the
|
/// The current album's full, unfiltered track list — kept so the
|
||||||
@@ -27,12 +27,23 @@ thread_local! {
|
|||||||
static PLAY_TRACKS: RefCell<Vec<Track>> = RefCell::new(Vec::new());
|
static PLAY_TRACKS: RefCell<Vec<Track>> = RefCell::new(Vec::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// One credited album artist for the header credit line (E1). Plain/`Send`.
|
||||||
|
pub struct ArtistCreditData {
|
||||||
|
pub id: String,
|
||||||
|
pub name: String,
|
||||||
|
/// Localized role suffix ("" for the main artist(s)).
|
||||||
|
pub role: String,
|
||||||
|
}
|
||||||
|
|
||||||
/// Plain, `Send` album data produced on the worker thread.
|
/// Plain, `Send` album data produced on the worker thread.
|
||||||
pub struct AlbumData {
|
pub struct AlbumData {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
/// Primary interpreter (back-compat: now-playing, fallbacks).
|
||||||
pub artist: String,
|
pub artist: String,
|
||||||
pub artist_id: String,
|
pub artist_id: String,
|
||||||
|
/// Full credited-artist list with roles for the header credit line.
|
||||||
|
pub artists: Vec<ArtistCreditData>,
|
||||||
/// Pre-formatted "year • label • genre • N tracks • duration".
|
/// Pre-formatted "year • label • genre • N tracks • duration".
|
||||||
pub info_line: String,
|
pub info_line: String,
|
||||||
/// Meta-line segment BEFORE the label (the year) — rendered with the
|
/// Meta-line segment BEFORE the label (the year) — rendered with the
|
||||||
@@ -90,10 +101,16 @@ pub struct TrackData {
|
|||||||
/// Used after mapping to decide where the "Disc N" headers fall when the
|
/// Used after mapping to decide where the "Disc N" headers fall when the
|
||||||
/// album spans more than one disc.
|
/// album spans more than one disc.
|
||||||
pub disc: u32,
|
pub disc: u32,
|
||||||
/// Pre-formatted classical work-section header (e.g. "Symphony No. 9
|
/// Classical work TITLE (e.g. "Symphony No. 9"), or "" when the track
|
||||||
/// (Beethoven)"), or "" when the track carries no `work` metadata. Used
|
/// carries no `work` metadata. Used after mapping to run-length stamp the
|
||||||
/// after mapping to run-length stamp the per-work headers (PR #536).
|
/// per-work headers (PR #536). E3: the composer is split out below so the
|
||||||
|
/// view can render its name as a clickable artist link.
|
||||||
pub work: String,
|
pub work: String,
|
||||||
|
/// Work composer display name ("" when none); shown in the work header's
|
||||||
|
/// parentheses as a link.
|
||||||
|
pub work_composer_name: String,
|
||||||
|
/// Work composer artist id ("" => the name renders as plain text).
|
||||||
|
pub work_composer_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch and map a full album by id.
|
/// Fetch and map a full album by id.
|
||||||
@@ -126,9 +143,44 @@ fn format_release_date(iso: Option<&str>) -> String {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Localized role suffix for a credit (E1). "" for the main artist (no suffix);
|
||||||
|
/// otherwise the first non-`main-artist` role, localized (e.g. "compositor").
|
||||||
|
fn credit_role(roles: Option<&Vec<String>>) -> String {
|
||||||
|
let Some(roles) = roles else {
|
||||||
|
return String::new();
|
||||||
|
};
|
||||||
|
roles
|
||||||
|
.iter()
|
||||||
|
.find(|r| r.as_str() != "main-artist")
|
||||||
|
.map(|r| qbz_i18n::t(&qbz_qobuz::performers::format_role_label(r)))
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Build the header credit line (E1): every credited artist with its role,
|
||||||
|
/// falling back to the single primary interpreter when the album carries no
|
||||||
|
/// `artists[]` array (some V2/discover shapes).
|
||||||
|
fn build_credits(album: &Album) -> Vec<ArtistCreditData> {
|
||||||
|
match album.artists.as_ref().filter(|v| !v.is_empty()) {
|
||||||
|
Some(list) => list
|
||||||
|
.iter()
|
||||||
|
.map(|a| ArtistCreditData {
|
||||||
|
id: a.id.to_string(),
|
||||||
|
name: a.name.clone(),
|
||||||
|
role: credit_role(a.roles.as_ref()),
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
None => vec![ArtistCreditData {
|
||||||
|
id: album.artist.id.to_string(),
|
||||||
|
name: album.artist.name.clone(),
|
||||||
|
role: String::new(),
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn map_album(album: Album) -> AlbumData {
|
fn map_album(album: Album) -> AlbumData {
|
||||||
let artist = album.artist.name.clone();
|
let artist = album.artist.name.clone();
|
||||||
let artist_id = album.artist.id.to_string();
|
let artist_id = album.artist.id.to_string();
|
||||||
|
let artists = build_credits(&album);
|
||||||
|
|
||||||
// Full readable release date ("Feb 19, 2026"); was year-only before.
|
// Full readable release date ("Feb 19, 2026"); was year-only before.
|
||||||
// Prefer the flat ISO field, fall back to the nested V2 `dates.original`.
|
// Prefer the flat ISO field, fall back to the nested V2 `dates.original`.
|
||||||
@@ -255,6 +307,7 @@ fn map_album(album: Album) -> AlbumData {
|
|||||||
title: album.title,
|
title: album.title,
|
||||||
artist,
|
artist,
|
||||||
artist_id,
|
artist_id,
|
||||||
|
artists,
|
||||||
info_line,
|
info_line,
|
||||||
meta_pre,
|
meta_pre,
|
||||||
meta_post,
|
meta_post,
|
||||||
@@ -302,23 +355,28 @@ fn truncate_words(text: &str, max: usize) -> String {
|
|||||||
// improvements.
|
// improvements.
|
||||||
|
|
||||||
fn map_track(track: Track) -> TrackData {
|
fn map_track(track: Track) -> TrackData {
|
||||||
// Classical work-section header, built before `title`/`performer` are moved
|
// Classical work metadata, read before `title`/`performer` are moved out of
|
||||||
// out of `track`. Qobuz serves `work` on the track (null for non-classical)
|
// `track`. Qobuz serves `work` on the track (null for non-classical) and a
|
||||||
// and a `composer` artist; the official player renders the work title with
|
// `composer` artist; the official player renders the work title with the
|
||||||
// the composer parenthesized (PR #536). "" when there is no work.
|
// composer parenthesized AND the composer name is a link to the artist page
|
||||||
let work = match track.work.as_ref().filter(|w| !w.is_empty()) {
|
// (PR #536 + E3). `work` holds the TITLE only (for run-length grouping); the
|
||||||
Some(w) => {
|
// composer name + id are carried separately so the view can make the name a
|
||||||
let composer = track
|
// clickable link. All "" when there is no work.
|
||||||
.composer
|
let work = track
|
||||||
.as_ref()
|
.work
|
||||||
.map(|c| c.name.as_str())
|
.as_ref()
|
||||||
.filter(|n| !n.is_empty());
|
.filter(|w| !w.is_empty())
|
||||||
match composer {
|
.cloned()
|
||||||
Some(c) => format!("{w} ({c})"),
|
.unwrap_or_default();
|
||||||
None => w.clone(),
|
let (work_composer_name, work_composer_id) = if work.is_empty() {
|
||||||
}
|
(String::new(), String::new())
|
||||||
}
|
} else {
|
||||||
None => String::new(),
|
track
|
||||||
|
.composer
|
||||||
|
.as_ref()
|
||||||
|
.filter(|c| !c.name.is_empty())
|
||||||
|
.map(|c| (c.name.clone(), c.id.to_string()))
|
||||||
|
.unwrap_or_default()
|
||||||
};
|
};
|
||||||
let mut title = track.title;
|
let mut title = track.title;
|
||||||
if let Some(version) = track.version.as_ref().filter(|v| !v.is_empty()) {
|
if let Some(version) = track.version.as_ref().filter(|v| !v.is_empty()) {
|
||||||
@@ -346,6 +404,8 @@ fn map_track(track: Track) -> TrackData {
|
|||||||
// Tauri: `disc = track.media_number ?? 1`.
|
// Tauri: `disc = track.media_number ?? 1`.
|
||||||
disc: track.media_number.unwrap_or(1),
|
disc: track.media_number.unwrap_or(1),
|
||||||
work,
|
work,
|
||||||
|
work_composer_name,
|
||||||
|
work_composer_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +490,15 @@ pub fn apply_album(window: &AppWindow, data: AlbumData) {
|
|||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
};
|
};
|
||||||
|
// Composer (name + id) accompanies the header only on its leading row.
|
||||||
|
let (work_composer_name, work_composer_id) = if work_header.is_empty() {
|
||||||
|
(String::new(), String::new())
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
track.work_composer_name.clone(),
|
||||||
|
track.work_composer_id.clone(),
|
||||||
|
)
|
||||||
|
};
|
||||||
prev_work = if track.work.is_empty() {
|
prev_work = if track.work.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
@@ -478,6 +547,8 @@ pub fn apply_album(window: &AppWindow, data: AlbumData) {
|
|||||||
unlocking: false,
|
unlocking: false,
|
||||||
disc_header_number,
|
disc_header_number,
|
||||||
work_header: work_header.into(),
|
work_header: work_header.into(),
|
||||||
|
work_composer_name: work_composer_name.into(),
|
||||||
|
work_composer_id: work_composer_id.into(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@@ -505,6 +576,16 @@ pub fn apply_album(window: &AppWindow, data: AlbumData) {
|
|||||||
state.set_has_custom_cover(has_custom_cover);
|
state.set_has_custom_cover(has_custom_cover);
|
||||||
state.set_artist(data.artist.into());
|
state.set_artist(data.artist.into());
|
||||||
state.set_artist_id(data.artist_id.into());
|
state.set_artist_id(data.artist_id.into());
|
||||||
|
let credits: Vec<ArtistCredit> = data
|
||||||
|
.artists
|
||||||
|
.into_iter()
|
||||||
|
.map(|c| ArtistCredit {
|
||||||
|
id: c.id.into(),
|
||||||
|
name: c.name.into(),
|
||||||
|
role: c.role.into(),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
state.set_artists(ModelRc::new(VecModel::from(credits)));
|
||||||
state.set_info_line(data.info_line.into());
|
state.set_info_line(data.info_line.into());
|
||||||
state.set_meta_pre(data.meta_pre.into());
|
state.set_meta_pre(data.meta_pre.into());
|
||||||
state.set_meta_post(data.meta_post.into());
|
state.set_meta_post(data.meta_post.into());
|
||||||
@@ -559,6 +640,7 @@ pub fn apply_album(window: &AppWindow, data: AlbumData) {
|
|||||||
// Seed the header heart from the favorite-album cache (kept in sync with
|
// Seed the header heart from the favorite-album cache (kept in sync with
|
||||||
// the server at login + on every toggle).
|
// the server at login + on every toggle).
|
||||||
state.set_is_favorite(crate::fav_cache::is_album_favorite(album_id.as_str()));
|
state.set_is_favorite(crate::fav_cache::is_album_favorite(album_id.as_str()));
|
||||||
|
state.set_is_album_blocked(crate::artist_blacklist::is_album_blacklisted(album_id.as_str()));
|
||||||
state.set_favorite_loading(false);
|
state.set_favorite_loading(false);
|
||||||
|
|
||||||
// Keep the unfiltered list for the track search + the raw tracks for the
|
// Keep the unfiltered list for the track search + the raw tracks for the
|
||||||
|
|||||||
@@ -492,8 +492,10 @@ fn map_track(index: usize, track: PageArtistTrack) -> TrackData {
|
|||||||
// "Disc N" headers, so the disc value is unused here — default to 1.
|
// "Disc N" headers, so the disc value is unused here — default to 1.
|
||||||
disc: 1,
|
disc: 1,
|
||||||
// Work-section headers are album-view only; the flat artist list never
|
// Work-section headers are album-view only; the flat artist list never
|
||||||
// renders them, so leave it empty.
|
// renders them, so leave them empty.
|
||||||
work: String::new(),
|
work: String::new(),
|
||||||
|
work_composer_name: String::new(),
|
||||||
|
work_composer_id: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,6 +646,8 @@ fn track_data_to_item(track: TrackData) -> TrackItem {
|
|||||||
unlocking: false,
|
unlocking: false,
|
||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ pub enum ArtworkTarget {
|
|||||||
/// targets a section row. Mirrors `CortinillaRow` but writes the immersive
|
/// targets a section row. Mirrors `CortinillaRow` but writes the immersive
|
||||||
/// global instead of `SearchState`.
|
/// global instead of `SearchState`.
|
||||||
ImmersiveSearchRow { flat_index: usize },
|
ImmersiveSearchRow { flat_index: usize },
|
||||||
|
/// A blocked-album row cover in `BlacklistState.album-items[idx]` (the
|
||||||
|
/// Blacklist Manager Albums tab).
|
||||||
|
BlacklistAlbum { idx: usize },
|
||||||
/// A release card in `ArtistState.release-sections[section_idx]
|
/// A release card in `ArtistState.release-sections[section_idx]
|
||||||
/// .albums[album_idx]`.
|
/// .albums[album_idx]`.
|
||||||
ArtistRelease { section_idx: usize, album_idx: usize },
|
ArtistRelease { section_idx: usize, album_idx: usize },
|
||||||
@@ -820,6 +823,13 @@ fn apply_artwork(
|
|||||||
model.set_row_data(idx, item);
|
model.set_row_data(idx, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ArtworkTarget::BlacklistAlbum { idx } => {
|
||||||
|
let model = window.global::<crate::BlacklistState>().get_album_items();
|
||||||
|
if let Some(mut item) = model.row_data(idx) {
|
||||||
|
item.cover = image;
|
||||||
|
model.set_row_data(idx, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
ArtworkTarget::SearchTrack { idx } => {
|
ArtworkTarget::SearchTrack { idx } => {
|
||||||
let model = window.global::<SearchState>().get_tracks();
|
let model = window.global::<SearchState>().get_tracks();
|
||||||
if let Some(mut item) = model.row_data(idx) {
|
if let Some(mut item) = model.row_data(idx) {
|
||||||
|
|||||||
@@ -23,11 +23,22 @@
|
|||||||
//! toasts being `format!` English).
|
//! toasts being `format!` English).
|
||||||
|
|
||||||
use std::sync::Mutex as StdMutex;
|
use std::sync::Mutex as StdMutex;
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
|
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
|
||||||
|
|
||||||
use crate::{AppWindow, BlacklistState, BlacklistedArtistItem};
|
use crate::artwork::{ArtworkJob, ArtworkTarget, ImageCache};
|
||||||
|
use crate::{AppWindow, BlacklistState, BlacklistedAlbumItem, BlacklistedArtistItem};
|
||||||
|
|
||||||
|
/// Shared image cache for resolving blocked-album cover thumbnails (the artist
|
||||||
|
/// tab has no covers; the album tab does). Set once during startup wiring.
|
||||||
|
static IMAGE_CACHE: OnceLock<ImageCache> = OnceLock::new();
|
||||||
|
|
||||||
|
/// Store the shared image cache for album-cover resolution (idempotent).
|
||||||
|
pub fn set_image_cache(cache: ImageCache) {
|
||||||
|
let _ = IMAGE_CACHE.set(cache);
|
||||||
|
}
|
||||||
|
|
||||||
/// The live search query (Rust-side source of truth). The view echoes it back
|
/// The live search query (Rust-side source of truth). The view echoes it back
|
||||||
/// from `BlacklistState.search-query`; this is what `refilter` reads so a
|
/// from `BlacklistState.search-query`; this is what `refilter` reads so a
|
||||||
@@ -82,14 +93,68 @@ fn build_items() -> (Vec<BlacklistedArtistItem>, i32) {
|
|||||||
(items, count)
|
(items, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Push the filtered items + full count + enabled flag + query into Slint.
|
/// Build the visible (filtered) blocked-album items from the full title-sorted
|
||||||
|
/// snapshot, applying the current query (matches album title OR artist name).
|
||||||
|
/// Also returns the cover-load jobs for rows that carry a cover URL (resolved
|
||||||
|
/// async; rows render the blind-eye fallback until the image lands).
|
||||||
|
fn build_album_items() -> (Vec<BlacklistedAlbumItem>, i32, Vec<ArtworkJob>) {
|
||||||
|
let all = crate::artist_blacklist::get_all_albums();
|
||||||
|
let count = all.len() as i32;
|
||||||
|
let query = current_query();
|
||||||
|
let needle = query.trim().to_lowercase();
|
||||||
|
|
||||||
|
let mut jobs: Vec<ArtworkJob> = Vec::new();
|
||||||
|
let items: Vec<BlacklistedAlbumItem> = all
|
||||||
|
.into_iter()
|
||||||
|
.filter(|a| {
|
||||||
|
needle.is_empty()
|
||||||
|
|| a.album_title.to_lowercase().contains(&needle)
|
||||||
|
|| a.artist_name.to_lowercase().contains(&needle)
|
||||||
|
})
|
||||||
|
.enumerate()
|
||||||
|
.map(|(idx, a)| {
|
||||||
|
let notes = a.notes.clone().unwrap_or_default();
|
||||||
|
if !a.cover_url.is_empty() {
|
||||||
|
jobs.push(ArtworkJob {
|
||||||
|
url: a.cover_url.clone(),
|
||||||
|
target: ArtworkTarget::BlacklistAlbum { idx },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
BlacklistedAlbumItem {
|
||||||
|
album_id: a.album_id.into(),
|
||||||
|
album_title: a.album_title.into(),
|
||||||
|
artist_name: a.artist_name.into(),
|
||||||
|
cover_url: a.cover_url.into(),
|
||||||
|
cover: slint::Image::default(),
|
||||||
|
added_at: a.added_at as i32,
|
||||||
|
added_display: format_added(a.added_at).into(),
|
||||||
|
has_notes: !notes.is_empty(),
|
||||||
|
notes: notes.into(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
(items, count, jobs)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Push the filtered items + full count + enabled flag + query into Slint (both
|
||||||
|
/// axes). Album covers resolve asynchronously via the shared image cache.
|
||||||
fn push(w: &AppWindow) {
|
fn push(w: &AppWindow) {
|
||||||
let (items, count) = build_items();
|
let (items, count) = build_items();
|
||||||
|
let (album_items, album_count, jobs) = build_album_items();
|
||||||
let st = w.global::<BlacklistState>();
|
let st = w.global::<BlacklistState>();
|
||||||
st.set_items(ModelRc::new(VecModel::from(items)));
|
st.set_items(ModelRc::new(VecModel::from(items)));
|
||||||
st.set_count(count);
|
st.set_count(count);
|
||||||
|
st.set_album_items(ModelRc::new(VecModel::from(album_items)));
|
||||||
|
st.set_album_count(album_count);
|
||||||
st.set_enabled(crate::artist_blacklist::is_enabled());
|
st.set_enabled(crate::artist_blacklist::is_enabled());
|
||||||
st.set_search_query(SharedString::from(current_query()));
|
st.set_search_query(SharedString::from(current_query()));
|
||||||
|
// Kick off cover loads (best-effort; needs the cache + a weak handle).
|
||||||
|
if let Some(cache) = IMAGE_CACHE.get() {
|
||||||
|
if !jobs.is_empty() {
|
||||||
|
crate::artwork::spawn_loads(jobs, w.as_weak(), cache.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Load (or refresh) the manager: mark loading, read the store, push state,
|
/// Load (or refresh) the manager: mark loading, read the store, push state,
|
||||||
@@ -168,3 +233,73 @@ pub fn clear_all(w: &AppWindow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Album axis actions -------------------------------------------------
|
||||||
|
|
||||||
|
/// Switch the manager's active tab (0 = Artists, 1 = Albums).
|
||||||
|
pub fn set_tab(w: &AppWindow, tab: i32) {
|
||||||
|
w.global::<BlacklistState>().set_active_tab(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Block an album from a context menu (grid card / list row). Adds it and
|
||||||
|
/// re-pushes the manager state + count badges; the source grid drops the card
|
||||||
|
/// on its next navigation (no global observer — the artist-block convention).
|
||||||
|
pub fn block_album(w: &AppWindow, id: String, title: String, artist: String, cover: String) {
|
||||||
|
if id.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
match crate::artist_blacklist::add_album(&id, &title, &artist, &cover, None) {
|
||||||
|
Ok(()) => {
|
||||||
|
// If the blocked album is the one currently open, reflect the header
|
||||||
|
// toggle immediately.
|
||||||
|
let album_st = w.global::<crate::AlbumState>();
|
||||||
|
if album_st.get_id().as_str() == id {
|
||||||
|
album_st.set_is_album_blocked(true);
|
||||||
|
}
|
||||||
|
push(w);
|
||||||
|
crate::toast::success(w, qbz_i18n::t_args("Album \"{}\" blocked", &[&title]));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("[qbz-slint] album block failed: {e}");
|
||||||
|
crate::toast::error(w, qbz_i18n::t("Failed to block album"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove one album from the blacklist (optimistic re-push) + toast.
|
||||||
|
pub fn remove_album(w: &AppWindow, album_id: String) {
|
||||||
|
let title = crate::artist_blacklist::get_all_albums()
|
||||||
|
.into_iter()
|
||||||
|
.find(|a| a.album_id == album_id)
|
||||||
|
.map(|a| a.album_title)
|
||||||
|
.unwrap_or_else(|| qbz_i18n::t("Album"));
|
||||||
|
match crate::artist_blacklist::remove_album(&album_id) {
|
||||||
|
Ok(()) => {
|
||||||
|
let album_st = w.global::<crate::AlbumState>();
|
||||||
|
if album_st.get_id().as_str() == album_id {
|
||||||
|
album_st.set_is_album_blocked(false);
|
||||||
|
}
|
||||||
|
push(w);
|
||||||
|
crate::toast::success(w, qbz_i18n::t_args("Album \"{}\" unblocked", &[&title]));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("[qbz-slint] album remove failed: {e}");
|
||||||
|
crate::toast::error(w, qbz_i18n::t("Failed to unblock album"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clear every blocked album + toast (count captured before).
|
||||||
|
pub fn clear_all_albums(w: &AppWindow) {
|
||||||
|
let count = crate::artist_blacklist::album_count();
|
||||||
|
match crate::artist_blacklist::clear_all_albums() {
|
||||||
|
Ok(()) => {
|
||||||
|
push(w);
|
||||||
|
crate::toast::success(w, qbz_i18n::tf("Removed {} album from blacklist", "Removed {} albums from blacklist", count as i64, &[&count.to_string()]));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("[qbz-slint] album clear-all failed: {e}");
|
||||||
|
crate::toast::error(w, qbz_i18n::t("Failed to clear album blacklist"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -504,6 +504,8 @@ pub fn apply_favorites(window: &AppWindow, data: FavData) {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
// `tracks` is the full set the artwork pipeline targets;
|
// `tracks` is the full set the artwork pipeline targets;
|
||||||
|
|||||||
@@ -901,6 +901,8 @@ fn top_track_to_item(t: &TopTrack) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -791,6 +791,8 @@ fn map_local_track(t: qbz_library::LocalTrack) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -980,6 +980,8 @@ fn row_item(item: &RowItem, queue: Option<&QueueTrack>) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
},
|
},
|
||||||
RowItem::Local(track) | RowItem::Plex(track) => {
|
RowItem::Local(track) | RowItem::Plex(track) => {
|
||||||
let (tier, quality_detail, _) = crate::quality::badge(
|
let (tier, quality_detail, _) = crate::quality::badge(
|
||||||
@@ -1025,6 +1027,8 @@ fn row_item(item: &RowItem, queue: Option<&QueueTrack>) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowItem::LocalFile { path } => {
|
RowItem::LocalFile { path } => {
|
||||||
@@ -1059,6 +1063,8 @@ fn row_item(item: &RowItem, queue: Option<&QueueTrack>) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Honest unavailable row: distinct title + the raw stored ref in
|
// Honest unavailable row: distinct title + the raw stored ref in
|
||||||
@@ -1109,6 +1115,8 @@ fn row_item(item: &RowItem, queue: Option<&QueueTrack>) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ fn seed_tray_appearance(w: &AppWindow, tray: &tray_settings::TraySettings) {
|
|||||||
fn seed_blacklist_status(w: &AppWindow) {
|
fn seed_blacklist_status(w: &AppWindow) {
|
||||||
let st = w.global::<BlacklistState>();
|
let st = w.global::<BlacklistState>();
|
||||||
st.set_count(crate::artist_blacklist::count() as i32);
|
st.set_count(crate::artist_blacklist::count() as i32);
|
||||||
|
st.set_album_count(crate::artist_blacklist::album_count() as i32);
|
||||||
st.set_enabled(crate::artist_blacklist::is_enabled());
|
st.set_enabled(crate::artist_blacklist::is_enabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4439,6 +4440,8 @@ fn wire_myqbz_detail(
|
|||||||
// `myqbz_detail::navigate` (whose resolveItems pass needs it) without
|
// `myqbz_detail::navigate` (whose resolveItems pass needs it) without
|
||||||
// threading it through every entry point.
|
// threading it through every entry point.
|
||||||
myqbz_detail::set_runtime(app_runtime.clone());
|
myqbz_detail::set_runtime(app_runtime.clone());
|
||||||
|
// Blacklist Manager album-cover resolution needs the shared image cache.
|
||||||
|
blacklist_manager::set_image_cache(image_cache.clone());
|
||||||
|
|
||||||
// After a toolbar re-derive the rendered model changed, so the visible
|
// After a toolbar re-derive the rendered model changed, so the visible
|
||||||
// rows need their thumbnails reloaded — through the SOURCE-SPLIT dispatch
|
// rows need their thumbnails reloaded — through the SOURCE-SPLIT dispatch
|
||||||
@@ -8903,6 +8906,57 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
("album", "block") | ("album", "unblock") => {
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
let st = w.global::<AlbumState>();
|
||||||
|
// Header menu: the open album is AlbumState, so resolve
|
||||||
|
// the display fields (title/artist/cover) from it.
|
||||||
|
let album_id = if id.is_empty() {
|
||||||
|
st.get_id().to_string()
|
||||||
|
} else {
|
||||||
|
id.clone()
|
||||||
|
};
|
||||||
|
if !album_id.is_empty() {
|
||||||
|
let was_blocked =
|
||||||
|
crate::artist_blacklist::is_album_blacklisted(&album_id);
|
||||||
|
// Optimistic flip on the header toggle.
|
||||||
|
st.set_is_album_blocked(!was_blocked);
|
||||||
|
let title = st.get_title().to_string();
|
||||||
|
let artist = st.get_artist().to_string();
|
||||||
|
let cover = st.get_artwork_url().to_string();
|
||||||
|
let res = if was_blocked {
|
||||||
|
crate::artist_blacklist::remove_album(&album_id)
|
||||||
|
} else {
|
||||||
|
crate::artist_blacklist::add_album(
|
||||||
|
&album_id, &title, &artist, &cover, None,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
match res {
|
||||||
|
Ok(()) => {
|
||||||
|
seed_blacklist_status(&w);
|
||||||
|
let msg = if was_blocked {
|
||||||
|
qbz_i18n::t_args("Album \"{}\" unblocked", &[&title])
|
||||||
|
} else {
|
||||||
|
qbz_i18n::t_args("Album \"{}\" blocked", &[&title])
|
||||||
|
};
|
||||||
|
crate::toast::success_weak(&weak, msg);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!(
|
||||||
|
"[qbz-slint] album block toggle failed: {e}"
|
||||||
|
);
|
||||||
|
st.set_is_album_blocked(was_blocked);
|
||||||
|
let emsg = if was_blocked {
|
||||||
|
qbz_i18n::t("Failed to unblock album")
|
||||||
|
} else {
|
||||||
|
qbz_i18n::t("Failed to block album")
|
||||||
|
};
|
||||||
|
crate::toast::error_weak(&weak, emsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
("artist", "play-top") => playback::play_artist_top_tracks(
|
("artist", "play-top") => playback::play_artist_top_tracks(
|
||||||
runtime.clone(),
|
runtime.clone(),
|
||||||
weak.clone(),
|
weak.clone(),
|
||||||
@@ -12814,6 +12868,75 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// --- Album blacklist callbacks ---
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
window
|
||||||
|
.global::<BlacklistActions>()
|
||||||
|
.on_set_tab(move |tab| {
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
blacklist_manager::set_tab(&w, tab);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
window
|
||||||
|
.global::<BlacklistActions>()
|
||||||
|
.on_block_album(move |id, title, artist, cover| {
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
blacklist_manager::block_album(
|
||||||
|
&w,
|
||||||
|
id.to_string(),
|
||||||
|
title.to_string(),
|
||||||
|
artist.to_string(),
|
||||||
|
cover.to_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
window
|
||||||
|
.global::<BlacklistActions>()
|
||||||
|
.on_remove_album(move |id| {
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
blacklist_manager::remove_album(&w, id.to_string());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
window
|
||||||
|
.global::<BlacklistActions>()
|
||||||
|
.on_clear_all_albums(move || {
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
blacklist_manager::clear_all_albums(&w);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
let bl_runtime_b = app_runtime.clone();
|
||||||
|
let bl_handle_b = tokio_rt.handle().clone();
|
||||||
|
let bl_image_cache_b = image_cache.clone();
|
||||||
|
window
|
||||||
|
.global::<BlacklistActions>()
|
||||||
|
.on_album_select(move |id| {
|
||||||
|
let album_id = id.to_string();
|
||||||
|
nav::record(nav::NavEntry::Album(album_id.clone()));
|
||||||
|
navigate_album(
|
||||||
|
bl_runtime_b.clone(),
|
||||||
|
weak.clone(),
|
||||||
|
&bl_handle_b,
|
||||||
|
bl_image_cache_b.clone(),
|
||||||
|
album_id,
|
||||||
|
);
|
||||||
|
if let Some(w) = weak.upgrade() {
|
||||||
|
update_nav_flags(&w);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Offline Cache Manager actions.
|
// Offline Cache Manager actions.
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -351,6 +351,8 @@ fn to_item(track: &Track) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -716,6 +716,8 @@ fn track_to_item(track: &qbz_models::QueueTrack, resolver_index: usize) -> Track
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -577,6 +577,8 @@ pub(crate) fn to_item(track: &Track) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1222,6 +1222,8 @@ fn track_item(row: TrackRowData) -> TrackItem {
|
|||||||
disc_header_number: 0,
|
disc_header_number: 0,
|
||||||
// Work grouping is album-detail only too.
|
// Work grouping is album-detail only too.
|
||||||
work_header: "".into(),
|
work_header: "".into(),
|
||||||
|
work_composer_name: "".into(),
|
||||||
|
work_composer_id: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user