Add ImmersiveSuggestionsPanel for the split-right slot (split-panel 2): a cards row (up to 2 artist-playlist book-collage cards + a Song-Radio diamond-collage card) and a recommended-tracks list. New suggestions.rs controller assembles everything in Rust (ADR-006): artist tracks_appears_on with an artist-tracks fallback under 5, dedupe by title, drop the current track, shuffle, take 10; cards from the first two playlists plus a track radio. New core method QbzCore::create_smart_track_radio mirrors the smart artist radio (spawn_blocking + block_on, seed hoisted to index 0). Does NOT use reco_store (live Qobuz queries only). Collage tilt deferred (flat for now); blacklist drop happens downstream in play_tracks. cc
994 lines
36 KiB
Plaintext
994 lines
36 KiB
Plaintext
// ImmersiveView base: reusable Kawarp-like atmosphere background +
|
|
// Tauri-shaped compact player with auto-hide. Foreground panels will be
|
|
// rebuilt on top of this base after the background/player are approved.
|
|
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
|
import { NowPlayingState, VisualizerState, ImmersiveState, SettingsState, LyricsState, QueueState, TrackInfoActions, SuggestionsActions } from "../state.slint";
|
|
import { ImmersiveAtmosphere } from "ImmersiveAtmosphere.slint";
|
|
import { AlbumReactivePanel } from "AlbumReactivePanel.slint";
|
|
import { StaticPanel } from "StaticPanel.slint";
|
|
import { CoverflowPanel } from "CoverflowPanel.slint";
|
|
import { SpectrumPanel } from "SpectrumPanel.slint";
|
|
import { ImmersiveLyricsFocusPanel } from "ImmersiveLyricsFocusPanel.slint";
|
|
import { ImmersiveQueuePanel } from "ImmersiveQueuePanel.slint";
|
|
import { ImmersiveTrackInfo } from "ImmersiveTrackInfo.slint";
|
|
import { ImmersiveTrackInfoPanel } from "ImmersiveTrackInfoPanel.slint";
|
|
import { ImmersiveSuggestionsPanel } from "ImmersiveSuggestionsPanel.slint";
|
|
import { LyricsLinesView } from "../shell/LyricsLinesView.slint";
|
|
|
|
component GhostButton inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <bool> active: false;
|
|
in property <bool> enabled: true;
|
|
in property <length> icon-size: 12px;
|
|
callback clicked();
|
|
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 14px;
|
|
opacity: root.enabled ? 1.0 : 0.4;
|
|
background: root.active ? #ffffff40 : transparent;
|
|
|
|
QbzIcon {
|
|
source: root.icon;
|
|
width: root.icon-size;
|
|
height: root.icon-size;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: root.active || ta.has-hover ? #ffffff : #ffffffa6;
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: root.enabled ? pointer : default;
|
|
clicked => {
|
|
if (root.enabled) {
|
|
root.clicked();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
component NavButton inherits Rectangle {
|
|
in property <image> icon;
|
|
callback clicked();
|
|
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 14px;
|
|
background: ta.has-hover ? #ffffff40 : #ffffff26;
|
|
|
|
QbzIcon {
|
|
source: root.icon;
|
|
width: 14px;
|
|
height: 14px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: #ffffff;
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
|
|
component PlayDisc inherits Rectangle {
|
|
callback clicked();
|
|
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 24px;
|
|
background: ta.has-hover ? #ffffffe6 : #ffffff;
|
|
drop-shadow-blur: 12px;
|
|
drop-shadow-color: #0000004d;
|
|
drop-shadow-offset-y: 4px;
|
|
|
|
QbzIcon {
|
|
source: NowPlayingState.playing
|
|
? @image-url("../assets/icons/pause.svg")
|
|
: @image-url("../assets/icons/play-fill.svg");
|
|
width: 20px;
|
|
height: 20px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px
|
|
+ (NowPlayingState.playing ? 0px : 1px);
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: #000000;
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
|
|
component TinyBar inherits Rectangle {
|
|
in property <float> value: 0.0;
|
|
in property <color> fill: #ffffff;
|
|
callback changed(float);
|
|
|
|
height: 10px;
|
|
background: transparent;
|
|
|
|
Rectangle {
|
|
x: 0px;
|
|
width: root.width;
|
|
y: 4px;
|
|
height: 2px;
|
|
border-radius: 1px;
|
|
background: #ffffff2e;
|
|
}
|
|
Rectangle {
|
|
x: 0px;
|
|
y: 4px;
|
|
height: 2px;
|
|
width: parent.width * Math.max(0.0, Math.min(1.0, root.value));
|
|
border-radius: 1px;
|
|
background: root.fill;
|
|
}
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.changed(Math.max(0.0, Math.min(1.0, self.mouse-x / self.width)));
|
|
}
|
|
moved => {
|
|
if (self.pressed) {
|
|
root.changed(Math.max(0.0, Math.min(1.0, self.mouse-x / self.width)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Volume slider mirroring Tauri's VolumeSlider.svelte: 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). NOTE: `opacity:` is intentionally
|
|
// NOT applied to the root (it would corrupt absolute positioning); inner content
|
|
// is dimmed instead.
|
|
component VolumeBar inherits Rectangle {
|
|
in property <float> value: 0.0; // 0..1
|
|
in property <bool> locked: false;
|
|
callback changed(float); // emits 0..1
|
|
|
|
// The visual fill fraction: pinned to 100% when locked (matches Tauri).
|
|
property <float> shown: root.locked ? 1.0 : Math.max(0.0, Math.min(1.0, root.value));
|
|
|
|
height: 12px;
|
|
background: transparent;
|
|
|
|
// Drag-time / hover percent readout. Hidden when locked.
|
|
Rectangle {
|
|
x: root.width - self.width;
|
|
y: -26px;
|
|
width: 34px;
|
|
height: 20px;
|
|
border-radius: 6px;
|
|
background: #000000b3;
|
|
visible: !root.locked && (ta.has-hover || ta.pressed);
|
|
Text {
|
|
text: Math.round(root.shown * 100) + "";
|
|
color: #ffffff;
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
x: 0; y: 0;
|
|
width: parent.width;
|
|
height: parent.height;
|
|
}
|
|
}
|
|
|
|
// Track background.
|
|
Rectangle {
|
|
x: 0px;
|
|
y: 5px;
|
|
width: root.width;
|
|
height: 2px;
|
|
border-radius: 1px;
|
|
background: root.locked ? #ffffff1f : #ffffff33;
|
|
}
|
|
// Fill.
|
|
Rectangle {
|
|
x: 0px;
|
|
y: 5px;
|
|
height: 2px;
|
|
width: root.width * root.shown;
|
|
border-radius: 1px;
|
|
background: root.locked ? #ffffff66 : #ffffffb3;
|
|
}
|
|
// Hover-revealed thumb. Position is computed from `root.width`, not from
|
|
// layout-managed geometry, so no recursion/binding-loop risk.
|
|
Rectangle {
|
|
x: root.width * root.shown - self.width / 2;
|
|
y: 0px;
|
|
width: 12px;
|
|
height: 12px;
|
|
border-radius: 6px;
|
|
background: #ffffff;
|
|
opacity: (!root.locked && (ta.has-hover || ta.pressed)) ? 1.0 : 0.0;
|
|
animate opacity { duration: 150ms; }
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: root.locked ? default : pointer;
|
|
clicked => {
|
|
if (!root.locked) {
|
|
root.changed(Math.max(0.0, Math.min(1.0, self.mouse-x / self.width)));
|
|
}
|
|
}
|
|
moved => {
|
|
if (!root.locked && self.pressed) {
|
|
root.changed(Math.max(0.0, Math.min(1.0, self.mouse-x / self.width)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
component ImmersivePlayerBar inherits Rectangle {
|
|
in property <length> viewport-width: 720px;
|
|
callback media-action(string, string, string);
|
|
callback wake();
|
|
|
|
// Volume lock, identical to PlayerBar.slint:154-155 / Tauri's
|
|
// handleVolumeChange formula:
|
|
// (isAlsaDirectHw && !peerActive) || (peerActive && !remoteVolumeAllowed)
|
|
// The local ALSA-Direct (bit-perfect) lock is LIFTED while controlling a
|
|
// peer (the `!is-remote` term) so the user can still drive the renderer's
|
|
// volume; the peer half is the sink-pushed NowPlayingState.volume-locked.
|
|
property <bool> vol-locked: (SettingsState.backend-is-alsa && SettingsState.alsa-plugin-is-hw && !NowPlayingState.is-remote)
|
|
|| NowPlayingState.volume-locked;
|
|
|
|
width: Math.min(root.viewport-width - 32px, 720px);
|
|
height: 90px;
|
|
border-radius: 16px;
|
|
background: #00000080;
|
|
border-width: 1px;
|
|
border-color: #ffffff2e;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000066;
|
|
drop-shadow-offset-y: 8px;
|
|
|
|
// Left utility group.
|
|
GhostButton {
|
|
x: 24px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/heart.svg");
|
|
active: false;
|
|
enabled: NowPlayingState.has-track && !NowPlayingState.is-ephemeral;
|
|
clicked => { root.media-action("track", NowPlayingState.track-id, "favorite"); }
|
|
}
|
|
GhostButton {
|
|
x: 56px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/shuffle.svg");
|
|
active: NowPlayingState.shuffle;
|
|
clicked => { NowPlayingState.toggle-shuffle(); }
|
|
}
|
|
GhostButton {
|
|
x: 88px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/repeat.svg");
|
|
active: NowPlayingState.repeat-mode != 0;
|
|
clicked => { NowPlayingState.cycle-repeat(); }
|
|
}
|
|
GhostButton {
|
|
x: 120px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/infinity.svg");
|
|
active: false;
|
|
enabled: false;
|
|
}
|
|
|
|
// Playback group: positioned from the play disc so play is exactly centered.
|
|
Text {
|
|
x: root.width / 2 - 108px;
|
|
y: 31px;
|
|
width: 42px;
|
|
text: NowPlayingState.elapsed;
|
|
color: #ffffffbf;
|
|
font-size: 11px;
|
|
horizontal-alignment: right;
|
|
}
|
|
NavButton {
|
|
x: root.width / 2 - 64px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/skip-back.svg");
|
|
clicked => { NowPlayingState.previous(); }
|
|
}
|
|
PlayDisc {
|
|
x: root.width / 2 - 24px;
|
|
y: 12px;
|
|
clicked => { NowPlayingState.toggle-play(); }
|
|
}
|
|
NavButton {
|
|
x: root.width / 2 + 36px;
|
|
y: 22px;
|
|
icon: @image-url("../assets/icons/skip-forward.svg");
|
|
clicked => { NowPlayingState.next(); }
|
|
}
|
|
Text {
|
|
x: root.width / 2 + 76px;
|
|
y: 31px;
|
|
width: 46px;
|
|
text: NowPlayingState.remaining;
|
|
color: #ffffffbf;
|
|
font-size: 11px;
|
|
}
|
|
|
|
// Right volume/menu group.
|
|
GhostButton {
|
|
x: root.width - 156px;
|
|
y: 22px;
|
|
// Under lock the fill pins to 100%, so the icon must NOT show the
|
|
// muted/zero glyph (matches Tauri VolumeSlider: Volume2 when locked).
|
|
icon: (!root.vol-locked && (NowPlayingState.muted || NowPlayingState.volume == 0))
|
|
? @image-url("../assets/icons/volume-x.svg")
|
|
: @image-url("../assets/icons/volume-2.svg");
|
|
enabled: !root.vol-locked;
|
|
clicked => {
|
|
if (!root.vol-locked) {
|
|
NowPlayingState.toggle-mute();
|
|
}
|
|
}
|
|
}
|
|
VolumeBar {
|
|
x: root.width - 112px;
|
|
y: 31px;
|
|
width: 64px;
|
|
value: NowPlayingState.volume;
|
|
locked: root.vol-locked;
|
|
changed(v) => {
|
|
if (!root.vol-locked) {
|
|
NowPlayingState.set-volume(v);
|
|
}
|
|
}
|
|
}
|
|
Rectangle {
|
|
x: root.width - 42px;
|
|
y: 22px;
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 14px;
|
|
background: menu-ta.has-hover ? #ffffff26 : transparent;
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/ellipsis.svg");
|
|
width: 12px;
|
|
height: 12px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: #ffffffa6;
|
|
}
|
|
menu-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.wake();
|
|
player-menu.show();
|
|
}
|
|
}
|
|
player-menu := PopupWindow {
|
|
x: -172px;
|
|
y: -58px;
|
|
width: 200px;
|
|
height: 46px;
|
|
close-policy: close-on-click;
|
|
Rectangle {
|
|
background: #000000cc;
|
|
border-radius: 12px;
|
|
border-width: 1px;
|
|
border-color: #ffffff2e;
|
|
Rectangle {
|
|
x: 6px;
|
|
y: 6px;
|
|
width: parent.width - 12px;
|
|
height: 34px;
|
|
border-radius: Radius.sm;
|
|
background: exit-ta.has-hover ? #ffffff1f : transparent;
|
|
exit-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
ImmersiveState.open = false;
|
|
VisualizerState.set-enabled(false);
|
|
}
|
|
}
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/x.svg");
|
|
width: 14px;
|
|
height: 14px;
|
|
x: 10px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: #ffffffcc;
|
|
}
|
|
Text {
|
|
x: 34px;
|
|
y: 0px;
|
|
height: parent.height;
|
|
width: parent.width - 44px;
|
|
text: @tr("Exit Immersive");
|
|
color: #ffffffcc;
|
|
font-size: 13px;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
TinyBar {
|
|
x: 16px;
|
|
y: 71px;
|
|
height: 10px;
|
|
width: root.width - 32px;
|
|
value: NowPlayingState.progress;
|
|
changed(v) => { NowPlayingState.seek(Math.min(v, NowPlayingState.seekable-max)); }
|
|
}
|
|
}
|
|
|
|
// Polished segmented mode selector (top-center). Rebuilt in the compact
|
|
// player's visual language (ImmersivePlayerBar:238-243): flat dark pill
|
|
// (#00000080), 1px white-on-glass border (#ffffff2e), drop-shadow. Four
|
|
// icon+label tabs map tab position -> ImmersiveState.mode (0 Album Reactive,
|
|
// 1 Static, 2 Coverflow, 3 Spectrum), with an inert leading panel-icon + a
|
|
// vertical divider as a section marker (mirrors Tauri's .mode-toggle +
|
|
// .tab-divider). Each tab has its own TouchArea (pointer cursor); no `changed
|
|
// x/y/width/height` watchers (Recursion-detected risk). Container height fixed;
|
|
// width sized to content. Clicking sets the mode and wakes the chrome so the
|
|
// bar resets its hide timer with the player.
|
|
component ModeTab inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <string> label;
|
|
// Whether this tab reads as selected. Callers compute it from the relevant
|
|
// state (focus: ImmersiveState.mode; split: ImmersiveState.split-panel) so
|
|
// one component serves both rails.
|
|
in property <bool> active: false;
|
|
callback clicked();
|
|
|
|
property <color> fg: root.active ? #ffffff : (ta.has-hover ? #fffffff2 : #ffffffb3);
|
|
|
|
height: 28px;
|
|
border-radius: 8px;
|
|
background: root.active ? #ffffff33 : (ta.has-hover ? #ffffff1f : transparent);
|
|
animate background { duration: 150ms; }
|
|
|
|
HorizontalLayout {
|
|
padding-left: 16px;
|
|
padding-right: 16px;
|
|
spacing: 8px;
|
|
alignment: center;
|
|
|
|
VerticalLayout {
|
|
alignment: center;
|
|
QbzIcon {
|
|
source: root.icon;
|
|
width: 16px;
|
|
height: 16px;
|
|
tint: root.fg;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.label;
|
|
color: root.fg;
|
|
font-size: 13px;
|
|
font-weight: root.active ? 600 : 500;
|
|
vertical-alignment: center;
|
|
animate color { duration: 150ms; }
|
|
}
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
|
|
component ModeBar inherits Rectangle {
|
|
// Focus-mode visualizer / lyrics tab picker -> ImmersiveState.mode.
|
|
callback select(int);
|
|
// Split-mode panel picker -> ImmersiveState.split-panel.
|
|
callback select-split(int);
|
|
// Flip focus<->split (ImmersiveState.view-mode 0<->1).
|
|
callback toggle-view();
|
|
// Fired whenever the user enters a lyrics surface (focus Lyrics tab or
|
|
// split Lyrics panel) so the parent can kick LyricsState.panel-opened().
|
|
callback lyrics-entered();
|
|
// Fired whenever the user enters a queue surface (focus Queue tab or split
|
|
// Queue panel) so the parent can kick QueueState.panel-opened().
|
|
callback queue-entered();
|
|
// Fired when the user enters the split Track Info panel so the parent can
|
|
// kick the inline load for the current track (TrackInfoActions.load-inline).
|
|
callback trackinfo-entered();
|
|
// Fired when the user enters the split Suggestions panel so the parent can
|
|
// kick the live artist load for the current track.
|
|
callback suggestions-entered();
|
|
|
|
property <bool> is-split: ImmersiveState.view-mode == 1;
|
|
|
|
height: 36px;
|
|
width: bar.preferred-width + 8px;
|
|
border-radius: 12px;
|
|
background: #00000080;
|
|
border-width: 1px;
|
|
border-color: #ffffff2e;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000066;
|
|
drop-shadow-offset-y: 8px;
|
|
|
|
bar := HorizontalLayout {
|
|
x: 4px;
|
|
y: 4px;
|
|
height: 28px;
|
|
spacing: 4px;
|
|
alignment: center;
|
|
|
|
// Leading focus/split TOGGLE (was an inert panel-icon). Active = split.
|
|
// Reuses the ModeTab active/hover styling idiom (flat highlight, no
|
|
// pill — ADR-008): a 28px square that lights up when split is active.
|
|
toggle := Rectangle {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 8px;
|
|
background: root.is-split
|
|
? #ffffff33
|
|
: (toggle-ta.has-hover ? #ffffff1f : transparent);
|
|
animate background { duration: 150ms; }
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/panel-left.svg");
|
|
width: 16px;
|
|
height: 16px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: root.is-split
|
|
? #ffffff
|
|
: (toggle-ta.has-hover ? #fffffff2 : #ffffffd9);
|
|
}
|
|
toggle-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.toggle-view(); }
|
|
}
|
|
}
|
|
// Vertical divider between the toggle and the tabs.
|
|
Rectangle {
|
|
width: 9px;
|
|
height: 28px;
|
|
Rectangle {
|
|
width: 1px;
|
|
height: 20px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
background: #ffffff33;
|
|
}
|
|
}
|
|
|
|
// FOCUS rail: the 4 visualizer modes + Lyrics. Shown when not split.
|
|
if !root.is-split: HorizontalLayout {
|
|
spacing: 4px;
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/audio-lines.svg");
|
|
label: @tr("Album Reactive");
|
|
active: ImmersiveState.mode == 0;
|
|
clicked => { root.select(0); }
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/image.svg");
|
|
label: @tr("Static");
|
|
active: ImmersiveState.mode == 1;
|
|
clicked => { root.select(1); }
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/disc-3.svg");
|
|
label: @tr("Coverflow");
|
|
active: ImmersiveState.mode == 2;
|
|
clicked => { root.select(2); }
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/chart-no-axes-column.svg");
|
|
label: @tr("Spectrum");
|
|
active: ImmersiveState.mode == 3;
|
|
clicked => { root.select(3); }
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/mic-vocal.svg");
|
|
label: @tr("Lyrics");
|
|
active: ImmersiveState.mode == 4;
|
|
clicked => {
|
|
root.select(4);
|
|
root.lyrics-entered();
|
|
}
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/list-music.svg");
|
|
label: @tr("Queue");
|
|
active: ImmersiveState.mode == 5;
|
|
clicked => {
|
|
root.select(5);
|
|
root.queue-entered();
|
|
}
|
|
}
|
|
}
|
|
|
|
// SPLIT rail: Lyrics (Checkpoint A) + Track Info (Checkpoint C) +
|
|
// Queue (Checkpoint B). Suggestions tab lands in its own checkpoint.
|
|
if root.is-split: HorizontalLayout {
|
|
spacing: 4px;
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/mic-vocal.svg");
|
|
label: @tr("Lyrics");
|
|
active: ImmersiveState.split-panel == 0;
|
|
clicked => {
|
|
root.select-split(0);
|
|
root.lyrics-entered();
|
|
}
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/info.svg");
|
|
label: @tr("Track Info");
|
|
active: ImmersiveState.split-panel == 1;
|
|
clicked => {
|
|
root.select-split(1);
|
|
root.trackinfo-entered();
|
|
}
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/radio.svg");
|
|
label: @tr("Suggestions");
|
|
active: ImmersiveState.split-panel == 2;
|
|
clicked => {
|
|
root.select-split(2);
|
|
root.suggestions-entered();
|
|
}
|
|
}
|
|
ModeTab {
|
|
icon: @image-url("../assets/icons/list-music.svg");
|
|
label: @tr("Queue");
|
|
active: ImmersiveState.split-panel == 3;
|
|
clicked => {
|
|
root.select-split(3);
|
|
root.queue-entered();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export component ImmersiveView inherits Rectangle {
|
|
callback media-action(string, string, string);
|
|
|
|
property <bool> chrome-visible: true;
|
|
|
|
background: #0a0a0b;
|
|
clip: true;
|
|
|
|
function wake() {
|
|
root.chrome-visible = true;
|
|
hide-timer.running = false;
|
|
hide-timer.running = true;
|
|
}
|
|
|
|
keys := FocusScope {
|
|
key-pressed(event) => {
|
|
if (event.text == Key.Escape) {
|
|
ImmersiveState.open = false;
|
|
VisualizerState.set-enabled(false);
|
|
return accept;
|
|
}
|
|
// WGPU UNDERLAY SPIKE: 'g' (GPU) toggles the shader scene on/off in
|
|
// place so the owner can A/B the shader vs the existing atmosphere /
|
|
// panels in a single run. Remove (or repurpose to a real picker)
|
|
// once the spike is validated.
|
|
if (event.text == "g" || event.text == "G") {
|
|
ImmersiveState.shader-mode = ImmersiveState.shader-mode > 0 ? 0 : 1;
|
|
root.wake();
|
|
return accept;
|
|
}
|
|
return reject;
|
|
}
|
|
focus-timer := Timer {
|
|
interval: 30ms;
|
|
running: true;
|
|
triggered => {
|
|
self.running = false;
|
|
keys.focus();
|
|
root.wake();
|
|
}
|
|
}
|
|
}
|
|
|
|
hide-timer := Timer {
|
|
interval: 4000ms;
|
|
triggered => {
|
|
root.chrome-visible = false;
|
|
}
|
|
}
|
|
|
|
// Pointer movement wakes the chrome. `TouchArea.moved` only fires while
|
|
// pressed in Slint, so watch mouse-x/mouse-y changes instead.
|
|
hover := TouchArea {
|
|
changed mouse-x => { root.wake(); }
|
|
changed mouse-y => { root.wake(); }
|
|
}
|
|
|
|
// (0) WGPU UNDERLAY SPIKE: the GPU fragment-shader texture, the bottom-most
|
|
// layer when a shader scene is active. ADR-010 conditional mount. When
|
|
// shader-mode > 0 it REPLACES the atmosphere (layer 1) and the mode panels
|
|
// (layer 2) so the shader is the visible background; the chrome below stays
|
|
// on top. Driven at ~30 fps from src/visualizer.rs -> shader_underlay.
|
|
if ImmersiveState.shader-mode > 0: Image {
|
|
x: 0px;
|
|
y: 0px;
|
|
width: 100%;
|
|
height: 100%;
|
|
image-fit: fill;
|
|
source: ImmersiveState.shader-texture;
|
|
}
|
|
|
|
// (1) Bottom: moving blurred-art atmosphere. Hidden while a shader scene is
|
|
// active (the shader owns the background layer instead).
|
|
if ImmersiveState.shader-mode == 0: ImmersiveAtmosphere {
|
|
source-image: ImmersiveState.bg-image;
|
|
fallback-image: NowPlayingState.artwork-large.width > 0
|
|
? NowPlayingState.artwork-large
|
|
: NowPlayingState.artwork;
|
|
dim: 0.15;
|
|
}
|
|
|
|
// (2) FOCUS foreground (view-mode == 0): switches on ImmersiveState.mode via
|
|
// conditional mount (ADR-010). Mode 0 = Album Reactive, 1 = Static,
|
|
// 2 = Coverflow, 3 = Spectrum, 4 = Lyrics-focus. Each gates additionally on
|
|
// `view-mode == 0` so the SPLIT branch (below) owns the screen instead.
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 0: AlbumReactivePanel {
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
}
|
|
// (2b) Static mode foreground (mode == 1) — calm centered now-playing
|
|
// card over the atmosphere. Same conditional-mount pattern (ADR-010).
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 1: StaticPanel {
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
}
|
|
// (2c) Coverflow mode foreground (mode == 2) — a CHEAP jukebox PYRAMID of
|
|
// flat scaled cards (now-playing centered + on top, 3 past left + 3 upcoming
|
|
// right; step-down scale + per-depth black-overlay attenuation; cards snap on
|
|
// click, no 3D / reflection / gradient / 500ms reflow). True-3D rotateY/
|
|
// perspective remains deferred to a wgpu/Skia session. Same conditional-mount
|
|
// + viewport-prop contract as the siblings (ADR-010).
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 2: CoverflowPanel {
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
}
|
|
// (2d) Spectrum mode foreground (mode == 3) — faithful 16-bar mirrored cube
|
|
// spectrum (14 active bins x 2 mirror = 28 columns) over a solid-black
|
|
// canvas, with the same centered now-playing card as the siblings. Reads
|
|
// VisualizerState.bars (pre-smoothed + clamped in Rust). set-enabled is
|
|
// ALREADY driven on open (the mode-0 AlbumReactivePanel reads
|
|
// VisualizerState.energy from the same enabled tap). Same conditional-mount +
|
|
// viewport-prop contract as the siblings (ADR-010).
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 3: SpectrumPanel {
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
}
|
|
// (2e) Lyrics-focus foreground (mode == 4) — one giant centered current
|
|
// line, cross-faded on change. Same conditional-mount + viewport-prop
|
|
// contract as the siblings (ADR-010). `init` kicks the lyrics fetch (mirror
|
|
// of LyricsSidebar's init -> panel-opened()) so entering this tab loads the
|
|
// doc once; cache-served / no-op when already fetched.
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 4: ImmersiveLyricsFocusPanel {
|
|
init => { LyricsState.panel-opened(); }
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
}
|
|
// (2f) Queue-focus foreground (mode == 5) — the SAME ImmersiveQueuePanel as
|
|
// the split placement, full-screen (centered: false). Queue + History
|
|
// sub-tabs. `init` pulls a fresh queue snapshot (mirror of the sidebar's
|
|
// init -> panel-opened()). Same conditional-mount + viewport-prop contract
|
|
// as the siblings (ADR-010).
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 0 && ImmersiveState.mode == 5: ImmersiveQueuePanel {
|
|
init => { QueueState.panel-opened(); }
|
|
x: 0px;
|
|
y: 0px;
|
|
viewport-width: root.width;
|
|
viewport-height: root.height;
|
|
centered: false;
|
|
}
|
|
|
|
// (2-split) SPLIT layout (view-mode == 1): artwork + metadata LEFT, the
|
|
// active data panel RIGHT (ADR-010 conditional mount). The atmosphere stays
|
|
// behind it (layer 1). Checkpoint A ships only the Lyrics split panel.
|
|
if ImmersiveState.shader-mode == 0 && ImmersiveState.view-mode == 1: HorizontalLayout {
|
|
x: 0px;
|
|
y: 0px;
|
|
width: root.width;
|
|
height: root.height;
|
|
// Top offset for the header, bottom for the floating player — mirrors
|
|
// the focus panels' clearance so nothing tucks under the chrome.
|
|
padding-top: 56px;
|
|
padding-bottom: 132px;
|
|
padding-left: 48px;
|
|
padding-right: 48px;
|
|
spacing: 40px;
|
|
|
|
// LEFT: artwork + shared metadata block, centered in its half.
|
|
VerticalLayout {
|
|
horizontal-stretch: 1;
|
|
alignment: center;
|
|
spacing: 24px;
|
|
|
|
// Artwork. Sized to fit its half without crowding the metadata:
|
|
// min(half-width, height-budget), capped, floored.
|
|
left-art := Rectangle {
|
|
property <length> art-size:
|
|
Math.max(200px,
|
|
Math.min(Math.min(root.width / 2 - 88px, root.height - 380px), 520px));
|
|
height: self.art-size;
|
|
horizontal-stretch: 1;
|
|
art-inner := Rectangle {
|
|
width: parent.art-size;
|
|
height: parent.art-size;
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 8px;
|
|
clip: true;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000080;
|
|
drop-shadow-offset-y: 8px;
|
|
Image {
|
|
source: NowPlayingState.artwork-large.width > 0
|
|
? NowPlayingState.artwork-large
|
|
: NowPlayingState.artwork;
|
|
image-fit: cover;
|
|
width: parent.width;
|
|
height: parent.height;
|
|
}
|
|
}
|
|
}
|
|
// Shared metadata block (reused from the focus panels).
|
|
ImmersiveTrackInfo {
|
|
equalizer-tint: #7c3aed;
|
|
}
|
|
}
|
|
|
|
// RIGHT: the active split panel. Checkpoint A = Lyrics only.
|
|
Rectangle {
|
|
horizontal-stretch: 1;
|
|
clip: true;
|
|
if ImmersiveState.split-panel == 0: LyricsLinesView {
|
|
init => { LyricsState.panel-opened(); }
|
|
width: 100%;
|
|
height: 100%;
|
|
// Immersive sizing — larger than the 280px sidebar. Computed
|
|
// from window width (no clamp()/vw in Slint).
|
|
side-padding: 8px;
|
|
line-gap: Math.clamp(16px, root.width * 0.014, 26px);
|
|
size-inactive: Math.clamp(24px, root.width * 0.018, 34px);
|
|
size-active: Math.clamp(28px, root.width * 0.022, 42px);
|
|
dimming-mode: LyricsState.dimming-mode;
|
|
auto-follow: true;
|
|
uppercase: LyricsState.uppercase;
|
|
show-attribution: false;
|
|
font-name: LyricsState.font-index == 1 ? "LINE Seed JP"
|
|
: LyricsState.font-index == 2 ? "Montserrat"
|
|
: LyricsState.font-index == 3 ? "Noto Sans"
|
|
: LyricsState.font-index == 4 ? "Source Sans 3"
|
|
: "";
|
|
// Solid white active line in immersive (data-panels.md §2).
|
|
active-color: #ffffff;
|
|
}
|
|
// Checkpoint C: the inline Track Info credits panel, centered in
|
|
// the right half (split-only, data-panels §7). `init` populates
|
|
// TrackInfoState for the current track WITHOUT opening the modal
|
|
// (TrackInfoActions.load-inline -> open stays false). A
|
|
// `changed NowPlayingState.track-id` guard re-fires the load so the
|
|
// panel refreshes when the track changes while it's open (track-id
|
|
// is a string — safe to watch, no layout geometry involved).
|
|
if ImmersiveState.split-panel == 1: ImmersiveTrackInfoPanel {
|
|
property <string> live-track-id: NowPlayingState.track-id;
|
|
init => { TrackInfoActions.load-inline(NowPlayingState.track-id); }
|
|
changed live-track-id => { TrackInfoActions.load-inline(self.live-track-id); }
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: parent.width;
|
|
viewport-height: parent.height;
|
|
centered: true;
|
|
}
|
|
// Checkpoint D: the live Suggestions panel (artist playlists +
|
|
// Song Radio + recommended tracks), centered in the right half
|
|
// (split-only, data-panels §6). `init` kicks the live artist load
|
|
// for the current track; a `changed NowPlayingState.track-id`
|
|
// guard re-fires the load so the panel refreshes when the track
|
|
// changes while it's open (track-id is a string — safe to watch,
|
|
// no layout geometry involved).
|
|
if ImmersiveState.split-panel == 2: ImmersiveSuggestionsPanel {
|
|
property <string> live-track-id: NowPlayingState.track-id;
|
|
init => { SuggestionsActions.load(NowPlayingState.track-id); }
|
|
changed live-track-id => { SuggestionsActions.load(self.live-track-id); }
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: parent.width;
|
|
viewport-height: parent.height;
|
|
centered: true;
|
|
}
|
|
// Checkpoint B: the Queue + History panel, centered in the right
|
|
// half. Same component as the focus mount; `centered: true` fills
|
|
// the slot (data-panels §4 — one QueuePanel in both placements).
|
|
if ImmersiveState.split-panel == 3: ImmersiveQueuePanel {
|
|
init => { QueueState.panel-opened(); }
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: parent.width;
|
|
viewport-height: parent.height;
|
|
centered: true;
|
|
}
|
|
}
|
|
}
|
|
|
|
// (3) Auto-hide compact player.
|
|
ImmersivePlayerBar {
|
|
viewport-width: root.width;
|
|
x: Math.round((root.width - self.width) / 2 / 1px) * 1px;
|
|
y: root.height - self.height - 24px;
|
|
opacity: root.chrome-visible ? 1.0 : 0.0;
|
|
animate opacity { duration: 300ms; }
|
|
wake => { root.wake(); }
|
|
media-action(kind, id, action) => { root.media-action(kind, id, action); }
|
|
}
|
|
|
|
// (4) Top-center mode selector. Shares the same chrome-visible flag so it
|
|
// auto-hides/wakes with the player (no second timer). Horizontally
|
|
// centered, pinned near the window top so it never overlaps the player.
|
|
ModeBar {
|
|
x: Math.round((root.width - self.width) / 2 / 1px) * 1px;
|
|
y: 16px;
|
|
opacity: root.chrome-visible ? 1.0 : 0.0;
|
|
animate opacity { duration: 300ms; }
|
|
select(idx) => {
|
|
ImmersiveState.mode = idx;
|
|
root.wake();
|
|
}
|
|
select-split(idx) => {
|
|
ImmersiveState.split-panel = idx;
|
|
root.wake();
|
|
}
|
|
toggle-view => {
|
|
ImmersiveState.view-mode = ImmersiveState.view-mode == 1 ? 0 : 1;
|
|
// Entering split kicks the load for whichever panel is already
|
|
// selected so it populates immediately (the panel's own `init`
|
|
// covers the first mount; this handles re-entry onto an existing
|
|
// selection).
|
|
if (ImmersiveState.view-mode == 1 && ImmersiveState.split-panel == 0) {
|
|
LyricsState.panel-opened();
|
|
}
|
|
if (ImmersiveState.view-mode == 1 && ImmersiveState.split-panel == 1) {
|
|
TrackInfoActions.load-inline(NowPlayingState.track-id);
|
|
}
|
|
if (ImmersiveState.view-mode == 1 && ImmersiveState.split-panel == 2) {
|
|
SuggestionsActions.load(NowPlayingState.track-id);
|
|
}
|
|
root.wake();
|
|
}
|
|
lyrics-entered => {
|
|
LyricsState.panel-opened();
|
|
root.wake();
|
|
}
|
|
queue-entered => {
|
|
QueueState.panel-opened();
|
|
root.wake();
|
|
}
|
|
trackinfo-entered => {
|
|
TrackInfoActions.load-inline(NowPlayingState.track-id);
|
|
root.wake();
|
|
}
|
|
suggestions-entered => {
|
|
SuggestionsActions.load(NowPlayingState.track-id);
|
|
root.wake();
|
|
}
|
|
}
|
|
}
|