Block B2 of the miniplayer/tray contract, and the block that settles the premise the whole port rests on: a second top-level Window in the same QQmlApplicationEngine reads the SAME bridge singletons as the shell. Proven by driving it — a probe window with one Text bound to QbzPlayer.npTitle tracked the main window across a track change with no mirror code. Slint needs ~155 lines of mirroring for this; Qt needs none. qml/miniplayer/ (new, six files) — MiniWindow (frameless, transparent, transientParent null, its own key host and its own onClosing), MiniShell (the card, the artwork backdrop, the surface router), MiniCoverArt and MiniExplicitBadge (the two components MiniBits.slint exports, which cannot share one .qml file), and the compact and artwork surfaces. The card is the window minus a 6 px gutter, its radius is 9 for the condensed surfaces and 10 otherwise, and switching the surface RESIZES THE WINDOW — 540 to 178 and back, driven and measured, not inferred. The backdrop lives inside a masked container. `clip: true` on a rounded Rectangle does NOT round its children on this Qt build — theme/RoundedImage.qml records that as measured fact — so without the mask the scrim and the atmosphere's own opaque root would paint square corners over the card the moment the backdrop is on. That is reachable before its toggle exists, because the pref is co-owned with the shipping Slint app. src/mini_bridge.rs — enter/exit, the mini's own key dispatcher, and toggle(). Re-entering an open mini re-raises it rather than doing nothing, which is what the reference does and what present() will want. src/hotkeys_qt.rs — action_for_mini_key, a SIBLING of action_for_key with the context arm inverted. The main window still refuses Context::Mini and the test that pins it is untouched; a new test pins the mirror. src/hotkeys_bridge.rs — the ui.miniPlayer arm stops logging and toggles. qml/shell/ViewModeMenu.qml — the Miniplayer row goes live with its own dispatch arm, and it is hidden under the kiosk profile, 1:1 with PlayerBarSmall.slint:819. The kiosk port landed first, so that gate was owed here. Three comments claiming the row is inert are corrected. Surfaces 0, 3 and 4 are clamped to the artwork surface until their content exists (B3 and B4), because mini_surface and mini_default_view live in the prefs file shared with the Slint app: a user whose Slint mini was last on Queue would otherwise open onto a blank card with no visible way out. Each block deletes its own entry from that clamp. Enter does not hide the main window yet — window.hideToTray() is B6's, and open-coding a bare hide() here is what the one-visibility-owner rule forbids. So the main window stays visible behind the mini in this commit, by design. cc
102 lines
3.7 KiB
QML
102 lines
3.7 KiB
QML
// MiniCompactSurface — surface 1 (2026-08-03 miniplayer/tray contract §4.2.1),
|
|
// port of `crates/qbz-ui/ui/miniplayer/MiniCompactSurface.slint` (57 L, read
|
|
// whole).
|
|
//
|
|
// A horizontal metadata strip in the 380x178 window. DISPLAY ONLY: no
|
|
// controls, no IPC, no marquee — long text ellipsis-truncates
|
|
// (MiniCompactSurface.slint:1-3). No album line, no hover, no click target, no
|
|
// context menu. Everything interactive lives in the footer.
|
|
//
|
|
// The one divergence from its artwork twin, and it is the reference's: the
|
|
// artist line here is ALWAYS mounted with a "—" fallback, where
|
|
// MiniArtworkSurface drops the row entirely. Reproduced exactly (§4.2.2).
|
|
|
|
import QtQuick
|
|
import com.blitzfc.qbz
|
|
import "../theme"
|
|
|
|
Item {
|
|
id: root
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
/// Handed down by MiniShell, which derives it once from the queue
|
|
/// document — QbzPlayer publishes no np_explicit (§8 rule 1: an explicit
|
|
/// property, never a `parent` read).
|
|
property bool npExplicit: false
|
|
|
|
// The cover is square: the surface height minus the 12 px padding on both
|
|
// sides, floored at 40 (MiniCompactSurface.slint:11) -> 78 px at the 102 px
|
|
// surface. Cached, per §7-M2.
|
|
readonly property int art: Math.max(40, root.height - 24)
|
|
|
|
// HorizontalLayout { padding: 12px; spacing: 12px; alignment: start }
|
|
// (:13-18), expressed as anchors: `alignment: start` means the cover leads
|
|
// and the text block takes the rest, which is what the anchor chain below
|
|
// does without a layout item in between.
|
|
MiniCoverArt {
|
|
id: cover
|
|
x: 12
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
width: root.art
|
|
height: root.art
|
|
// Overrides the 7 px default (:23).
|
|
radius: 8
|
|
source: QbzPlayer.npArtworkPath
|
|
}
|
|
|
|
Column {
|
|
id: meta
|
|
anchors.left: cover.right
|
|
anchors.leftMargin: 12
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 12
|
|
// VerticalLayout { alignment: center; spacing: 2px } (:29-31).
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 2
|
|
|
|
// Title + badge row: HorizontalLayout { spacing: 5px } with the title
|
|
// at stretch 1 and the badge at stretch 0 (:33-46) — so the badge sits
|
|
// 5 px after the title's BOX, at the right edge, not flush against the
|
|
// glyphs.
|
|
Item {
|
|
id: titleRow
|
|
width: meta.width
|
|
height: title.implicitHeight
|
|
|
|
Text {
|
|
id: title
|
|
anchors.left: parent.left
|
|
// badge.width is the constant 13, so this is not a loop.
|
|
width: parent.width - (badge.visible ? badge.width + 5 : 0)
|
|
text: QbzPlayer.npHasTrack
|
|
? QbzPlayer.npTitle
|
|
: QbzSession.tr("No track playing", QbzSession.trRev)
|
|
color: theme.textPrimary
|
|
font.pixelSize: 13
|
|
font.weight: Font.DemiBold
|
|
elide: Text.ElideRight
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
MiniExplicitBadge {
|
|
id: badge
|
|
visible: root.npExplicit
|
|
anchors.left: title.right
|
|
anchors.leftMargin: 5
|
|
anchors.verticalCenter: title.verticalCenter
|
|
}
|
|
}
|
|
|
|
// ALWAYS mounted, with a literal em-dash fallback (:49-54) — NOT
|
|
// translated, and NOT the conditional mount the artwork surface uses.
|
|
Text {
|
|
width: meta.width
|
|
text: QbzPlayer.npArtist !== "" ? QbzPlayer.npArtist : "—"
|
|
color: theme.textMuted
|
|
font.pixelSize: 11
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|