refactor(qbz-qt): phase 23 part 1 — QML module layout + first five domain bridges

Two fronts of the modularization, both gated green before this commit.

QML leaves the flat qml/ directory for seven modules: cards, controls,
rows, settings, shell, theme, views. Only Main.qml and LoginScreen.qml
stay at the root. build.rs matches the tree exactly (55 files), relative
imports and asset paths were re-anchored for the new depth.

The QbzBridge God-object starts breaking up: QbzSession, QbzShell,
QbzPlayer, QbzQueue and QbzHome are now their own #[cxx_qt::bridge]
singletons, each with its own OnceLock<CxxQtThread> and ui() hop, booted
in order from Main.qml. Bridge files stay directly under src/ because
cxx-qt-build only accepts rust_files from one directory (QTBUG-93443).

bridge.rs keeps 5.5 domains (library, album/artist, settings,
integrations, search, playlist) and dies once they are split out.

cc
This commit is contained in:
vicrodh committed 2026-07-28 11:08:20 -06:00
1 parent 580b72084f
commit 9a4fec6b70
72 files changed
+2152 -1690

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
// CardMenu — the shared ⋯ menu surface for card overlays (promoted from
// LibraryView in phase 21): 33px rows, icon 15 + label 13, driven by an
// `entries` model of {label, icon, action}; emits picked(action).
import QtQuick
import com.blitzfc.qbz
import "../theme"
QbzContextMenu {
id: cmRoot
property var entries: []
signal picked(string action)
QbzTheme { id: theme }
Repeater {
model: cmRoot.entries
delegate: Rectangle {
required property var modelData
width: parent ? parent.width : 0
height: 33
radius: 5
color: cmiArea.containsMouse ? theme.surfaceHover : "transparent"
Row {
anchors.fill: parent
anchors.leftMargin: 8
spacing: 8
QbzIcon { name: modelData.icon; width: 15; height: 15; anchors.verticalCenter: parent.verticalCenter; tintName: "secondary" }
Text {
height: parent.height
width: parent.width - 23
text: modelData.label
color: theme.textSecondary
font.pixelSize: 13
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
MouseArea {
id: cmiArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { cmRoot.close(); cmRoot.picked(modelData.action) }
}
}
}
}
@@ -0,0 +1,39 @@
// CardOverlayButton — the shared card hover-overlay button (the Slint
// per-card OverlayButton copies, homologated in the POC at
// LibraryView.LibOverlayBtn and promoted to shared in phase 21):
// primary = 44px white disc (black icon), ghost = 36px translucent disc
// (1.5px border); `active` tints the icon accent (follow/heart state).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string name: ""
property bool primary: false
property bool active: false
signal clicked()
width: primary ? 44 : 36
height: primary ? 44 : 36
radius: width / 2
color: primary ? (obArea.containsMouse ? "#d6ffffff" : "#ffffff")
: (obArea.containsMouse ? "#3dffffff" : "#24ffffff")
border.width: primary ? 0 : 1.5
border.color: "#ccffffff"
QbzIcon {
name: parent.name
width: primary ? 18 : 16
height: primary ? 18 : 16
anchors.centerIn: parent
tintName: parent.active ? "accent" : (parent.primary ? "black" : "primary")
}
property alias hovered: obArea.containsMouse
MouseArea {
id: obArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: parent.clicked()
}
}
@@ -0,0 +1,16 @@
// Settings group header (AppearanceSettings.slint GroupHeader) — extracted
// from SettingsView.qml in phase 19: 11px muted uppercase, 1.5px tracking,
// semibold.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Text {
QbzTheme { id: theme }
color: theme.textMuted
font.pixelSize: 11
font.letterSpacing: 1.5
font.weight: theme.weightSemibold
}
@@ -0,0 +1,46 @@
// QbzCircleAction — the on-surface circular header action (Slint
// primitives/CircleAction.slint on-surface arm), consolidated in phase 22
// from THREE copies (AlbumView.CircleBtn ≡ ArtistView.CircleBtn,
// PlaylistView.CircleBtn = superset with the `primary` + `btnEnabled`
// arms). 32px elevated disc + 1.5px muted ring (active = accent glyph);
// `primary` = 40px accent disc (black glyph).
// NOTE: the OVERLAY-palette circle buttons (on artwork) are the separate
// CardOverlayButton.qml — different palette, deliberately not merged.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string name: ""
property bool active: false
property bool primary: false
property bool btnEnabled: true
signal clicked(var mouse)
QbzTheme { id: theme }
width: primary ? 40 : 32
height: primary ? 40 : 32
radius: width / 2
color: primary ? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
border.width: primary ? 0 : 1.5
border.color: theme.borderMuted
opacity: btnEnabled ? 1.0 : 0.4
QbzIcon {
name: parent.name
width: primary ? 20 : 15
height: primary ? 20 : 15
anchors.centerIn: parent
tintName: parent.primary ? "black" : (parent.active ? "accent" : "primary")
}
MouseArea {
id: cbArea
anchors.fill: parent
enabled: parent.btnEnabled
hoverEnabled: true
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: function (mouse) { parent.clicked(mouse) }
}
}
@@ -0,0 +1,72 @@
// QbzContextMenu — the shared popup surface for the app's ⋯ / context
// menus, with CORRECT positioning (phase 12):
//
// - openAtCursor(item, localX, localY): context menus open AT THE
// POINTER, like the Slint unified TrackContextMenu (TrackRow.slint:
// `absolute-position - layout-offset + local-pointer`, clamped into
// the row/window). Coordinates are mapped to the window and the menu
// is parented to the Overlay, so a menu never renders inside the
// triggering card/row.
// - openBelowRight(item): button menus anchor under their trigger,
// right edge aligned (the QbzSelect / sort-menu convention).
// - Both clamp into the window with an 8px margin (Slint clamps the x
// to `width - menu-width - 12`) so a menu never opens off-screen —
// Popup does NOT do this on its own.
//
// The background matches ContextMenu.slint (surface-main, Radius.sm,
// 1px border-muted). Rows go in the default content (33px, icon 15 +
// label 13 per the existing per-site convention).
import QtQuick
import QtQuick.Controls
import com.blitzfc.qbz
import "../theme"
Popup {
id: root
parent: Overlay.overlay
width: menuWidth
padding: 5
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
property int menuWidth: 196
default property alias menuContent: col.data
QbzTheme { id: theme }
background: Rectangle {
color: theme.surfaceMain
radius: theme.radiusSm
border.width: 1
border.color: theme.borderMuted
}
contentItem: Column { id: col }
// Final placement is computed BEFORE open() — the popup's implicit
// height is already known (static content), and `Window.window` is
// only reliably attached on the SOURCE item, not on the popup.
function _place(gx, gy, win) {
if (win) {
x = Math.max(8, Math.min(gx, win.width - width - 8))
y = Math.max(8, Math.min(gy, win.height - implicitHeight - 8))
} else {
x = gx
y = gy
}
open()
}
/// Context menu at the pointer. `localX/localY` are the click coords
/// inside `sourceItem` (the MouseArea that caught the click).
function openAtCursor(sourceItem, localX, localY) {
var g = sourceItem.mapToItem(null, localX, localY)
_place(g.x, g.y, sourceItem.Window.window)
}
/// Button menu: below the trigger, right edges aligned.
function openBelowRight(sourceItem) {
var g = sourceItem.mapToItem(null, sourceItem.width - width, sourceItem.height + 4)
_place(g.x, g.y, sourceItem.Window.window)
}
}
@@ -0,0 +1,55 @@
// QbzEmptyState — the plain centered empty state (title + optional icon /
// body / action), consolidated in phase 22 from HomeView.RecentPlaceholder,
// QueuePanel's empty queue, SearchView's no-results and Cortinilla's
// no-results. Slint has no shared EmptyState either (per-surface inline) —
// this is a POC-only consolidation; arms: `iconName` ("" = none), `title`,
// `body` ("" = hidden), `actionLabel` + `actionClicked()` ("" = no action).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Column {
property string iconName: ""
property string title: ""
property string body: ""
property string actionLabel: ""
signal actionClicked()
QbzTheme { id: theme }
spacing: 0
QbzIcon {
visible: iconName !== ""
name: iconName
width: 40
height: 40
anchors.horizontalCenter: parent.horizontalCenter
tintName: "muted"
}
Item { visible: iconName !== ""; width: 1; height: 14 }
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: title
color: theme.textPrimary
font.pixelSize: theme.fontSection
font.weight: theme.weightSemibold
}
Item { visible: body !== ""; width: 1; height: 6 }
Text {
visible: body !== ""
anchors.horizontalCenter: parent.horizontalCenter
text: body
color: theme.textMuted
font.pixelSize: 13
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
}
Item { visible: actionLabel !== ""; width: 1; height: 14 }
SettingsButton {
visible: actionLabel !== ""
anchors.horizontalCenter: parent.horizontalCenter
text: actionLabel
onClicked: parent.actionClicked()
}
}
@@ -0,0 +1,47 @@
// QbzIconButton — the square icon button (Slint BarControls IconButton /
// HeaderIconButton), consolidated in phase 22 from PlayerBar.BarIconBtn +
// NowPlayingBarSmall.BarIconBtn (verbatim twins), QueuePanel.PanelIconBtn
// and HeaderBar.HeaderIconBtn.
// 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).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string name: ""
property int btnSize: 32
property int iconSize: 16
property bool active: false
property bool activeBackground: false
property bool btnEnabled: true
signal clicked()
QbzTheme { id: theme }
width: btnSize
height: btnSize
radius: theme.radiusSm
opacity: btnEnabled ? 1.0 : 0.3
color: (biArea.containsMouse && btnEnabled) ? theme.surfaceHover
: (active && activeBackground) ? theme.surfaceElevated : "transparent"
QbzIcon {
name: parent.name
width: parent.iconSize
height: parent.iconSize
anchors.centerIn: parent
tintName: !parent.btnEnabled ? "muted"
: parent.active ? "accent"
: biArea.containsMouse ? "primary" : "secondary"
}
MouseArea {
id: biArea
anchors.fill: parent
enabled: parent.btnEnabled
hoverEnabled: true
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: if (parent.btnEnabled) parent.clicked()
}
}
@@ -0,0 +1,58 @@
// QbzLineEdit (std-widgets LineEdit, settings styling) — extracted from
// SettingsView.qml in phase 19. 240px / 34px elevated r8 bordered input;
// commits on Enter AND on focus loss (the Tauri onchange semantics —
// PlaybackSettings.slint).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string text: ""
property string placeholder: ""
property bool isPassword: false
signal committed(string value)
QbzTheme { id: theme }
width: 240
height: 34
radius: theme.radiusSm
border.width: 1
border.color: theme.borderSubtle
color: theme.surfaceElevated
TextInput {
id: input
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
color: theme.textPrimary
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
clip: true
echoMode: parent.isPassword ? TextInput.Password : TextInput.Normal
text: parent.text
onAccepted: parent.committed(text)
onActiveFocusChanged: if (!activeFocus) parent.committed(text)
// External republish (e.g. Reset) re-seeds the field while it is
// not being edited.
Binding {
target: input
property: "text"
value: input.parent.text
when: !input.activeFocus
}
}
Text {
visible: input.text === ""
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
text: placeholder
color: theme.textMuted
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
@@ -0,0 +1,37 @@
// QbzNavButton — the 28px circular page/history chevron (Slint NavButton),
// consolidated in phase 22 from THREE identical copies (HomeView.NavBtn,
// SectionRail.RailNavBtn, HeaderBar.HeaderNavBtn). Contract: icon `name`,
// `btnEnabled` (dims to 0.4 + muted glyph, disarms), `clicked()`.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string name: ""
property bool btnEnabled: true
signal clicked()
QbzTheme { id: theme }
width: 28
height: 28
radius: 14
opacity: btnEnabled ? 1.0 : 0.4
color: (nbArea.containsMouse && btnEnabled) ? theme.surfaceHover : theme.surfaceElevated
QbzIcon {
name: parent.name
width: 15
height: 15
anchors.centerIn: parent
tintName: parent.btnEnabled ? "primary" : "muted"
}
MouseArea {
id: nbArea
anchors.fill: parent
enabled: parent.btnEnabled
hoverEnabled: true
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: parent.clicked()
}
}
@@ -0,0 +1,53 @@
// QbzOfflinePlaceholder — the offline gate (offline/OfflinePlaceholder
// .slint), consolidated in phase 22 from the TWO verbatim copies
// (HomeView + LibraryView). Arms: `induced` (offlineMode === 2) switches
// the body copy; `showSettingsAction` mounts the induced-only "Open
// Settings" button (POC-NOTE: navigates via QbzShell.navigateTo —
// the Slint opens Settings the same way).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Column {
property bool induced: QbzSession.offlineMode === 2
property bool showSettingsAction: false
signal settingsClicked()
QbzTheme { id: theme }
spacing: 0
QbzIcon {
name: "cloud-off"
width: 56
height: 56
anchors.horizontalCenter: parent.horizontalCenter
tintName: "muted"
}
Item { width: 1; height: 18 }
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: QbzSession.tr("You're offline", QbzSession.trRev)
color: theme.textPrimary
font.pixelSize: theme.fontHeading
font.weight: theme.weightSemibold
}
Item { width: 1; height: 8 }
Text {
width: 420
text: induced
? QbzSession.tr("Offline mode is enabled. Disable it in Settings to use Qobuz.", QbzSession.trRev)
: QbzSession.tr("No internet connection. Your local library and downloads keep working.", QbzSession.trRev)
color: theme.textSecondary
font.pixelSize: theme.fontBody
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
}
Item { visible: showSettingsAction && induced; width: 1; height: 18 }
SettingsButton {
visible: showSettingsAction && induced
anchors.horizontalCenter: parent.horizontalCenter
text: QbzSession.tr("Open Settings", QbzSession.trRev)
onClicked: parent.settingsClicked()
}
}
@@ -0,0 +1,89 @@
// QbzSectionHeader — the section/rail header (Slint Carousel header:
// title + [View all] LEFT of the page chevrons), consolidated in phase 22
// from HomeView.RailHeader (+ its ViewAllLink), SectionRail's header and
// SearchView.SectionHeader. Slint has NO shared SectionHeader primitive
// (each carousel inlines one) — this is a POC consolidation of the three
// identical-in-intent copies.
//
// Arms: `title` (fontSection semibold); `showViewAll` + `viewAllLabel` +
// `viewAllAccent` (Search's accent chip vs Home's secondary link) +
// viewAllClicked(); `showChevrons` + `leftEnabled`/`rightEnabled` +
// pageLeft()/pageRight() (the host owns the page-step math).
// Deliberately NOT absorbed: ArtistView.ReleaseSection's header (adds a
// sort dropdown + "See discography" — distinct arms, still stubs) and the
// uppercase 10-11px eyebrow mini-headers (different type scale).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Item {
property string title: ""
property bool showViewAll: false
property string viewAllLabel: ""
property bool viewAllAccent: false
property bool showChevrons: true
property bool leftEnabled: false
property bool rightEnabled: false
signal viewAllClicked()
signal pageLeft()
signal pageRight()
QbzTheme { id: theme }
width: parent ? parent.width : 0
height: 28
Text {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
text: parent.title
color: theme.textPrimary
font.pixelSize: theme.fontSection
font.weight: theme.weightSemibold
}
Row {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: 4
// "View all" link/chip (accent = Search's, secondary = Home's).
Rectangle {
visible: parent.parent.showViewAll
anchors.verticalCenter: parent.verticalCenter
width: vaText.implicitWidth + 16
height: 26
radius: 4
color: vaArea.containsMouse ? theme.surfaceHover : "transparent"
Text {
id: vaText
anchors.centerIn: parent
text: parent.parent.parent.viewAllLabel !== ""
? parent.parent.parent.viewAllLabel
: QbzSession.tr("View all →", QbzSession.trRev)
color: parent.parent.parent.viewAllAccent ? theme.accent
: vaArea.containsMouse ? theme.textPrimary : theme.textSecondary
font.pixelSize: 14
font.weight: theme.weightMedium
}
MouseArea {
id: vaArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: parent.parent.parent.viewAllClicked()
}
}
QbzNavButton {
visible: parent.parent.showChevrons
name: "chevron-left"
btnEnabled: parent.parent.leftEnabled
onClicked: parent.parent.pageLeft()
}
QbzNavButton {
visible: parent.parent.showChevrons
name: "chevron-right"
btnEnabled: parent.parent.rightEnabled
onClicked: parent.parent.pageRight()
}
}
}
+293
View File
@@ -0,0 +1,293 @@
// QbzSelect (primitives/QbzSelect.slint, standard size) — extracted from
// SettingsView.qml in phase 19 so every settings panel shares the one
// replica (the ui-control-alignment-standard searchable dropdown: the
// filter box shows past ~8 options via `searchable: true`).
// 34px bordered control (elevated, hover -> surface-hover) + a Popup
// list (surface-main r8 border-muted, 32px rows, capped at 360px with
// scroll, optional 42px filter box, 24px group-header rows, "BP" badge
// / speaker glyph on device options). `options` entries are either
// plain strings or {label, bp, group} objects (the device list).
import QtQuick
import QtQuick.Controls
import com.blitzfc.qbz
import "../theme"
Rectangle {
property var options: []
property int currentIndex: 0
property int menuWidth: 240
property int popupWidth: 0
property bool enabled: true
property bool searchable: false
signal selected(int index)
QbzTheme { id: theme }
id: selectRoot
width: menuWidth
height: 34
radius: theme.radiusSm
border.width: 1
border.color: theme.borderSubtle
color: selArea.containsMouse && enabled ? theme.surfaceHover : theme.surfaceElevated
opacity: enabled ? 1.0 : 0.4
readonly property int listWidth: Math.max(popupWidth, menuWidth)
readonly property int rowHeight: 32
readonly property int headerHeight: 24
readonly property int searchHeight: searchable ? 42 : 0
readonly property int maxListHeight: 360
property string filter: ""
function optLabel(i) {
const o = options[i]
return (typeof o === "string") ? o : (o && o.label !== undefined ? o.label : "")
}
function optHasBadges() {
return options.length > 0 && typeof options[0] !== "string"
}
function optBp(i) {
const o = options[i]
return o && o.bp === true
}
function optGroup(i) {
const o = options[i]
return (o && o.group !== undefined) ? o.group : ""
}
Row {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 10
spacing: 8
Text {
width: parent.width - 16 - 8 - badgeSlot.width - (badgeSlot.visible ? 8 : 0)
height: parent.height
text: selectRoot.currentIndex >= 0 && selectRoot.currentIndex < selectRoot.options.length
? selectRoot.optLabel(selectRoot.currentIndex) : ""
color: theme.textPrimary
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
// Trailing BP badge / speaker glyph for the CURRENT device option.
Item {
id: badgeSlot
visible: selectRoot.optHasBadges()
width: visible ? 20 : 0
height: parent.height
Text {
visible: selectRoot.optHasBadges() && selectRoot.currentIndex < selectRoot.options.length
&& selectRoot.optBp(selectRoot.currentIndex)
anchors.centerIn: parent
text: "BP"
color: theme.accent
font.pixelSize: theme.fontLegal
font.weight: theme.weightSemibold
font.letterSpacing: 0.5
}
QbzIcon {
visible: selectRoot.optHasBadges() && selectRoot.currentIndex < selectRoot.options.length
&& !selectRoot.optBp(selectRoot.currentIndex)
name: "volume-2"
width: 14
height: 14
anchors.centerIn: parent
tintName: "muted"
}
}
QbzIcon {
name: "chevron-down"
width: 16
height: 16
anchors.verticalCenter: parent.verticalCenter
tintName: "muted"
}
}
MouseArea {
id: selArea
anchors.fill: parent
hoverEnabled: true
cursorShape: selectRoot.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
if (selectRoot.enabled) {
selectRoot.filter = ""
popup.open()
}
}
}
Popup {
id: popup
parent: selectRoot
// Right-anchored: a list wider than the control grows leftward.
x: selectRoot.width - selectRoot.listWidth
y: selectRoot.height + 4
width: selectRoot.listWidth
height: selectRoot.searchHeight + Math.min(listContent.contentHeight, selectRoot.maxListHeight) + 10
padding: 0
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
background: Rectangle {
color: theme.surfaceMain
radius: theme.radiusSm
border.width: 1
border.color: theme.borderMuted
}
contentItem: Item {
implicitWidth: selectRoot.listWidth
implicitHeight: popup.height
// Filter box (searchable lists only).
Rectangle {
id: searchBox
visible: selectRoot.searchable
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: selectRoot.searchHeight
color: "transparent"
Row {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.bottomMargin: 6
spacing: 8
QbzIcon {
name: "search"
width: 14
height: 14
anchors.verticalCenter: parent.verticalCenter
tintName: "muted"
}
Item {
width: parent.width - 14 - 8
height: parent.height
TextInput {
id: searchInput
anchors.fill: parent
color: theme.textPrimary
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
clip: true
text: selectRoot.filter
onTextChanged: selectRoot.filter = text
}
Text {
visible: searchInput.text === ""
anchors.fill: parent
text: QbzSession.tr("Search…", QbzSession.trRev)
color: theme.textMuted
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
}
}
}
}
ListView {
id: listContent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: searchBox.bottom
anchors.bottom: parent.bottom
anchors.topMargin: 5
anchors.bottomMargin: 5
clip: true
boundsBehavior: Flickable.StopAtBounds
model: selectRoot.options
delegate: Column {
id: optRow
required property int index
required property var modelData
width: listContent.width
readonly property string label: selectRoot.optLabel(index)
readonly property bool shown: selectRoot.filter === ""
|| label.toLowerCase().indexOf(selectRoot.filter.toLowerCase()) >= 0
// Group-header row (ALSA device sections).
Rectangle {
visible: optRow.shown && selectRoot.optGroup(optRow.index) !== ""
width: parent.width
height: visible ? selectRoot.headerHeight : 0
color: "transparent"
Text {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.top: parent.top
anchors.topMargin: 4
height: parent.height - 4
text: selectRoot.optGroup(optRow.index)
color: theme.textMuted
font.pixelSize: theme.fontLegal
font.weight: theme.weightSemibold
font.letterSpacing: 0.5
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
Rectangle {
visible: optRow.shown
width: parent.width
height: visible ? selectRoot.rowHeight : 0
color: optArea.containsMouse ? theme.surfaceHover : "transparent"
Row {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
spacing: 8
Text {
width: parent.width - rowBadge.width - (rowBadge.visible ? 8 : 0)
height: parent.height
text: optRow.label
color: optRow.index === selectRoot.currentIndex
? theme.accent : theme.textSecondary
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
Item {
id: rowBadge
visible: selectRoot.optHasBadges()
width: visible ? 20 : 0
height: parent.height
Text {
visible: selectRoot.optBp(optRow.index)
anchors.centerIn: parent
text: "BP"
color: theme.accent
font.pixelSize: theme.fontLegal
font.weight: theme.weightSemibold
font.letterSpacing: 0.5
}
QbzIcon {
visible: !selectRoot.optBp(optRow.index)
name: "volume-2"
width: 14
height: 14
anchors.centerIn: parent
tintName: "muted"
}
}
}
MouseArea {
id: optArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
popup.close()
selectRoot.selected(optRow.index)
}
}
}
}
}
}
}
}
+75
View File
@@ -0,0 +1,75 @@
// QbzSlider (primitives/QbzSlider.slint) — extracted from SettingsView.qml
// in phase 19. 200x22, 4px r2 track, accent fill, 16px thumb; integer
// steps. Like the Slint original the thumb follows the pointer during a
// drag (local dragValue) and commits each step via changed(int).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Item {
property int minimum: 0
property int maximum: 10
property int value: 0
signal changed(int newValue)
QbzTheme { id: theme }
width: 200
height: 22
readonly property int thumbSize: 16
readonly property real travel: width - thumbSize
readonly property real fraction: maximum > minimum
? Math.max(0, Math.min(1, (value - minimum) / (maximum - minimum))) : 0
property bool dragging: false
property real dragFraction: fraction
readonly property real shownFraction: dragging ? dragFraction : fraction
onFractionChanged: if (!dragging) dragFraction = fraction
function commit(frac) {
const v = Math.round(minimum + Math.max(0, Math.min(1, frac)) * (maximum - minimum))
if (v !== value) changed(v)
}
Rectangle { // track
x: 0
y: Math.round((parent.height - height) / 2)
width: parent.width
height: 4
radius: 2
color: theme.surfaceElevated
}
Rectangle { // accent fill
x: 0
y: Math.round((parent.height - height) / 2)
width: parent.thumbSize / 2 + parent.shownFraction * parent.travel
height: 4
radius: 2
color: theme.accent
}
Rectangle { // thumb
width: parent.thumbSize
height: parent.thumbSize
radius: parent.thumbSize / 2
x: parent.shownFraction * parent.travel
anchors.verticalCenter: parent.verticalCenter
color: theme.textPrimary
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onPressed: {
parent.dragging = true
parent.dragFraction = Math.max(0, Math.min(1, (mouse.x - parent.thumbSize / 2) / parent.travel))
parent.commit(parent.dragFraction)
}
onPositionChanged: {
if (pressed) {
parent.dragFraction = Math.max(0, Math.min(1, (mouse.x - parent.thumbSize / 2) / parent.travel))
parent.commit(parent.dragFraction)
}
}
onReleased: parent.dragging = false
}
}
+102
View File
@@ -0,0 +1,102 @@
// QbzTabBar — the segmented tab pill bar (primitives/SegmentedTabBar
// .slint), consolidated in phase 22 from HomeView's discover tab pill and
// LibraryView's SegTab row (+ the playlists sub-tab via `compact`).
// Arms: `tabs` ([{id, label, count?}]), `activeId`, `counts` (11px count
// chip), `underline` (2px accent active cue — the Slint redundant-shape
// cue), `compact` (24px mini variant). Emits selected(id); the host owns
// side effects (scroll resets, refetches).
// Deliberately NOT absorbed (Slint keeps them per-surface too): the
// SearchView underline tab strip, QueuePanel's text tabs, ArtistView's
// scroll-spy jump links.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
id: root
property var tabs: []
property string activeId: ""
property bool counts: false
property bool underline: false
property bool compact: false
signal selected(string id)
QbzTheme { id: theme }
width: segBarRow.width
height: segBarRow.height
color: theme.surfaceElevated
radius: 6
Row {
id: segBarRow
padding: root.compact ? 2 : 3
spacing: 4
Repeater {
model: root.tabs
delegate: Rectangle {
id: segRoot
required property var modelData
readonly property bool active: modelData.id === root.activeId
readonly property int count: modelData.count || 0
width: segRow.implicitWidth
height: segRow.implicitHeight
radius: 4
color: active ? theme.surfaceMain
: segArea.containsMouse ? theme.surfaceHover : "transparent"
Row {
id: segRow
leftPadding: root.compact ? 8 : 12
rightPadding: (root.compact ? 8 : 12) - (root.counts && segRoot.count > 0 ? 4 : 0)
topPadding: root.compact ? 4 : 6
bottomPadding: root.compact ? 4 : 6
spacing: 7
Text {
text: segRoot.modelData.label
color: segRoot.active ? theme.textPrimary : theme.textMuted
font.pixelSize: root.compact ? 12 : theme.fontLegal
font.weight: theme.weightMedium
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
visible: root.counts && segRoot.count > 0
width: Math.max(18, countText.implicitWidth + 10)
height: 16
radius: 8
anchors.verticalCenter: parent.verticalCenter
color: segRoot.active ? "#26ffffff" : "#14ffffff"
Text {
id: countText
anchors.centerIn: parent
text: segRoot.count
color: segRoot.active ? theme.textPrimary : theme.textSecondary
font.pixelSize: 11
font.weight: theme.weightMedium
}
}
}
// Active underline (redundant shape cue, Slint Segment).
Rectangle {
visible: root.underline && segRoot.active
x: 4
width: parent.width - 8
height: 2
y: parent.height - 2
radius: 1
color: theme.accent
}
MouseArea {
id: segArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.selected(segRoot.modelData.id)
}
}
}
}
}
+37
View File
@@ -0,0 +1,37 @@
// QbzToggle (primitives/QbzToggle.slint) — extracted from SettingsView.qml
// in phase 19 so every settings panel shares the one replica.
// 40x22 pill r11, 16px knob, accent when on, opacity .4 disabled,
// 120ms ease-out knob travel. Emits toggled(newValue); never self-flips.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property bool checked: false
property bool enabled: true
signal toggled(bool value)
QbzTheme { id: theme }
width: 40
height: 22
radius: 11
color: checked ? theme.accent : theme.surfaceElevated
opacity: enabled ? 1.0 : 0.4
Rectangle {
width: 16
height: 16
radius: 8
color: theme.textPrimary
y: 3
x: parent.checked ? parent.width - width - 3 : 3
Behavior on x { NumberAnimation { duration: 120; easing.type: Easing.OutQuad } }
}
MouseArea {
anchors.fill: parent
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: if (parent.enabled) parent.toggled(!parent.checked)
}
}
@@ -0,0 +1,36 @@
// QualityMini — the icon-only quality badge (hi-res SVG / CD glyph),
// promoted from LibraryView in phase 21 so the shared TrackCard (and the
// Library track rows) mount the one replica.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Item {
property string tier: ""
visible: tier !== ""
width: tier === "hires" ? 42 : 30
height: 30
QbzTheme { id: theme }
Image {
visible: tier === "hires"
source: "qrc:/qt/qml/com/blitzfc/qbz/qml/assets/hi-res.svg"
width: 42
height: 28
anchors.centerIn: parent
sourceSize: Qt.size(84, 56)
fillMode: Image.PreserveAspectFit
}
Rectangle {
visible: tier === "cd"
width: 30
height: 30
radius: 3
color: theme.surfaceElevated
border.width: 1
border.color: theme.borderSubtle
QbzIcon { name: "cd"; width: 16; height: 16; anchors.centerIn: parent; tintName: "muted" }
}
}
+51
View File
@@ -0,0 +1,51 @@
// SettingRow (settings/SettingRow.slint) — extracted from SettingsView.qml
// in phase 19. 52px (64 with a description); label 15 medium + description
// 12 muted on the left (opacity .45 when disabled), the control flush right.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Item {
property string label: ""
property string description: ""
property bool rowEnabled: true
default property alias control: controlHost.data
QbzTheme { id: theme }
width: parent ? parent.width : 0
height: description === "" ? 52 : 64
Column {
anchors.left: parent.left
anchors.right: controlHost.left
anchors.rightMargin: 24
anchors.verticalCenter: parent.verticalCenter
spacing: 3
opacity: rowEnabled ? 1.0 : 0.45
Text {
width: parent.width
text: label
color: theme.textPrimary
font.pixelSize: theme.fontBody
font.weight: theme.weightMedium
elide: Text.ElideRight
}
Text {
visible: description !== ""
width: parent.width
text: description
color: theme.textMuted
font.pixelSize: 12
wrapMode: Text.WordWrap
}
}
Item {
id: controlHost
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
width: childrenRect.width
height: childrenRect.height
}
}
@@ -0,0 +1,56 @@
// Settings SecondaryButton (IntegrationsSettings.slint:27 /
// AppearanceSettings.slint:83) — min 160px (compact variant 34px square for
// icon buttons), 34px tall, bordered, optional danger red (#e0564f ≈
// theme.danger), busy spinner text.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string text: ""
property string iconName: ""
property bool danger: false
property bool busy: false
property bool enabled: true
signal clicked()
QbzTheme { id: theme }
width: Math.max(iconName !== "" && text === "" ? 34 : 160, row.implicitWidth + 24)
height: 34
radius: theme.radiusSm
border.width: 1
border.color: danger ? theme.danger : theme.borderSubtle
color: enabled && btnArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
opacity: enabled ? 1.0 : 0.4
Row {
id: row
anchors.centerIn: parent
spacing: 8
QbzIcon {
visible: iconName !== ""
name: iconName
width: 15
height: 15
anchors.verticalCenter: parent.verticalCenter
tintName: danger ? "favorite" : "secondary"
}
Text {
visible: text !== ""
text: parent.parent.text
color: parent.parent.danger ? theme.danger : theme.textPrimary
font.pixelSize: theme.fontBody
font.weight: theme.weightMedium
verticalAlignment: Text.AlignVCenter
}
}
MouseArea {
id: btnArea
anchors.fill: parent
hoverEnabled: true
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: if (parent.enabled) parent.clicked()
}
}
@@ -0,0 +1,15 @@
// Settings 1px divider (settings panel group separator) — extracted from
// SettingsView.qml in phase 19 (named SettingsDivider so it never shadows
// QtQuick.Controls.Divider in the shared qml directory).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
QbzTheme { id: theme }
width: parent ? parent.width : 0
height: 1
color: theme.borderSubtle
}
@@ -0,0 +1,5 @@
// Settings 12px group spacer — extracted from SettingsView.qml in phase 19.
import QtQuick
Item { width: 1; height: 12 }