feat(kiosk): forward nav, window chrome, NPB gating, list windowing
- Add the forward nav button beside back (NavState.can-forward/request-forward). - The kiosk back bar owns the window chrome (no HeaderBar): macOS leaves the ~78px traffic-light inset, Linux frameless draws the custom WindowControls on the right. OS-agnostic (the kiosk is not restricted to any platform). - Hide ALL NPB view modes not compatible with kiosk (New/Classic/Small/Large + Miniplayer + Immersive) while in the kiosk profile; only the profile toggle remains. - Track lists (Library/Search) use ListView so only the visible band mounts — the plain VerticalLayout spiked CPU on entry, which a Pi cannot afford. cc
This commit is contained in:
4 files changed
+56
-33
No files matched your search
@@ -5,6 +5,7 @@
|
||||
// FavoritesActions.select-tab (Rust lazy-loads each tab). Covers are push-only
|
||||
// except album covers (windowed — v1 shows the first ~60; the window hook is a
|
||||
// follow-up).
|
||||
import { ListView } from "std-widgets.slint";
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { FavoritesState, FavoritesActions } from "../state.slint";
|
||||
@@ -77,17 +78,14 @@ export component KioskLibrary inherits Rectangle {
|
||||
vertical-stretch: 1;
|
||||
clip: true;
|
||||
|
||||
if FavoritesState.active-tab == "tracks": Flickable {
|
||||
viewport-width: self.width;
|
||||
viewport-height: tracklist.preferred-height;
|
||||
tracklist := VerticalLayout {
|
||||
padding: root.pad;
|
||||
spacing: 2px;
|
||||
for track in FavoritesState.tracks-visible: KioskTrackRow {
|
||||
track: track;
|
||||
play(id) => {
|
||||
FavoritesActions.play-track(id);
|
||||
}
|
||||
// ListView windows the rows (only the visible band is mounted) — a
|
||||
// plain VerticalLayout of every track spiked CPU on entry, which a Pi
|
||||
// can't afford.
|
||||
if FavoritesState.active-tab == "tracks": ListView {
|
||||
for track in FavoritesState.tracks-visible: KioskTrackRow {
|
||||
track: track;
|
||||
play(id) => {
|
||||
FavoritesActions.play-track(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// The query is entered in the KioskShell back-bar field (SearchActions.submit);
|
||||
// this view is the tabbed results. Covers are push-only, so binding the shared
|
||||
// arrays is enough.
|
||||
import { ListView } from "std-widgets.slint";
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { SearchState, SearchActions } from "../state.slint";
|
||||
@@ -88,18 +89,12 @@ export component KioskSearch inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Tracks — simple vertical list.
|
||||
if SearchState.tab == 2: Flickable {
|
||||
viewport-width: self.width;
|
||||
viewport-height: tracklist.preferred-height;
|
||||
tracklist := VerticalLayout {
|
||||
padding: root.pad;
|
||||
spacing: 2px;
|
||||
for track in SearchState.tracks: KioskTrackRow {
|
||||
track: track;
|
||||
play(id) => {
|
||||
root.media-action("track", id, "play");
|
||||
}
|
||||
// Tracks — windowed list (ListView mounts only the visible band).
|
||||
if SearchState.tab == 2: ListView {
|
||||
for track in SearchState.tracks: KioskTrackRow {
|
||||
track: track;
|
||||
play(id) => {
|
||||
root.media-action("track", id, "play");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,10 @@ 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 { NavState, ContentView, OfflineState, PlaylistState, PurchaseDetailState, SearchActions, UiFocusState, AppearanceState } from "../state.slint";
|
||||
import { PlayerBarSmall } from "PlayerBarSmall.slint";
|
||||
import { NavRail } from "NavRail.slint";
|
||||
import { WindowControls } from "WindowControls.slint";
|
||||
import { KioskDiscover } from "KioskDiscover.slint";
|
||||
import { DiscoverBrowseView } from "../discover/DiscoverBrowseView.slint";
|
||||
import { RecentAlbumsView } from "../discover/RecentAlbumsView.slint";
|
||||
@@ -108,15 +109,21 @@ export component KioskShell inherits Rectangle {
|
||||
// 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 {
|
||||
backbar := Rectangle {
|
||||
height: Layout.header-height;
|
||||
background: Theme.surface-card;
|
||||
// The kiosk carries no HeaderBar, so it owns the window chrome too.
|
||||
// macOS overlay leaves the native traffic-light inset; Linux frameless
|
||||
// draws the custom WindowControls. OS-agnostic on purpose (the kiosk
|
||||
// is not restricted to any platform).
|
||||
property <length> mac-inset: AppearanceState.is-macos && !AppearanceState.system-title-bar-active ? 78px : 0px;
|
||||
property <bool> lin-chrome: !AppearanceState.is-macos && !AppearanceState.system-title-bar-active && AppearanceState.show-window-controls;
|
||||
HorizontalLayout {
|
||||
padding-left: 6px;
|
||||
padding-right: 8px;
|
||||
padding-left: 6px + backbar.mac-inset;
|
||||
padding-right: backbar.lin-chrome ? 118px : 8px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
spacing: 8px;
|
||||
spacing: 6px;
|
||||
back-btn := Rectangle {
|
||||
width: 44px;
|
||||
border-radius: Radius.sm;
|
||||
@@ -135,6 +142,24 @@ export component KioskShell inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
fwd-btn := Rectangle {
|
||||
width: 44px;
|
||||
border-radius: Radius.sm;
|
||||
background: fwd-ta.has-hover && NavState.can-forward ? Theme.alpha-8 : transparent;
|
||||
opacity: NavState.can-forward ? 1.0 : 0.32;
|
||||
Image {
|
||||
source: @image-url("../assets/icons/chevron-right.svg");
|
||||
colorize: Theme.text-secondary;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
fwd-ta := TouchArea {
|
||||
enabled: NavState.can-forward;
|
||||
clicked => {
|
||||
NavState.request-forward();
|
||||
}
|
||||
}
|
||||
}
|
||||
search-field := LineEdit {
|
||||
horizontal-stretch: 1;
|
||||
placeholder-text: @tr("Search");
|
||||
@@ -150,6 +175,11 @@ export component KioskShell inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Linux custom window controls at the right edge.
|
||||
if backbar.lin-chrome: WindowControls {
|
||||
x: backbar.width - self.preferred-width - 8px;
|
||||
y: (backbar.height - self.preferred-height) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Content frame (mirrors AppShell:237-279 arithmetic-height pattern).
|
||||
|
||||
@@ -741,7 +741,7 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
height: 215px;
|
||||
close-policy: close-on-click;
|
||||
ContextMenu {
|
||||
ContextMenuItem {
|
||||
if !ShellState.kiosk-profile: ContextMenuItem {
|
||||
icon: @image-url("../assets/icons/panel-left.svg");
|
||||
label: @tr("New");
|
||||
selected: ShellState.npb-mode == 0;
|
||||
@@ -749,7 +749,7 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
root.media-action("npb-view", "", "new");
|
||||
}
|
||||
}
|
||||
ContextMenuItem {
|
||||
if !ShellState.kiosk-profile: ContextMenuItem {
|
||||
icon: @image-url("../assets/icons/panel-right-close.svg");
|
||||
label: @tr("Classic");
|
||||
selected: ShellState.npb-mode == 1;
|
||||
@@ -757,7 +757,7 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
root.media-action("npb-view", "", "classic");
|
||||
}
|
||||
}
|
||||
ContextMenuItem {
|
||||
if !ShellState.kiosk-profile: ContextMenuItem {
|
||||
icon: @image-url("../assets/icons/rows-3.svg");
|
||||
label: @tr("Small");
|
||||
selected: ShellState.npb-mode == 2;
|
||||
@@ -765,7 +765,7 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
root.media-action("npb-view", "", "small");
|
||||
}
|
||||
}
|
||||
ContextMenuItem {
|
||||
if !ShellState.kiosk-profile: ContextMenuItem {
|
||||
icon: @image-url("../assets/icons/layout-grid.svg");
|
||||
label: @tr("Large");
|
||||
selected: ShellState.npb-mode == 3;
|
||||
@@ -780,7 +780,7 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
root.media-action("npb-view", "", "large");
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
if !ShellState.kiosk-profile: Rectangle {
|
||||
height: 7px;
|
||||
Rectangle {
|
||||
height: 1px;
|
||||
|
||||
Reference in new issue
Block a user