feat(qt): immersive player bar and search cortinilla (B5)
km
This commit is contained in:
9 files changed
+1830
-57
No files matched your search
@@ -0,0 +1,351 @@
|
||||
// ImmersivePlayerBar — the immersive compact player (contract
|
||||
// 2026-08-02-immersive-port §5.7; ImmersiveView.slint:240-458). Mounted by
|
||||
// ImmersiveView as layer 5, centered, y = height-90-24, fading with the
|
||||
// auto-hide chrome (the host drives the opacity binding; this component
|
||||
// knows nothing about the hide timer).
|
||||
//
|
||||
// Bar: width min(viewport-32, 600) x 90, radius 16, #00000080, border
|
||||
// #ffffff2e, shadow 32/#00000066/8 (:257-265). Composition 1:1:
|
||||
// LEFT ghosts (x=24/56/88/120, y=22): favorite / shuffle / repeat / ∞
|
||||
// CENTER: elapsed · prev · play-disc-48 · next · remaining (11px #ffffffbf)
|
||||
// RIGHT: volume ghost (width-156) · VolumeBar 64 (width-112) · ⋯ (width-42)
|
||||
// TinyBar seek at y=71, width-32 — changed(v) -> seek(min(v, npSeekableMax))
|
||||
//
|
||||
// GhostButton / NavButton / PlayDisc are hand-rolled here (NOT QbzIconButton):
|
||||
// the Slint immersive chrome paints FIXED white-alpha glyphs/fills on the
|
||||
// dark overlay under EVERY theme (#ffffffa6 idle etc.), and QbzIconButton's
|
||||
// theme-following tints + fills would go dark on light themes. The header's
|
||||
// capsule glyphs (ImmersiveHeader.qml) made the same call. All colors are
|
||||
// Slint RRGGBBAA converted to Qt #AARRGGBB.
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import com.blitzfc.qbz
|
||||
import "../controls"
|
||||
import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// The host viewport width (the overlay root's width) — drives the
|
||||
// min(viewport-32, 600) bar width without a parent-binding loop.
|
||||
property real viewportWidth: 720
|
||||
// The Slint bar wakes the auto-hide chrome when the ⋯ menu opens
|
||||
// (:372-374); the host owns the hide timer.
|
||||
signal wakeRequested()
|
||||
|
||||
implicitWidth: bar.width
|
||||
implicitHeight: bar.height
|
||||
|
||||
// Volume lock, both halves, VERBATIM (contract §5.8 / trap 8;
|
||||
// PlayerBar.qml:84-94): npVolumeLocked carries the ALSA-Direct hw
|
||||
// derivation INSIDE it, and that local bit-perfect lock is LIFTED when a
|
||||
// peer owns playback (the `&& !npIsRemote` term) so the user CAN adjust
|
||||
// the remote renderer; npRemoteVolumeLocked is the sink-pushed "peer
|
||||
// disallows remote volume" half.
|
||||
readonly property bool volLocked:
|
||||
(QbzPlayer.npVolumeLocked && !QbzPlayer.npIsRemote)
|
||||
|| QbzPlayer.npRemoteVolumeLocked
|
||||
|
||||
// The now-playing favorite + ephemeral flags ride the queue document's
|
||||
// `current` row (Slint: QueueState.now-playing-favorite /
|
||||
// NowPlayingState.is-ephemeral; the PlayerBar.qml npFavorite + the
|
||||
// QueuePanel.qml currentEphemeral precedents).
|
||||
readonly property var queueDoc: {
|
||||
try {
|
||||
return JSON.parse(QbzQueue.queueJson)
|
||||
} catch (e) {
|
||||
return ({})
|
||||
}
|
||||
}
|
||||
readonly property bool npFavorite: !!(queueDoc.current && queueDoc.current.isFavorite)
|
||||
readonly property bool npEphemeral: !!(queueDoc.current && queueDoc.current.isEphemeral === true)
|
||||
|
||||
function fmt(secs) {
|
||||
var m = Math.floor(secs / 60)
|
||||
var s = Math.floor(secs % 60)
|
||||
return m + ":" + (s < 10 ? "0" : "") + s
|
||||
}
|
||||
|
||||
// Software-renderer detection (the ImmersiveView _noShaders idiom) —
|
||||
// the two drop shadows are MultiEffect blurs; no shaders -> plain
|
||||
// offset rects.
|
||||
readonly property bool _noShaders: GraphicsInfo.api === GraphicsInfo.Software
|
||||
|| GraphicsInfo.api === GraphicsInfo.Null
|
||||
|
||||
// --- Bar shadow: 32 / #00000066 / offset-y 8 (:262-265) --------------
|
||||
Rectangle {
|
||||
x: 0
|
||||
y: 8
|
||||
width: bar.width
|
||||
height: bar.height
|
||||
radius: 16
|
||||
color: "#66000000"
|
||||
layer.enabled: !root._noShaders
|
||||
layer.effect: MultiEffect {
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 0.5 // 32/64
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: bar
|
||||
width: Math.min(root.viewportWidth - 32, 600)
|
||||
height: 90
|
||||
radius: 16
|
||||
color: "#80000000"
|
||||
border.width: 1
|
||||
border.color: "#2effffff"
|
||||
|
||||
// --- Inline chrome controls (see the file header for why these are
|
||||
// NOT QbzIconButton) ----------------------------------------------
|
||||
|
||||
// GhostButton (:27-56): 28px circle, transparent idle, #ffffff40
|
||||
// fill while ACTIVE, glyph 12px white / white-65% (opacity on the
|
||||
// glyph — there is no 65%-white tint bake).
|
||||
component GhostBtn: Rectangle {
|
||||
property string icon: ""
|
||||
property bool active: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
color: active ? "#40ffffff" : "transparent"
|
||||
QbzIcon {
|
||||
name: parent.icon
|
||||
width: 12
|
||||
height: 12
|
||||
anchors.centerIn: parent
|
||||
tintName: "white"
|
||||
opacity: (parent.active || ghostArea.containsMouse) ? 1.0 : 0.65
|
||||
}
|
||||
MouseArea {
|
||||
id: ghostArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (parent.btnEnabled) parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// NavButton (:58-81): 28px circle, fill #ffffff26 -> #ffffff40 on
|
||||
// hover, glyph 14px white.
|
||||
component NavBtn: Rectangle {
|
||||
property string icon: ""
|
||||
signal clicked()
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: navArea.containsMouse ? "#40ffffff" : "#26ffffff"
|
||||
QbzIcon {
|
||||
name: parent.icon
|
||||
width: 14
|
||||
height: 14
|
||||
anchors.centerIn: parent
|
||||
tintName: "white"
|
||||
}
|
||||
MouseArea {
|
||||
id: navArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// --- LEFT utility group (x=24/56/88/120, y=22; :268-300) ---------
|
||||
GhostBtn {
|
||||
x: 24
|
||||
y: 22
|
||||
icon: root.npFavorite ? "heart-filled" : "heart"
|
||||
active: root.npFavorite
|
||||
// Gated npHasTrack && !ephemeral (FavToggle.qml:47-48 precedent;
|
||||
// an ephemeral play must leave nothing behind).
|
||||
btnEnabled: QbzPlayer.npHasTrack && !root.npEphemeral
|
||||
onClicked: QbzQueue.queueToggleFavorite("track", QbzPlayer.npTrackId)
|
||||
}
|
||||
GhostBtn {
|
||||
x: 56
|
||||
y: 22
|
||||
icon: "shuffle"
|
||||
active: QbzPlayer.npShuffle
|
||||
onClicked: QbzPlayer.toggleShuffle()
|
||||
}
|
||||
GhostBtn {
|
||||
x: 88
|
||||
y: 22
|
||||
icon: "repeat"
|
||||
active: QbzPlayer.npRepeatMode !== 0
|
||||
onClicked: QbzPlayer.cycleRepeat()
|
||||
}
|
||||
GhostBtn {
|
||||
x: 120
|
||||
y: 22
|
||||
icon: "infinity"
|
||||
active: root.queueDoc.infinitePlay === true
|
||||
onClicked: QbzQueue.queueToggleInfinitePlay()
|
||||
}
|
||||
|
||||
// --- CENTER playback group (:303-336): positioned from the play
|
||||
// disc so play is exactly centered ------------------------------
|
||||
Text {
|
||||
x: bar.width / 2 - 108
|
||||
y: 31
|
||||
width: 42
|
||||
text: root.fmt(QbzPlayer.npElapsedSecs)
|
||||
color: "#bfffffff"
|
||||
font.pixelSize: 11
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
NavBtn {
|
||||
x: bar.width / 2 - 64
|
||||
y: 22
|
||||
icon: "skip-back"
|
||||
onClicked: QbzPlayer.previous()
|
||||
}
|
||||
// PlayDisc (:83-108): 48px white disc, hover #ffffffe6, glyph 20px
|
||||
// black (play nudged +1px right), shadow 12/#0000004d/4.
|
||||
Item {
|
||||
x: bar.width / 2 - 24
|
||||
y: 12
|
||||
width: 48
|
||||
height: 48
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
y: 4
|
||||
radius: 24
|
||||
color: "#4d000000"
|
||||
layer.enabled: !root._noShaders
|
||||
layer.effect: MultiEffect {
|
||||
blurEnabled: true
|
||||
blurMax: 24
|
||||
blur: 0.5 // 12/24
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 24
|
||||
color: playArea.containsMouse ? "#e6ffffff" : "#ffffff"
|
||||
QbzIcon {
|
||||
name: QbzPlayer.npPlaying ? "pause" : "play-fill"
|
||||
width: 20
|
||||
height: 20
|
||||
x: Math.round((parent.width - width) / 2) + (QbzPlayer.npPlaying ? 0 : 1)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
tintName: "black"
|
||||
}
|
||||
MouseArea {
|
||||
id: playArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzPlayer.togglePlay()
|
||||
}
|
||||
}
|
||||
}
|
||||
NavBtn {
|
||||
x: bar.width / 2 + 36
|
||||
y: 22
|
||||
icon: "skip-forward"
|
||||
onClicked: QbzPlayer.next()
|
||||
}
|
||||
Text {
|
||||
x: bar.width / 2 + 76
|
||||
y: 31
|
||||
width: 46
|
||||
text: "-" + root.fmt(Math.max(0, QbzPlayer.npDurationSecs - QbzPlayer.npElapsedSecs))
|
||||
color: "#bfffffff"
|
||||
font.pixelSize: 11
|
||||
}
|
||||
|
||||
// --- RIGHT volume/menu group (:339-372) ---------------------------
|
||||
GhostBtn {
|
||||
x: bar.width - 156
|
||||
y: 22
|
||||
// Under lock the fill pins to 100%, so the icon must NOT show
|
||||
// the muted/zero glyph (Tauri VolumeSlider: Volume2 when locked).
|
||||
icon: (!root.volLocked && (QbzPlayer.npMuted || QbzPlayer.npVolume === 0))
|
||||
? "volume-x" : "volume-2"
|
||||
btnEnabled: !root.volLocked
|
||||
onClicked: QbzPlayer.toggleMute()
|
||||
}
|
||||
VolumeBar {
|
||||
x: bar.width - 112
|
||||
y: 31
|
||||
width: 64
|
||||
value: QbzPlayer.npVolume
|
||||
locked: root.volLocked
|
||||
onChanged: function (v) {
|
||||
if (!root.volLocked)
|
||||
QbzPlayer.setVolume(v)
|
||||
}
|
||||
onReleased: function (v) {
|
||||
if (!root.volLocked)
|
||||
QbzPlayer.persistVolume(v)
|
||||
}
|
||||
}
|
||||
// The ⋯ trigger + the ONE-entry menu ("Exit Immersive" — exit path
|
||||
// 1, §5.4). Slint shows the popup ABOVE the bar (:375-390); the
|
||||
// shared CardMenu/QbzContextMenu surface clamps into the window.
|
||||
Rectangle {
|
||||
id: menuBtn
|
||||
x: bar.width - 42
|
||||
y: 22
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: menuArea.containsMouse ? "#26ffffff" : "transparent"
|
||||
QbzIcon {
|
||||
name: "ellipsis"
|
||||
width: 12
|
||||
height: 12
|
||||
anchors.centerIn: parent
|
||||
tintName: "white"
|
||||
opacity: 0.65
|
||||
}
|
||||
MouseArea {
|
||||
id: menuArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.wakeRequested()
|
||||
// Above the trigger, right edges aligned (Slint: x=-172,
|
||||
// y=-58 for a 200x46 popup off a 28px button).
|
||||
playerMenu.openAtCursor(menuBtn,
|
||||
menuBtn.width - playerMenu.menuWidth,
|
||||
-playerMenu.implicitHeight - 12)
|
||||
}
|
||||
}
|
||||
}
|
||||
CardMenu {
|
||||
id: playerMenu
|
||||
menuWidth: 200
|
||||
entries: [
|
||||
{ "label": QbzSession.tr("Exit Immersive", QbzSession.trRev),
|
||||
"icon": "x", "action": "exit" }
|
||||
]
|
||||
onPicked: function (a) {
|
||||
if (a === "exit")
|
||||
QbzImmersive.open = false
|
||||
}
|
||||
}
|
||||
|
||||
// --- TinyBar seek (:450-457): full width-32 at y=71 --------------
|
||||
TinyBar {
|
||||
x: 16
|
||||
y: 71
|
||||
width: bar.width - 32
|
||||
value: QbzPlayer.npProgress
|
||||
onChanged: function (v) {
|
||||
QbzPlayer.seek(Math.min(v, QbzPlayer.npSeekableMax))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
// ImmersiveSearchCortinilla — the live as-you-type dropdown under the
|
||||
// immersive header search field (ImmersiveSearchCortinilla.slint:33-366;
|
||||
// contract 2026-08-02-immersive-port §12 B5). Mounted by ImmersiveView as
|
||||
// layer 7 (TOPMOST), anchors.fill.
|
||||
//
|
||||
// Like the desktop twin (shell/Cortinilla.qml) this is a plain Item, NOT a
|
||||
// Popup — a Popup grabs the pointer and kills typing in the search field.
|
||||
// Differences from the desktop twin (D8): GLASS immersive palette (dark
|
||||
// translucent panel, white-alpha text) instead of the app theme tokens;
|
||||
// sections ONLY (Artists / Albums / Playlists — NO top-result hero, NO
|
||||
// "View more", NO track rows); reads QbzImmersive.immSearch* (never
|
||||
// QbzBridge.cortinilla*); NO idle auto-close (Slint has no such timer) and
|
||||
// no view-change dismiss — the immersive host never navigates.
|
||||
//
|
||||
// Data: QbzImmersive.immSearchJson (search_qt.rs CortinillaData: query /
|
||||
// top:null / sections with controller flat indices from 1). Keyboard
|
||||
// selection rides immSearchSelectedIndex + immSearchScrollY (content-space
|
||||
// top-y of the selected row, 56/24/4 layout — scrolled into view here).
|
||||
// Row activation -> QbzImmersive.searchRowActivated(flatIndex); the Rust
|
||||
// controller closes the dropdown, clears the field and ACTS ON PLAYBACK —
|
||||
// the user STAYS in immersive.
|
||||
//
|
||||
// All colors are Slint RRGGBBAA converted to Qt #AARRGGBB.
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import com.blitzfc.qbz
|
||||
import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// Keyboard accent (the host feeds QbzShell.ambientAccent so the active
|
||||
// row matches the atmosphere; the Slint passes it in from the host the
|
||||
// same way, default #3fd9c8).
|
||||
property color accent: "#3fd9c8"
|
||||
|
||||
// Only render (and only consume events) when the search is open AND the
|
||||
// live query is long enough to have meaningful results — mirrors the
|
||||
// controller's >= 2 gate so a 1-char query never flashes a half-empty
|
||||
// panel (ImmersiveSearchCortinilla.slint:165-167). searchInputText is
|
||||
// the Qt mirror of Slint's search-query.
|
||||
visible: QbzImmersive.immSearchOpen
|
||||
&& QbzImmersive.searchInputText.trim().length >= 2
|
||||
|
||||
// --- Geometry (all dims passed/computed here — no parent-binding
|
||||
// loops) ---------------------------------------------------------------
|
||||
readonly property int panelWidth: 380
|
||||
// The TOP of the panel (header-band y + field height + a small gap).
|
||||
readonly property int anchorY: 58
|
||||
// The immersive player bar's reserved bottom band (bar height + bottom
|
||||
// inset + a breathing gap) — the panel's bottom edge stays ABOVE it.
|
||||
readonly property int bottomReserved: 138
|
||||
// scroll-cap = window-height - anchor-y - bottom-reserved - 12 (the
|
||||
// 12 = the panel box's top+bottom padding).
|
||||
readonly property int scrollCap: root.height - anchorY - bottomReserved - 12
|
||||
|
||||
// The centered search field's span (same width math as the header
|
||||
// field): the header band across that span stays un-scrimmed so the
|
||||
// field keeps typing/focus.
|
||||
readonly property int fieldWidth: Math.min(root.width - 48, 420)
|
||||
readonly property int fieldLeft: (root.width - root.fieldWidth) / 2
|
||||
// The header band's vertical extent (field 36px + the 6px gap).
|
||||
readonly property int bandBottom: anchorY - 6
|
||||
|
||||
readonly property var doc: parseDoc()
|
||||
function parseDoc() {
|
||||
try {
|
||||
return JSON.parse(QbzImmersive.immSearchJson)
|
||||
} catch (e) {
|
||||
return ({})
|
||||
}
|
||||
}
|
||||
readonly property var sections: doc.sections || []
|
||||
|
||||
// Keyboard scroll-into-view (the desktop Cortinilla.qml:63-71 idiom):
|
||||
// the controller publishes the selected row's content-space top-y;
|
||||
// nudge the Flickable so that row is visible. 56px is the row height.
|
||||
Connections {
|
||||
target: QbzImmersive
|
||||
function onImmSearchScrollYChanged() {
|
||||
var y = QbzImmersive.immSearchScrollY
|
||||
if (y < bodyFlick.contentY) {
|
||||
bodyFlick.contentY = Math.max(0, y)
|
||||
} else if (y + 56 > bodyFlick.contentY + bodyFlick.height) {
|
||||
bodyFlick.contentY = y + 56 - bodyFlick.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Click-outside scrims (ANY click outside the panel dismisses) ----
|
||||
// Transparent MouseAreas tile the whole window EXCEPT the panel
|
||||
// (declared later -> on top, keeps its own clicks) and the header band
|
||||
// across the search field's horizontal span.
|
||||
// 1) everything BELOW the header band (panels, player bar region)
|
||||
MouseArea {
|
||||
visible: root.visible
|
||||
x: 0
|
||||
y: root.bandBottom
|
||||
width: root.width
|
||||
height: root.height - y
|
||||
onClicked: QbzImmersive.dismissSearch()
|
||||
}
|
||||
// 2) header band, LEFT of the search field
|
||||
MouseArea {
|
||||
visible: root.visible
|
||||
x: 0
|
||||
y: 0
|
||||
width: root.fieldLeft
|
||||
height: root.bandBottom
|
||||
onClicked: QbzImmersive.dismissSearch()
|
||||
}
|
||||
// 3) header band, RIGHT of the search field
|
||||
MouseArea {
|
||||
visible: root.visible
|
||||
x: root.fieldLeft + root.fieldWidth
|
||||
y: 0
|
||||
width: root.width - x
|
||||
height: root.bandBottom
|
||||
onClicked: QbzImmersive.dismissSearch()
|
||||
}
|
||||
|
||||
// --- The panel ---------------------------------------------------------
|
||||
// Anchored under the centered search field; its total height is capped
|
||||
// so the bottom edge stays ABOVE the player bar. A tall result set
|
||||
// scrolls inside the Flickable; a short one collapses.
|
||||
// Shadow: 32 / #00000066 / offset-y 8 (the ImmersiveView shadow idiom).
|
||||
Rectangle {
|
||||
visible: root.visible
|
||||
x: (root.width - root.panelWidth) / 2
|
||||
y: root.anchorY + 8
|
||||
width: root.panelWidth
|
||||
height: Math.min(bodyColumn.height + 12, root.scrollCap + 12)
|
||||
radius: 16
|
||||
color: "#66000000"
|
||||
layer.enabled: !root._noShaders
|
||||
layer.effect: MultiEffect {
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 0.5 // 32/64
|
||||
}
|
||||
}
|
||||
readonly property bool _noShaders: GraphicsInfo.api === GraphicsInfo.Software
|
||||
|| GraphicsInfo.api === GraphicsInfo.Null
|
||||
|
||||
Rectangle {
|
||||
id: panel
|
||||
visible: root.visible
|
||||
x: (root.width - root.panelWidth) / 2
|
||||
y: root.anchorY
|
||||
width: root.panelWidth
|
||||
height: Math.min(bodyColumn.height + 12, root.scrollCap + 12)
|
||||
radius: 16
|
||||
color: "#94000000"
|
||||
border.width: 1
|
||||
border.color: "#1affffff"
|
||||
clip: true
|
||||
|
||||
Flickable {
|
||||
id: bodyFlick
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 6
|
||||
anchors.bottomMargin: 6
|
||||
contentWidth: width
|
||||
contentHeight: bodyColumn.height
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
Column {
|
||||
id: bodyColumn
|
||||
width: bodyFlick.width
|
||||
|
||||
// --- Loading skeleton (4 rows; skeleton-only, no cached
|
||||
// instant-paint — the desktop Cortinilla.qml:143-194 idiom,
|
||||
// glass-white boxes like ImmersiveSkeletonRow) --------------
|
||||
Column {
|
||||
visible: QbzImmersive.immSearchLoading
|
||||
width: parent.width
|
||||
topPadding: 4
|
||||
property bool pulse: false
|
||||
Timer {
|
||||
interval: 700
|
||||
running: parent.visible
|
||||
repeat: true
|
||||
onTriggered: parent.pulse = !parent.pulse
|
||||
}
|
||||
Repeater {
|
||||
model: 4
|
||||
delegate: Item {
|
||||
width: bodyColumn.width
|
||||
height: 56
|
||||
Rectangle {
|
||||
x: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 40
|
||||
height: 40
|
||||
radius: 4
|
||||
color: "#ffffff"
|
||||
opacity: parent.parent.pulse ? 0.32 : 0.08
|
||||
Behavior on opacity { NumberAnimation { duration: 650; easing.type: Easing.InOutQuad } }
|
||||
}
|
||||
Column {
|
||||
x: 62
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 8
|
||||
Rectangle {
|
||||
width: 150
|
||||
height: 11
|
||||
radius: 3
|
||||
color: "#ffffff"
|
||||
opacity: parent.parent.parent.pulse ? 0.32 : 0.08
|
||||
Behavior on opacity { NumberAnimation { duration: 650; easing.type: Easing.InOutQuad } }
|
||||
}
|
||||
Rectangle {
|
||||
width: 96
|
||||
height: 9
|
||||
radius: 3
|
||||
color: "#ffffff"
|
||||
opacity: parent.parent.parent.pulse ? 0.32 : 0.08
|
||||
Behavior on opacity { NumberAnimation { duration: 650; easing.type: Easing.InOutQuad } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Loaded content ----------------------------------------
|
||||
Column {
|
||||
visible: !QbzImmersive.immSearchLoading
|
||||
width: parent.width
|
||||
|
||||
// No results: explicit empty-state line.
|
||||
Item {
|
||||
visible: root.sections.length === 0
|
||||
width: parent.width
|
||||
height: 28
|
||||
Text {
|
||||
x: 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: QbzSession.tr("No results for", QbzSession.trRev)
|
||||
+ " “" + (root.doc.query || "") + "”"
|
||||
color: "#80ffffff"
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
|
||||
// Result sections (Artists / Albums / Playlists, then the
|
||||
// local-album section). NO "View more" — immersive has
|
||||
// no results page to navigate to.
|
||||
Repeater {
|
||||
model: root.sections
|
||||
delegate: Column {
|
||||
required property var modelData
|
||||
width: bodyColumn.width
|
||||
leftPadding: 6
|
||||
rightPadding: 6
|
||||
topPadding: 4
|
||||
|
||||
// Section header — title only, 24px, 11px
|
||||
// semibold #ffffff80.
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 24
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: modelData.title
|
||||
color: "#80ffffff"
|
||||
font.pixelSize: 11
|
||||
font.weight: 600
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
model: modelData.rows
|
||||
delegate: ImmRow { row: modelData }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QbzScrollBar {
|
||||
target: bodyFlick
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
// --- One result row (ImmersiveResultRow :30-102) -----------------------
|
||||
// 56px, radius 8; keyboard-active #ffffff26 + the 3px accent bar, plain
|
||||
// hover #ffffff14. Hover is PURELY VISUAL — it deliberately does NOT
|
||||
// write the selection, so a stray hover can never hijack the keyboard
|
||||
// selection that Enter activates (same lesson as the main cortinilla).
|
||||
component ImmRow: Rectangle {
|
||||
property var row: ({})
|
||||
width: parent ? parent.width : 0
|
||||
height: 56
|
||||
radius: 8
|
||||
readonly property bool active: QbzImmersive.immSearchSelectedIndex === (row.flatIndex ?? -2)
|
||||
color: active ? "#26ffffff"
|
||||
: (rowArea.containsMouse ? "#14ffffff" : "transparent")
|
||||
|
||||
// Accent bar on the keyboard-active row (distinct from plain hover).
|
||||
Rectangle {
|
||||
visible: parent.active
|
||||
x: 0
|
||||
y: 4
|
||||
width: 3
|
||||
height: parent.height - 8
|
||||
radius: 2
|
||||
color: root.accent
|
||||
}
|
||||
// 40x40 thumb — circle for artists, tile otherwise.
|
||||
Rectangle {
|
||||
x: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 40
|
||||
height: 40
|
||||
radius: row.kind === "artist" ? 20 : 4
|
||||
color: "#14ffffff"
|
||||
clip: true
|
||||
RoundedImage {
|
||||
anchors.fill: parent
|
||||
source: row.artPath || ""
|
||||
radius: row.kind === "artist" ? 20 : 4
|
||||
}
|
||||
}
|
||||
Column {
|
||||
x: 62
|
||||
width: parent.width - 62 - 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Text {
|
||||
width: parent.width
|
||||
text: row.title || ""
|
||||
color: "#ccffffff"
|
||||
font.pixelSize: 14
|
||||
font.weight: 500
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: row.subtitle || ""
|
||||
color: "#80ffffff"
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzImmersive.searchRowActivated(row.flatIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,16 @@
|
||||
// AppShell AFTER QbzToast and BEFORE ArtPreviewOverlay/QbzTooltip (§5.1
|
||||
// declaration-order z convention).
|
||||
//
|
||||
// BLOCK B2+B3+B4 SCOPE: the overlay shell (root + click-blocker + chrome +
|
||||
// BLOCK B2+B3+B4+B5 SCOPE: the overlay shell (root + click-blocker + chrome +
|
||||
// auto-hide + exit paths 2-4 + the fullscreen guard + seek arrows) PLUS the
|
||||
// B3 panels (the ImmersiveAtmosphere underlay, the five FOCUS panels Album
|
||||
// Reactive / Static / Coverflow / Spectrum / Wave Bed, the layer-4
|
||||
// ImmersiveSongCard) PLUS the B4 panels: FOCUS Lyrics (mode 4,
|
||||
// LyricsFocusPanel) and Queue (mode 5, QueueTabsPanel), and the full §5.6
|
||||
// SPLIT layout (50/50: artwork + ImmersiveTrackMeta LEFT, the Lyrics /
|
||||
// TrackInfo / Suggestions / Queue panels RIGHT) with the §5.5 entry loads.
|
||||
// B5 adds the player bar + search cortinilla (layer 7 is therefore absent,
|
||||
// per contract §12 B2).
|
||||
// TrackInfo / Suggestions / Queue panels RIGHT) with the §5.5 entry loads —
|
||||
// PLUS the B5 layer-5 ImmersivePlayerBar (TinyBar/VolumeBar, §5.7/§5.8) and
|
||||
// the B5 layer-7 ImmersiveSearchCortinilla (§3.4).
|
||||
//
|
||||
// Layer order bottom->top (§5.1):
|
||||
// 1. root color #0a0a0b, clip (:1199-1200)
|
||||
@@ -25,7 +25,10 @@
|
||||
// 3. FOCUS panels (viewMode==0 && mode==N) / the SPLIT layout (viewMode==1)
|
||||
// 4. ImmersiveSongCard (viewMode==0 && mode==6 && npHasTrack — trap 19;
|
||||
// does NOT fade with the chrome, :1602-1605)
|
||||
// 6. ImmersiveHeader band (layer 5 — the PlayerBar — is B5)
|
||||
// 5. ImmersivePlayerBar (B5, :1607-1616) — centered, y = height-90-24,
|
||||
// fades with the chrome like the header
|
||||
// 6. ImmersiveHeader band
|
||||
// 7. ImmersiveSearchCortinilla (B5, :1695-1705) — topmost
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
@@ -517,6 +520,20 @@ Item {
|
||||
event.accepted = true
|
||||
}
|
||||
|
||||
// --- Layer 5: the player bar (§5.7, :1607-1616) -------------------------
|
||||
// Centered, y = height-90-24; fades with the auto-hide chrome on the
|
||||
// SAME binding as the header (300ms), inert while hidden.
|
||||
ImmersivePlayerBar {
|
||||
id: playerBar
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: root.height - 90 - 24
|
||||
viewportWidth: root.width
|
||||
opacity: root.chromeVisible ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 300 } }
|
||||
enabled: opacity > 0
|
||||
onWakeRequested: root.wake()
|
||||
}
|
||||
|
||||
// --- Layer 6: the header band (§5.2) --------------------------------------
|
||||
ImmersiveHeader {
|
||||
id: header
|
||||
@@ -531,4 +548,14 @@ Item {
|
||||
Behavior on opacity { NumberAnimation { duration: 300 } }
|
||||
enabled: opacity > 0
|
||||
}
|
||||
|
||||
// --- Layer 7: the search cortinilla (§3.4, :1695-1705) -------------------
|
||||
// TOPMOST: above the header band and the player bar. Self-gated on
|
||||
// QbzImmersive.immSearchOpen && query >= 2 chars; NOT chrome-faded (its
|
||||
// open flag is exactly what suppresses the auto-hide, trap 10). The
|
||||
// accent follows the atmosphere so the keyboard-active row matches.
|
||||
ImmersiveSearchCortinilla {
|
||||
anchors.fill: parent
|
||||
accent: QbzShell.ambientAccent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// TinyBar — the immersive seek micro-slider (ImmersiveView.slint:110-145),
|
||||
// immersive-local per divergence D5: NOT QbzSlider (integer-step; seek needs
|
||||
// a fraction + the npSeekableMax clamp, which the HOST applies).
|
||||
//
|
||||
// Fraction in/out, fill width = parent.width * clamp(value, 0, 1); the
|
||||
// changed() callback fires on press AND pressed-move with
|
||||
// clamp(mouseX / width, 0, 1).
|
||||
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real value: 0.0
|
||||
property color fill: "#ffffff"
|
||||
signal changed(real v)
|
||||
|
||||
function clamp01(v) {
|
||||
return Math.max(0.0, Math.min(1.0, v))
|
||||
}
|
||||
|
||||
height: 10
|
||||
|
||||
// Track: 2px #ffffff2e (Slint RRGGBBAA -> Qt #AARRGGBB) at y=4.
|
||||
Rectangle {
|
||||
x: 0
|
||||
y: 4
|
||||
width: root.width
|
||||
height: 2
|
||||
radius: 1
|
||||
color: "#2effffff"
|
||||
}
|
||||
// Fill.
|
||||
Rectangle {
|
||||
x: 0
|
||||
y: 4
|
||||
width: root.width * root.clamp01(root.value)
|
||||
height: 2
|
||||
radius: 1
|
||||
color: root.fill
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: function (mouse) { root.changed(root.clamp01(mouse.x / width)) }
|
||||
onPositionChanged: function (mouse) {
|
||||
if (pressed)
|
||||
root.changed(root.clamp01(mouse.x / width))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// VolumeBar — the immersive volume micro-slider (ImmersiveView.slint:153-238),
|
||||
// immersive-local per divergence D5 (QbzSlider is integer-step and has no lock
|
||||
// states). Thin white-on-glass track, hover-revealed thumb, drag-time percent
|
||||
// bubble, and a LOCKED state that pins the fill to 100% and dims/no-ops
|
||||
// (bit-perfect ALSA-Direct or a QConnect peer that disallows remote volume).
|
||||
//
|
||||
// Lock FORMULA lives in the host (ImmersivePlayerBar), verbatim from
|
||||
// PlayerBar.qml:92-94 (contract §5.8 / trap 8). Wiring: live changed(v) ->
|
||||
// QbzPlayer.setVolume(v); drag-end released(v) -> QbzPlayer.persistVolume(v).
|
||||
// NOTE: no `opacity` on the root (it would corrupt absolute positioning) —
|
||||
// inner content carries the states instead.
|
||||
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real value: 0.0 // 0..1
|
||||
property bool locked: false
|
||||
signal changed(real v) // emits 0..1 — live (every drag tick)
|
||||
signal released(real v) // emits 0..1 — drag-end only (persist)
|
||||
|
||||
// The visual fill fraction: pinned to 100% when locked (matches Tauri).
|
||||
readonly property real shown: root.locked ? 1.0 : Math.max(0.0, Math.min(1.0, root.value))
|
||||
|
||||
function clamp01(v) {
|
||||
return Math.max(0.0, Math.min(1.0, v))
|
||||
}
|
||||
|
||||
height: 12
|
||||
|
||||
// Drag-time / hover percent readout, 34x20 at y=-26, #000000b3 (Qt
|
||||
// #AARRGGBB), 11px/600. Hidden when locked.
|
||||
Rectangle {
|
||||
x: root.width - width
|
||||
y: -26
|
||||
width: 34
|
||||
height: 20
|
||||
radius: 6
|
||||
color: "#b3000000"
|
||||
visible: !root.locked && (area.containsMouse || area.pressed)
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
text: Math.round(root.shown * 100)
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 11
|
||||
font.weight: 600
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
||||
// Track background: #ffffff1f locked / #ffffff33.
|
||||
Rectangle {
|
||||
x: 0
|
||||
y: 5
|
||||
width: root.width
|
||||
height: 2
|
||||
radius: 1
|
||||
color: root.locked ? "#1fffffff" : "#33ffffff"
|
||||
}
|
||||
// Fill: #ffffff66 locked / #ffffffb3.
|
||||
Rectangle {
|
||||
x: 0
|
||||
y: 5
|
||||
width: root.width * root.shown
|
||||
height: 2
|
||||
radius: 1
|
||||
color: root.locked ? "#66ffffff" : "#b3ffffff"
|
||||
}
|
||||
// Hover-revealed thumb, 12px white, only !locked && (hover || pressed).
|
||||
// Position computed from root.width (no layout recursion).
|
||||
Rectangle {
|
||||
x: root.width * root.shown - width / 2
|
||||
y: 0
|
||||
width: 12
|
||||
height: 12
|
||||
radius: 6
|
||||
color: "#ffffff"
|
||||
opacity: (!root.locked && (area.containsMouse || area.pressed)) ? 1.0 : 0.0
|
||||
Behavior on opacity { NumberAnimation { duration: 150 } }
|
||||
}
|
||||
|
||||
// ALL pointer events gated !locked (:218-237).
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.locked ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
onPressed: function (mouse) {
|
||||
if (!root.locked)
|
||||
root.changed(root.clamp01(mouse.x / width))
|
||||
}
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!root.locked && pressed)
|
||||
root.changed(root.clamp01(mouse.x / width))
|
||||
}
|
||||
// Persist only the final value on drag-end (the NPB sliders'
|
||||
// released -> persistVolume; live changes still fire via changed).
|
||||
onReleased: function (mouse) {
|
||||
if (!root.locked)
|
||||
root.released(root.clamp01(mouse.x / width))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user