feat(qt): ambient background port, clip sweep and measurement tooling

Accumulated qt-frontend work from the 2026-08-11/12 sessions (cc),
uncommitted until now: the app-wide dynamic background in both modes
(AmbientField with GPU/Canvas arms, AppShell layering, ambient palette
pipeline), the wave-1 clip/batch sweep across the tree (alpha batches
449 -> 327, reproducible), the rounded-cover and icon-tint arms, and
scripts/qt-batches.sh (batches + presents/s sampler).

The GPU behaviour of these pieces was finalized in the follow-up pulse
commits; see qbz-nix-docs/qt-frontend/2026-08-11-scenegraph-batches/
GPU-COST-INVESTIGATION.md for the full campaign.

km
This commit is contained in:
vicrodh committed 2026-08-13 13:01:32 -06:00
1 parent 21e941bdf6
commit b136c9cf5d
60 files changed
+915 -162

No files matched your search

@@ -41,8 +41,13 @@ Rectangle {
width: genreRow.width
height: btnHeight
radius: 6
// Resting fill translucent under the dynamic background
// (HomeView.slint:89, BrowseHeaderTools.slint:111, PlaylistTagFilter
// .slint:77 — the same chip in three mounts). Accent and hover keep theirs.
color: root.active ? theme.accent
: genreArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
: genreArea.containsMouse
? theme.surfaceHover
: (theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated)
Row {
id: genreRow
@@ -86,7 +86,12 @@ Rectangle {
: ((cbArea.containsMouse || active) ? "#3dffffff" : "#24ffffff"))
: (primary
? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
: ((cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated))
// Resting fill translucent under the dynamic background
// (CircleAction.slint:53-55). The overlay variant above sits on
// artwork and keeps its white scale.
: ((cbArea.containsMouse || active)
? theme.surfaceHover
: (theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated)))
border.width: primary ? 0 : 1.5
border.color: overlay ? "#ccffffff" : theme.borderStrong
opacity: btnEnabled ? 1.0 : 0.4
+15 -3
View File
@@ -161,10 +161,21 @@ Rectangle {
width: root.expandable ? (root.open ? root.openWidth : 0) : root.width
height: root.height
radius: (root.searchMode || root.expandable) ? 6 : theme.radiusSm
color: root.elevated ? theme.surfaceElevated : theme.surfaceCard
// Translucent under the app-wide dynamic background, on the SAME
// token the opaque arm uses: surface-card for the expandable search
// overlay (ExpandableSearch.slint:80), surface-elevated for the inline
// toolbar field (BrowseHeaderTools.slint:26).
color: root.elevated
? (theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated)
: (theme.ambientOn ? theme.surfaceCardA50 : theme.surfaceCard)
border.width: (root.expandable && !root.open) ? 0 : 1
border.color: input.activeFocus ? theme.accent : theme.borderSubtle
clip: true
// Load-bearing ONLY on the expandable arm, where `width` animates
// 0 -> openWidth past a fixed 14px magnifier and the 22/24px clear
// slot. On the plain arm the Row sums to exactly the box and the text
// is guarded one level down, so the scissor there was a free batch
// root on every mounted field.
clip: root.expandable
Behavior on width {
enabled: root.expandable
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
@@ -191,7 +202,8 @@ Rectangle {
- (root.searchMode ? root.glyph + 7 : 0)
- (clearSlot.visible ? clearSlot.width + 7 : 0))
height: parent.height
clip: true
// No clip: TextInput scissors itself (:207) and the
// placeholder elides. A redundant second scissor.
TextInput {
id: input
anchors.fill: parent
+1 -2
View File
@@ -96,8 +96,7 @@ Rectangle {
// `ShellState.app-background-active` (state.slint:4184) — the port spells
// it this way app-wide, npHasTrack included: with nothing playing the
// shell restores its opaque theme surfaces (rule D4).
readonly property bool ambientOn:
ambient && QbzShell.ambientMode > 0 && QbzPlayer.npHasTrack
readonly property bool ambientOn: ambient && theme.ambientOn
width: 28
height: 28
+10 -2
View File
@@ -95,8 +95,16 @@ Rectangle {
width: 60
height: 30
radius: 6
color: theme.surfaceElevated
clip: true
// The well itself: surface-elevated @ 0.5 under the dynamic background
// (SegmentedTabBar.slint:108).
color: theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated
// NO CLIP, and that turns a silent crop into a visible one. The invariant
// a caller now owns: `width >= N*segWidth + (N-1)*segSpacing`. All six
// call sites satisfy it today with integer geometry (54/60, 60/60, 90/90);
// a future one that does not will OVERFLOW instead of being cropped
// without a trace, which is the failure you want. The rounded corner comes
// from `segRadius` on the cells — a QML clip is a rectangular scissor and
// never shaped this well.
Row {
anchors.centerIn: parent
+6 -1
View File
@@ -36,7 +36,12 @@ Rectangle {
radius: sm ? 6 : theme.radiusSm
border.width: sm ? 0 : 1
border.color: theme.borderSubtle
color: selArea.containsMouse && enabled ? theme.surfaceHover : theme.surfaceElevated
// Resting fill goes translucent under the dynamic background so the field
// shows through the control (QbzSelect.slint:110-116). Hover keeps its own
// token, which is already translucent.
color: selArea.containsMouse && enabled
? theme.surfaceHover
: (theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated)
opacity: enabled ? 1.0 : 0.4
// `width`, NOT `menuWidth`: QbzSelect.slint:89-91 resolves the open list as
+7 -2
View File
@@ -27,7 +27,9 @@ Rectangle {
width: segBarRow.width
height: segBarRow.height
color: theme.surfaceElevated
// The well: surface-elevated @ 0.5 under the dynamic background
// (SegmentedTabBar.slint:108).
color: theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated
radius: 6
Row {
@@ -45,7 +47,10 @@ Rectangle {
width: segRow.implicitWidth
height: segRow.implicitHeight
radius: 4
color: active ? theme.surfaceMain
// The ACTIVE cell takes surface-main @ 0.5 — surface-MAIN, not
// elevated, and at the chrome alpha (SegmentedTabBar.slint:29).
color: active
? (theme.ambientOn ? theme.surfaceMainA50 : theme.surfaceMain)
: segArea.containsMouse ? theme.surfaceHover : "transparent"
Row {
@@ -39,8 +39,12 @@ Rectangle {
height: sm ? 30 : 34
radius: 6
opacity: btnEnabled ? 1.0 : 0.35
// Glass under the app-wide dynamic background: the ACTIVE fill goes
// translucent so the moving field shows through (ToggleButton.slint:25-29).
// Only the active arm changes — surface-hover is already translucent and
// the resting arm is transparent, so neither has an alpha to set.
color: root.active
? theme.surfaceHover
? (theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceHover)
: (tbArea.containsMouse && root.btnEnabled ? theme.surfaceElevated : "transparent")
QbzIcon {
@@ -37,6 +37,12 @@ Item {
property bool compact: false
/// Extra proportional scale on top of `compact` (1.0 = none).
property real scaleFactor: 1.0
/// Cap for the text column, in px. 0 = uncapped, which is what every
/// existing call site gets — this exists so the ONE caller that used to
/// wrap the badge in a `clip: true` (rows/TrackRow.qml's quality cell) can
/// bound the badge instead. A clip there was a batch root per visible row,
/// and Qt cannot merge alpha geometry across clip roots.
property real maxTextWidth: 0
readonly property string tierLabel: tier === "hires" ? "HI-RES"
: (tier === "mp3" ? "MP3"
@@ -110,7 +116,13 @@ Item {
// with `width: parent.width` inside an implicitly-sized Column is
// a binding loop. Both Texts are unwrapped, so `implicitWidth` is
// the natural content width and does not depend on `width`.
width: Math.max(tierText.implicitWidth, detailText.implicitWidth)
// `implicitWidth` stays the natural content width even with the
// elides below (an unwrapped Text does not shrink its implicit
// size), so the no-binding-loop argument above still holds.
width: root.maxTextWidth > 0
? Math.min(root.maxTextWidth,
Math.max(tierText.implicitWidth, detailText.implicitWidth))
: Math.max(tierText.implicitWidth, detailText.implicitWidth)
Text {
id: tierText
@@ -121,6 +133,7 @@ Item {
font.weight: Font.Thin
font.letterSpacing: 0.5
horizontalAlignment: root.bare ? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
}
Text {
id: detailText
@@ -130,6 +143,7 @@ Item {
font.pixelSize: Math.max(1, Math.round((root.compact ? 8 : 9) * root.sf))
font.weight: Font.Thin
horizontalAlignment: root.bare ? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
}
}
}
@@ -25,7 +25,9 @@ Rectangle {
width: 68
height: 34
radius: 6
color: theme.surfaceElevated
// The well: surface-elevated @ 0.5 under the dynamic background
// (BrowseHeaderTools.slint:155).
color: theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated
clip: true
Row {