Files
qbz/crates/qbz-qt/qml/kiosk/KioskNavigation.qml
T
vicrodh b1dba198c9 feat(qt): kiosk profile release hardening
Integrate the Kiosk profile hardening round: 12 dedicated Kiosk views plus
22 shared opt-in hosts, shared navigation history with Back/Forward, Albums
as the default library tab, native paged Local Library (artists/tracks),
lightweight MyQBZ grid and detail, Ephemeral lifecycle, bounded lists and
artwork sized to the physical frame, static skeletons, 64px transport bar,
Settings touch reflow and a persistent Immersive exit.

Desktop keeps its prior behavior: every shared component defaults to the
desktop path and only opts into Kiosk behavior through explicit properties
(origin-relative ScrollMemory, viewport-bounded artwork requests).

Regression coverage: kiosk navigation and artwork Node tests added to the
runtime gate, scroll-origin fixtures for fixed and grouped rows, i18n
strings for all eight locales.

Verified by 750 release tests, six QML audits, Kiosk smokes at 800x480 and
1280x800 and a Desktop A/B with seven pixel-identical captures.

cc
2026-09-07 08:23:11 -06:00

58 lines
1.9 KiB
QML

// View-owned opaque state on the single QbzShell history. No private stack.
import QtQuick
import com.blitzfc.qbz
Item {
id: root
property string route: ""
property var snapshot: ({})
readonly property string stateJson: JSON.stringify(snapshot)
property bool ready: false
property bool restoring: false
signal restore(var saved)
width: 0
height: 0
visible: false
function recordTab(tab) {
if (ready && !restoring && QbzShell.currentView === route)
QbzShell.recordKioskTab(route, String(tab), stateJson)
}
function report() {
if (ready && !restoring && QbzShell.currentView === route)
QbzShell.reportNavState(route, stateJson)
}
function restoreState() {
if (QbzShell.currentView !== route || QbzShell.restoreStateScope !== route)
return
var saved
try { saved = JSON.parse(QbzShell.stateRestore) }
catch (e) { return }
restoring = true
restore(saved)
QbzShell.restoreStateScope = ""
restoring = false
}
onStateJsonChanged: report()
Component.onCompleted: {
if (QbzShell.restoreStateScope === route) {
restoreState()
} else {
// A live Desktop -> Kiosk switch carries the current explicit tab.
// Fresh starts have no live snapshot and keep the Albums fallback.
var live = QbzShell.navigationState(route)
if (live !== "") {
try { restoring = true; restore(JSON.parse(live)) }
catch (e) { /* An invalid optional snapshot keeps fresh defaults. */ }
finally { restoring = false }
}
}
Qt.callLater(function() { root.ready = true; root.report() })
}
Connections {
target: QbzShell
function onStateRestoreChanged() { root.restoreState() }
function onCurrentViewChanged() { root.restoreState() }
}
}