The track's "ShaderEffect / ColorOverlay / MultiEffect render NOTHING on the
software path this port runs on" doctrine was measured FALSE on 2026-07-29:
qbz-qt runs on the GPU (OpenGL RHI, threaded render loop, vsync 5.56ms). The
claim came from an offscreen session, and QT_QPA_PLATFORM=offscreen forces
software by definition. Every design it justified needed re-deciding.
- RoundedImage was a Canvas (renderTarget: Canvas.Image) that rasterised with
QPainter on the CPU AND uploaded a texture per repaint, for every cover in
the app, purely to round a corner identical in every frame of that image's
life. It is now layer.enabled + MultiEffect { maskSource } — an FBO rendered
once and cached for static content. Rectangle { radius; clip: true } cannot
do this: clip in Qt Quick is a RECTANGULAR scissor and ignores radius.
maskThresholdMin/maskSpreadAtMin are 0.5/1.0, NOT the 0.0/0.0 that looks
natural: 0.0 collapses Qt's mask smoothstep to step(0, alpha) and every
pixel with any alpha snaps fully opaque — measured 0 antialiased pixels at
radius 40 against the Canvas's 292. At 0.5/1.0 it is 308, ramp [0,51,219,255].
A software machine keeps the Canvas arm (GraphicsInfo.api), and
QBZ_QT_ROUND_MODE=canvas pins it on a GPU machine where the mask misbehaves.
- VizSettle drove the spectrum from FrameAnimation, i.e. every rendered frame:
180fps on this box for data the producer publishes at TARGET_FPS = 30. Now a
16ms Timer; the wall-clock maths is unchanged.
- SpectrumBand's per-bar y was a SECOND JS binding derived from height. An
anchor does the same arithmetic in C++ with no binding at all, and each FFT
frame is materialised into a plain array once per publish instead of being
read element by element across the JS/C++ boundary. Bindings per tick: bars
28 (was 56), waveform 48 (was 96), energy 5 (was 10).
QQuickPaintedItem was investigated and rejected with evidence: cxx-qt 0.7.3
emits X(QObject* parent) : base(parent), which does not compile against
QQuickPaintedItem(QQuickItem*), paint() is pure virtual, and there is zero
precedent for a custom base class in this workspace. Qt 6 ShaderEffect takes
no GLSL, only precompiled .qsb, which would make the build depend on a Qt
tool whose path differs on macOS.
- PlaylistCollage point-sampled its mosaic in its own Canvas
(Context2D.drawImage does not filter when it scales — measured RMSE 0.000
against nearest-neighbour). It now draws through RoundedImage.
- The scaled-derivative cache had no eviction at all and the .jpg -> .png key
change had orphaned 1251 files. Boot housekeeping sweeps the orphans once and
bounds the directory at 64 MB, LRU by mtime. Verified by effect: first run
deleted 1259 files / 10.05 MB, every run since reports 0, and the directory
is 14 MB. The eviction is only survivable because RoundedImage clears
_scaled on Image.Error and re-requests.
- For You artwork patched the rails in place instead of republishing the
document, which was resetting contentY. HomeView is destroyed on every
navigation, so the patch map is re-handed on mount through
QbzHome.refreshForyouArt() — otherwise the Radio rail and the Spotlight hero
went blank for the rest of the session after one navigation, and the skeleton
pulse Timer stayed pinned ON, defeating the fix it belonged to.
- Spotlight's placeholder gated on the local path instead of the remote url, so
it flashed a glyph on a cold cache where the Slint does not.
The retired doctrine is corrected wherever it was load-bearing for a decision.
The pre-baked icon tints are deliberately NOT reopened and no drop-shadows are
added: both are visual changes, not perf fixes.
cc
173 lines
6.6 KiB
QML
173 lines
6.6 KiB
QML
// Track Info modal — 1:1 QML port of crates/qbz-ui/ui/album/TrackInfoModal.slint.
|
|
//
|
|
// HOW IT OPENS (taken from the .slint, not chosen): a MODAL — a full-window
|
|
// #000000bf scrim with a centered card, NOT a flyout and NOT a docked panel.
|
|
// Slint mounts it in AppShell as `Rectangle scrim + centered card` gated on
|
|
// TrackInfoState.open; Escape and a scrim click close it (ADR-009: modal
|
|
// z >= 3000). Here it is a Popup parented to `Overlay.overlay` so the bars can
|
|
// own it without AppShell.qml having to mount anything (the NowPlayingBar
|
|
// Loader guarantees only ONE bar — hence only one instance — is alive).
|
|
//
|
|
// Geometry, verbatim from the .slint:
|
|
// card width = min(window - 40, 728)
|
|
// card height = min(window * 0.8, content preferred height)
|
|
// credits col = (card width - 48 /*content padding*/ - 24 /*gutter*/) / 2
|
|
// metadata col = (card width - 48 - 2 * 24) / 3 (three equal columns)
|
|
// scrollbar = 14px, inset 4px from the card's right edge
|
|
// The Slint card carries drop-shadow-blur 32px; QML shadows need an effect
|
|
// (Qt5Compat / MultiEffect) and it is dropped here rather than faked.
|
|
// SUPERSEDED (2026-07-29): the reason used to be "effects render NOTHING on the
|
|
// software path in this port". Effects need shaders, and this port runs on the
|
|
// GPU (OpenGL RHI, measured); that note came from an offscreen session, which
|
|
// forces the software renderer by definition — theme/RoundedImage.qml now
|
|
// detects the software path with `GraphicsInfo.api` rather than assuming it.
|
|
// The shadow is still not added: it is a visual change owing its own parity
|
|
// pass against Slint's blur, not a perf fix.
|
|
//
|
|
// DATA — see the report's GLUE NEEDED; the Qt port has no track-info bridge
|
|
// yet. Contract: QbzAlbum.openTrackInfo(trackId) fetches and publishes
|
|
// QbzAlbum.trackInfoJson while QbzAlbum.trackInfoLoading is true. Document
|
|
// shape (1:1 with crates/qbz/src/info_modals.rs `TrackInfoData`):
|
|
// { "error": "", "title": "", "album": "", "artist": "", "artistId": "",
|
|
// "duration": "3:45", "quality": "24-bit / 96kHz", "isrc": "",
|
|
// "label": "", "labelId": "", "copyright": "",
|
|
// "credits": [ { "role": "PRODUCER", "roleRaw": "Producer",
|
|
// "names": ["A", "B"] } ] }
|
|
// Every read is guarded, so while the glue is missing the modal degrades to
|
|
// its (already 1:1) loading state instead of throwing.
|
|
//
|
|
// Inert, matching the existing port precedent (cards/LabelCard.qml): the label
|
|
// and musician links render and hover exactly like the Slint but have no Qt
|
|
// invokable to call. The artist link IS live (QbzArtist.openArtist).
|
|
//
|
|
// Split (project size rule): the scrolling content is TrackInfoBody.qml and
|
|
// the two cell primitives are InfoMetaCell.qml / InfoCreditCell.qml — the
|
|
// .slint exports those two as components as well.
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import com.blitzfc.qbz
|
|
import "../theme"
|
|
|
|
Popup {
|
|
id: root
|
|
|
|
parent: Overlay.overlay
|
|
x: 0
|
|
y: 0
|
|
width: parent ? parent.width : 0
|
|
height: parent ? parent.height : 0
|
|
padding: 0
|
|
z: 3000
|
|
modal: true
|
|
// Our own scrim (the Slint's #000000bf) — the default modal dimmer would
|
|
// darken it twice.
|
|
dim: false
|
|
closePolicy: Popup.CloseOnEscape
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
// --- Data ------------------------------------------------------------
|
|
readonly property var doc: parseDoc()
|
|
function parseDoc() {
|
|
try {
|
|
return JSON.parse(QbzAlbum.trackInfoJson || "{}")
|
|
} catch (e) {
|
|
return ({})
|
|
}
|
|
}
|
|
readonly property bool loading: {
|
|
try {
|
|
return QbzAlbum.trackInfoLoading === true
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|
|
readonly property string errorText: doc.error || ""
|
|
readonly property var credits: doc.credits || []
|
|
// Even index -> left column, odd -> right (info_modals.rs step_by(2)).
|
|
readonly property var creditsLeft: credits.filter(function (c, i) { return i % 2 === 0 })
|
|
readonly property var creditsRight: credits.filter(function (c, i) { return i % 2 === 1 })
|
|
|
|
// --- Actions ---------------------------------------------------------
|
|
|
|
/// Open the modal for a track id — the Slint's media-action("track", id,
|
|
/// "track-info"). The caller does the Qobuz-only gating.
|
|
function openFor(trackId) {
|
|
if (!trackId || trackId === "")
|
|
return
|
|
try {
|
|
QbzAlbum.openTrackInfo(trackId)
|
|
} catch (e) {
|
|
// TODO(glue): no openTrackInfo on the Qt bridge yet — the modal
|
|
// still opens and shows its loading state.
|
|
console.warn("[qbz-qt] track info: no bridge invokable yet")
|
|
}
|
|
open()
|
|
}
|
|
|
|
function openArtist(artistId) {
|
|
if (!artistId || artistId === "")
|
|
return
|
|
close()
|
|
QbzArtist.openArtist(artistId)
|
|
}
|
|
// TODO(qt-bridge): no label view in the Qt port (cards/LabelCard.qml has
|
|
// the same hole) — the link is rendered 1:1 and inert.
|
|
function openLabel(labelId) {}
|
|
// TODO(qt-bridge): no musician navigation in the Qt port (Slint routes to
|
|
// NetworkSidebarActions.musician-clicked) — names hover 1:1, inert.
|
|
function openMusician(name, roleRaw) {}
|
|
|
|
background: Rectangle { color: "#bf000000" }
|
|
|
|
contentItem: Item {
|
|
|
|
// Scrim — click outside dismisses.
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: root.close()
|
|
}
|
|
|
|
Rectangle {
|
|
id: card
|
|
width: Math.min(root.width - 40, 728)
|
|
height: Math.min(root.height * 0.8, body.implicitHeight)
|
|
x: Math.round((parent.width - width) / 2)
|
|
y: Math.round((parent.height - height) / 2)
|
|
radius: theme.radiusMd
|
|
color: theme.surfaceCard
|
|
border.width: 1
|
|
border.color: theme.borderSubtle
|
|
clip: true
|
|
|
|
// Swallow clicks so they don't reach the scrim.
|
|
MouseArea { anchors.fill: parent }
|
|
|
|
Flickable {
|
|
id: flick
|
|
anchors.fill: parent
|
|
contentWidth: width
|
|
contentHeight: body.implicitHeight
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
clip: true
|
|
|
|
TrackInfoBody {
|
|
id: body
|
|
host: root
|
|
width: flick.width
|
|
}
|
|
}
|
|
|
|
// The Slint mounts a 14px ListScrollbar inset 4px from the right.
|
|
QbzScrollBar {
|
|
target: flick
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 4
|
|
anchors.top: parent.top
|
|
anchors.bottom: parent.bottom
|
|
}
|
|
}
|
|
}
|
|
}
|