Files
qbz/crates/qbz-qt/qml/cards/SlimCard.qml
T
vicrodh b136c9cf5d 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
2026-08-13 13:01:32 -06:00

83 lines
2.7 KiB
QML

// SlimCard — THE slim row card (discover/SlimCard.slint — a DISTINCT
// component in Slint, NOT an AlbumCard variant: 60px row, optional rank +
// 44px thumb + title/subtitle, single whole-row click, no overlay). The
// Slint mounts it via SlimCarousel (Home recent/popular grids, ForYou,
// ExternalReco, offline rail); the POC has it on the Home popular grid
// (SlimGrid). Promoted from HomeView in phase 21.
//
// card contract: { id, title, artist, rank, artPath } — slim rows are
// albums in the POC: click opens the album view (phase 8).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property var card: ({})
QbzTheme { id: theme }
height: 60
radius: theme.radiusSm
color: slArea.containsMouse ? theme.surfaceHover : "transparent"
Row {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
spacing: 12
Text {
visible: card.rank !== ""
width: 20
anchors.verticalCenter: parent.verticalCenter
text: card.rank
color: theme.textMuted
font.pixelSize: theme.fontBody
horizontalAlignment: Text.AlignHCenter
}
Rectangle {
width: 44
height: 44
radius: 4
anchors.verticalCenter: parent.verticalCenter
color: theme.surfaceElevated
// No clip: the child RoundedImage confines itself on both arms, and
// a rectangular scissor never produced this radius. A clip is an
// unconditional batch root, so this one cost a draw call per item.
RoundedImage {
anchors.fill: parent
source: card.artPath
radius: 4
}
}
Column {
width: parent.width - (card.rank !== "" ? 20 : 0) - 44 - 2 * 12
anchors.verticalCenter: parent.verticalCenter
spacing: 2
Text {
width: parent.width
text: card.title
color: theme.textPrimary
font.pixelSize: theme.fontLink
font.weight: theme.weightMedium
elide: Text.ElideRight
}
Text {
width: parent.width
text: card.artist
color: theme.textMuted
font.pixelSize: 12
elide: Text.ElideRight
}
}
}
MouseArea {
id: slArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
// Phase 8: slim rows are albums — click opens the album view.
onClicked: QbzAlbum.openAlbum(card.id)
}
}