Ports Tauri's Filter-by-genre popup (simple grid view). The selection
is shared across the three Discover tabs — matching Tauri's single
"home" genre context — and re-fetches the discover index with the
chosen genre ids.
UI:
- New GenreFilterPopup: header (icon + title + close), Remember
selection + Advanced view toggles (QbzToggle), a 3-column grid of
parent-genre chips with an accent fill + check circle when
selected, and a Clear filter footer. Anchored top-right under the
button, with a click-away backdrop.
- GenreButton turns accent-filled and shows "N genres" / "1 genre"
when a filter is active (else "Filter by genre"), 1:1 with Tauri.
- Advanced view (search + 3-level tree + counts) is the next
increment; its toggle is present and shows a "coming soon" stub.
State / backend:
- GenreFilterState + GenreFilterActions globals; GenreChip struct.
- crate::genre_filter loads the parent genres (QbzCore::get_genres)
and owns the shared selection, persisted to
<data-dir>/qbz/genre_filter.json when Remember is on (dropped
when off). Stale ids are pruned against the loaded genres.
- load_home now takes genre_ids and threads them into
get_discover_index. The home-load path is extracted into a shared
`reload_home(active_tab)` used by the initial shell load and by
genre toggle/clear; it rebuilds all three section sets, restores
the active tab via select_tab, and re-fires artwork.
cc
107 lines
3.6 KiB
Plaintext
107 lines
3.6 KiB
Plaintext
// QBZ Slint MVP — UI entry point.
|
|
//
|
|
// Stays thin: imports the feature screens and exports the single
|
|
// top-level window. No raw visual constants or domain logic here
|
|
// (MVP ADR, sections 13 and 21).
|
|
|
|
// Bundles + registers the Inter 18pt faces (compile-time embed) so the
|
|
// app can render with Inter — see the FONT_TEST_INTER toggle in main.rs.
|
|
import "assets/fonts/Inter_18pt-Regular.ttf";
|
|
import "assets/fonts/Inter_18pt-Medium.ttf";
|
|
import "assets/fonts/Inter_18pt-SemiBold.ttf";
|
|
import "assets/fonts/Inter_18pt-Bold.ttf";
|
|
|
|
import { Theme } from "foundation/semantic-colors.slint";
|
|
import { SplashScreen } from "splash/SplashScreen.slint";
|
|
import { LoginScreen } from "login/LoginScreen.slint";
|
|
import { AppShell } from "shell/AppShell.slint";
|
|
|
|
// Re-export the state globals so the Rust layer can populate them.
|
|
export { HomeState, HomeActions, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions } from "state.slint";
|
|
|
|
// Which top-level screen is shown. The app starts on `splash` while it
|
|
// restores a saved session, then resolves to `shell` or `login`.
|
|
export enum AppScreen { splash, login, shell }
|
|
|
|
export component AppWindow inherits Window {
|
|
title: "QBZ";
|
|
preferred-width: 1180px;
|
|
preferred-height: 760px;
|
|
min-width: 940px;
|
|
min-height: 600px;
|
|
background: Theme.surface-main;
|
|
|
|
// Resolved by the Rust layer from the desktop environment (e.g. the
|
|
// KDE Plasma general font). Empty falls back to the Slint default.
|
|
in property <string> system-font: "";
|
|
default-font-family: root.system-font;
|
|
|
|
in-out property <AppScreen> screen: AppScreen.splash;
|
|
|
|
// Forwarded to the Rust layer.
|
|
callback sign-in-via-browser();
|
|
callback use-system-browser();
|
|
callback start-offline();
|
|
callback open-tos();
|
|
callback open-album(string);
|
|
callback open-artist(string);
|
|
callback media-action(string, string, string);
|
|
callback header-menu-navigate(string);
|
|
callback settings-bool(string, bool);
|
|
callback settings-select(string, int);
|
|
callback settings-slider(string, int);
|
|
callback settings-reset();
|
|
callback logout();
|
|
callback close-app();
|
|
|
|
if root.screen == AppScreen.splash: SplashScreen { }
|
|
|
|
if root.screen == AppScreen.login: LoginScreen {
|
|
sign-in-via-browser => {
|
|
root.sign-in-via-browser();
|
|
}
|
|
use-system-browser => {
|
|
root.use-system-browser();
|
|
}
|
|
start-offline => {
|
|
root.start-offline();
|
|
}
|
|
open-tos => {
|
|
root.open-tos();
|
|
}
|
|
}
|
|
|
|
if root.screen == AppScreen.shell: AppShell {
|
|
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);
|
|
}
|
|
header-menu-navigate(route) => {
|
|
root.header-menu-navigate(route);
|
|
}
|
|
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-reset => {
|
|
root.settings-reset();
|
|
}
|
|
logout => {
|
|
root.logout();
|
|
}
|
|
close-app => {
|
|
root.close-app();
|
|
}
|
|
}
|
|
}
|