feat(qt): port the Blacklist manager for artists and albums

The port had a 67-line settings row showing two counters and a header saying
the Manage chevron was "NOT shipped — this port has no Blacklist Manager view
for it to open". The Slint has 1,114 lines of manager plus the consumer surfaces
that make the feature mean anything.

- src/artist_blacklist.rs is a 1:1 port of the reference's per-user lifecycle,
  including the fail-open asymmetry (is_enabled reads TRUE when there is no
  session, everything else false/empty) and the byte-identical NO_SESSION_ERR.
  src/reco_dismiss_qt.rs carries the reco-dismissal store. Both are bound in
  ALL THREE session-activation paths — the offline one included, because the
  reference records that Tauri never bound it offline and blacklisted artists
  leaked into offline surfaces — and torn down on logout, or the next account
  inherits them.
- The manager view: three tabs (bordered, ADR-008 — no pills), search, sort,
  the enable toggle, the disabled warning banner, the four body branches per
  tab in their load-bearing order, windowed lists, and the clear-all confirm.
  Reached from Settings only, exactly like the Slint; no sidebar entry.
- Every one of the ten store mutations publishes TWICE — its own document and
  publish_settings() — because the Settings counters live in a different
  document and nav_qt::back() re-runs no per-view load. Without it,
  Manage -> unblock -> Back showed pre-mutation counters. The Slint gets this
  free from a shared global.
- The search field is driven imperatively, not by a binding: QbzLineEdit's X
  used to destroy the binding, after which the box went blank while the list
  stayed filtered.
- Consumer surfaces, which is where the feature actually lives: the album card
  and album list row gained "Block this album", the artist card gained the
  3-arg "Not interested", the album header menu gained Block/Unblock swapping
  on state, and the artist page gained the Show/Blacklist flip plus the amber
  hidden banner with its "Show artist" button. album_qt and artist_qt now seed
  isAlbumBlocked / isBlacklisted at document build time — without the seed an
  already-blocked album offered "Block this album" and the first click
  UN-blocked it, the same lie the pin glyph told before isPinned existed.
- search_qt passed &Default::default() for both blacklist snapshots, so nothing
  was filtered anywhere and a greyed row still played. It now passes the real
  snapshots at both call sites.
- The 17 toasts the spec had dropped for want of a toast host are wired: that
  premise stopped being true when toast_qt landed, and a Clear All that failed
  with NO_SESSION_ERR was completely silent. Their msgids are in all eight
  catalogues; the five album-axis ones existed only in es and nl.

Also fixed in passing, pre-existing on this branch and unrelated to the
blacklist: ArtistView's library tab read `libTracks` unqualified from a child
of the object that declares it, which QML resolves against the component root,
not the enclosing object — so the "Tracks" heading threw a ReferenceError and
never rendered. Found by forcing the artist route in the offscreen smoke, which
no earlier gate did.

cc
This commit is contained in:
vicrodh committed 2026-07-29 21:24:12 -06:00
1 parent acf23abc9b
commit 494596616e
26 files changed
+3393 -132

No files matched your search

@@ -0,0 +1,231 @@
// QbzConfirmModal — THE port's confirm dialog. Before this file the tree had
// no confirm surface at all (grep -rl confirm qml/ found only LyricsPanel and
// ArtistView, neither a dialog), so every destructive action either mutated
// straight away or was not shipped. It is written generic on purpose: the
// Blacklist manager's Clear-All is the first caller, and MyQBZ delete,
// playlist delete and the offline-cache purge all need the same surface.
//
// Geometry is 1:1 with the Slint Clear-All modal
// (settings/BlacklistManagerView.slint:992-1113), which itself mirrors
// PlaylistDuplicateConfirmModal:
// scrim full-bleed #000000bf, click dismisses
// panel width min(host - 80, 400), height = content, centered, Radius.md,
// surface-main, 1px border-subtle, drop-shadow blur 32 #00000080
// padding 24, spacing 16; title heading/semibold, body 15 text-secondary
// buttons right-aligned, spacing 10, both 36px tall, Radius.sm,
// width = label + 32
// danger fill Theme.danger, hover Theme.danger.darker(0.12) — NOT
// `danger-hover`, which is a translucent tint for GHOST danger
// surfaces and would wash a filled button out (the Slint comment at
// :1080-1089 spells this out at length); label hard #ffffff
//
// MOUNT IT LAST inside the view root with `anchors.fill: parent`. ADR-009's
// ">= 3000" is satisfied both structurally (declaration order IS z-order) and
// by the explicit z: 3100 below — the same layer the port's only other in-pane
// modal scrim sits on (controls/DiscoverConfigModal.qml:56), so the two never
// fight.
//
// The shadow is FAKED (a translucent rounded rect behind the panel) — the
// LoginScreen.qml:30-49 precedent, including its 2026-07-29 note: the old
// "effects render nothing here" doctrine is RETIRED (both effect modules are
// installed and this port runs on the GPU; RoundedImage.qml detects the
// software path with GraphicsInfo.api instead of assuming it). A real blurred
// drop shadow is a visual change owing its own parity pass, so the fake stays
// for now, exactly as LoginScreen's does. The port's only other in-pane modal
// (controls/DiscoverConfigModal.qml) draws no shadow at all.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Item {
id: root
property string title: ""
property string body: ""
/// "" is not a valid label — the default is the shared msgid, as a BINDING
/// so a live language switch re-translates it (QbzSession.trRev).
property string cancelLabel: QbzSession.tr("Cancel", QbzSession.trRev)
property string confirmLabel: ""
/// Filled-red confirm button (the Clear-All / delete voice). false gives
/// the accent fill instead, for a non-destructive confirmation.
///
/// NAMED `danger`, not `destructive`: spec 03 §6.10/§10 specifies `danger`,
/// and `controls/SettingsButton.qml:15` already carries `property bool
/// danger` for exactly this concept (red border + red label + a `favorite`
/// glyph tint). Two names for one idea across two neighbouring controls is
/// how a call site ends up setting a property that does not exist — which in
/// QML is not an error, just a silently-ignored line.
property bool danger: true
readonly property bool opened: root._open
property bool _open: false
signal confirmed()
signal cancelled()
QbzTheme { id: theme }
function open() {
root._open = true
// AFTER _open, so `visible` is already true — an invisible item cannot
// take active focus and the Esc handler would be dead.
keyScope.forceActiveFocus()
}
function close() {
root._open = false
}
function _cancel() {
root.close()
root.cancelled()
}
function _confirm() {
root.close()
root.confirmed()
}
visible: root._open
enabled: root._open
z: 3100
// Esc dismiss (the Slint esc-scope FocusScope, :1006-1017). No visual and
// no MouseArea, so it never intercepts a press meant for the scrim.
FocusScope {
id: keyScope
anchors.fill: parent
Keys.onEscapePressed: function (event) {
root._cancel()
event.accepted = true
}
}
// Scrim. `radius` is load-bearing, not decoration: this Item fills the
// view root, which fills AppShell's rounded content frame, and Qt Quick's
// `clip` is a rectangular scissor that does not follow `radius` — so an
// opaque full-bleed child paints into the frame's four bezel corners
// (AppShell.qml:252-259, which names DiscoverConfigModal's scrim as the
// one that had to be fixed exactly this way).
Rectangle {
anchors.fill: parent
radius: theme.radiusMd
color: "#bf000000"
MouseArea {
anchors.fill: parent
onClicked: root._cancel()
}
}
// Faked drop shadow (blur 32 / #00000080) — see the header note.
Rectangle {
x: panel.x
y: panel.y + 8
width: panel.width
height: panel.height
radius: theme.radiusMd
color: "#00000080"
opacity: 0.5
}
Rectangle {
id: panel
width: Math.min(root.width - 80, 400)
// The Slint panel is `height: panel.preferred-height` over a
// VerticalLayout with padding 24 -> content + 48.
height: panelCol.implicitHeight + 48
x: Math.round((root.width - width) / 2)
y: Math.round((root.height - height) / 2)
radius: theme.radiusMd
color: theme.surfaceMain
border.width: 1
border.color: theme.borderSubtle
// Swallow clicks so they never reach the scrim (the Slint's empty
// panel TouchArea, :1030).
MouseArea { anchors.fill: parent }
Column {
id: panelCol
x: 24
y: 24
width: parent.width - 48
spacing: 16
Text {
width: parent.width
text: root.title
color: theme.textPrimary
font.pixelSize: theme.fontHeading
font.weight: theme.weightSemibold
wrapMode: Text.WordWrap
}
Text {
visible: root.body !== ""
width: parent.width
text: root.body
color: theme.textSecondary
font.pixelSize: theme.fontBody
wrapMode: Text.WordWrap
}
Item {
width: parent.width
height: 36
Row {
anchors.right: parent.right
spacing: 10
Rectangle {
width: cancelLbl.implicitWidth + 32
height: 36
radius: theme.radiusSm
color: cancelArea.containsMouse ? theme.surfaceHover
: theme.surfaceElevated
Text {
id: cancelLbl
anchors.centerIn: parent
text: root.cancelLabel
color: theme.textPrimary
font.pixelSize: theme.fontBody
}
MouseArea {
id: cancelArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root._cancel()
}
}
Rectangle {
width: confirmLbl.implicitWidth + 32
height: 36
radius: theme.radiusSm
color: root.danger
? (confirmArea.containsMouse ? Qt.darker(theme.danger, 1.12)
: theme.danger)
: (confirmArea.containsMouse ? theme.accentHover : theme.accent)
Text {
id: confirmLbl
anchors.centerIn: parent
text: root.confirmLabel
// The Slint hard-codes #ffffff on the filled danger
// button and that is correct here — `danger` is a
// fixed red under every palette. The accent arm goes
// through the theme's on-accent selector instead
// (QbzTheme.qml:314-317), which is the port's
// owner-approved WCAG deviation.
color: root.danger ? "#ffffff" : theme.accentGlyphColor
font.pixelSize: theme.fontBody
font.weight: theme.weightMedium
}
MouseArea {
id: confirmArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root._confirm()
}
}
}
}
}
}
}
+18 -7
View File
@@ -10,30 +10,41 @@ import com.blitzfc.qbz
import "../theme"
Column {
id: emptyRoot
property string iconName: ""
property string title: ""
property string body: ""
property string actionLabel: ""
// Per-surface metrics. The consolidated default is the phase-22 one (40px
// glyph, full opacity, primary semibold title); the Blacklist manager's
// three empty branches are a 48px glyph at 0.3 with a MUTED regular title
// (BlacklistManagerView.slint:702-732, :801-831, :898-928), which is a
// call-site number, not a second component.
property int iconSize: 40
property real iconOpacity: 1.0
property bool titleMuted: false
property int titleWeight: theme.weightSemibold
signal actionClicked()
QbzTheme { id: theme }
spacing: 0
QbzIcon {
visible: iconName !== ""
name: iconName
width: 40
height: 40
visible: emptyRoot.iconName !== ""
name: emptyRoot.iconName
width: emptyRoot.iconSize
height: emptyRoot.iconSize
opacity: emptyRoot.iconOpacity
anchors.horizontalCenter: parent.horizontalCenter
tintName: "muted"
}
Item { visible: iconName !== ""; width: 1; height: 14 }
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: title
color: theme.textPrimary
text: emptyRoot.title
color: emptyRoot.titleMuted ? theme.textMuted : theme.textPrimary
font.pixelSize: theme.fontSection
font.weight: theme.weightSemibold
font.weight: emptyRoot.titleWeight
}
Item { visible: body !== ""; width: 1; height: 6 }
Text {