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
50 lines
1.8 KiB
QML
50 lines
1.8 KiB
QML
// MiniCoverArt — the mini's cover tile (2026-08-03 miniplayer/tray contract
|
|
// A-28, §4.2.3), port of `CoverArt` at
|
|
// `crates/qbz-ui/ui/miniplayer/MiniBits.slint:28-44`. The other half of the
|
|
// MiniBits split; see MiniExplicitBadge.qml.
|
|
//
|
|
// THE PLACEHOLDER IS THE BACKGROUND SHOWING THROUGH AN EMPTY IMAGE — no icon,
|
|
// no glyph, no skeleton (MiniBits.slint:25-27). RoundedImage renders nothing
|
|
// while `source` is empty, so the tinted fill and its 1 px border are the
|
|
// empty state, exactly as the reference's bordered empty-art box is.
|
|
//
|
|
// `radius` is Rectangle's OWN property, defaulted to 7 here rather than
|
|
// redeclared: Slint's `in property <length> radius: 7px` and a QML
|
|
// `property real radius` on a Rectangle root are the same knob, and shadowing
|
|
// it would be a property-override. The default is never actually used — the
|
|
// two call sites pass 8 (compact) and 10 (artwork).
|
|
//
|
|
// RoundedImage's DEFAULT arm is the one that matters here (§7-M3): Image +
|
|
// layer + a MultiEffect masked by a rounded Rectangle, whose FBOs are pure
|
|
// functions of (width, height, radius), so a static cover costs zero CPU raster
|
|
// and zero texture upload per frame. The mini's cover does not change between
|
|
// frames — it is the clearest "static content, cache it" case in the app. Do
|
|
// not reach for the Canvas arm.
|
|
|
|
import QtQuick
|
|
import "../theme"
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
/// A file:// path from the artwork pipeline (QbzPlayer.npArtworkPath), not
|
|
/// an image object — the Qt component takes URL strings where the Slint one
|
|
/// takes `image`.
|
|
property string source: ""
|
|
|
|
radius: 7
|
|
antialiasing: true
|
|
color: theme.alphaTier(8)
|
|
border.width: 1
|
|
border.color: theme.alphaTier(12)
|
|
clip: true
|
|
|
|
RoundedImage {
|
|
anchors.fill: parent
|
|
source: root.source
|
|
radius: root.radius
|
|
}
|
|
}
|