feat(kiosk): lightweight KioskLocalLibrary + KioskMyQBZ views
KioskLocalLibrary (tabs Albums/Artists/Folders/Tracks, reading LocalLibraryState, driving LocalLibraryActions; open-album routes to the local-album detail) and KioskMyQBZ (Mixtapes/Collections tabs over MyQbzState, MyQbzActions.open-card). Both reuse the shared kiosk cards/grid + ListView for tracks. Wired onto the local-library / mixtapes / collections routes. With this every kiosk content view is the light version. Validated via slintcheck. (v1: no album-window / tracks-load-more hooks yet.) cc
This commit is contained in:
3 files changed
+288
-6
No files matched your search
@@ -0,0 +1,122 @@
|
||||
// KioskLocalLibrary — lightweight kiosk Local Library (2.0.2 frente #3). Reads
|
||||
// the same LocalLibraryState the desktop LocalLibraryView reads (3 sources
|
||||
// unified: local / offline / plex). Tabs Albums / Artists / Folders / Tracks,
|
||||
// rendered with the shared kiosk cards. Drives LocalLibraryActions directly
|
||||
// (open-album routes to ContentView.local-album in Rust). v1 simplifications:
|
||||
// no album-window / tracks-load-more hooks yet (first band loads), folders as a
|
||||
// flat grid.
|
||||
import { ListView } from "std-widgets.slint";
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { LocalLibraryState, LocalLibraryActions } from "../state.slint";
|
||||
import { KioskAlbumGrid } from "KioskAlbumGrid.slint";
|
||||
import { KioskArtistCard } from "KioskArtistCard.slint";
|
||||
import { KioskTrackRow } from "KioskTrackRow.slint";
|
||||
|
||||
component LLTab inherits Rectangle {
|
||||
in property <string> label;
|
||||
in property <string> id;
|
||||
callback picked(string);
|
||||
property <bool> active: LocalLibraryState.active-tab == root.id;
|
||||
horizontal-stretch: 0;
|
||||
HorizontalLayout {
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
VerticalLayout {
|
||||
Text {
|
||||
text: root.label;
|
||||
color: root.active ? Theme.text-primary : Theme.text-muted;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Rectangle {
|
||||
height: 2px;
|
||||
background: root.active ? Theme.accent : transparent;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
ta := TouchArea {
|
||||
clicked => {
|
||||
root.picked(root.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component KioskLocalLibrary inherits Rectangle {
|
||||
property <length> pad: 16px;
|
||||
|
||||
VerticalLayout {
|
||||
spacing: 0px;
|
||||
|
||||
Rectangle {
|
||||
height: 48px;
|
||||
background: Theme.surface-main;
|
||||
HorizontalLayout {
|
||||
padding-left: root.pad;
|
||||
padding-right: root.pad;
|
||||
spacing: 22px;
|
||||
alignment: start;
|
||||
LLTab { label: @tr("Albums"); id: "albums"; picked(t) => { LocalLibraryActions.select-tab(t); } }
|
||||
LLTab { label: @tr("Artists"); id: "artists"; picked(t) => { LocalLibraryActions.select-tab(t); } }
|
||||
LLTab { label: @tr("Folders"); id: "folders"; picked(t) => { LocalLibraryActions.select-tab(t); } }
|
||||
LLTab { label: @tr("Tracks"); id: "tracks"; picked(t) => { LocalLibraryActions.select-tab(t); } }
|
||||
}
|
||||
Rectangle {
|
||||
y: parent.height - 1px;
|
||||
height: 1px;
|
||||
background: Theme.border-subtle;
|
||||
}
|
||||
}
|
||||
|
||||
content := Rectangle {
|
||||
vertical-stretch: 1;
|
||||
clip: true;
|
||||
|
||||
if LocalLibraryState.active-tab == "albums": KioskAlbumGrid {
|
||||
albums: LocalLibraryState.albums-visible;
|
||||
open(id) => {
|
||||
LocalLibraryActions.open-album(id);
|
||||
}
|
||||
}
|
||||
|
||||
if LocalLibraryState.active-tab == "folders": KioskAlbumGrid {
|
||||
albums: LocalLibraryState.folders-visible;
|
||||
open(id) => {
|
||||
LocalLibraryActions.open-album(id);
|
||||
}
|
||||
}
|
||||
|
||||
if LocalLibraryState.active-tab == "artists": arts := Flickable {
|
||||
property <int> cols: 7;
|
||||
property <length> gap: 14px;
|
||||
property <length> cell: (self.width - 2 * root.pad - (self.cols - 1) * self.gap) / self.cols;
|
||||
viewport-width: self.width;
|
||||
viewport-height: Math.ceil(LocalLibraryState.artists.length / self.cols) * (self.cell + 26px + self.gap) + root.pad;
|
||||
Rectangle {
|
||||
for artist[i] in LocalLibraryState.artists: KioskArtistCard {
|
||||
x: root.pad + Math.mod(i, arts.cols) * (arts.cell + arts.gap);
|
||||
y: root.pad + Math.floor(i / arts.cols) * (arts.cell + 26px + arts.gap);
|
||||
size: arts.cell;
|
||||
id: artist.name;
|
||||
name: artist.display-name;
|
||||
avatar: artist.image;
|
||||
clicked(id) => {
|
||||
LocalLibraryActions.open-artist(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if LocalLibraryState.active-tab == "tracks": ListView {
|
||||
for track in LocalLibraryState.tracks-visible: KioskTrackRow {
|
||||
track: track;
|
||||
play(id) => {
|
||||
LocalLibraryActions.track-action(id, "play");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
// KioskMyQBZ — lightweight kiosk My QBZ view (2.0.2 frente #3). Reads the same
|
||||
// MyQbzState the desktop MixtapesView/CollectionsView read. Tabs Mixtapes /
|
||||
// Collections (separate ContentView routes); simple cover cards, tap opens the
|
||||
// detail. Covers are push-only. Mounted for both ContentView.mixtapes and
|
||||
// ContentView.collections.
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { MyQbzState, MyQbzActions, MixtapeCardItem, NavState, ContentView } from "../state.slint";
|
||||
|
||||
component MyQbzTab inherits Rectangle {
|
||||
in property <string> label;
|
||||
in property <bool> active;
|
||||
callback picked;
|
||||
horizontal-stretch: 0;
|
||||
HorizontalLayout {
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
VerticalLayout {
|
||||
Text {
|
||||
text: root.label;
|
||||
color: root.active ? Theme.text-primary : Theme.text-muted;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Rectangle {
|
||||
height: 2px;
|
||||
background: root.active ? Theme.accent : transparent;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
ta := TouchArea {
|
||||
clicked => {
|
||||
root.picked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component MyQbzCardLite inherits Rectangle {
|
||||
in property <MixtapeCardItem> item;
|
||||
in property <length> size: 150px;
|
||||
callback clicked(string);
|
||||
width: root.size;
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
spacing: 7px;
|
||||
Rectangle {
|
||||
width: root.size;
|
||||
height: root.size;
|
||||
border-radius: Radius.md;
|
||||
background: Theme.surface-elevated;
|
||||
clip: true;
|
||||
if root.item.has-custom-cover: Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
source: root.item.custom-cover;
|
||||
image-fit: cover;
|
||||
}
|
||||
if !root.item.has-custom-cover && root.item.url1 != "": Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
source: root.item.cover1;
|
||||
image-fit: cover;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: root.item.name;
|
||||
color: Theme.text-primary;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
overflow: elide;
|
||||
wrap: no-wrap;
|
||||
}
|
||||
Text {
|
||||
text: root.item.label + " · " + root.item.meta;
|
||||
color: Theme.text-muted;
|
||||
font-size: 12px;
|
||||
overflow: elide;
|
||||
wrap: no-wrap;
|
||||
}
|
||||
}
|
||||
ta := TouchArea {
|
||||
clicked => {
|
||||
root.clicked(root.item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component KioskMyQBZ inherits Rectangle {
|
||||
// Tab switch routes through the same header-menu navigation the Sidebar uses.
|
||||
callback navigate(string);
|
||||
|
||||
property <length> pad: 16px;
|
||||
property <bool> on-collections: NavState.view == ContentView.collections;
|
||||
|
||||
VerticalLayout {
|
||||
spacing: 0px;
|
||||
|
||||
Rectangle {
|
||||
height: 48px;
|
||||
background: Theme.surface-main;
|
||||
HorizontalLayout {
|
||||
padding-left: root.pad;
|
||||
padding-right: root.pad;
|
||||
spacing: 22px;
|
||||
alignment: start;
|
||||
MyQbzTab {
|
||||
label: @tr("Mixtapes");
|
||||
active: !root.on-collections;
|
||||
picked => {
|
||||
root.navigate("myqbz-mixtapes");
|
||||
}
|
||||
}
|
||||
MyQbzTab {
|
||||
label: @tr("Collections");
|
||||
active: root.on-collections;
|
||||
picked => {
|
||||
root.navigate("myqbz-collections");
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
y: parent.height - 1px;
|
||||
height: 1px;
|
||||
background: Theme.border-subtle;
|
||||
}
|
||||
}
|
||||
|
||||
content := Rectangle {
|
||||
vertical-stretch: 1;
|
||||
clip: true;
|
||||
grid := Flickable {
|
||||
property <int> cols: 6;
|
||||
property <length> gap: 16px;
|
||||
property <length> cell: (self.width - 2 * root.pad - (self.cols - 1) * self.gap) / self.cols;
|
||||
viewport-width: self.width;
|
||||
viewport-height: Math.ceil((root.on-collections ? MyQbzState.collections.length : MyQbzState.mixtapes.length) / self.cols) * (self.cell + 44px + self.gap) + root.pad;
|
||||
Rectangle {
|
||||
for item[i] in (root.on-collections ? MyQbzState.collections : MyQbzState.mixtapes): MyQbzCardLite {
|
||||
x: root.pad + Math.mod(i, grid.cols) * (grid.cell + grid.gap);
|
||||
y: root.pad + Math.floor(i / grid.cols) * (grid.cell + 44px + grid.gap);
|
||||
size: grid.cell;
|
||||
item: item;
|
||||
clicked(id) => {
|
||||
MyQbzActions.open-card(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,14 +44,13 @@ 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 { KioskMyQBZ } from "KioskMyQBZ.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 { KioskLocalLibrary } from "KioskLocalLibrary.slint";
|
||||
import { SettingsView } from "../settings/SettingsView.slint";
|
||||
import { KioskSearch } from "KioskSearch.slint";
|
||||
|
||||
@@ -357,13 +356,21 @@ export component KioskShell inherits Rectangle {
|
||||
&& !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.mixtapes: KioskMyQBZ {
|
||||
navigate(r) => {
|
||||
root.header-menu-navigate(r);
|
||||
}
|
||||
}
|
||||
if NavState.view == ContentView.collections: KioskMyQBZ {
|
||||
navigate(r) => {
|
||||
root.header-menu-navigate(r);
|
||||
}
|
||||
}
|
||||
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.local-library: KioskLocalLibrary { }
|
||||
if NavState.view == ContentView.mix && !OfflineState.offline: MixView {
|
||||
play-track(id) => {
|
||||
root.media-action("track", id, "play");
|
||||
|
||||
Reference in new issue
Block a user