Replace the reused AlbumPageView/ArtistPageView on the kiosk album/artist routes with Pi-light detail: KioskAlbum (cover + title + tappable artist + Play/Shuffle + number/title/duration track list, reading AlbumState) and KioskArtist (round portrait + Play/Radio + discography as KioskCard shelves per release section, skipping the \"other\" bucket, reading ArtistState). Both bind the shared state so covers push in. Validated via slintcheck. cc
454 lines
21 KiB
Plaintext
454 lines
21 KiB
Plaintext
// KioskShell — small-panel touch shell (2.0.2 frente #3, Axis B).
|
|
//
|
|
// A SIBLING of AppShell inside the same AppWindow, mounted when
|
|
// `AppScreen.kiosk` is active. It shares every `*State` global verbatim with the
|
|
// desktop shell (no mirroring), so it re-hosts the SAME view components; the
|
|
// only differences from AppShell are the chrome: a thin back bar + bottom
|
|
// NavRail replace the HeaderBar + Sidebar, the transport is forced to
|
|
// PlayerBarSmall, and there is no queue/lyrics side panel.
|
|
//
|
|
// The content-mount block below is a VERBATIM copy of AppShell's (every
|
|
// ContentView route + the offline placeholder), so navigation reaches the same
|
|
// views by construction. Keeping it in sync with AppShell is temporary debt: a
|
|
// shared `ShellContent` extraction is the DRY follow-up, deferred because the
|
|
// content-height arithmetic references `root.height` (= the shell/window height)
|
|
// and extracting it into a sub-component needs that height re-threaded — a
|
|
// change worth doing only once the kiosk shell is build-verified. Kept isolated
|
|
// here so the desktop shell is untouched and cannot regress.
|
|
import { LineEdit } from "std-widgets.slint";
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Layout } from "../foundation/layout.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { NavState, ContentView, OfflineState, PlaylistState, PurchaseDetailState, SearchActions, UiFocusState } from "../state.slint";
|
|
import { PlayerBarSmall } from "PlayerBarSmall.slint";
|
|
import { NavRail } from "NavRail.slint";
|
|
import { KioskDiscover } from "KioskDiscover.slint";
|
|
import { DiscoverBrowseView } from "../discover/DiscoverBrowseView.slint";
|
|
import { RecentAlbumsView } from "../discover/RecentAlbumsView.slint";
|
|
import { KioskAlbum } from "KioskAlbum.slint";
|
|
import { LocalAlbumView } from "../album/LocalAlbumView.slint";
|
|
import { KioskArtist } from "KioskArtist.slint";
|
|
import { ArtistReleasesView } from "../artist/ArtistReleasesView.slint";
|
|
import { MusicianPageView } from "../musician/MusicianPageView.slint";
|
|
import { LabelReleasesView } from "../label/LabelReleasesView.slint";
|
|
import { LabelPageView } from "../label/LabelPageView.slint";
|
|
import { AwardView } from "../award/AwardView.slint";
|
|
import { AwardAlbumsView } from "../award/AwardAlbumsView.slint";
|
|
import { PurchasesView } from "../purchases/PurchasesView.slint";
|
|
import { PurchaseDetailView } from "../purchases/PurchaseDetailView.slint";
|
|
import { ArtistsByLocationView } from "../location/ArtistsByLocationView.slint";
|
|
import { KioskLibrary } from "KioskLibrary.slint";
|
|
import { FavoritesOfflineRail } from "../favorites/FavoritesOfflineRail.slint";
|
|
import { MixView } from "../mix/MixView.slint";
|
|
import { PlaylistView } from "../playlist/PlaylistView.slint";
|
|
import { PlaylistManagerView } from "../playlist/PlaylistManagerView.slint";
|
|
import { MixtapesView } from "../myqbz/MixtapesView.slint";
|
|
import { CollectionsView } from "../myqbz/CollectionsView.slint";
|
|
import { MixtapeDetailView } from "../myqbz/MixtapeDetailView.slint";
|
|
import { DiscographyBuilderView } from "../myqbz/DiscographyBuilderView.slint";
|
|
import { OfflineManagerView } from "../offline/OfflineManagerView.slint";
|
|
import { BlacklistManagerView } from "../settings/BlacklistManagerView.slint";
|
|
import { OfflinePlaceholder } from "../offline/OfflinePlaceholder.slint";
|
|
import { LocalLibraryView } from "../locallibrary/LocalLibraryView.slint";
|
|
import { SettingsView } from "../settings/SettingsView.slint";
|
|
import { KioskSearch } from "KioskSearch.slint";
|
|
|
|
export component KioskShell inherits Rectangle {
|
|
// Public interface mirrors AppShell 1:1 (app.slint forwards these to the
|
|
// AppWindow root callbacks handled in Rust).
|
|
callback open-album(string);
|
|
callback open-artist(string);
|
|
callback open-purchase-album(string);
|
|
callback media-action(string, string, string);
|
|
callback header-menu-navigate(string);
|
|
callback discover-view-all(string, string);
|
|
callback settings-bool(string, bool);
|
|
callback settings-select(string, int);
|
|
callback settings-slider(string, int);
|
|
callback settings-string(string, string);
|
|
callback settings-reset();
|
|
callback settings-release-device();
|
|
callback logout();
|
|
callback close-app();
|
|
callback recovery-login();
|
|
|
|
// Kiosk chrome heights. The back bar + transport are one header-row tall
|
|
// each; the NavRail is a fat touch target.
|
|
property <length> navrail-height: 80px;
|
|
|
|
// Offline gate (verbatim from AppShell:110-130): Qobuz-only views mount only
|
|
// online; local-DB views (LocalLibrary, local album, offline manager, My QBZ,
|
|
// Settings) keep mounting offline.
|
|
property <bool> qobuz-view-blocked: OfflineState.offline && (
|
|
NavState.view == ContentView.home
|
|
|| NavState.view == ContentView.discover-browse
|
|
|| NavState.view == ContentView.search
|
|
|| NavState.view == ContentView.favorites
|
|
|| NavState.view == ContentView.album
|
|
|| NavState.view == ContentView.artist
|
|
|| NavState.view == ContentView.artist-releases
|
|
|| NavState.view == ContentView.musician
|
|
|| NavState.view == ContentView.label
|
|
|| NavState.view == ContentView.label-releases
|
|
|| NavState.view == ContentView.award
|
|
|| NavState.view == ContentView.award-albums
|
|
|| NavState.view == ContentView.purchases
|
|
|| NavState.view == ContentView.purchase-album
|
|
|| NavState.view == ContentView.location
|
|
|| NavState.view == ContentView.mix
|
|
|| (NavState.view == ContentView.playlist
|
|
&& !PlaylistState.is-local && !PlaylistState.offline-subset));
|
|
|
|
VerticalLayout {
|
|
spacing: 0px;
|
|
|
|
// --- Back bar: persistent global back (workstream B, wired to NavState
|
|
// history, ADR-004) + the kiosk search entry. The desktop search box
|
|
// lives in the HeaderBar, which the kiosk drops, so a persistent search
|
|
// field here is what makes Search functional; Enter submits through the
|
|
// same SearchActions seam the header uses and lands on the results view.
|
|
Rectangle {
|
|
height: Layout.header-height;
|
|
background: Theme.surface-card;
|
|
HorizontalLayout {
|
|
padding-left: 6px;
|
|
padding-right: 8px;
|
|
padding-top: 4px;
|
|
padding-bottom: 4px;
|
|
spacing: 8px;
|
|
back-btn := Rectangle {
|
|
width: 44px;
|
|
border-radius: Radius.sm;
|
|
background: back-ta.has-hover && NavState.can-back ? Theme.alpha-8 : transparent;
|
|
opacity: NavState.can-back ? 1.0 : 0.32;
|
|
Image {
|
|
source: @image-url("../assets/icons/chevron-left.svg");
|
|
colorize: Theme.text-secondary;
|
|
width: 22px;
|
|
height: 22px;
|
|
}
|
|
back-ta := TouchArea {
|
|
enabled: NavState.can-back;
|
|
clicked => {
|
|
NavState.request-back();
|
|
}
|
|
}
|
|
}
|
|
search-field := LineEdit {
|
|
horizontal-stretch: 1;
|
|
placeholder-text: @tr("Search");
|
|
// Suppress the global single-key hotkeys while typing (the
|
|
// desktop search box drives the same guard); without this,
|
|
// letters fire hotkeys instead of reaching the field.
|
|
changed has-focus => {
|
|
UiFocusState.text-input-focused = self.has-focus;
|
|
}
|
|
accepted(text) => {
|
|
SearchActions.submit(text);
|
|
NavState.view = ContentView.search;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// --- Content frame (mirrors AppShell:237-279 arithmetic-height pattern).
|
|
// A conditionally-mounted view will not stretch to fill a layout cell, so
|
|
// the inner Rectangle takes an EXPLICIT height and the views fill it via
|
|
// clip — this is the documented layout-collapse footgun. --------------
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
background: Theme.surface-card;
|
|
VerticalLayout {
|
|
vertical-stretch: 1;
|
|
padding-left: 8px;
|
|
padding-right: 8px;
|
|
padding-top: 0px;
|
|
padding-bottom: 8px;
|
|
|
|
Rectangle {
|
|
// window - back bar - transport(PlayerBarSmall = one header
|
|
// row) - NavRail - this VL's bottom padding.
|
|
height: root.height - Layout.header-height - Layout.header-height
|
|
- root.navrail-height - 8px;
|
|
vertical-stretch: 1;
|
|
background: Theme.surface-main;
|
|
border-radius: Radius.md;
|
|
clip: true;
|
|
|
|
// --- Verbatim copy of AppShell's view mounts (286-526). ---
|
|
if root.qobuz-view-blocked && NavState.view != ContentView.favorites: OfflinePlaceholder { }
|
|
if root.qobuz-view-blocked && NavState.view == ContentView.favorites: OfflinePlaceholder {
|
|
FavoritesOfflineRail { }
|
|
}
|
|
|
|
if NavState.view == ContentView.home && !OfflineState.offline: KioskDiscover {
|
|
album-clicked(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
discover-view-all(e, t) => {
|
|
root.discover-view-all(e, t);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.discover-browse && !OfflineState.offline: DiscoverBrowseView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.recent-albums: RecentAlbumsView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.album && !OfflineState.offline: KioskAlbum {
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.local-album: LocalAlbumView {
|
|
open-artist(name) => {
|
|
root.open-artist(name);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.artist && !OfflineState.offline: KioskArtist {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.artist-releases && !OfflineState.offline: ArtistReleasesView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.musician && !OfflineState.offline: MusicianPageView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.label && !OfflineState.offline: LabelPageView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.label-releases && !OfflineState.offline: LabelReleasesView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.award && !OfflineState.offline: AwardView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.award-albums && !OfflineState.offline: AwardAlbumsView {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.location && !OfflineState.offline: ArtistsByLocationView {
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.favorites && !OfflineState.offline: KioskLibrary {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.purchases && !OfflineState.offline: PurchasesView {
|
|
open-album(id) => {
|
|
root.open-purchase-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.purchase-album
|
|
&& !OfflineState.offline
|
|
&& PurchaseDetailState.album-id != "": PurchaseDetailView { }
|
|
if NavState.view == ContentView.playlist-manager: PlaylistManagerView { }
|
|
if NavState.view == ContentView.mixtapes: MixtapesView { }
|
|
if NavState.view == ContentView.collections: CollectionsView { }
|
|
if NavState.view == ContentView.mixtape-detail: MixtapeDetailView { }
|
|
if NavState.view == ContentView.discography-builder: DiscographyBuilderView { }
|
|
if NavState.view == ContentView.offline-manager: OfflineManagerView { }
|
|
if NavState.view == ContentView.blacklist-manager: BlacklistManagerView { }
|
|
if NavState.view == ContentView.local-library: LocalLibraryView { }
|
|
if NavState.view == ContentView.mix && !OfflineState.offline: MixView {
|
|
play-track(id) => {
|
|
root.media-action("track", id, "play");
|
|
}
|
|
play-all => {
|
|
root.media-action("mix", "", "play-all");
|
|
}
|
|
shuffle => {
|
|
root.media-action("mix", "", "shuffle");
|
|
}
|
|
refresh => {
|
|
root.media-action("mix", "", "refresh");
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.playlist
|
|
&& (!OfflineState.offline
|
|
|| PlaylistState.is-local
|
|
|| PlaylistState.offline-subset): PlaylistView {
|
|
play-track(id) => {
|
|
root.media-action("track", id, "play");
|
|
}
|
|
play-all => {
|
|
root.media-action("playlist", "", "play-all");
|
|
}
|
|
shuffle => {
|
|
root.media-action("playlist", "", "shuffle");
|
|
}
|
|
toggle-favorite => {
|
|
root.media-action("playlist", "", "favorite");
|
|
}
|
|
edit => {
|
|
root.media-action("playlist", "", "edit");
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if NavState.view == ContentView.settings: SettingsView {
|
|
settings-bool(k, v) => {
|
|
root.settings-bool(k, v);
|
|
}
|
|
settings-select(k, i) => {
|
|
root.settings-select(k, i);
|
|
}
|
|
settings-slider(k, v) => {
|
|
root.settings-slider(k, v);
|
|
}
|
|
settings-string(k, s) => {
|
|
root.settings-string(k, s);
|
|
}
|
|
settings-reset => {
|
|
root.settings-reset();
|
|
}
|
|
settings-release-device => {
|
|
root.settings-release-device();
|
|
}
|
|
}
|
|
if NavState.view == ContentView.search && !OfflineState.offline: KioskSearch {
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// --- Persistent transport: force PlayerBarSmall (npb=2 seam). Reused
|
|
// verbatim; it self-heights to one header row and reads its own globals.
|
|
PlayerBarSmall {
|
|
height: Layout.header-height;
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
settings-bool(k, v) => {
|
|
root.settings-bool(k, v);
|
|
}
|
|
}
|
|
|
|
// --- Bottom NavRail (net-new). Each tile maps to the real route the
|
|
// Sidebar/Rust dispatcher already uses. ------------------------------
|
|
NavRail {
|
|
height: root.navrail-height;
|
|
discover => {
|
|
root.header-menu-navigate("discover-home");
|
|
}
|
|
library => {
|
|
root.header-menu-navigate("favorites-tracks");
|
|
}
|
|
search => {
|
|
NavState.view = ContentView.search;
|
|
}
|
|
playing => {
|
|
root.media-action("npb-view", "", "immersive");
|
|
}
|
|
visualizer => {
|
|
root.media-action("npb-view", "", "immersive");
|
|
}
|
|
menu => {
|
|
NavState.request-settings();
|
|
}
|
|
}
|
|
}
|
|
}
|