fix(qt): harden macOS reopening and miniplayer appearance
Restore hidden windows from Dock/Finder and add a macOS-only Dock visibility setting. Share the app background with the miniplayer, improve theme contrast and translucent controls, and allow dragging from artwork and free areas. Bump the workspace version to 2.1.2. Add lifecycle and miniplayer regression coverage. Linux release, QML software/OpenGL tests and isolated startup passed; native macOS validation remains pending. Refs #792, #793 cx
This commit is contained in:
36 files changed
+789
-285
No files matched your search
@@ -96,6 +96,8 @@ on:
|
||||
- "scripts/test-track-row-click-qml.sh"
|
||||
- "scripts/test-settings-fieldset-qml.sh"
|
||||
- "scripts/test-remote-volume-qml.sh"
|
||||
- "scripts/test-miniplayer-qml.sh"
|
||||
- "scripts/test_qt_window_lifecycle.mjs"
|
||||
- "scripts/test-wallpaper-field-qml.sh"
|
||||
- "scripts/test-card-menu-qml.sh"
|
||||
- "scripts/test-orbit-daemon.py"
|
||||
@@ -132,6 +134,8 @@ on:
|
||||
- "scripts/test-track-row-click-qml.sh"
|
||||
- "scripts/test-settings-fieldset-qml.sh"
|
||||
- "scripts/test-remote-volume-qml.sh"
|
||||
- "scripts/test-miniplayer-qml.sh"
|
||||
- "scripts/test_qt_window_lifecycle.mjs"
|
||||
- "scripts/test-wallpaper-field-qml.sh"
|
||||
- "scripts/test-card-menu-qml.sh"
|
||||
- "scripts/test-orbit-daemon.py"
|
||||
|
||||
Generated
+36
-36
@@ -3940,7 +3940,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-app"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"chrono",
|
||||
@@ -3967,7 +3967,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-audio"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"alsa",
|
||||
"alsa-sys",
|
||||
@@ -4031,7 +4031,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-cmaf"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"base64 0.23.1",
|
||||
@@ -4046,7 +4046,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-control"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"qbz-core",
|
||||
@@ -4065,7 +4065,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-core"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -4087,7 +4087,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-credentials"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"ashpd",
|
||||
@@ -4105,7 +4105,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-dac-wizard-core"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"qbz-audio",
|
||||
"qbz-i18n",
|
||||
@@ -4114,7 +4114,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-disc"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"dirs 6.0.0",
|
||||
@@ -4134,7 +4134,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-dsd"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"dst-decoder",
|
||||
"id3",
|
||||
@@ -4145,7 +4145,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-external-reco"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
@@ -4181,7 +4181,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-jellyfin"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"reqwest",
|
||||
"rustls",
|
||||
@@ -4227,7 +4227,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-log"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"dirs 5.0.1",
|
||||
@@ -4257,7 +4257,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-media-cache"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"rusqlite",
|
||||
"serde_json",
|
||||
@@ -4266,7 +4266,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-media-controls"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"ashpd",
|
||||
"async-channel",
|
||||
@@ -4302,7 +4302,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-models"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
@@ -4316,7 +4316,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-music-link"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"log",
|
||||
@@ -4332,7 +4332,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-offline-cache"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"futures-util",
|
||||
@@ -4354,7 +4354,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-player"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
@@ -4395,7 +4395,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-plex"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"open",
|
||||
@@ -4407,7 +4407,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-qobuz"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.23.1",
|
||||
@@ -4432,7 +4432,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-qt"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"async-trait",
|
||||
@@ -4511,7 +4511,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-radio"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"dirs 5.0.1",
|
||||
"log",
|
||||
@@ -4522,7 +4522,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-reco"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"qbz-integrations",
|
||||
@@ -4535,7 +4535,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-rip"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"flacenc",
|
||||
"lofty",
|
||||
@@ -4546,7 +4546,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-secrets"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64 0.23.1",
|
||||
@@ -4563,7 +4563,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-source"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"log",
|
||||
@@ -4586,7 +4586,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-subsonic"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"md-5",
|
||||
"reqwest",
|
||||
@@ -4598,7 +4598,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-text-utils"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"qbz-i18n",
|
||||
@@ -4606,7 +4606,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-theme"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"image",
|
||||
"serde",
|
||||
@@ -4615,7 +4615,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbz-updater"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"chrono",
|
||||
@@ -4637,7 +4637,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qbzd"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"clap",
|
||||
@@ -4683,7 +4683,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qconnect-app"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
@@ -4705,7 +4705,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qconnect-core"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"qbz-models",
|
||||
"serde",
|
||||
@@ -4714,7 +4714,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qconnect-lan"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"if-addrs 0.15.0",
|
||||
@@ -4738,7 +4738,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qconnect-protocol"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"prost",
|
||||
@@ -4751,7 +4751,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qconnect-transport-ws"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ members = [
|
||||
default-members = ["qbz-qt"]
|
||||
|
||||
[workspace.package]
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/vicrodh/qbz"
|
||||
|
||||
@@ -3395,3 +3395,9 @@ msgstr "Waiting for the renderer’s volume…"
|
||||
|
||||
msgid "This audio output does not support volume control."
|
||||
msgstr "This audio output does not support volume control."
|
||||
|
||||
msgid "Hide Dock icon when closed to menu bar"
|
||||
msgstr "Hide Dock icon when closed to menu bar"
|
||||
|
||||
msgid "Run as a menu-bar-only app while the window is closed. Off keeps the Dock icon (like Spotify)"
|
||||
msgstr "Run as a menu-bar-only app while the window is closed. Off keeps the Dock icon (like Spotify)"
|
||||
@@ -417,6 +417,8 @@ fn build_rhi_items() {
|
||||
// not for a cross one.
|
||||
let macos = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos");
|
||||
if macos {
|
||||
println!("cargo:rerun-if-changed=cxx/macos_reopen.mm");
|
||||
cc.file("cxx/macos_reopen.mm");
|
||||
// FRAMEWORK search path. Without it every `#include <QtCore/...>` in
|
||||
// cxx/ fails: the `-I .../QtCore.framework/Headers` that
|
||||
// `include_paths()` produces cannot resolve a module-qualified include,
|
||||
@@ -661,6 +663,7 @@ fn main() {
|
||||
"qml/settings/OrbitSettings.qml",
|
||||
"qml/settings/OrbitSettingsPanel.qml",
|
||||
"qml/shell/AmbientField.qml",
|
||||
"qml/shell/AppBackground.qml",
|
||||
"qml/shell/WallpaperField.qml",
|
||||
"qml/shell/AppShell.qml",
|
||||
"qml/shell/OrbitBanner.qml",
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
// Handle only Finder/Dock reopen AppleEvents. Ordinary activation (including
|
||||
// a menu-bar click or a policy change) must not undo a user's hide action.
|
||||
// Keep Qt's NSApplication delegate: it still owns quit, menus and file opens.
|
||||
@interface QbzReopenHandler : NSObject
|
||||
@property(nonatomic, assign) void (*presentWindow)(void);
|
||||
- (void)reopen:(NSAppleEventDescriptor *)event reply:(NSAppleEventDescriptor *)reply;
|
||||
- (void)installAfterLaunch:(NSNotification *)notification;
|
||||
@end
|
||||
|
||||
@implementation QbzReopenHandler
|
||||
- (void)installAfterLaunch:(NSNotification *)notification
|
||||
{
|
||||
(void)notification;
|
||||
// AppKit installs its defaults during launch. Register after that so the
|
||||
// first launch cannot silently replace our reopen handler.
|
||||
[[NSAppleEventManager sharedAppleEventManager]
|
||||
setEventHandler:self andSelector:@selector(reopen:reply:)
|
||||
forEventClass:kCoreEventClass andEventID:kAEReopenApplication];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:NSApplicationDidFinishLaunchingNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)reopen:(NSAppleEventDescriptor *)event reply:(NSAppleEventDescriptor *)reply
|
||||
{
|
||||
(void)event;
|
||||
(void)reply;
|
||||
if (self.presentWindow)
|
||||
self.presentWindow();
|
||||
}
|
||||
@end
|
||||
|
||||
extern "C" void qbz_install_macos_reopen_handler(void (*presentWindow)(void))
|
||||
{
|
||||
// Main thread, one owner for the entire application lifetime. QML can
|
||||
// boot before exec(), when AppKit has not finished launching yet.
|
||||
static QbzReopenHandler *handler = nil;
|
||||
if (handler)
|
||||
return;
|
||||
handler = [[QbzReopenHandler alloc] init];
|
||||
handler.presentWindow = presentWindow;
|
||||
if (NSApp.isRunning) {
|
||||
[handler installAfterLaunch:nil];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:handler
|
||||
selector:@selector(installAfterLaunch:)
|
||||
name:NSApplicationDidFinishLaunchingNotification object:nil];
|
||||
}
|
||||
}
|
||||
@@ -866,6 +866,8 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
function showFromTray() {
|
||||
// Restore Regular activation policy before showing/focusing on macOS.
|
||||
QbzTray.setWindowShown(true)
|
||||
if (window.trayRestoreValid) {
|
||||
window.x = window.trayRestoreX
|
||||
window.y = window.trayRestoreY
|
||||
@@ -888,7 +890,6 @@ ApplicationWindow {
|
||||
window.requestActivate()
|
||||
if (window.trayRestoreValid)
|
||||
trayRestoreTimer.restart()
|
||||
QbzTray.setWindowShown(true)
|
||||
}
|
||||
|
||||
// THE ONE close choreography (A-26, §5.7). Five exits reach it: this
|
||||
@@ -897,12 +898,10 @@ ApplicationWindow {
|
||||
// shell/KioskShell.qml, and the miniplayer's closeApp through the
|
||||
// QbzMini.closeAppRequested handler below.
|
||||
//
|
||||
// The predicate is BOTH conditions, ported verbatim from
|
||||
// crates/qbz/src/main.rs:23253 — `tray_settings::get().close_to_tray &&
|
||||
// tray::handle().is_some()`. TRAY OFF => CLOSE QUITS: `handle()` is None
|
||||
// when the tray is disabled, suppressed under gamescope or failed to
|
||||
// initialise, and gating on the setting alone would strand the process with
|
||||
// no window and no way back on a desktop with no SNI host (§15 trap 22).
|
||||
// On macOS Close hides and Dock/Finder reopen restores the current window,
|
||||
// even without a menu-bar item. On other desktops BOTH a live tray and
|
||||
// close-to-tray are required, so hiding cannot strand an unreachable app.
|
||||
// Quit remains a separate command on every platform.
|
||||
//
|
||||
// `closeEvent` is the QQuickCloseEvent on the one path that carries one and
|
||||
// null on the other four.
|
||||
@@ -911,7 +910,8 @@ ApplicationWindow {
|
||||
closeEvent.accepted = false
|
||||
if (quitConfirmation.opened)
|
||||
return
|
||||
var hide = QbzTray.trayLive && (QbzShell.isMacos || QbzTray.closeToTray)
|
||||
// macOS always has the Dock/Finder reopen path, even without a tray.
|
||||
var hide = QbzShell.isMacos || (QbzTray.trayLive && QbzTray.closeToTray)
|
||||
// The evidence line (2026-08-04): logged RUST-side so it lands in
|
||||
// qbz.log — console.log only reaches stderr, which owner reports
|
||||
// never carry. It prints both operands and the arm taken, which is
|
||||
@@ -1006,6 +1006,8 @@ ApplicationWindow {
|
||||
target: QbzTray
|
||||
function onCloseRequested() { window.closeOrHide(null) }
|
||||
function onWindowShowRequested() {
|
||||
if (window.quitAccepted)
|
||||
return
|
||||
console.log("[qml] tray -> showFromTray")
|
||||
window.showFromTray()
|
||||
}
|
||||
@@ -1018,9 +1020,13 @@ ApplicationWindow {
|
||||
// beside it. No setWindowShown — the mini is not the main window, and
|
||||
// the flag still honestly says the main one is hidden.
|
||||
function onMiniPresentRequested() {
|
||||
if (window.quitAccepted)
|
||||
return
|
||||
var mini = window.ensureMiniWindow()
|
||||
if (mini !== null) {
|
||||
mini.show()
|
||||
if (mini.visibility === Window.Minimized)
|
||||
mini.showNormal()
|
||||
mini.raise()
|
||||
mini.requestActivate()
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Rectangle {
|
||||
property string name: ""
|
||||
property int iconSize: 13
|
||||
property bool active: false
|
||||
property real idleOpacity: 0.65
|
||||
/// The close button: red hover fill, white glyph on it.
|
||||
property bool danger: false
|
||||
/// `a-move` only — the grab cursor that says "this drags the window".
|
||||
@@ -65,7 +66,7 @@ Rectangle {
|
||||
tintName: root.active
|
||||
? "accent"
|
||||
: ((ta.containsMouse && root.danger) ? "white" : "textPrimary")
|
||||
opacity: (root.active || ta.containsMouse) ? 1.0 : 0.65
|
||||
opacity: (root.active || ta.containsMouse) ? 1.0 : root.idleOpacity
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -22,12 +22,18 @@ import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
objectName: "miniMetadata"
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
/// Handed down by MiniShell (see MiniCompactSurface for why it is a
|
||||
/// property and not a `parent` read).
|
||||
property bool npExplicit: false
|
||||
property bool backdropActive: false
|
||||
// AlbumView header foregrounds on the dark ambient backdrop.
|
||||
readonly property bool lightText: backdropActive && theme.isDark
|
||||
readonly property color headerStrong: lightText ? "#ffffff" : theme.textPrimary
|
||||
readonly property color headerBody: lightText ? "#e0ffffff" : theme.textSecondary
|
||||
|
||||
// Max 320, 1:1, shrinking with the resizable window: the card is 40 px
|
||||
// wider than the cover at the padding, so this is 320 at the 368 px card
|
||||
@@ -82,7 +88,7 @@ Item {
|
||||
text: QbzPlayer.npHasTrack
|
||||
? QbzPlayer.npTitle
|
||||
: QbzSession.tr("No track playing", QbzSession.trRev)
|
||||
color: theme.textPrimary
|
||||
color: root.headerStrong
|
||||
font.pixelSize: 13
|
||||
font.weight: Font.DemiBold
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -104,7 +110,7 @@ Item {
|
||||
width: parent.width
|
||||
visible: QbzPlayer.npArtist !== ""
|
||||
text: QbzPlayer.npArtist
|
||||
color: theme.textMuted
|
||||
color: root.headerBody
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
@@ -116,7 +122,7 @@ Item {
|
||||
width: parent.width
|
||||
visible: QbzPlayer.npAlbum !== ""
|
||||
text: QbzPlayer.npAlbum
|
||||
color: theme.alphaTier(55)
|
||||
color: root.headerBody
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
|
||||
@@ -17,6 +17,7 @@ import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
objectName: "miniMetadata"
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
@@ -24,6 +25,11 @@ Item {
|
||||
/// document — QbzPlayer publishes no np_explicit (§8 rule 1: an explicit
|
||||
/// property, never a `parent` read).
|
||||
property bool npExplicit: false
|
||||
property bool backdropActive: false
|
||||
// AlbumView header foregrounds on the dark ambient backdrop.
|
||||
readonly property bool lightText: backdropActive && theme.isDark
|
||||
readonly property color headerStrong: lightText ? "#ffffff" : theme.textPrimary
|
||||
readonly property color headerBody: lightText ? "#e0ffffff" : theme.textSecondary
|
||||
|
||||
// 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
|
||||
@@ -72,7 +78,7 @@ Item {
|
||||
text: QbzPlayer.npHasTrack
|
||||
? QbzPlayer.npTitle
|
||||
: QbzSession.tr("No track playing", QbzSession.trRev)
|
||||
color: theme.textPrimary
|
||||
color: root.headerStrong
|
||||
font.pixelSize: 13
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
@@ -93,7 +99,7 @@ Item {
|
||||
Text {
|
||||
width: meta.width
|
||||
text: QbzPlayer.npArtist !== "" ? QbzPlayer.npArtist : "—"
|
||||
color: theme.textMuted
|
||||
color: root.headerBody
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@
|
||||
// smell, so all of them are cached here, including the paddings and the seek
|
||||
// sizes the reference also spells inline.
|
||||
//
|
||||
// THE CAPSULE IS A CONDITIONAL MOUNT (§15 trap 7). `Loader { active: }`, never
|
||||
// `visible: false`: when the pointer leaves the card the component is destroyed
|
||||
// and its expanded flag and 250 ms collapse timer go with it.
|
||||
// The menu trigger remains visible while the mini is open; leaving the card
|
||||
// collapses its controls.
|
||||
//
|
||||
// The two mode branches are Loaders for the same reason Slint uses `if`
|
||||
// (:263, :332) rather than a visibility flip — an always-visible surface pays
|
||||
@@ -45,9 +44,7 @@ Rectangle {
|
||||
property int mode: 0
|
||||
/// The MINI window (§8 rule 3), for startSystemMove().
|
||||
property var hostWindow: null
|
||||
/// Drives the capsule's conditional mount. Fed by MiniShell's HoverHandler
|
||||
/// on the card, which is §13-D4's replacement for the reference's winit
|
||||
/// CursorMoved/CursorLeft feed.
|
||||
/// Leaving the card collapses the menu without hiding its trigger.
|
||||
property bool windowHovered: false
|
||||
|
||||
QbzTheme { id: theme }
|
||||
@@ -141,7 +138,11 @@ Rectangle {
|
||||
return m + ":" + (s < 10 ? "0" : "") + s
|
||||
}
|
||||
|
||||
color: QbzMini.backgroundBlur ? "#d906070a" : theme.surfaceCard // #06070ad9 in Slint; Qt is #AARRGGBB
|
||||
property bool backgroundActive: false
|
||||
readonly property bool lightForeground: backgroundActive && theme.isDark
|
||||
color: root.backgroundActive
|
||||
? Qt.rgba(theme.surfaceCard.r, theme.surfaceCard.g, theme.surfaceCard.b, 0.20)
|
||||
: theme.surfaceCard
|
||||
|
||||
/// The CARD's corner radius, handed down by MiniShell.
|
||||
///
|
||||
@@ -181,6 +182,7 @@ Rectangle {
|
||||
sourceComponent: Component {
|
||||
Item {
|
||||
MiniSeek {
|
||||
lightForeground: root.lightForeground
|
||||
id: seek
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
@@ -205,7 +207,7 @@ Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.fmt(QbzPlayer.npElapsedSecs)
|
||||
color: theme.textMuted
|
||||
color: root.lightForeground ? "#e0ffffff" : theme.textSecondary
|
||||
font.pixelSize: root.timeFont
|
||||
}
|
||||
Text {
|
||||
@@ -221,7 +223,7 @@ Rectangle {
|
||||
// itself.
|
||||
text: "-" + root.fmt(Math.max(0, QbzPlayer.npDurationSecs
|
||||
- QbzPlayer.npElapsedSecs))
|
||||
color: theme.textMuted
|
||||
color: root.lightForeground ? "#e0ffffff" : theme.textSecondary
|
||||
font.pixelSize: root.timeFont
|
||||
}
|
||||
}
|
||||
@@ -235,6 +237,7 @@ Rectangle {
|
||||
height: root.ctrlH
|
||||
|
||||
MiniVolume {
|
||||
lightForeground: root.lightForeground
|
||||
id: vol
|
||||
// Above the transport, so its popup and the
|
||||
// click-outside layer inside it are not painted under
|
||||
@@ -260,6 +263,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MiniTransport {
|
||||
lightForeground: root.lightForeground
|
||||
id: transport
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// Centred in the band BETWEEN the volume button and the
|
||||
@@ -282,11 +286,12 @@ Rectangle {
|
||||
// volume popup's dismiss layer.
|
||||
Loader {
|
||||
z: 3
|
||||
active: root.windowHovered
|
||||
active: QbzMini.open
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceComponent: Component {
|
||||
MiniWindowControls {
|
||||
windowHovered: root.windowHovered
|
||||
activeSurface: QbzMini.surface
|
||||
hostWindow: root.hostWindow
|
||||
}
|
||||
@@ -328,7 +333,7 @@ Rectangle {
|
||||
? QbzPlayer.npTitle + " - " + QbzPlayer.npArtist
|
||||
: QbzPlayer.npTitle)
|
||||
: QbzSession.tr("No track playing", QbzSession.trRev)
|
||||
color: theme.alphaTier(70)
|
||||
color: root.lightForeground ? "#e0ffffff" : theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@@ -359,17 +364,17 @@ Rectangle {
|
||||
// the reference's own arithmetic leaves it overflowing
|
||||
// upward and visibly high. `root` is the footer, which in
|
||||
// micro IS the whole card (§13-D10), so its centre is the
|
||||
// card's centre. Anchoring across the parent boundary is
|
||||
// safe here and NOT the §8 rule-1 hazard: `root` is an id,
|
||||
// not a `parent.<something>` walk.
|
||||
// card's centre. Qt anchors require a parent or sibling;
|
||||
// the footer is neither here. Use its mapped centre.
|
||||
Loader {
|
||||
z: 1
|
||||
active: root.windowHovered
|
||||
active: QbzMini.open
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 8
|
||||
anchors.verticalCenter: root.verticalCenter
|
||||
y: root.mapToItem(microHeader, 0, root.height / 2).y - height / 2
|
||||
sourceComponent: Component {
|
||||
MiniWindowControls {
|
||||
windowHovered: root.windowHovered
|
||||
activeSurface: QbzMini.surface
|
||||
hostWindow: root.hostWindow
|
||||
}
|
||||
@@ -388,6 +393,7 @@ Rectangle {
|
||||
height: 16
|
||||
|
||||
MiniTransport {
|
||||
lightForeground: root.lightForeground
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
btn: 16
|
||||
@@ -405,6 +411,7 @@ Rectangle {
|
||||
// layout's 8 px side padding says otherwise and the CODE wins
|
||||
// (§12-P6).
|
||||
MiniSeek {
|
||||
lightForeground: root.lightForeground
|
||||
anchors.top: microCtrl.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
@@ -25,6 +25,7 @@ import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property bool lightForeground: false
|
||||
|
||||
/// Effective 0..1, fed by MiniFooter's pending-seek machine.
|
||||
property real progress: 0.0
|
||||
@@ -47,7 +48,7 @@ Item {
|
||||
height: root.trackHeight
|
||||
y: Math.round((root.height - height) / 2)
|
||||
radius: root.rounded ? height / 2 : 0
|
||||
color: theme.alphaTier(12)
|
||||
color: root.lightForeground ? "#40ffffff" : theme.alphaTier(12)
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -16,6 +16,7 @@ import QtQuick
|
||||
import QtQuick.Effects
|
||||
import com.blitzfc.qbz
|
||||
import "../immersive"
|
||||
import "../shell"
|
||||
import "../theme"
|
||||
|
||||
Rectangle {
|
||||
@@ -28,17 +29,7 @@ Rectangle {
|
||||
// startSystemMove() on it rather than walking a parent chain.
|
||||
property var hostWindow: null
|
||||
|
||||
// §13-D4 — the reference feeds `MiniPlayerState.window-hovered` from winit
|
||||
// CursorMoved/CursorLeft (`crates/qbz/src/miniplayer.rs:420-429`) because a
|
||||
// borderless Slint card has no reliable root hover; `state.slint:4506`
|
||||
// names "or a root TouchArea" as the alternative and Qt takes that branch.
|
||||
// A HoverHandler, NOT a MouseArea: a MouseArea would lose containsMouse the
|
||||
// moment the pointer crossed onto any button in the footer, which is
|
||||
// exactly the measured failure the tree records at
|
||||
// qml/immersive/SuggestionsPanel.qml:316-325 and
|
||||
// qml/shell/Cortinilla.qml:215-222. This drives the capsule's conditional
|
||||
// mount, so getting it wrong means the capsule vanishes under the cursor
|
||||
// that is reaching for it.
|
||||
// A whole-card hover sensor keeps the capsule open across its buttons.
|
||||
HoverHandler { id: cardHover }
|
||||
|
||||
// --- Cached per-mode values (§7-M2) ------------------------------------
|
||||
@@ -91,11 +82,13 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Card chrome (MiniShell.slint:20-24) -------------------------------
|
||||
// #050506 stays a literal here because it is a literal there (§4.11): it is
|
||||
// the near-black the artwork backdrop is composed against, not a theme
|
||||
// surface.
|
||||
color: QbzMini.backgroundBlur ? "#050506" : theme.surfaceMain
|
||||
// Inherit the app background. The mini's blur button can override it
|
||||
// with its static artwork backdrop; turning that off restores the app mode.
|
||||
readonly property bool useAppBackground: theme.ambientOn && !QbzMini.backgroundBlur
|
||||
readonly property bool backdropOn: root.useAppBackground || QbzMini.backgroundBlur
|
||||
readonly property bool backdropMounted: QbzMini.open && root.backdropOn
|
||||
|
||||
color: theme.surfaceMain
|
||||
border.width: 1
|
||||
border.color: theme.alphaTier(10)
|
||||
// 9 px for micro + compact, 10 px otherwise (§15 trap 6).
|
||||
@@ -103,35 +96,14 @@ Rectangle {
|
||||
antialiasing: true
|
||||
clip: true
|
||||
|
||||
// --- The backdrop, and why it needs a MASK ----------------------------
|
||||
// Both backdrop layers live inside ONE masked container.
|
||||
//
|
||||
// The card above sets `radius` + `clip: true`, and that is NOT enough:
|
||||
// **QML's clip is RECTANGULAR.** `qml/theme/RoundedImage.qml:3-6` states it
|
||||
// as measured fact on this exact Qt build — *"a Rectangle with radius +
|
||||
// clip: true does NOT clip children to the rounded shape (proven with an
|
||||
// isolated scene on this Qt build: the child paints square over the rounded
|
||||
// fill)"*. So without a mask the scrim, and the atmosphere's own opaque
|
||||
// `#0a0a0b` root (ImmersiveAtmosphere.qml:57-60), would both paint into the
|
||||
// four corner regions the card fill leaves transparent: the moment the
|
||||
// backdrop is switched on, the floating card stops being a rounded card and
|
||||
// becomes a hard-cornered rectangle with a rounded hairline inside it.
|
||||
//
|
||||
// This is reachable WITHOUT B3's toggle: `mini_background_blur` lives in
|
||||
// the ui_prefs.json that is CO-OWNED with the shipping Slint app
|
||||
// (mini_qt.rs's key table), so a user who enabled the backdrop over there
|
||||
// gets it on their first Qt mini open.
|
||||
//
|
||||
// ONE layer + ONE mask for the whole group, never one per child — the
|
||||
// tree's own idiom at `qml/shell/Sidebar.qml:1002-1013`. The 0.5/1.0 mask
|
||||
// pair is MEASURED, not defaulted; RoundedImage.qml:495-521 has the table
|
||||
// and the reason 0.0/0.0 collapses Qt's smoothstep to `step()`.
|
||||
// One rounded mask for either background, shared by all five surfaces.
|
||||
Item {
|
||||
id: backdrop
|
||||
objectName: "miniBackdrop"
|
||||
anchors.fill: parent
|
||||
visible: QbzMini.backgroundBlur
|
||||
visible: root.backdropMounted
|
||||
clip: true
|
||||
layer.enabled: QbzMini.backgroundBlur && !root._noShaders
|
||||
layer.enabled: root.backdropMounted && !root._noShaders
|
||||
layer.smooth: true
|
||||
layer.effect: MultiEffect {
|
||||
maskEnabled: true
|
||||
@@ -139,53 +111,37 @@ Rectangle {
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1.0
|
||||
}
|
||||
|
||||
// Layer 1: the ambient field (MiniShell.slint:26-37). A conditional
|
||||
// MOUNT, not a `visible` flip: with the backdrop off there is no
|
||||
// ambient item at all, which is the point of §7-M11 — handing a 380 px
|
||||
// always-on-top window a continuously repainting shader surface is the
|
||||
// failure mode. A Loader with an INLINE sourceComponent keeps the type
|
||||
// (and therefore every property name below) checkable; nothing ever
|
||||
// reads `Loader.item`, which §8 rule 4 forbids.
|
||||
//
|
||||
// All four tuning values are passed EXPLICITLY. ImmersiveAtmosphere's
|
||||
// own defaults are animated:true / dim 0.15 / baseOpacity 0.95 /
|
||||
// warpOpacity 0.48 (ImmersiveAtmosphere.qml:36-41) and every one of
|
||||
// them is wrong for the mini.
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: QbzMini.backgroundBlur && QbzPlayer.npHasTrack
|
||||
sourceComponent: Component {
|
||||
ImmersiveAtmosphere {
|
||||
source: QbzImmersive.atmosphereUrl
|
||||
fallbackSource: QbzPlayer.npArtworkPath
|
||||
animated: false
|
||||
dim: 0.54
|
||||
baseOpacity: 0.72
|
||||
warpOpacity: 0.20
|
||||
}
|
||||
active: root.backdropMounted && root.useAppBackground
|
||||
sourceComponent: AppBackground {
|
||||
hostWindow: root.hostWindow
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: root.backdropMounted && QbzMini.backgroundBlur && QbzPlayer.npHasTrack
|
||||
sourceComponent: ImmersiveAtmosphere {
|
||||
source: QbzImmersive.atmosphereUrl
|
||||
fallbackSource: QbzPlayer.npArtworkPath
|
||||
animated: false
|
||||
dim: theme.isDark ? 0.54 : 0.0
|
||||
baseOpacity: 0.72
|
||||
warpOpacity: 0.20
|
||||
}
|
||||
}
|
||||
|
||||
// Layer 2: the scrim (MiniShell.slint:39-41). Gated on background-blur
|
||||
// ALONE — NOT on has-track, unlike the layer above it. That asymmetry
|
||||
// is the reference's and it is deliberate: with the backdrop on and no
|
||||
// track, the card is the flat scrim over #050506.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#bf050506" // #050506bf in Slint; Qt is #AARRGGBB
|
||||
visible: QbzMini.backgroundBlur
|
||||
color: theme.surfaceMain
|
||||
opacity: 0.75
|
||||
}
|
||||
}
|
||||
|
||||
// The mask's own item. A layer renders even when its item is invisible —
|
||||
// that IS the mask idiom — so the gate is `backgroundBlur`, not `visible`,
|
||||
// and an ungated pair of layers would cost two FBOs on a card that usually
|
||||
// has the backdrop OFF.
|
||||
Item {
|
||||
id: backdropMask
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
layer.enabled: QbzMini.backgroundBlur && !root._noShaders
|
||||
layer.enabled: root.backdropMounted && !root._noShaders
|
||||
layer.smooth: true
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
@@ -194,6 +150,22 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Below every interactive surface: controls retain the pointer grab.
|
||||
// Queue/lyrics reserve their content area for scrolling, even in gaps.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onPressed: function(mouse) {
|
||||
if ((root.surfaceId === 3 || root.surfaceId === 4)
|
||||
&& mouse.y < root.height - root.footerHeight) {
|
||||
mouse.accepted = false
|
||||
return
|
||||
}
|
||||
if (root.hostWindow)
|
||||
root.hostWindow.startSystemMove()
|
||||
}
|
||||
}
|
||||
|
||||
// --- The surface area (MiniShell.slint:43-55) --------------------------
|
||||
// Absent in micro, where the footer IS the card. Its height is the card
|
||||
// minus the footer, which is how §4.2's "surface-area H" column is
|
||||
@@ -223,14 +195,14 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
active: root.surfaceId === 1
|
||||
sourceComponent: Component {
|
||||
MiniCompactSurface { npExplicit: root.npExplicit }
|
||||
MiniCompactSurface { npExplicit: root.npExplicit; backdropActive: root.backdropOn }
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: root.surfaceId === 2
|
||||
sourceComponent: Component {
|
||||
MiniArtworkSurface { npExplicit: root.npExplicit }
|
||||
MiniArtworkSurface { npExplicit: root.npExplicit; backdropActive: root.backdropOn }
|
||||
}
|
||||
}
|
||||
// Both of these carry `QbzMini.open` in their gate, and that term is
|
||||
@@ -285,6 +257,7 @@ Rectangle {
|
||||
// two overlap rather than part.
|
||||
MiniFooter {
|
||||
id: footer
|
||||
objectName: "miniFooter"
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
@@ -292,6 +265,7 @@ Rectangle {
|
||||
anchors.rightMargin: root.border.width
|
||||
anchors.bottomMargin: root.border.width
|
||||
height: root.footerHeight
|
||||
backgroundActive: root.backdropOn
|
||||
mode: root.footerMode
|
||||
cardRadius: root.radius - root.border.width
|
||||
hostWindow: root.hostWindow
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.blitzfc.qbz
|
||||
|
||||
Row {
|
||||
id: root
|
||||
property bool lightForeground: false
|
||||
|
||||
property int btn: 30
|
||||
property int icShuffle: 16
|
||||
@@ -35,6 +36,7 @@ Row {
|
||||
spacing: root.gap
|
||||
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
name: "shuffle"
|
||||
iconSize: root.icShuffle
|
||||
btn: root.btn
|
||||
@@ -43,6 +45,7 @@ Row {
|
||||
onClicked: QbzPlayer.toggleShuffle()
|
||||
}
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
name: "skip-back"
|
||||
iconSize: root.icSkip
|
||||
btn: root.btn
|
||||
@@ -50,6 +53,7 @@ Row {
|
||||
onClicked: QbzPlayer.previous()
|
||||
}
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
name: QbzPlayer.npPlaying ? "pause" : "play-fill"
|
||||
iconSize: root.icPlay
|
||||
btn: root.btn
|
||||
@@ -57,6 +61,7 @@ Row {
|
||||
onClicked: QbzPlayer.togglePlay()
|
||||
}
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
name: "skip-forward"
|
||||
iconSize: root.icSkip
|
||||
btn: root.btn
|
||||
@@ -64,6 +69,7 @@ Row {
|
||||
onClicked: QbzPlayer.next()
|
||||
}
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
// 0 off · 1 all · 2 one (src/player_bridge.rs:52).
|
||||
name: QbzPlayer.npRepeatMode === 2 ? "repeat-1" : "repeat"
|
||||
iconSize: root.icShuffle
|
||||
|
||||
@@ -42,6 +42,7 @@ import "../theme"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property bool lightForeground: false
|
||||
|
||||
readonly property bool volLocked: (QbzPlayer.npVolumeLocked && !QbzPlayer.npIsRemote) || QbzPlayer.npRemoteVolumeLocked
|
||||
property int btn: 30
|
||||
@@ -61,6 +62,7 @@ Rectangle {
|
||||
color: "transparent"
|
||||
|
||||
TBtn {
|
||||
lightForeground: root.lightForeground
|
||||
name: (QbzPlayer.npMuted || QbzPlayer.npVolume === 0) ? "volume-x" : "volume-2"
|
||||
iconSize: root.iconSize
|
||||
btn: root.btn
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
// carries the K1 column of §4.3.4's table (cluster 243, expanded 272), not the
|
||||
// nine-button one (219 / 248).
|
||||
//
|
||||
// THIS COMPONENT IS MOUNTED CONDITIONALLY, NEVER `visible: false` (§15 trap 7).
|
||||
// MiniFooter mounts it through a `Loader { active: windowHovered }`, so when the
|
||||
// pointer leaves the card the whole thing is destroyed and `expanded` plus the
|
||||
// 250 ms collapse timer die with it. A `visible` flip would leave a capsule
|
||||
// mid-unfold waiting to be re-revealed in that state.
|
||||
// The trigger stays mounted while the mini is open. Leaving the card resets
|
||||
// expansion without hiding the entry point to the window controls.
|
||||
//
|
||||
// THE WIDTH IS COMPUTED FROM CONSTANTS, NOT FROM THE CHILDREN (§8 rule 1).
|
||||
// The reference reads `cluster.preferred-width` (:81); a QML port that reached
|
||||
@@ -48,6 +45,7 @@ import "../theme"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
objectName: "miniWindowControls"
|
||||
|
||||
/// The lit tab. Passed in rather than read off QbzMini here so the mount
|
||||
/// site owns the binding (:56, `active-surface`).
|
||||
@@ -63,6 +61,13 @@ Rectangle {
|
||||
// 118 · two 3 px gaps in the outer row = 118 + 3 + 1 + 3 + 118.
|
||||
readonly property int clusterWidth: 243
|
||||
|
||||
property bool windowHovered: true
|
||||
onWindowHoveredChanged: {
|
||||
if (!windowHovered) {
|
||||
collapseTimer.stop()
|
||||
expanded = false
|
||||
}
|
||||
}
|
||||
property bool expanded: false
|
||||
|
||||
// A1 (§4.12): 220 ms, cubic-bezier(0.4, 0, 0.2, 1). The ONLY animated
|
||||
@@ -83,9 +88,9 @@ Rectangle {
|
||||
|
||||
radius: 13
|
||||
antialiasing: true
|
||||
color: "#e606070a" // #06070ae6 in Slint; Qt is #AARRGGBB
|
||||
color: Qt.rgba(theme.surfaceElevated.r, theme.surfaceElevated.g, theme.surfaceElevated.b, 1.0)
|
||||
border.width: 1
|
||||
border.color: "#33ffffff" // #ffffff33 in Slint; Qt is #AARRGGBB
|
||||
border.color: theme.alphaTier(20)
|
||||
|
||||
HoverHandler {
|
||||
onHoveredChanged: {
|
||||
@@ -171,7 +176,7 @@ Rectangle {
|
||||
Rectangle {
|
||||
width: 1
|
||||
height: 12
|
||||
color: "#29ffffff" // #ffffff29 in Slint; Qt is #AARRGGBB
|
||||
color: theme.alphaTier(15)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@@ -243,11 +248,16 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// The trigger: always visible, HOVER-ONLY — it has no clicked handler in
|
||||
// the reference either (:176-183). 22 x 22 overrides CapBtn's 22 x 20 so
|
||||
// The trigger opens on hover or click. 22 x 22 overrides CapBtn's 22 x 20 so
|
||||
// the collapsed capsule is a circle inside the 26 px radius-13 chrome.
|
||||
CapBtn {
|
||||
objectName: "miniMenuTrigger"
|
||||
name: "square"
|
||||
idleOpacity: 1.0
|
||||
onClicked: {
|
||||
collapseTimer.stop()
|
||||
root.expanded = true
|
||||
}
|
||||
iconSize: 12
|
||||
width: 22
|
||||
height: 22
|
||||
|
||||
@@ -33,6 +33,7 @@ import "../theme"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property bool lightForeground: false
|
||||
|
||||
/// Icon file stem, e.g. "shuffle" (QbzIcon appends ".svg").
|
||||
property string name: ""
|
||||
@@ -61,7 +62,7 @@ Rectangle {
|
||||
// a half-pixel offset on a 13 px glyph is visible as a blur.
|
||||
x: Math.round((root.width - width) / 2)
|
||||
y: Math.round((root.height - height) / 2)
|
||||
tintName: root.active ? "accent" : "textPrimary"
|
||||
tintName: root.active ? "accent" : (root.lightForeground ? "white" : "textPrimary")
|
||||
opacity: (root.active || ta.containsMouse) ? 1.0 : 0.70
|
||||
}
|
||||
|
||||
|
||||
@@ -638,6 +638,17 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
SettingRow { kioskHost: root.kioskHost;
|
||||
visible: root.doc.isMacos === true
|
||||
enabled: root.doc.trayEnable === true
|
||||
label: QbzSession.tr("Hide Dock icon when closed to menu bar", QbzSession.trRev)
|
||||
description: QbzSession.tr("Run as a menu-bar-only app while the window is closed. Off keeps the Dock icon (like Spotify)", QbzSession.trRev)
|
||||
QbzToggle { kioskHost: root.kioskHost;
|
||||
checked: root.doc.trayMacHideDock === true
|
||||
onToggled: function (v) { QbzBridge.settingsBool("tray-mac-hide-dock", v) }
|
||||
}
|
||||
}
|
||||
|
||||
// The group's own separator is gated too, or the panel ends on a divider
|
||||
// with nothing under it (the reference gates its three spacer/divider
|
||||
// elements the same way, AppearanceSettings.slint:1015-1017).
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
// Shared app/miniplayer background. The host owns visibility; all animation
|
||||
// stays on the existing shell pulse and each field observes its own window.
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import com.blitzfc.qbz
|
||||
import "../immersive"
|
||||
import "../theme"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property var hostWindow: null
|
||||
property bool activeBackground: theme.ambientOn
|
||||
readonly property bool painting: root.activeBackground && root.visible
|
||||
&& (!root.Window.window || (root.Window.window.visibility !== Window.Hidden
|
||||
&& root.Window.window.visibility !== Window.Minimized))
|
||||
QbzTheme { id: theme }
|
||||
|
||||
// --- The background layers (AppShell.slint:206-242) --------------------
|
||||
// The bottom-most visual layer, declared before every chrome surface so
|
||||
// they all paint above it. Mode 1 and mode 2 are DIFFERENT looks and are
|
||||
// mutually exclusive; neither is mounted while a mode is off or nothing is
|
||||
// playing, which is the D4 "opaque theme restored" case.
|
||||
readonly property bool ambientModeOn: root.painting && QbzShell.ambientMode === 1
|
||||
readonly property bool blurredModeOn: root.painting && QbzShell.ambientMode === 2
|
||||
|
||||
// --- The polarity-aware legibility veil (owner, 2026-08-31) ------------
|
||||
// The old scrim was a fixed BLACK layer at ambientDim — tuned for dark
|
||||
// themes, where dark ground + light text is exactly right. Over a LIGHT
|
||||
// theme the same dark scrim pushed the field to MID luminance, the worst
|
||||
// possible ground for dark text (the weak grey ramp died completely).
|
||||
// Light themes therefore veil with their own near-white surfaceMain, a
|
||||
// notch stronger, and the in-shader/in-atmosphere darkening is turned
|
||||
// OFF there (darkening and then whitening would just grey the field).
|
||||
// Dark themes keep the exact previous look.
|
||||
readonly property real veilStrength: theme.isDark
|
||||
? QbzShell.ambientDim
|
||||
: Math.min(0.72, QbzShell.ambientDim + 0.2)
|
||||
|
||||
// Mode 1 — the album-triad metaball field, plus the veil that keeps text
|
||||
// legible over a bright album palette (QBZ_BG_DIM, default 0.35).
|
||||
AmbientField {
|
||||
anchors.fill: parent
|
||||
visible: root.ambientModeOn
|
||||
running: root.ambientModeOn
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.ambientModeOn
|
||||
color: theme.isDark ? "#000000" : theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
|
||||
// Mode 2 — Blurred art: the SAME ImmersiveAtmosphere the immersive view
|
||||
// and the album/artist headers use, at window size (AppShell.slint:221-231
|
||||
// reuses the identical component). `animated` follows the transport, so a
|
||||
// paused player holds the static pose instead of drifting forever, and the
|
||||
// fallback is the plain cover for a track whose atmosphere bitmap has not
|
||||
// been generated yet. On light themes its internal dark dim is disabled
|
||||
// and the veil below provides the legibility layer instead (the
|
||||
// atmosphere's baked gradient scrim stays — it reads as depth under the
|
||||
// light veil, not as darkness).
|
||||
ImmersiveAtmosphere {
|
||||
anchors.fill: parent
|
||||
visible: root.blurredModeOn
|
||||
source: root.blurredModeOn ? QbzImmersive.atmosphereUrl : ""
|
||||
fallbackSource: root.blurredModeOn ? QbzPlayer.npArtworkPath : ""
|
||||
animated: root.blurredModeOn && QbzPlayer.npPlaying
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.blurredModeOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
|
||||
// Mode 3 — Wallpaper: the window reads as translucent to the desktop:
|
||||
// ALWAYS the part of the wallpaper that lies under it, wherever it is
|
||||
// moved (X11, macOS and Windows say where the window is; KDE Plasma
|
||||
// Wayland says so through its window-management protocol; anywhere
|
||||
// else a centred crop stands in), lightly blurred so nothing in the
|
||||
// picture competes with the text, yet still recognisable. Static: it
|
||||
// costs a frame only when the window moves or resizes
|
||||
// (shell/WallpaperField.qml).
|
||||
// Mode 4 — Wallpaper, blurred: Blurred art with the wallpaper in the
|
||||
// cover's place — the SAME atmosphere pass, the SAME drift while the
|
||||
// transport plays, the same still pose when it does not.
|
||||
// Neither waits for a playing track (QbzTheme.ambientOn).
|
||||
readonly property bool wallpaperModeOn: root.painting && QbzShell.ambientMode === 3
|
||||
readonly property bool wallpaperBlurOn: root.painting && QbzShell.ambientMode === 4
|
||||
WallpaperField {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperModeOn
|
||||
source: root.wallpaperModeOn ? QbzShell.wallpaperUrl : ""
|
||||
hostWindow: root.hostWindow
|
||||
// The user's choice (Settings > Appearance, 0-100 % of Qt's 0.0-1.0),
|
||||
// live while that slider drags; 0.75 by default.
|
||||
blur: QbzShell.wallpaperBlur
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperModeOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
ImmersiveAtmosphere {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperBlurOn
|
||||
source: root.wallpaperBlurOn ? QbzShell.wallpaperAtmosphereUrl : ""
|
||||
animated: root.wallpaperBlurOn && QbzPlayer.npPlaying
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperBlurOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
// The wallpaper can change while QBZ runs: re-resolve when the window
|
||||
// comes back to the front (wallpaper_qt memoises path + mtime, so a
|
||||
// wallpaper that did not change republishes nothing).
|
||||
Connections {
|
||||
target: root.hostWindow
|
||||
ignoreUnknownSignals: true
|
||||
function onActiveChanged() {
|
||||
if (root.hostWindow && root.hostWindow.active && QbzShell.ambientMode >= 3)
|
||||
QbzShell.refreshWallpaper()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,119 +61,10 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
// --- The background layers (AppShell.slint:206-242) --------------------
|
||||
// The bottom-most visual layer, declared before every chrome surface so
|
||||
// they all paint above it. Mode 1 and mode 2 are DIFFERENT looks and are
|
||||
// mutually exclusive; neither is mounted while a mode is off or nothing is
|
||||
// playing, which is the D4 "opaque theme restored" case.
|
||||
readonly property bool ambientModeOn: root.ambientOn && QbzShell.ambientMode === 1
|
||||
readonly property bool blurredModeOn: root.ambientOn && QbzShell.ambientMode === 2
|
||||
|
||||
// --- The polarity-aware legibility veil (owner, 2026-08-31) ------------
|
||||
// The old scrim was a fixed BLACK layer at ambientDim — tuned for dark
|
||||
// themes, where dark ground + light text is exactly right. Over a LIGHT
|
||||
// theme the same dark scrim pushed the field to MID luminance, the worst
|
||||
// possible ground for dark text (the weak grey ramp died completely).
|
||||
// Light themes therefore veil with their own near-white surfaceMain, a
|
||||
// notch stronger, and the in-shader/in-atmosphere darkening is turned
|
||||
// OFF there (darkening and then whitening would just grey the field).
|
||||
// Dark themes keep the exact previous look.
|
||||
readonly property real veilStrength: theme.isDark
|
||||
? QbzShell.ambientDim
|
||||
: Math.min(0.72, QbzShell.ambientDim + 0.2)
|
||||
|
||||
// Mode 1 — the album-triad metaball field, plus the veil that keeps text
|
||||
// legible over a bright album palette (QBZ_BG_DIM, default 0.35).
|
||||
AmbientField {
|
||||
AppBackground {
|
||||
anchors.fill: parent
|
||||
visible: root.ambientModeOn
|
||||
running: root.ambientModeOn
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.ambientModeOn
|
||||
color: theme.isDark ? "#000000" : theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
|
||||
// Mode 2 — Blurred art: the SAME ImmersiveAtmosphere the immersive view
|
||||
// and the album/artist headers use, at window size (AppShell.slint:221-231
|
||||
// reuses the identical component). `animated` follows the transport, so a
|
||||
// paused player holds the static pose instead of drifting forever, and the
|
||||
// fallback is the plain cover for a track whose atmosphere bitmap has not
|
||||
// been generated yet. On light themes its internal dark dim is disabled
|
||||
// and the veil below provides the legibility layer instead (the
|
||||
// atmosphere's baked gradient scrim stays — it reads as depth under the
|
||||
// light veil, not as darkness).
|
||||
ImmersiveAtmosphere {
|
||||
anchors.fill: parent
|
||||
visible: root.blurredModeOn
|
||||
source: root.blurredModeOn ? QbzImmersive.atmosphereUrl : ""
|
||||
fallbackSource: root.blurredModeOn ? QbzPlayer.npArtworkPath : ""
|
||||
animated: root.blurredModeOn && QbzPlayer.npPlaying
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.blurredModeOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
|
||||
// Mode 3 — Wallpaper: the window reads as translucent to the desktop:
|
||||
// ALWAYS the part of the wallpaper that lies under it, wherever it is
|
||||
// moved (X11, macOS and Windows say where the window is; KDE Plasma
|
||||
// Wayland says so through its window-management protocol; anywhere
|
||||
// else a centred crop stands in), lightly blurred so nothing in the
|
||||
// picture competes with the text, yet still recognisable. Static: it
|
||||
// costs a frame only when the window moves or resizes
|
||||
// (shell/WallpaperField.qml).
|
||||
// Mode 4 — Wallpaper, blurred: Blurred art with the wallpaper in the
|
||||
// cover's place — the SAME atmosphere pass, the SAME drift while the
|
||||
// transport plays, the same still pose when it does not.
|
||||
// Neither waits for a playing track (QbzTheme.ambientOn).
|
||||
readonly property bool wallpaperModeOn: root.ambientOn && QbzShell.ambientMode === 3
|
||||
readonly property bool wallpaperBlurOn: root.ambientOn && QbzShell.ambientMode === 4
|
||||
WallpaperField {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperModeOn
|
||||
source: root.wallpaperModeOn ? QbzShell.wallpaperUrl : ""
|
||||
hostWindow: root.hostWindow
|
||||
// The user's choice (Settings > Appearance, 0-100 % of Qt's 0.0-1.0),
|
||||
// live while that slider drags; 0.75 by default.
|
||||
blur: QbzShell.wallpaperBlur
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperModeOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
ImmersiveAtmosphere {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperBlurOn
|
||||
source: root.wallpaperBlurOn ? QbzShell.wallpaperAtmosphereUrl : ""
|
||||
animated: root.wallpaperBlurOn && QbzPlayer.npPlaying
|
||||
dim: theme.isDark ? QbzShell.ambientDim : 0.0
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.wallpaperBlurOn && !theme.isDark
|
||||
color: theme.surfaceMain
|
||||
opacity: root.veilStrength
|
||||
}
|
||||
// The wallpaper can change while QBZ runs: re-resolve when the window
|
||||
// comes back to the front (wallpaper_qt memoises path + mtime, so a
|
||||
// wallpaper that did not change republishes nothing).
|
||||
Connections {
|
||||
target: root.hostWindow
|
||||
ignoreUnknownSignals: true
|
||||
function onActiveChanged() {
|
||||
if (root.hostWindow && root.hostWindow.active && QbzShell.ambientMode >= 3)
|
||||
QbzShell.refreshWallpaper()
|
||||
}
|
||||
activeBackground: root.ambientOn
|
||||
}
|
||||
|
||||
// The host ApplicationWindow (custom chrome: drag / maximize / resize).
|
||||
|
||||
@@ -3892,7 +3892,12 @@ pub async fn settings_bool(runtime: &Arc<AppRuntime<LoggingAdapter>>, key: &str,
|
||||
"tray-mac-hide-dock" => tray()
|
||||
.set_mac_hide_dock(value)
|
||||
.map_err(|e| e.to_string())
|
||||
.map(|_| Apply::None),
|
||||
.map(|_| {
|
||||
crate::tray_bridge::ui(|t| {
|
||||
crate::tray_qt::refresh_mac_dock_policy(*t.as_ref().tray_live());
|
||||
});
|
||||
Apply::None
|
||||
}),
|
||||
// --- Integrations (phase 19) --------------------------------------
|
||||
"show-recommendations" => {
|
||||
crate::integrations_qt::set_show_recommendations(value).map(|_| Apply::None)
|
||||
|
||||
@@ -175,6 +175,17 @@ static QT_THREAD: OnceLock<CxxQtThread<QbzTray>> = OnceLock::new();
|
||||
|
||||
unsafe extern "C" {
|
||||
fn qbz_install_lifecycle_filter(request: extern "C" fn(bool));
|
||||
#[cfg(target_os = "macos")]
|
||||
fn qbz_install_macos_reopen_handler(present: extern "C" fn());
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
extern "C" fn present_from_dock() {
|
||||
if crate::HARD_EXIT_ARMED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
log::info!("[macos] Dock/Finder reopen requested");
|
||||
crate::tray_qt::present();
|
||||
}
|
||||
|
||||
extern "C" fn request_lifecycle(quit: bool) {
|
||||
@@ -204,6 +215,8 @@ impl qbz_tray::QbzTray {
|
||||
// SAFETY: boot runs on the GUI thread after QGuiApplication exists;
|
||||
// callback has static lifetime and queues all QML work.
|
||||
unsafe { qbz_install_lifecycle_filter(request_lifecycle) };
|
||||
#[cfg(target_os = "macos")]
|
||||
unsafe { qbz_install_macos_reopen_handler(present_from_dock) };
|
||||
// If `tray_qt::init` ran before this point its queued closure was
|
||||
// dropped on the floor -- `ui()` above is a no-op until the line
|
||||
// right here. Pick the work up now; we are already on the GUI thread.
|
||||
@@ -222,15 +235,11 @@ impl qbz_tray::QbzTray {
|
||||
/// (`hideToTray` / `showFromTray`), so the macOS Dock-icon policy hangs
|
||||
/// here rather than growing a third visibility owner.
|
||||
///
|
||||
/// A live tray keeps hidden windows reachable, so hiding removes the Dock
|
||||
/// icon. Showing always restores it. Minimizing does not call this method.
|
||||
/// Hide the Dock only by opt-in, with a live menu-bar recovery path and
|
||||
/// no miniplayer on screen. Showing always restores it.
|
||||
pub fn set_window_shown(self: Pin<&mut Self>, shown: bool) {
|
||||
crate::tray_qt::set_window_shown(shown);
|
||||
if shown {
|
||||
crate::tray_qt::set_mac_dock_hidden(false);
|
||||
} else if *self.as_ref().tray_live() {
|
||||
crate::tray_qt::set_mac_dock_hidden(true);
|
||||
}
|
||||
crate::tray_qt::refresh_mac_dock_policy(*self.as_ref().tray_live());
|
||||
}
|
||||
|
||||
/// The close-choreography evidence line — see the declaration above. The
|
||||
|
||||
@@ -239,9 +239,8 @@ pub(crate) fn handle() -> Option<&'static TrayHandle> {
|
||||
/// on, while a plain minimize still goes to the Dock like any app. Only the
|
||||
/// close path calls this; minimize is untouched by design.
|
||||
///
|
||||
/// **Main thread only.** Its one caller is `QbzTray::set_window_shown`, a
|
||||
/// `#[qinvokable]` — those run on the Qt GUI thread, which on macOS IS the
|
||||
/// AppKit main thread, so `MainThreadMarker::new()` succeeds there. It returns
|
||||
/// **Main thread only.** Visibility and preference changes reach this through
|
||||
/// `refresh_mac_dock_policy` on the Qt GUI/AppKit thread. The marker returns
|
||||
/// `None` and no-ops anywhere else rather than panicking.
|
||||
///
|
||||
/// Port of `crates/qbz/src/tray/macos.rs:320-331`, reached through the
|
||||
@@ -271,11 +270,6 @@ pub(crate) fn set_mac_dock_hidden(hidden: bool) {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub(crate) fn set_mac_dock_hidden(hidden: bool) {
|
||||
let _ = hidden;
|
||||
}
|
||||
|
||||
/// The close-to-tray predicate, ported verbatim from the reference's
|
||||
/// `tray_settings::get().close_to_tray && tray::handle().is_some()`
|
||||
/// (`crates/qbz/src/main.rs:23253`, WM arm `:23276`). QML evaluates the same
|
||||
@@ -647,6 +641,38 @@ pub(crate) fn set_window_shown(shown: bool) {
|
||||
WINDOW_SHOWN.store(shown, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub(crate) fn refresh_mac_dock_policy(tray_live: bool) {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let hide_dock = crate::settings_qt::tray()
|
||||
.get()
|
||||
.map(|settings| settings.mac_hide_dock)
|
||||
.unwrap_or(false);
|
||||
set_mac_dock_hidden(mac_dock_should_hide(
|
||||
WINDOW_SHOWN.load(Ordering::Relaxed),
|
||||
crate::mini_bridge::is_open(),
|
||||
tray_live,
|
||||
hide_dock,
|
||||
));
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let _ = tray_live;
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", test))]
|
||||
fn mac_dock_should_hide(main_shown: bool, mini_open: bool, tray_live: bool, opt_in: bool) -> bool {
|
||||
opt_in && tray_live && !main_shown && !mini_open
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mac_dock_remains_a_recovery_path_unless_menu_bar_only_is_selected() {
|
||||
assert!(!mac_dock_should_hide(false, false, true, false));
|
||||
assert!(mac_dock_should_hide(false, false, true, true));
|
||||
assert!(!mac_dock_should_hide(false, false, false, true));
|
||||
assert!(!mac_dock_should_hide(true, false, true, true));
|
||||
assert!(!mac_dock_should_hide(false, true, true, true));
|
||||
}
|
||||
|
||||
/// Quit the whole app from a tray action (any thread) → `Main.qml`'s
|
||||
/// `persistWindowGeometryOnExit(); Qt.exit(0)`.
|
||||
///
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
# QbzCore initialized, and process still alive at the deadline.
|
||||
# Native Qt SDK content participates in the C++ dependency cache.
|
||||
# 6. release xcb boot against a private silent D-Bus (requires Xvfb).
|
||||
# The shared runtime gate also executes Local Library QML logic and Kiosk artwork/navigation with Node.
|
||||
# The shared runtime gate also executes Local Library QML logic, Kiosk artwork/navigation,
|
||||
# window close/quit policy and miniplayer light/dark/background rendering regressions.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/cargo-test.sh # job `test`
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
// Load the real repository SVGs; the executable normally serves generated
|
||||
// tints through this singleton. Tests exercise light/dark polarity.
|
||||
function dirFor(tint, json) {
|
||||
var light = json !== "" && JSON.parse(json).isDark === false
|
||||
var dir = tint
|
||||
if (tint === "textPrimary" || tint === "accentText") dir = light ? "black" : "primary"
|
||||
if (tint === "textSecondary" || tint === "secondary") dir = light ? "black" : "secondary"
|
||||
if (tint === "textMuted" || tint === "disabled" || tint === "textDisabled") dir = "muted"
|
||||
if (tint === "white") dir = "primary"
|
||||
return Qt.resolvedUrl("../../../../../../crates/qbz-qt/qml/assets/icons/" + dir).toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
property string atmosphereUrl: ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
property string docJson: '{"lines":[],"synced":false}'
|
||||
property bool showTranslation: false
|
||||
property bool liteFill: false
|
||||
property bool playing: false
|
||||
property real positionMs: 0
|
||||
function activeIndexAt(ms) { return -1 }
|
||||
function fillFractionAt(index, ms) { return 0 }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
property bool open: true
|
||||
property int surface: 2
|
||||
property bool backgroundBlur: false
|
||||
property string miniQueueJson: '{"currentId":"","rows":[]}'
|
||||
function toggleBackgroundBlur() { backgroundBlur = !backgroundBlur }
|
||||
function exit() { open = false }
|
||||
function closeApp() {}
|
||||
function queuePlay(id) {}
|
||||
}
|
||||
@@ -10,6 +10,24 @@ QtObject {
|
||||
property int muteCalls: 0
|
||||
function setVolume(value) { volumeCalls++ }
|
||||
function toggleMute() { muteCalls++ }
|
||||
property string npArtworkPath: ""
|
||||
property string npTitle: "Track"
|
||||
property string npArtist: "Artist"
|
||||
property string npAlbum: "Album"
|
||||
property real npDurationSecs: 240
|
||||
property real npElapsedSecs: 30
|
||||
property real npProgress: 0.125
|
||||
property real npSeekableMax: 1
|
||||
property int npRepeatMode: 0
|
||||
property bool npShuffle: false
|
||||
property int seekCalls: 0
|
||||
property int playCalls: 0
|
||||
function seek(f) { seekCalls++ }
|
||||
function togglePlay() { playCalls++ }
|
||||
function toggleShuffle() {}
|
||||
function cycleRepeat() {}
|
||||
function next() {}
|
||||
function previous() {}
|
||||
property bool npHasTrack: false
|
||||
property bool npPlaying: false
|
||||
property bool npLoading: false
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
property string queueJson: '{"current":null}'
|
||||
property bool hasPlayTarget: false
|
||||
}
|
||||
@@ -2,6 +2,16 @@ pragma Singleton
|
||||
import QtQuick
|
||||
QtObject {
|
||||
signal trackCacheStatusChanged(string trackId, int status, real progress)
|
||||
property bool isWindows: false
|
||||
property real ambientDim: 0.35
|
||||
property color ambientPrimary: "#c08030"
|
||||
property color ambientSecondary: "#306080"
|
||||
property color ambientAccent: "#803060"
|
||||
property real pulseMs: 0
|
||||
property string wallpaperUrl: ""
|
||||
property string wallpaperAtmosphereUrl: ""
|
||||
property real wallpaperBlur: 0.75
|
||||
function refreshWallpaper() {}
|
||||
property bool reduceMotion: false
|
||||
property bool forceCanvasArt: false
|
||||
property string restoreScope: ""
|
||||
|
||||
@@ -14,3 +14,8 @@ singleton QbzAlbum 1.0 QbzAlbum.qml
|
||||
singleton QbzSearch 1.0 QbzSearch.qml
|
||||
singleton QbzHome 1.0 QbzHome.qml
|
||||
singleton QbzMyQbz 1.0 QbzMyQbz.qml
|
||||
singleton QbzMini 1.0 QbzMini.qml
|
||||
singleton QbzImmersive 1.0 QbzImmersive.qml
|
||||
singleton QbzQueue 1.0 QbzQueue.qml
|
||||
singleton QbzLyrics 1.0 QbzLyrics.qml
|
||||
singleton QbzIconTint 1.0 QbzIconTint.qml
|
||||
@@ -0,0 +1,223 @@
|
||||
import QtQuick
|
||||
import QtTest
|
||||
import com.blitzfc.qbz
|
||||
import "../../crates/qbz-qt/qml/miniplayer" as Mini
|
||||
import "../../crates/qbz-qt/qml/shell" as Shell
|
||||
|
||||
Item {
|
||||
width: 400; height: 600
|
||||
QtObject {
|
||||
id: host
|
||||
property int moves: 0
|
||||
property bool pinnedOnTop: false
|
||||
function startSystemMove() { moves++ }
|
||||
}
|
||||
Mini.MiniShell {
|
||||
id: mini; width: 368
|
||||
hostWindow: host
|
||||
height: QbzMini.surface === 0 ? 45 : (QbzMini.surface === 1 ? 166 : 540)
|
||||
}
|
||||
Mini.MiniWindowControls { id: capsule; y: 560; expanded: true }
|
||||
Shell.AppBackground { id: background; visible: false; width: 100; height: 100 }
|
||||
Component {
|
||||
id: footerBackdropFixture
|
||||
Rectangle {
|
||||
width: 368; height: 80; color: "#ff0000"
|
||||
Mini.MiniFooter { anchors.fill: parent; backgroundActive: true }
|
||||
}
|
||||
}
|
||||
TestCase {
|
||||
name: "MiniplayerTheme"
|
||||
when: windowShown
|
||||
function palette(light) {
|
||||
var tiers = [4,5,6,8,10,12,15,18,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95]
|
||||
var alpha = tiers.map(function(pct) {
|
||||
var alphaByte = Math.round(pct * 255 / 100).toString(16).padStart(2, "0")
|
||||
return "#" + alphaByte + (light ? "000000" : "ffffff")
|
||||
})
|
||||
QbzShell.themeJson = JSON.stringify({isDark: !light, alpha: alpha,
|
||||
textSecondary: light ? "#444444" : "#cccccc",
|
||||
surfaceMain: light ? "#ffffff" : "#101010",
|
||||
surfaceCard: light ? "#f2f2f2" : "#1a1a1a",
|
||||
surfaceElevated: light ? "#eeeeee" : "#2a2a2a",
|
||||
textPrimary: light ? "#111111" : "#ffffff",
|
||||
textMuted: light ? "#555555" : "#aaaaaa"})
|
||||
}
|
||||
function init() {
|
||||
failOnWarning(/.*/)
|
||||
host.moves = 0
|
||||
QbzPlayer.playCalls = 0
|
||||
QbzPlayer.seekCalls = 0
|
||||
QbzMini.open = true
|
||||
QbzMini.backgroundBlur = false
|
||||
QbzMini.surface = 2
|
||||
QbzShell.ambientMode = 0
|
||||
QbzPlayer.npHasTrack = false
|
||||
QbzPlayer.npPlaying = false
|
||||
background.visible = false
|
||||
palette(true)
|
||||
mouseMove(mini, 395, 590)
|
||||
wait(500)
|
||||
}
|
||||
function test_light_dark_live_switch_data() {
|
||||
var data = []
|
||||
for (var surface = 0; surface < 5; surface++)
|
||||
for (var blur = 0; blur < 2; blur++)
|
||||
data.push({tag: surface + "-blur-" + blur, surface: surface, blur: !!blur})
|
||||
return data
|
||||
}
|
||||
function test_light_dark_live_switch(data) {
|
||||
QbzPlayer.npHasTrack = true
|
||||
QbzPlayer.npArtworkPath = Qt.resolvedUrl("fixtures/red.ppm").toString()
|
||||
QbzMini.surface = data.surface
|
||||
QbzMini.backgroundBlur = data.blur
|
||||
var footer = findChild(mini, "miniFooter")
|
||||
for (var light of [true, false, true]) {
|
||||
palette(light)
|
||||
waitForRendering(mini)
|
||||
var cardShot = grabImage(mini)
|
||||
var capsuleShot = grabImage(capsule)
|
||||
var ink = 0
|
||||
for (var x = 6; x < capsule.width - 6; x++)
|
||||
for (var y = 5; y < 21; y++) {
|
||||
var r = capsuleShot.red(x, y)
|
||||
if (light ? r < 150 : r > 150) ink++
|
||||
}
|
||||
verify(ink > 30, "icons must actually render with contrasting foreground")
|
||||
// Background pixels clear of text, icons and rounded edges.
|
||||
function linear(v) {
|
||||
v /= 255
|
||||
return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)
|
||||
}
|
||||
var sampleY = Math.min(200, Math.floor(mini.height / 2))
|
||||
var bg = 0.2126 * linear(cardShot.red(2, sampleY))
|
||||
+ 0.7152 * linear(cardShot.green(2, sampleY))
|
||||
+ 0.0722 * linear(cardShot.blue(2, sampleY))
|
||||
var fg = linear(light ? 17 : 255)
|
||||
var contrast = (Math.max(bg, fg) + 0.05) / (Math.min(bg, fg) + 0.05)
|
||||
verify(contrast >= 4.5, "track/queue/lyrics text contrast: " + contrast)
|
||||
verify(light ? footer.color.r > 0.9 : footer.color.r < 0.2)
|
||||
verify(light ? capsuleShot.red(3, 13) > 200 : capsuleShot.red(3, 13) < 80,
|
||||
"options capsule must follow the text/icon theme")
|
||||
}
|
||||
}
|
||||
function test_collapsed_trigger_data() {
|
||||
return test_light_dark_live_switch_data()
|
||||
}
|
||||
function test_collapsed_trigger(data) {
|
||||
QbzMini.surface = data.surface
|
||||
QbzMini.backgroundBlur = data.blur
|
||||
for (var light of [false, true]) {
|
||||
palette(light)
|
||||
mouseMove(mini, 395, 590)
|
||||
var controls = findChild(mini, "miniWindowControls")
|
||||
verify(controls !== null, "trigger stays mounted outside hover")
|
||||
tryCompare(controls, "expanded", false)
|
||||
waitForRendering(mini)
|
||||
var trigger = findChild(controls, "miniMenuTrigger")
|
||||
var p = trigger.mapToItem(mini, 0, 0)
|
||||
var shot = grabImage(mini)
|
||||
var ink = 0
|
||||
for (var x = 5; x < 17; x++)
|
||||
for (var y = 5; y < 17; y++) {
|
||||
var r = shot.red(Math.round(p.x + x), Math.round(p.y + y))
|
||||
if (light ? r < 150 : r > 150) ink++
|
||||
}
|
||||
verify(ink > 12, "collapsed trigger visible in real card: " + ink)
|
||||
mouseMove(trigger, 11, 11)
|
||||
tryCompare(controls, "expanded", true)
|
||||
mouseMove(mini, 2, 2)
|
||||
tryCompare(controls, "expanded", false)
|
||||
}
|
||||
}
|
||||
function test_free_area_drag_data() {
|
||||
return [{tag: "micro", surface: 0, y: 8},
|
||||
{tag: "compact", surface: 1, y: 45},
|
||||
{tag: "artwork", surface: 2, y: 100}]
|
||||
}
|
||||
function test_free_area_drag(data) {
|
||||
QbzMini.surface = data.surface
|
||||
mousePress(mini, 100, data.y)
|
||||
compare(host.moves, 1)
|
||||
mouseRelease(mini, 100, data.y)
|
||||
}
|
||||
function test_controls_keep_their_gestures() {
|
||||
QbzPlayer.npHasTrack = true
|
||||
mouseClick(mini, mini.width / 2, mini.height - 31)
|
||||
compare(QbzPlayer.playCalls, 1)
|
||||
compare(host.moves, 0)
|
||||
mouseDrag(mini, 100, mini.height - 74, 40, 0)
|
||||
verify(QbzPlayer.seekCalls > 0)
|
||||
compare(host.moves, 0)
|
||||
for (var surface of [3, 4]) {
|
||||
QbzMini.surface = surface
|
||||
mouseDrag(mini, 100, 150, 0, -50)
|
||||
compare(host.moves, 0, "scroll surface must never drag the window")
|
||||
mousePress(mini, 3, mini.height - 3)
|
||||
compare(host.moves, 1, "footer edge remains draggable")
|
||||
mouseRelease(mini, 3, mini.height - 3)
|
||||
host.moves = 0
|
||||
}
|
||||
}
|
||||
function test_ambient_metadata_and_chrome() {
|
||||
QbzPlayer.npHasTrack = true
|
||||
QbzShell.ambientMode = 2
|
||||
for (var light of [false, true]) {
|
||||
palette(light)
|
||||
var doc = JSON.parse(QbzShell.themeJson)
|
||||
doc.surfaceElevated = light ? "#80eeeeee" : "#802a2a2a"
|
||||
QbzShell.themeJson = JSON.stringify(doc)
|
||||
for (var surface of [1, 2]) {
|
||||
QbzMini.surface = surface
|
||||
var metadata = findChild(mini, "miniMetadata")
|
||||
verify(metadata !== null)
|
||||
if (!light) {
|
||||
compare(metadata.headerStrong, Qt.color("#ffffff"))
|
||||
compare(metadata.headerBody, Qt.color("#e0ffffff"))
|
||||
} else {
|
||||
verify(metadata.headerBody.r < 0.5, "dark text on light ambient veil")
|
||||
}
|
||||
}
|
||||
waitForRendering(capsule)
|
||||
var shot = grabImage(capsule)
|
||||
compare(capsule.color.a, 1, "menu must ignore translucent palette alpha")
|
||||
verify(light ? shot.red(3, 13) > 220 : shot.red(3, 13) < 60)
|
||||
}
|
||||
palette(false)
|
||||
var fixture = createTemporaryObject(footerBackdropFixture, mini, {z: 20})
|
||||
verify(fixture !== null)
|
||||
waitForRendering(fixture)
|
||||
var footerShot = grabImage(fixture)
|
||||
verify(footerShot.red(3, 25) > 190, "ambient must show through the control area")
|
||||
verify(footerShot.green(3, 25) < 40)
|
||||
}
|
||||
function test_inherits_background_and_unloads_when_closed() {
|
||||
QbzPlayer.npHasTrack = true
|
||||
for (var mode = 1; mode <= 4; mode++) {
|
||||
QbzShell.ambientMode = mode
|
||||
verify(mini.useAppBackground)
|
||||
verify(mini.backdropMounted)
|
||||
QbzMini.backgroundBlur = true
|
||||
verify(!mini.useAppBackground, "mini blur explicitly overrides the app mode")
|
||||
QbzMini.backgroundBlur = false
|
||||
QbzMini.open = false
|
||||
verify(!mini.backdropMounted)
|
||||
QbzMini.open = true
|
||||
}
|
||||
QbzShell.ambientMode = 1
|
||||
QbzPlayer.npHasTrack = false
|
||||
verify(!mini.backdropOn, "no artwork means the opaque theme returns")
|
||||
}
|
||||
function test_hidden_background_stops_animation() {
|
||||
QbzShell.ambientMode = 2
|
||||
QbzPlayer.npHasTrack = true
|
||||
QbzPlayer.npPlaying = true
|
||||
background.visible = true
|
||||
verify(background.blurredModeOn)
|
||||
background.visible = false
|
||||
verify(!background.blurredModeOn)
|
||||
QbzShell.pulseMs += 33
|
||||
verify(!background.painting)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ bash scripts/test-playback-cache-qml.sh
|
||||
bash scripts/test-text-edit-menu-qml.sh
|
||||
bash scripts/test-compact-seek-qml.sh
|
||||
bash scripts/test-remote-volume-qml.sh
|
||||
bash scripts/test-miniplayer-qml.sh
|
||||
node scripts/test_qt_window_lifecycle.mjs
|
||||
bash scripts/test-library-folders-qml.sh
|
||||
bash scripts/test-array-model-qml.sh
|
||||
bash scripts/test-keyed-model-qml.sh
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# The same bounded view/activation regression runs in CI and locally.
|
||||
set -euo pipefail
|
||||
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
if [[ -n "${QT_ROOT_DIR:-}" ]]; then
|
||||
qt_miniplayer_bins="$QT_ROOT_DIR/bin"
|
||||
else
|
||||
qt_miniplayer_qmake="${QMAKE:-}"
|
||||
if [[ -z "$qt_miniplayer_qmake" ]]; then
|
||||
qt_miniplayer_qmake="$(command -v qmake6 || command -v qmake)"
|
||||
fi
|
||||
qt_miniplayer_bins="$("$qt_miniplayer_qmake" -query QT_INSTALL_BINS)"
|
||||
fi
|
||||
QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
|
||||
"$qt_miniplayer_bins/qmltestrunner" \
|
||||
-input scripts/qml-tests/tst_miniplayer.qml \
|
||||
-import scripts/qml-tests/imports
|
||||
@@ -17,6 +17,7 @@ function fixture(tray, mac, closeToTray = true, confirm = true) {
|
||||
const ctx = vm.createContext({
|
||||
QbzTray: {trayLive: tray, closeToTray, closeDecision() {},
|
||||
confirmQuitEnabled: () => confirm, armQuitWatchdog: () => calls.push('watchdog')},
|
||||
QbzAbout: {updatesJson: '{"phase":"idle"}', updatesCheck() {}},
|
||||
QbzShell: {isMacos: mac}, Window: {Minimized: 3},
|
||||
Qt: {exit: (code) => calls.push(`exit:${code}`)},
|
||||
quitConfirmation: {opened: false, checkboxChecked: true, open() {this.opened = true;}},
|
||||
@@ -37,6 +38,11 @@ for (const mac of [false, true]) {
|
||||
assert.equal(event.accepted, false);
|
||||
({ctx, calls} = fixture(false, mac));
|
||||
ctx.closeOrHide({accepted: true});
|
||||
if (mac) {
|
||||
assert.deepEqual(calls, ['hide'], 'Dock recovers macOS even without a menu-bar item');
|
||||
calls.length = 0;
|
||||
ctx.requestQuit();
|
||||
}
|
||||
assert.equal(ctx.quitConfirmation.opened, true);
|
||||
assert.deepEqual(calls, [], 'dialog must not arm the watchdog');
|
||||
ctx.quitConfirmation.opened = false; // user cancels
|
||||
@@ -57,3 +63,17 @@ const {ctx, calls} = fixture(true, true, false);
|
||||
ctx.closeOrHide(null);
|
||||
assert.deepEqual(calls, ['hide'], 'macOS tray lifecycle supersedes legacy close preference');
|
||||
console.log('Window lifecycle: tray/no-tray, macOS policy, confirmation cancellation and one-shot exit passed');
|
||||
|
||||
// Re-show restores Dock policy before requesting native focus.
|
||||
const showCalls = [];
|
||||
const showCtx = vm.createContext({
|
||||
QbzTray: {setWindowShown: () => showCalls.push('dock')},
|
||||
Window: {Minimized: 3, Windowed: 2, Maximized: 4},
|
||||
trayRestoreValid: false, visibility: 3, maximizedLatch: false,
|
||||
show: () => showCalls.push('show'), raise: () => showCalls.push('raise'),
|
||||
requestActivate: () => showCalls.push('activate'),
|
||||
});
|
||||
showCtx.window = showCtx;
|
||||
vm.runInContext(`(function () {${body('showFromTray')}})()`, showCtx);
|
||||
assert.deepEqual(showCalls, ['dock', 'show', 'raise', 'activate']);
|
||||
assert.equal(showCtx.visibility, 2);
|
||||
Reference in new issue
Block a user