fix(qbz-qt): row buttons, cover triggers, light-theme contrast, flyouts, genre filter
**Track-row buttons did nothing.** Declaration order is z-order in QML, and the row-wide MouseArea added for right-click was declared last — so it covered the heart, cloud and menu buttons and swallowed their presses. propagateComposedEvents cannot rescue that: a press is not a composed event, which is why only the row's own double-click still worked. **Covers appeared only after a scroll.** Three compounding defects, not one. The window report fired on contentY and on model change, both of which happen while the tab body is still hidden behind its loading flag, so the report that mattered hit the not-visible early return and was discarded with nothing to re-fire it. The debounce reset on every change, so a burst of mount-time reports kept pushing its trailing edge out. And a single pending slot meant that when two surfaces are mounted at once — the artist rail and that artist's grid — the second overwrote the first, so one pane was never requested at all. Eviction had the same shape: each report deleted everything outside its own array, so the two panes deleted each other's covers. **Latest release had no cover** because the artist page's collector skipped it, along with Appears On and the playlists strip. **Light themes.** The mechanism is Slint's, from 2.0.2 and issue #638: the on-surface arm on circle actions, header-light deciding the header foreground only when a dark backdrop is actually painted, and the circular backing behind the track-row play glyph. Ported as specified rather than approximated. Two icons rendered in their SVG's own colour because they pointed at the raw asset instead of a baked tint — a sweep found the rest of that class. **Navigation flyouts** exist, one component serving both the sidebar and the header nav modes. **Filter by genre and the Discover sort now work**, everywhere the control is drawn. The genre ids were already a parameter on the discover fetch that the port always passed empty. cc
This commit is contained in:
52 files changed
+3557
-264
No files matched your search
@@ -0,0 +1,307 @@
|
||||
// DiscoverConfigModal — QML port of
|
||||
// crates/qbz-ui/ui/discover/DiscoverConfigModal.slint (the per-tab
|
||||
// "Customize" modal opened by the Discover toolbar gear): reorder +
|
||||
// show/hide the active tab's rails, with a perf-warning banner, an
|
||||
// enabled/total count and a Reset-to-defaults footer.
|
||||
//
|
||||
// No Save button — every toggle / move / reset persists live to
|
||||
// discover_prefs.db and re-renders the three tabs from the cached section
|
||||
// data (src/discover_config_qt.rs), so the list stays authoritative.
|
||||
//
|
||||
// Mount as the LAST child of the view root (declaration order IS z-order)
|
||||
// with `anchors.fill: parent`; ADR-009's ">= 3000" is satisfied structurally
|
||||
// AND by the explicit z below.
|
||||
//
|
||||
// POC-NOTE: the Slint modal's Recommendations arm (explainer + cache window
|
||||
// + "Refresh now") drives ExternalRecoState, and the external reco engine is
|
||||
// not ported — the toolbar gear is DISABLED on that tab instead (HomeView).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
import "../controls"
|
||||
import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// "home" | "editorPicks" | "forYou" — the tab whose sections are edited.
|
||||
property string tab: "home"
|
||||
readonly property bool opened: root._open
|
||||
property bool _open: false
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
readonly property var doc: {
|
||||
try {
|
||||
return JSON.parse(QbzBridge.discoverConfigJson)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
// Only render rows once Rust has published THIS tab's payload.
|
||||
readonly property bool mine: (doc.tab || "") === root.tab
|
||||
readonly property var rows: root.mine ? (doc.rows || []) : []
|
||||
|
||||
function open(forTab) {
|
||||
root.tab = forTab
|
||||
QbzBridge.discoverConfigOpen(forTab)
|
||||
root._open = true
|
||||
}
|
||||
function close() {
|
||||
root._open = false
|
||||
}
|
||||
|
||||
visible: root._open
|
||||
enabled: root._open
|
||||
z: 3100
|
||||
|
||||
// Scrim — declared FIRST so the panel below it in source order (and thus
|
||||
// above it in z) keeps its own presses.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#bf000000"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.close()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: panel
|
||||
width: Math.min(root.width - 80, 520)
|
||||
height: Math.min(panelCol.implicitHeight + 40, root.height * 0.78)
|
||||
x: Math.round((root.width - width) / 2)
|
||||
y: Math.round((root.height - height) / 2)
|
||||
radius: theme.radiusMd
|
||||
color: theme.surfaceCard
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
clip: true
|
||||
|
||||
// Swallow clicks so they never reach the scrim.
|
||||
MouseArea { anchors.fill: parent }
|
||||
|
||||
Column {
|
||||
// NOT `body`: WarningBanner below has a `body` PROPERTY, and an
|
||||
// id that shadows a child's property name is a trap waiting for
|
||||
// the next reader.
|
||||
id: panelCol
|
||||
x: 20
|
||||
y: 20
|
||||
width: parent.width - 40
|
||||
spacing: 14
|
||||
|
||||
// --- Title + close --------------------------------------------
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 28
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: QbzSession.tr("Customize", QbzSession.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontHeading
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 6
|
||||
color: cfgCloseArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "x"
|
||||
width: 17
|
||||
height: 17
|
||||
tintName: cfgCloseArea.containsMouse ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: cfgCloseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Perf-warning banner (the shared WarningBanner replica) ----
|
||||
WarningBanner {
|
||||
width: parent.width
|
||||
variant: "warning"
|
||||
body: QbzSession.tr("Enabling more sections increases load time.", QbzSession.trRev)
|
||||
}
|
||||
|
||||
// --- Count line -----------------------------------------------
|
||||
Text {
|
||||
width: parent.width
|
||||
text: QbzSession.tr("{} of {} enabled", QbzSession.trRev)
|
||||
.replace("{}", root.mine ? (doc.enabled || 0) : 0)
|
||||
.replace("{}", root.mine ? (doc.total || 0) : 0)
|
||||
color: theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
|
||||
// --- Section list ---------------------------------------------
|
||||
// Explicit, content-derived height capped to what is left of the
|
||||
// panel; the Flickable scrolls past that.
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(0, Math.min(listCol.height, root.height * 0.78 - 260))
|
||||
clip: true
|
||||
Flickable {
|
||||
id: listFlick
|
||||
anchors.fill: parent
|
||||
contentWidth: width
|
||||
contentHeight: listCol.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
Column {
|
||||
id: listCol
|
||||
width: listFlick.width
|
||||
spacing: 2
|
||||
Repeater {
|
||||
model: root.rows
|
||||
delegate: Rectangle {
|
||||
id: cfgRow
|
||||
required property var modelData
|
||||
required property int index
|
||||
width: listCol.width
|
||||
height: 40
|
||||
radius: theme.radiusSm
|
||||
color: cfgRowArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
// Whole-row tap toggles (primary affordance).
|
||||
// Declared FIRST so the checkbox and the two
|
||||
// reorder buttons below sit ON TOP of it and
|
||||
// keep their own presses.
|
||||
MouseArea {
|
||||
id: cfgRowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzBridge.discoverToggleSection(root.tab, cfgRow.modelData.id)
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 10
|
||||
anchors.rightMargin: 6
|
||||
spacing: 12
|
||||
|
||||
QbzCheckbox {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: cfgRow.modelData.enabled
|
||||
onToggled: QbzBridge.discoverToggleSection(root.tab, cfgRow.modelData.id)
|
||||
}
|
||||
Text {
|
||||
width: parent.width - 18 - 28 - 28 - 3 * 12
|
||||
height: parent.height
|
||||
text: cfgRow.modelData.label
|
||||
color: cfgRow.modelData.enabled ? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: theme.fontBody
|
||||
font.weight: theme.weightMedium
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
ReorderButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
glyph: "chevron-up"
|
||||
buttonEnabled: cfgRow.index > 0
|
||||
onClicked: QbzBridge.discoverMoveSection(root.tab, cfgRow.modelData.id, -1)
|
||||
}
|
||||
ReorderButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
glyph: "chevron-down"
|
||||
buttonEnabled: cfgRow.index < root.rows.length - 1
|
||||
onClicked: QbzBridge.discoverMoveSection(root.tab, cfgRow.modelData.id, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Empty state — a tab whose sections have not been fetched yet.
|
||||
Text {
|
||||
visible: root.rows.length === 0
|
||||
width: parent.width
|
||||
height: 34
|
||||
text: QbzSession.tr("No sections to configure yet.", QbzSession.trRev)
|
||||
color: theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
// --- Footer: Reset to defaults --------------------------------
|
||||
Rectangle {
|
||||
width: resetRow.width + 24
|
||||
height: 34
|
||||
radius: theme.radiusSm
|
||||
color: resetArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
Row {
|
||||
id: resetRow
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
QbzIcon {
|
||||
name: "rotate-ccw"
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
tintName: "secondary"
|
||||
}
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: QbzSession.tr("Reset to defaults", QbzSession.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontBody
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: resetArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzBridge.discoverResetTab(root.tab)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 28x28 ghost reorder button (the Slint ReorderButton): dims and drops
|
||||
// the pointer cursor at the list boundary.
|
||||
component ReorderButton: Rectangle {
|
||||
id: reorderRoot
|
||||
property string glyph: "chevron-up"
|
||||
property bool buttonEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: theme.radiusSm
|
||||
opacity: reorderRoot.buttonEnabled ? 1.0 : 0.3
|
||||
color: (reorderRoot.buttonEnabled && reorderArea.containsMouse)
|
||||
? theme.surfaceHover : "transparent"
|
||||
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: reorderRoot.glyph
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: reorderArea
|
||||
anchors.fill: parent
|
||||
enabled: reorderRoot.buttonEnabled
|
||||
hoverEnabled: reorderRoot.buttonEnabled
|
||||
cursorShape: reorderRoot.buttonEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: reorderRoot.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
// GenreFilterPopup — QML port of crates/qbz-ui/ui/discover/GenreFilterPopup.slint
|
||||
// (+ its GenreCard / GenreTreeRowItem sub-components).
|
||||
//
|
||||
// ONE shared overlay used by every surface that draws a "Filter by genre"
|
||||
// button. Mount it as the LAST child of a view root (declaration order IS
|
||||
// z-order in QML) with `anchors.fill: parent`, give it the surface's
|
||||
// `context`, and drive it from the button:
|
||||
//
|
||||
// GenreFilterPopup { id: genrePopup; anchors.fill: parent
|
||||
// context: "discover"; anchorTop: 62 }
|
||||
// ... MouseArea { onClicked: genrePopup.toggle() } // click handler: safe
|
||||
//
|
||||
// The BUTTON's badge must NOT bind to `genrePopup.selectedCount`: the popup is
|
||||
// declared last, and a creation-time binding that dereferences a
|
||||
// not-yet-created id registers no dependency and never re-evaluates. Views
|
||||
// parse QbzBridge.genreFilterJson themselves for that (see HomeView's
|
||||
// `genreCount`); `selectedCount` here is for post-creation reads.
|
||||
//
|
||||
// Data: QbzBridge.genreFilterJson (src/genre_filter_qt.rs) — chips, the
|
||||
// 3-level advanced tree, remember/advanced flags, and the PER-CONTEXT
|
||||
// selection counts + names. Actions go straight back through the QbzBridge
|
||||
// invokables; the controller persists and refreshes the right consumer
|
||||
// (Discover re-fetches the index, Library > All re-derives in JS).
|
||||
//
|
||||
// The counts are PER CONTEXT, so Discover's button and Library's button each
|
||||
// show their own badge no matter which one was opened last (the Slint pair
|
||||
// both read the shared current-context count — one of them showed the
|
||||
// other's number).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
// Self-referential directory import: QbzToggle lives next to this file and
|
||||
// the port's proven way to reach a control is the explicit directory import
|
||||
// (a missing one resolves LAZILY and dies at runtime, not at build).
|
||||
import "../controls"
|
||||
import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// "discover" | "library-all" — which selection this instance edits.
|
||||
property string context: "discover"
|
||||
// Card position: below the toolbar, pinned to the right edge (the Slint
|
||||
// overlay sits under the Filter-by-genre button).
|
||||
property int anchorTop: 62
|
||||
property int anchorRight: 32
|
||||
|
||||
readonly property bool opened: root._open
|
||||
property bool _open: false
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
readonly property var doc: {
|
||||
try {
|
||||
return JSON.parse(QbzBridge.genreFilterJson)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
// This surface's own selection size (button badge).
|
||||
readonly property int selectedCount: (doc.counts || {})[root.context] || 0
|
||||
// The popup body only ever shows the context it was opened for.
|
||||
readonly property bool mine: (doc.context || "") === root.context
|
||||
readonly property var chips: root.mine ? (doc.genres || []) : []
|
||||
readonly property var treeRows: root.mine ? (doc.tree || []) : []
|
||||
readonly property bool advanced: root.mine && doc.advanced === true
|
||||
readonly property bool remember: doc.remember !== false
|
||||
readonly property bool loading: root.mine && doc.loading === true
|
||||
readonly property int liveCount: root.mine ? (doc.selectedCount || 0) : 0
|
||||
|
||||
// `genreOpen` resets the controller's query, and `setAdvanced(false)`
|
||||
// clears it too — mirror that in the box so a reopened advanced view
|
||||
// never shows a stale needle over an unfiltered tree.
|
||||
onAdvancedChanged: if (!root.advanced) searchInput.text = ""
|
||||
|
||||
function open() {
|
||||
searchInput.text = ""
|
||||
QbzBridge.genreOpen(root.context)
|
||||
root._open = true
|
||||
}
|
||||
function close() {
|
||||
root._open = false
|
||||
}
|
||||
function toggle() {
|
||||
if (root._open)
|
||||
root.close()
|
||||
else
|
||||
root.open()
|
||||
}
|
||||
|
||||
visible: root._open
|
||||
enabled: root._open
|
||||
z: 3000
|
||||
|
||||
// Click-out backdrop — declared FIRST so every later sibling (the card)
|
||||
// sits above it and keeps its own presses.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.close()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: card
|
||||
x: parent.width - width - root.anchorRight
|
||||
y: root.anchorTop
|
||||
width: 470
|
||||
height: col.implicitHeight + 32
|
||||
radius: theme.radiusMd
|
||||
color: theme.surfaceMain
|
||||
border.width: 1
|
||||
border.color: theme.borderMuted
|
||||
|
||||
// Swallow clicks that land on the card's own chrome so the backdrop
|
||||
// does not close it. Declared FIRST: the content below stays on top.
|
||||
MouseArea { anchors.fill: parent }
|
||||
|
||||
Column {
|
||||
id: col
|
||||
x: 16
|
||||
y: 16
|
||||
width: parent.width - 32
|
||||
spacing: 14
|
||||
|
||||
// --- Header ---------------------------------------------------
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 26
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 8
|
||||
QbzIcon {
|
||||
name: "list-filter"
|
||||
width: 16
|
||||
height: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
tintName: "secondary"
|
||||
}
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: QbzSession.tr("Filter by genre", QbzSession.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontHeading
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 26
|
||||
height: 26
|
||||
radius: 6
|
||||
color: closeArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "x"
|
||||
width: 15
|
||||
height: 15
|
||||
tintName: closeArea.containsMouse ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: closeArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Options: Remember selection + Advanced view ---------------
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 22
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
width: (parent.width - 16) / 2
|
||||
spacing: 10
|
||||
Text {
|
||||
width: parent.width - 50
|
||||
height: 22
|
||||
text: QbzSession.tr("Remember selection", QbzSession.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
QbzToggle {
|
||||
checked: root.remember
|
||||
onToggled: function (v) { QbzBridge.genreSetRemember(v) }
|
||||
}
|
||||
}
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
width: (parent.width - 16) / 2
|
||||
spacing: 10
|
||||
Text {
|
||||
width: parent.width - 50
|
||||
height: 22
|
||||
text: QbzSession.tr("Advanced view", QbzSession.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
QbzToggle {
|
||||
checked: root.advanced
|
||||
onToggled: function (v) { QbzBridge.genreSetAdvanced(v) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Advanced view: search + 3-level tree ----------------------
|
||||
Column {
|
||||
visible: root.advanced
|
||||
width: parent.width
|
||||
spacing: 10
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 34
|
||||
radius: 6
|
||||
color: theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: searchInput.activeFocus ? theme.borderSubtle : theme.surfaceElevated
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 10
|
||||
anchors.rightMargin: 10
|
||||
spacing: 8
|
||||
QbzIcon {
|
||||
name: "search"
|
||||
width: 14
|
||||
height: 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
TextInput {
|
||||
id: searchInput
|
||||
width: parent.width - 22
|
||||
height: parent.height
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
clip: true
|
||||
onTextEdited: QbzBridge.genreSearch(text)
|
||||
Text {
|
||||
visible: searchInput.text === ""
|
||||
anchors.fill: parent
|
||||
text: QbzSession.tr("Search genres…", QbzSession.trRev)
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 320
|
||||
Flickable {
|
||||
id: treeFlick
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentWidth: width
|
||||
contentHeight: treeCol.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
Column {
|
||||
id: treeCol
|
||||
width: treeFlick.width
|
||||
spacing: 1
|
||||
Repeater {
|
||||
model: root.treeRows
|
||||
delegate: Rectangle {
|
||||
id: treeRow
|
||||
required property var modelData
|
||||
width: treeCol.width
|
||||
height: 34
|
||||
radius: 6
|
||||
color: rowArea.containsMouse || arrowArea.containsMouse
|
||||
? theme.surfaceHover : "transparent"
|
||||
|
||||
// Row click toggles selection. Declared
|
||||
// FIRST so the chevron's MouseArea below
|
||||
// sits ON TOP of it — otherwise the row
|
||||
// swallows the chevron press and the
|
||||
// sub-genres never expand (Slint #545,
|
||||
// same z-order rule).
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzBridge.genreToggle(treeRow.modelData.id)
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 6 + treeRow.modelData.level * 18
|
||||
anchors.rightMargin: 10
|
||||
spacing: 6
|
||||
|
||||
Item {
|
||||
width: 20
|
||||
height: parent.height
|
||||
QbzIcon {
|
||||
visible: treeRow.modelData.hasChildren
|
||||
anchors.centerIn: parent
|
||||
name: treeRow.modelData.expanded ? "chevron-down" : "chevron-right"
|
||||
width: 13
|
||||
height: 13
|
||||
tintName: "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: arrowArea
|
||||
anchors.fill: parent
|
||||
// Disabled on leaf rows so the
|
||||
// press falls through to the row
|
||||
// (an enabled MouseArea eats it
|
||||
// even with a no-op handler —
|
||||
// 20px dead zone otherwise).
|
||||
enabled: treeRow.modelData.hasChildren
|
||||
hoverEnabled: treeRow.modelData.hasChildren
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzBridge.genreToggleExpand(treeRow.modelData.id)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 4
|
||||
color: treeRow.modelData.selected ? theme.accent : "transparent"
|
||||
border.width: treeRow.modelData.selected ? 0 : 2
|
||||
border.color: theme.borderMuted
|
||||
QbzIcon {
|
||||
visible: treeRow.modelData.selected
|
||||
anchors.centerIn: parent
|
||||
name: "check"
|
||||
width: 11
|
||||
height: 11
|
||||
tintName: "primary"
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
// Row: [20 arrow][16 box][name][count],
|
||||
// spacing 6 — the count and ITS
|
||||
// spacing only exist when shown
|
||||
// (an invisible Text still has a
|
||||
// width, so it cannot be
|
||||
// subtracted unconditionally).
|
||||
width: parent.width - 26 - 22
|
||||
- (countLabel.visible ? countLabel.width + 6 : 0)
|
||||
height: parent.height
|
||||
text: treeRow.modelData.name
|
||||
color: treeRow.modelData.selected ? theme.textPrimary : theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
font.weight: treeRow.modelData.level === 0
|
||||
? theme.weightMedium : theme.weightRegular
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Text {
|
||||
id: countLabel
|
||||
visible: (treeRow.modelData.count || 0) > 0
|
||||
height: parent.height
|
||||
text: treeRow.modelData.count
|
||||
color: theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Simple grid: parent genres as chips -----------------------
|
||||
Grid {
|
||||
id: chipGrid
|
||||
visible: !root.advanced && root.chips.length > 0
|
||||
width: parent.width
|
||||
columns: 3
|
||||
columnSpacing: 8
|
||||
rowSpacing: 8
|
||||
readonly property int cellWidth: Math.floor((width - 2 * columnSpacing) / columns)
|
||||
|
||||
Repeater {
|
||||
model: root.chips
|
||||
delegate: Rectangle {
|
||||
id: chip
|
||||
required property var modelData
|
||||
width: chipGrid.cellWidth
|
||||
height: 38
|
||||
radius: 6
|
||||
color: chip.modelData.selected ? theme.accent
|
||||
: chipArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 8
|
||||
Text {
|
||||
width: parent.width - 24
|
||||
height: parent.height
|
||||
text: chip.modelData.name
|
||||
color: chip.modelData.selected ? theme.accentText : theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
font.weight: chip.modelData.selected ? theme.weightMedium : theme.weightRegular
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 8
|
||||
color: chip.modelData.selected ? theme.accentText : "transparent"
|
||||
border.width: chip.modelData.selected ? 0 : 2
|
||||
border.color: theme.borderMuted
|
||||
QbzIcon {
|
||||
visible: chip.modelData.selected
|
||||
anchors.centerIn: parent
|
||||
name: "check"
|
||||
width: 11
|
||||
height: 11
|
||||
tintName: "accent"
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: chipArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzBridge.genreToggle(chip.modelData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Empty/loading state for the simple grid — the parent list loads
|
||||
// on first open, so the card would otherwise flash a bare header.
|
||||
Text {
|
||||
visible: !root.advanced && root.chips.length === 0
|
||||
width: parent.width
|
||||
height: 38
|
||||
// `!mine` = the context switch has been sent but Rust's
|
||||
// republish has not landed yet (one event-loop hop), which
|
||||
// reads as loading, not as "nothing here".
|
||||
text: (root.loading || !root.mine)
|
||||
? QbzSession.tr("Loading…", QbzSession.trRev)
|
||||
: QbzSession.tr("No genres available.", QbzSession.trRev)
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
// --- Footer: Clear filter -------------------------------------
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 34
|
||||
radius: 6
|
||||
opacity: root.liveCount > 0 ? 1.0 : 0.5
|
||||
color: clearArea.containsMouse && root.liveCount > 0
|
||||
? theme.surfaceHover : theme.surfaceElevated
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: QbzSession.tr("Clear filter", QbzSession.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
}
|
||||
MouseArea {
|
||||
id: clearArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.liveCount > 0 ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (root.liveCount > 0) QbzBridge.genreClear()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,35 @@
|
||||
// missing. `tint` is the header_tint hex the Rust side now publishes in the
|
||||
// page document (album_qt.rs / artist_qt.rs `headerColor`).
|
||||
//
|
||||
// Two stacked bands, read off the .slint:
|
||||
// Bands, read off the .slint:
|
||||
// band 1 linear-gradient(180deg, tint 0%, tint 16%, transparent 100%)
|
||||
// band 2 linear-gradient(180deg, transparent 0%, transparent 82%,
|
||||
// band 4 linear-gradient(180deg, transparent 0%, transparent 82%,
|
||||
// surface-main 100%)
|
||||
// Band 2 lands the fade EXACTLY on the header/content boundary whatever
|
||||
// Band 4 lands the fade EXACTLY on the header/content boundary whatever
|
||||
// height the header resolved to, which is why the host binds `height` to the
|
||||
// divider's y rather than to a constant.
|
||||
//
|
||||
// --- LIGHT-THEME CONTRAST FLOOR (bands 2 + 3) ---------------------------
|
||||
// The header text is WHITE whenever this band is on — AlbumPageView.slint
|
||||
// :169-172 pins `hdr-strong: #ffffff` / `hdr-body: #ffffff@88%` the moment
|
||||
// `header-light` is true, on EVERY theme. That is only safe because the
|
||||
// backdrop the .slint normally paints is route A, and route A is OPAQUE
|
||||
// DARK: ImmersiveAtmosphere.slint:18 fills `#0a0a0b` under the artwork
|
||||
// copies, then :76-79 lay a flat `#000000 @ dim` sheet (the album/artist
|
||||
// headers pass `dim: 0.24`) and a `linear-gradient(180deg, #00000066 0%,
|
||||
// transparent 35%, #00000080 100%)` vignette over the whole band. White text
|
||||
// and the overlay-palette circles sit on that, not on the page colour.
|
||||
//
|
||||
// Route B alone does NOT reproduce that: its tint alpha decays from 1.0 at
|
||||
// 16% to 0.0 at 100%, so below roughly half the band the backdrop IS the
|
||||
// page. On a dark theme that is invisible (white on dark either way); on a
|
||||
// LIGHT theme the description, the meta line and the whole CircleAction row
|
||||
// — which live in the bottom third of the header — were white on white.
|
||||
// Route A's two constant sheets are therefore replicated verbatim here as
|
||||
// bands 2 and 3, and band 1 holds the tint solid until the 82% mark where
|
||||
// band 4 takes over, matching route A's opaque coverage instead of route
|
||||
// B's early decay. Same numbers, same order as ImmersiveAtmosphere.
|
||||
//
|
||||
// Mount it as the FIRST child of the page Flickable (so it scrolls with the
|
||||
// content, as the Slint's does) at x:0 with the viewport width — the band is
|
||||
// deliberately full-bleed: the page's own 32px padding must not clip it, or
|
||||
@@ -44,6 +65,10 @@ Item {
|
||||
/// (AlbumPageView.slint:168). The dynamic background and this atmosphere
|
||||
/// clash, so only one of them is ever on.
|
||||
property bool active: false
|
||||
/// ImmersiveAtmosphere's flat black sheet — the album and artist headers
|
||||
/// both mount it with `dim: 0.24` (AlbumPageView.slint:230,
|
||||
/// ArtistPageView.slint:222).
|
||||
property real dim: 0.24
|
||||
|
||||
// `visible` gates the paint, but bindings still evaluate underneath it —
|
||||
// so the stops read this, never the raw string: coercing "" to a colour
|
||||
@@ -54,15 +79,35 @@ Item {
|
||||
// Never eat clicks meant for the header controls painted on top.
|
||||
enabled: false
|
||||
|
||||
// Band 1 — the artwork tint. Solid down to the 82% mark (route A's image
|
||||
// field is opaque over exactly that span); the last 18% is band 4's job.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: root.tintColor }
|
||||
GradientStop { position: 0.16; color: root.tintColor }
|
||||
GradientStop { position: 0.82; color: root.tintColor }
|
||||
GradientStop { position: 1.0; color: "transparent" }
|
||||
}
|
||||
}
|
||||
|
||||
// Band 2 — ImmersiveAtmosphere.slint:77-79, `#000000.with-alpha(dim)`.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, root.dim)
|
||||
}
|
||||
|
||||
// Band 3 — ImmersiveAtmosphere.slint:80-82 vignette, verbatim stops.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: "#66000000" }
|
||||
GradientStop { position: 0.35; color: "transparent" }
|
||||
GradientStop { position: 1.0; color: "#80000000" }
|
||||
}
|
||||
}
|
||||
|
||||
// Band 4 — the blend that must COMPLETE on the header/content divider.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
|
||||
@@ -20,6 +20,26 @@
|
||||
// #ffffffcc ring, white glyph.
|
||||
// NOTE: the card hover-overlay circles are still the separate
|
||||
// CardOverlayButton.qml — same palette, different sizing contract.
|
||||
//
|
||||
// --- LIGHT-THEME LEGIBILITY (Slint 2.0.2, "CircleAction buttons legible on
|
||||
// --- light themes" — docs/release-2.0.2/CHANGELOG.md:213) ----------------
|
||||
// The `on-surface` arm IS that fix: CircleAction.slint:30-37 exists exactly
|
||||
// because "the default light-on-dark palette (white fills/rings/icons)
|
||||
// vanishes on light themes' plain surface". Its secondary glyph is
|
||||
// `Theme.text-primary` (CircleAction.slint:73) — the theme's max-contrast
|
||||
// colour, DARK on a light theme.
|
||||
//
|
||||
// The port could not express that, and this is where it was still broken:
|
||||
// icon tints here are PRE-BAKED SVG variants (QbzIcon.qml), and the
|
||||
// "primary" bake is a hardcoded `fill="#ffffff"` — it is NOT text-primary,
|
||||
// it is white. So the on-surface secondary (a `surface-elevated` disc, i.e.
|
||||
// near-white on a light theme) was painting a WHITE glyph on it: the exact
|
||||
// vanishing act the .slint arm was written to stop. `onSurfaceTint` below
|
||||
// resolves text-primary to the only baked dark variant ("black") whenever
|
||||
// the active theme is light — theme.isDark is Rust-published from the
|
||||
// surface-main luminance (theme_qt.rs:221), the same luminance test Slint's
|
||||
// `Theme.is-dark` uses. The OVERLAY arm keeps its literals: it sits on the
|
||||
// artwork band, which is dark under every theme.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
@@ -38,6 +58,11 @@ Rectangle {
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
/// Slint's `Theme.text-primary` glyph tint, expressed in baked variants:
|
||||
/// the "primary" bake is a literal #ffffff, so a light theme has to take
|
||||
/// the "black" bake or the glyph paints white-on-near-white.
|
||||
readonly property string onSurfaceTint: theme.isDark ? "primary" : "black"
|
||||
|
||||
width: primary ? 44 : 32
|
||||
height: primary ? 44 : 32
|
||||
radius: width / 2
|
||||
@@ -56,10 +81,18 @@ Rectangle {
|
||||
width: root.primary ? 19 : 15
|
||||
height: root.primary ? 19 : 15
|
||||
anchors.centerIn: parent
|
||||
// active wins in both arms; then: overlay primary = black glyph on
|
||||
// the white disc, everything else = the light/primary glyph.
|
||||
tintName: root.active ? "accent"
|
||||
: (root.overlay && root.primary ? "black" : "primary")
|
||||
// CircleAction.slint:70-74, verbatim:
|
||||
// active -> Theme.accent
|
||||
// on-surface + primary -> #ffffff (glyph on the accent disc)
|
||||
// on-surface + secondary -> Theme.text-primary <- the light-theme
|
||||
// case; "primary" would be white here
|
||||
// overlay + primary -> #000000 (glyph on the white disc)
|
||||
// overlay + secondary -> #ffffff
|
||||
tintName: root.active
|
||||
? "accent"
|
||||
: (root.overlay
|
||||
? (root.primary ? "black" : "primary")
|
||||
: (root.primary ? "primary" : root.onSurfaceTint))
|
||||
}
|
||||
MouseArea {
|
||||
id: cbArea
|
||||
|
||||
@@ -5,12 +5,24 @@
|
||||
// Arms: `btnSize` (32 default; 30 compact panels, 36 header), `iconSize`,
|
||||
// `active` (accent glyph), `activeBackground` (HeaderBar: elevated fill
|
||||
// when active), `btnEnabled` (dims 0.3 + muted glyph, disarms).
|
||||
//
|
||||
// LIGHT-THEME CORRECTNESS: the glyph tints are PRE-BAKED SVG colours
|
||||
// (assets/icons/<tint>/) — "primary" is literally #ffffff and "secondary"
|
||||
// #cccccc, i.e. the DARK theme's text-primary / text-secondary frozen into
|
||||
// the asset. On a light theme those render near-white on a light surface and
|
||||
// the whole button set disappears, which is the reported bug. The bake is
|
||||
// therefore chosen from the LIVE token's lightness instead of being
|
||||
// hardcoded: bright token -> the light bake, dark token -> the dark bake.
|
||||
// TODO(glue): the durable home for this is a QbzTheme.tintFor(token) helper
|
||||
// (or real runtime tinting in QbzIcon) — see the report; it is duplicated in
|
||||
// FavToggle / TransportControls / SongCard until then.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
import "../theme"
|
||||
|
||||
Rectangle {
|
||||
id: btn
|
||||
property string name: ""
|
||||
property int btnSize: 32
|
||||
property int iconSize: 16
|
||||
@@ -21,6 +33,13 @@ Rectangle {
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
// Bake that actually matches Theme.text-primary / text-secondary in the
|
||||
// ACTIVE theme (BarControls.slint IconButton: hover -> text-primary,
|
||||
// idle -> text-secondary). text-muted maps to the "muted" bake in both
|
||||
// polarities: #888888 is mid-grey and reads on light and dark alike.
|
||||
readonly property string tintStrong: theme.textPrimary.hslLightness > 0.5 ? "primary" : "black"
|
||||
readonly property string tintWeak: theme.textSecondary.hslLightness > 0.5 ? "secondary" : "muted"
|
||||
|
||||
width: btnSize
|
||||
height: btnSize
|
||||
radius: theme.radiusSm
|
||||
@@ -34,7 +53,7 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
tintName: !parent.btnEnabled ? "muted"
|
||||
: parent.active ? "accent"
|
||||
: biArea.containsMouse ? "primary" : "secondary"
|
||||
: biArea.containsMouse ? btn.tintStrong : btn.tintWeak
|
||||
}
|
||||
MouseArea {
|
||||
id: biArea
|
||||
|
||||
Reference in new issue
Block a user