The apps are developed apart from the OS now, each in its own repo under gitea.bluefox.support/fennec: - sdk: sf-app (the app contract: manifest, permissions, store rules, sandbox, launch; from sf-ipc), sf-ui, sf-pack, the app template, the developer guide. The OS depends on it by tag (v0.1.0). - youtube, steam: store apps. netflex (native) replaces the Netflex web app. - store: the Fennec catalog, the store source a new TV starts with. This repo keeps the OS and its own apps (Settings, App Store, AirPlay, Miracast). sf-ipc re-exports sf-app, so OS code is mostly unchanged. - Store apps may register for DIAL (the `dial` permission); an official app with the same DIAL name wins. - Built-in icon names are for official apps only. - The image installs the catalog apps at build time (factory-store.toml, sf-update store in mkosi.postinst.chroot). Steam's system part stays in the image: 32-bit libraries, controller udev rules (from Valve's apt repo), Valve's key. - Older TVs move over by themselves: sf-update adds the replacements to store.toml once, the old factory app stays until its replacement is installed, YouTube's and Steam's data folders move to the new ids, and the old sf-app-<id> packages are not installed any more. Shell 0.3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1320 lines
55 KiB
Plaintext
1320 lines
55 KiB
Plaintext
// Fennec OS launcher UI.
|
|
//
|
|
// Everything is laid out on a 1920x1080 design grid scaled by `u`:
|
|
// 96 px side margins, 64 px top and bottom, an 8 px rhythm.
|
|
// The glass surfaces are NOT drawn here: Slint exports their geometry
|
|
// (`glass-*` arrays plus the card-row properties) and the Rust OpenGL layer
|
|
// draws them underneath. Slint only draws text, icons and images on top, so
|
|
// nothing Slint draws may sit under a glass pane.
|
|
|
|
import "@sf-ui/fonts/Onest-Regular.ttf";
|
|
import "@sf-ui/fonts/Onest-Medium.ttf";
|
|
import "@sf-ui/fonts/Onest-SemiBold.ttf";
|
|
import "@sf-ui/fonts/Onest-Bold.ttf";
|
|
|
|
import { AppIcon, NamedIcon, PlayIcon, InfoIcon } from "icons.slint";
|
|
import { PairingGuide } from "pairing.slint";
|
|
import { SettingsView, SettingRow } from "settings.slint";
|
|
import { KeyboardView } from "keyboard.slint";
|
|
|
|
// A live line under the focused app's name ("Siri Remote 82%").
|
|
export struct Fact {
|
|
icon: string,
|
|
text: string,
|
|
// "" | "ok" | "warn"
|
|
tone: string,
|
|
}
|
|
|
|
export struct AppEntry {
|
|
id: string,
|
|
name: string,
|
|
category: string,
|
|
description: string,
|
|
icon: string,
|
|
accent: color,
|
|
kind: string,
|
|
kind-label: string,
|
|
target: string,
|
|
version: string,
|
|
// Web apps: the address without the scheme ("netflex.furbidden.cloud").
|
|
host: string,
|
|
facts: [Fact],
|
|
// A picture shipped with the app (store apps): replaces the vector icon.
|
|
image: image,
|
|
has-image: bool,
|
|
// No picture and no built-in icon: the name's first letter is drawn.
|
|
initial: string,
|
|
// A phone can start it by casting (DIAL).
|
|
cast: bool,
|
|
}
|
|
|
|
// Top Shelf card (Netflex: continue watching or its first home row).
|
|
export struct ShelfItem {
|
|
title: string,
|
|
detail: string,
|
|
image: image,
|
|
has-image: bool,
|
|
// 0..1, 0 = no bar
|
|
progress: float,
|
|
}
|
|
|
|
export struct GlassRect {
|
|
x: length,
|
|
y: length,
|
|
w: length,
|
|
h: length,
|
|
r: length,
|
|
focus: float,
|
|
alpha: float,
|
|
// Frost (mip level). Negative = nested glass that sits on another pane.
|
|
blur: float,
|
|
glow: color,
|
|
// alpha channel = tint amount
|
|
tint: color,
|
|
// Consecutive rects with the same group (> 0) melt together like liquid.
|
|
group: int,
|
|
}
|
|
|
|
export component App inherits Window {
|
|
title: "Fennec OS";
|
|
background: #050506;
|
|
default-font-family: "Onest";
|
|
preferred-width: 1600px;
|
|
preferred-height: 900px;
|
|
forward-focus: keys;
|
|
|
|
// ---- data from Rust -------------------------------------------------
|
|
in property <[AppEntry]> apps;
|
|
in property <string> clock: "21:42";
|
|
in property <string> date: "csütörtök, október 23.";
|
|
in property <string> remote-status: "Nincs párosítva";
|
|
// Status capsule: network ("wired" | "wifi" | "none") and the remote's battery (-1 = unknown).
|
|
in property <string> net-icon: "wired";
|
|
in property <string> net-label: "";
|
|
in property <int> remote-battery: -1;
|
|
// Top Shelf: shown while the app `shelf-app` is focused and there are items.
|
|
// The Netflex store app (fennec/netflex); its cards come from shelf.rs.
|
|
in property <string> shelf-app: "support.bluefox.netflex";
|
|
in property <string> shelf-title;
|
|
in property <[ShelfItem]> shelf-items;
|
|
// Remote pairing guide (state comes from sf-remote).
|
|
in-out property <string> remote-state;
|
|
in-out property <bool> pairing-open: false;
|
|
callback pairing-dismissed();
|
|
in-out property <bool> pairing-skipped: false;
|
|
out property <float> pair-t: self.pairing-open ? 1 : 0;
|
|
animate pair-t { duration: 650ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
// Slint draws on top of the glass, so content under a pane must go fully away.
|
|
out property <float> dim: max(0, 1 - 1.6 * max(self.pair-t, self.set-t));
|
|
in-out property <string> toast-text;
|
|
// Standby (power button): black screen; any key wakes (power.rs).
|
|
in-out property <bool> standby: false;
|
|
callback wake-requested();
|
|
out property <float> standby-t: self.standby ? 1 : 0;
|
|
animate standby-t { duration: 450ms; easing: ease-in-out; }
|
|
in-out property <bool> toast-shown;
|
|
|
|
// ---- settings screen (rows and actions come from settings_screen.rs) ----
|
|
in-out property <bool> settings-open: false;
|
|
in-out property <int> set-area: 0; // 0 = categories, 1 = rows
|
|
in-out property <int> set-nav: 0;
|
|
in-out property <int> set-row: 0;
|
|
in property <bool> set-sub: false; // inside a sub page (picker, confirm)
|
|
in property <string> set-title;
|
|
in property <string> set-subtitle;
|
|
in property <[SettingRow]> set-rows;
|
|
// "settings" or "store": the App Store uses the same pane (store_screen.rs).
|
|
in-out property <string> set-mode: "settings";
|
|
// Keep in sync with the category constants in settings_screen.rs / store_screen.rs.
|
|
out property <[string]> set-categories: self.set-mode == "store"
|
|
? ["Felfedezés", "Telepítve", "Források"]
|
|
: ["Kijelző", "Távirányító és Bluetooth", "Hang", "Hálózat", "Energia", "Rendszer"];
|
|
out property <int> set-nav-count: self.set-categories.length;
|
|
callback settings-opened();
|
|
callback settings-nav-changed(int);
|
|
callback settings-activate(int);
|
|
callback settings-back();
|
|
changed set-nav => { root.settings-nav-changed(self.set-nav); }
|
|
|
|
out property <float> set-t: self.settings-open ? 1 : 0;
|
|
animate set-t { duration: 600ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> nav-pos: self.set-nav;
|
|
animate nav-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> row-pos: self.set-row;
|
|
animate row-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> nav-active: (self.settings-open && self.set-area == 0) ? 1 : 0;
|
|
animate nav-active { duration: 300ms; easing: ease-out; }
|
|
out property <float> content-active: (self.settings-open && self.set-area == 1) ? 1 : 0;
|
|
animate content-active { duration: 300ms; easing: ease-out; }
|
|
// Geometry, mirrored by settings_screen::glass. The screen uses the whole
|
|
// safe area: categories on the left, one grouped platter of rows on the right.
|
|
out property <length> sp-x: 96 * self.u;
|
|
out property <length> sp-y: 64 * self.u + (1 - self.set-t) * 32 * self.u;
|
|
out property <length> sp-w: 1728 * self.u;
|
|
out property <length> sp-h: 952 * self.u;
|
|
out property <length> nav-x: self.sp-x;
|
|
out property <length> nav-y: self.sp-y + 184 * self.u;
|
|
out property <length> nav-w: 512 * self.u;
|
|
out property <length> nav-h: 80 * self.u;
|
|
out property <length> nav-step: 88 * self.u;
|
|
out property <length> rows-x: self.sp-x + 608 * self.u;
|
|
out property <length> rows-y: self.sp-y + 320 * self.u;
|
|
out property <length> rows-w: self.sp-w - 608 * self.u;
|
|
out property <length> set-row-h: 88 * self.u;
|
|
out property <length> set-row-step: 88 * self.u;
|
|
out property <length> rows-view-h: 7 * self.set-row-step;
|
|
out property <length> rows-scroll: max(0, min(self.set-row - 5, self.set-rows.length - 7)) * self.set-row-step;
|
|
animate rows-scroll { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
|
|
// ---- on-screen keyboard (text and callbacks: keyboard.rs) ----------------
|
|
// Opens in place of the settings content; Rust owns the text and validation.
|
|
in-out property <bool> kb-open: false;
|
|
in property <string> kb-title;
|
|
in property <string> kb-subtitle;
|
|
in property <string> kb-text;
|
|
in property <string> kb-masked;
|
|
in property <string> kb-placeholder;
|
|
in property <string> kb-hint;
|
|
in property <bool> kb-hint-error;
|
|
in property <bool> kb-secret;
|
|
in property <bool> kb-can-submit;
|
|
in property <string> kb-submit-label: "Kész";
|
|
in-out property <bool> kb-reveal: false;
|
|
in-out property <int> kb-mode: 0; // abc, ABC, 123, #+=
|
|
in-out property <int> kb-index: 1;
|
|
in-out property <int> kb-area: 0; // 0 = keys, 1 = chips
|
|
in-out property <int> kb-chip: 0;
|
|
callback kb-type(string);
|
|
callback kb-delete();
|
|
callback kb-clear();
|
|
callback kb-submit();
|
|
callback kb-closed();
|
|
changed kb-open => { if !self.kb-open { root.kb-closed(); } }
|
|
changed settings-open => { if !self.settings-open { self.kb-open = false; } }
|
|
|
|
out property <[string]> kb-keys: self.kb-mode == 1
|
|
? ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
|
|
: self.kb-mode == 2
|
|
? ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", ",", "-", "_", "@", "!", "?", "#", "$", "%", "&", "*"]
|
|
: self.kb-mode == 3
|
|
? ["+", "=", "/", "\\", ":", ";", "'", "\"", "(", ")", "[", "]", "{", "}", "<", ">", "^", "`", "|", "~"]
|
|
: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
|
|
out property <int> kb-n: self.kb-keys.length + 2;
|
|
out property <[string]> kb-chips: [
|
|
"abc", "ABC", ".?123", "#+=",
|
|
self.kb-secret ? (self.kb-reveal ? "Elrejtés" : "Megjelenítés") : "Törlés",
|
|
self.kb-submit-label,
|
|
];
|
|
out property <float> kb-t: self.kb-open ? 1 : 0;
|
|
animate kb-t { duration: 480ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> kb-pos: self.kb-index;
|
|
animate kb-pos { duration: 200ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> kb-cpos: self.kb-chip;
|
|
animate kb-cpos { duration: 300ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> kb-keys-active: (self.kb-open && self.kb-area == 0) ? 1 : 0;
|
|
animate kb-keys-active { duration: 260ms; easing: ease-out; }
|
|
out property <float> kb-chips-active: (self.kb-open && self.kb-area == 1) ? 1 : 0;
|
|
animate kb-chips-active { duration: 260ms; easing: ease-out; }
|
|
// Geometry, mirrored by keyboard::glass.
|
|
out property <length> kb-field-w: 1200 * self.u;
|
|
out property <length> kb-field-h: 96 * self.u;
|
|
out property <length> kb-field-x: self.sp-x + (self.sp-w - self.kb-field-w) / 2;
|
|
out property <length> kb-field-y: self.sp-y + 264 * self.u;
|
|
out property <length> kb-key-w: min(58 * self.u, 1600 * self.u / self.kb-n);
|
|
out property <length> kb-row-x: self.sp-x + (self.sp-w - self.kb-n * self.kb-key-w) / 2;
|
|
out property <length> kb-row-y: self.sp-y + 472 * self.u;
|
|
out property <length> kb-row-h: 120 * self.u;
|
|
out property <length> kb-chip-w: 200 * self.u;
|
|
out property <length> kb-chip-h: 72 * self.u;
|
|
out property <length> kb-chip-step: 216 * self.u;
|
|
out property <length> kb-chip-x: self.sp-x + (self.sp-w - 6 * self.kb-chip-step + 16 * self.u) / 2;
|
|
out property <length> kb-chip-y: self.sp-y + 664 * self.u;
|
|
|
|
function kb-press-key() {
|
|
if root.kb-index == 0 {
|
|
root.kb-type(" ");
|
|
} else if root.kb-index >= root.kb-n - 1 {
|
|
root.kb-delete();
|
|
} else {
|
|
root.kb-type(root.kb-keys[root.kb-index - 1]);
|
|
}
|
|
}
|
|
|
|
function kb-press-chip() {
|
|
if root.kb-chip < 4 {
|
|
root.kb-mode = root.kb-chip;
|
|
root.kb-index = min(root.kb-index, root.kb-keys.length + 1);
|
|
root.kb-area = 0;
|
|
} else if root.kb-chip == 4 {
|
|
if root.kb-secret {
|
|
root.kb-reveal = !root.kb-reveal;
|
|
} else {
|
|
root.kb-clear();
|
|
}
|
|
} else {
|
|
root.kb-submit();
|
|
}
|
|
}
|
|
|
|
callback launch(int);
|
|
callback cancel-launch();
|
|
in property <string> launch-detail: "indítása…";
|
|
|
|
// ---- home grid (tvOS layout; exported so the glass layer can mirror it) ----
|
|
// Five icons per row, the name under each. The first row sits under the
|
|
// Top Shelf; further rows scroll up and the shelf dims.
|
|
out property <length> u: min(self.width / 1920, self.height / 1080);
|
|
out property <int> cols: 5;
|
|
out property <length> row-x: 96 * self.u;
|
|
out property <length> row-y: 760 * self.u;
|
|
out property <length> card-w: 320 * self.u;
|
|
out property <length> card-h: 192 * self.u;
|
|
out property <length> card-gap: 32 * self.u;
|
|
out property <length> row-step: 296 * self.u;
|
|
out property <length> card-r: 36 * self.u;
|
|
// Focused icon lift (tvOS-like) and the press-in while OK is held.
|
|
out property <float> lift: 0.12;
|
|
out property <float> press-in: 0.05;
|
|
|
|
// ---- focus state -----------------------------------------------------
|
|
in-out property <int> focus-index: 0;
|
|
in-out property <bool> sheet-open: false;
|
|
in-out property <bool> launching: false;
|
|
|
|
out property <int> focus-col: Math.mod(self.focus-index, self.cols);
|
|
out property <int> focus-row: Math.floor(self.focus-index / self.cols);
|
|
out property <float> focus-x: self.focus-col;
|
|
animate focus-x { duration: 380ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> focus-y: self.focus-row;
|
|
animate focus-y { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
|
|
out property <float> row-active: (!self.sheet-open && !self.launching && !self.settings-open) ? 1 : 0;
|
|
animate row-active { duration: 320ms; easing: ease-out; }
|
|
|
|
// Row 0: the shelf is showing. Deeper rows: the focused row moves to the middle, the row above stays in view.
|
|
out property <length> grid-scroll: self.focus-row == 0 ? 0 : self.row-y + self.focus-row * self.row-step - 520 * self.u;
|
|
animate grid-scroll { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <float> shelf-t: self.focus-row == 0 ? 1 : 0;
|
|
animate shelf-t { duration: 600ms; easing: ease-in-out; }
|
|
|
|
out property <float> intro: 0;
|
|
animate intro { duration: 1700ms; easing: ease-out; }
|
|
|
|
// ---- OK: short press opens, long press (hold) shows the context menu ----
|
|
in-out property <bool> ok-down: false;
|
|
out property <float> press: (self.ok-down && !self.menu-open) ? 1 : 0;
|
|
animate press { duration: 160ms; easing: ease-out; }
|
|
in-out property <bool> menu-open: false;
|
|
in-out property <int> menu-index: 0;
|
|
out property <float> menu-t: self.menu-open ? 1 : 0;
|
|
animate menu-t { duration: 460ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); }
|
|
out property <float> menu-pos: self.menu-index;
|
|
animate menu-pos { duration: 240ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
out property <[string]> menu-items: ["Megnyitás", "Részletek"];
|
|
hold-timer := Timer {
|
|
interval: 520ms;
|
|
running: false;
|
|
triggered => {
|
|
self.running = false;
|
|
if root.ok-down && root.apps.length > 0 && !root.sheet-open && !root.launching && !root.settings-open {
|
|
root.menu-index = 0;
|
|
root.menu-open = true;
|
|
}
|
|
}
|
|
}
|
|
// Context menu geometry: it buds out of the focused icon (merged glass),
|
|
// above it when there is room, otherwise below.
|
|
property <length> fc-w: self.card-w * (1 + self.lift);
|
|
property <length> fc-h: self.card-h * (1 + self.lift);
|
|
property <length> fc-x: self.row-x + self.focus-col * (self.card-w + self.card-gap) + (self.card-w - self.fc-w) / 2;
|
|
property <length> fc-y: self.row-y + self.focus-row * self.row-step - self.grid-scroll + (self.card-h - self.fc-h) / 2;
|
|
out property <length> menu-w: 432 * self.u;
|
|
out property <length> menu-item-h: 72 * self.u;
|
|
out property <length> menu-pad: 12 * self.u;
|
|
property <length> menu-h: self.menu-items.length * self.menu-item-h + 2 * self.menu-pad;
|
|
property <bool> menu-above: self.fc-y - 32 * self.u - self.menu-h > 64 * self.u;
|
|
property <length> menu-x-end: clamp(self.fc-x, 96 * self.u, self.width - 96 * self.u - self.menu-w);
|
|
property <length> menu-y-end: self.menu-above ? self.fc-y - 32 * self.u - self.menu-h : self.fc-y + self.fc-h + 32 * self.u;
|
|
property <float> me: clamp(self.menu-t, 0, 1.2);
|
|
out property <length> mx: self.fc-x + (self.menu-x-end - self.fc-x) * self.me;
|
|
out property <length> my: self.fc-y + (self.menu-y-end - self.fc-y) * self.me;
|
|
out property <length> mw: self.fc-w + (self.menu-w - self.fc-w) * self.me;
|
|
out property <length> mh: self.fc-h + (self.menu-h - self.fc-h) * self.me;
|
|
property <float> menu-in: clamp((self.menu-t - 0.45) * 2.5, 0, 1);
|
|
|
|
property <float> toast-t: self.toast-shown ? 1 : 0;
|
|
animate toast-t { duration: 520ms; easing: cubic-bezier(0.22, 1.25, 0.36, 1); }
|
|
|
|
out property <float> sheet-t: self.sheet-open ? 1 : 0;
|
|
animate sheet-t { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
|
|
|
out property <float> launch-t: self.launching ? 1 : 0;
|
|
// Moves from the first frame and settles softly; sf-compositor shows the
|
|
// app only once this is nearly done (its MORPH constant).
|
|
animate launch-t { duration: 800ms; easing: cubic-bezier(0.45, 0, 0.15, 1); }
|
|
// Set by Rust once the app window is visible on top.
|
|
in property <bool> app-ready: false;
|
|
|
|
// Launch morph: the focused card's glass grows into a full-screen pane.
|
|
property <float> le: self.launch-t;
|
|
property <length> lc-w: self.fc-w;
|
|
property <length> lc-h: self.fc-h;
|
|
property <length> lc-x: self.fc-x;
|
|
property <length> lc-y: self.fc-y;
|
|
property <length> lm-x: self.lc-x * (1 - self.le);
|
|
property <length> lm-y: self.lc-y * (1 - self.le);
|
|
property <length> lm-w: self.lc-w + (self.width - self.lc-w) * self.le;
|
|
property <length> lm-h: self.lc-h + (self.height - self.lc-h) * self.le;
|
|
// Splash content appears in the second half of the morph.
|
|
property <float> splash: clamp((self.le - 0.55) / 0.45, 0, 1);
|
|
|
|
property <AppEntry> focused: self.apps.length > 0 ? self.apps[self.focus-index] : { name: "Fennec OS" };
|
|
|
|
// The shelf follows the focus as it glides: it fades out halfway between
|
|
// two icons and comes back with the next app's content.
|
|
property <int> hero-col: clamp(Math.round(self.focus-x), 0, self.cols - 1);
|
|
property <int> hero-row: max(0, Math.round(self.focus-y));
|
|
property <int> hero-index: max(0, min(self.apps.length - 1, self.hero-row * self.cols + self.hero-col));
|
|
property <AppEntry> hero: self.apps.length > 0 ? self.apps[self.hero-index] : { name: "Fennec OS" };
|
|
property <float> hero-fade: clamp(1 - 2.4 * max(abs(self.focus-x - self.hero-col), abs(self.focus-y - self.hero-row)), 0, 1);
|
|
property <bool> show-shelf: self.hero.id == self.shelf-app && self.shelf-items.length > 0;
|
|
|
|
property <float> top-in: clamp(self.intro * 2.0 - 0.15, 0, 1);
|
|
// Home content (top bar, shelf) goes away under the screens that cover it.
|
|
property <float> home-vis: self.top-in * (1 - self.launch-t) * (1 - self.sheet-t) * self.dim;
|
|
property <float> shelf-vis: self.home-vis * self.shelf-t * clamp(self.intro * 1.6 - 0.3, 0, 1);
|
|
|
|
// ---- status capsule (right end of the top bar) ----------------------------
|
|
property <length> capsule-h: 64 * self.u;
|
|
property <length> capsule-w: status-row.preferred-width;
|
|
property <length> capsule-x: self.width - 96 * self.u - self.capsule-w;
|
|
property <length> capsule-y: 56 * self.u;
|
|
// The toast buds off the status capsule like a droplet (merged glass).
|
|
property <length> toast-w-end: 640 * self.u;
|
|
property <length> toast-h-end: 72 * self.u;
|
|
property <float> toast-e: clamp(self.toast-t, 0, 1.2);
|
|
property <length> toast-w: self.capsule-w + (self.toast-w-end - self.capsule-w) * clamp(self.toast-e, 0, 1);
|
|
property <length> toast-h: self.capsule-h + (self.toast-h-end - self.capsule-h) * clamp(self.toast-e, 0, 1);
|
|
property <length> toast-x: self.capsule-x + self.capsule-w - self.toast-w;
|
|
property <length> toast-y: self.capsule-y + self.toast-e * (self.capsule-h + 16 * self.u);
|
|
|
|
// ---- pairing pane (pairing.slint draws the content at these offsets) -----
|
|
property <length> pane-w: 1312 * self.u;
|
|
property <length> pane-h: 720 * self.u;
|
|
property <length> pane-x: (self.width - self.pane-w) / 2;
|
|
property <length> pane-y: (self.height - self.pane-h) / 2 + (1 - self.pair-t) * 48 * self.u;
|
|
property <length> pc-x: self.pane-x + 440 * self.u;
|
|
property <length> pc-y: self.pane-y + 88 * self.u;
|
|
property <[length]> pair-steps: [128 * self.u, 200 * self.u, 312 * self.u];
|
|
property <length> pair-pill-y: 480 * self.u;
|
|
property <bool> remote-ok: self.remote-state == "paired" || self.remote-state == "connected";
|
|
property <bool> remote-broken: self.remote-state == "no-adapter";
|
|
property <float> pair-in: self.pair-t * self.pair-t;
|
|
// Launch splash bits.
|
|
property <float> splash-bar: self.splash * (self.app-ready ? 0 : 1);
|
|
animate splash-bar { duration: 300ms; }
|
|
|
|
// ---- details sheet --------------------------------------------------------
|
|
property <length> sheet-w: 720 * self.u;
|
|
property <length> sheet-x: self.width - 64 * self.u - self.sheet-w + (1 - self.sheet-t) * 96 * self.u;
|
|
property <length> sheet-y: 64 * self.u;
|
|
// The sheet fits its content: icon, name, category, description, info rows.
|
|
property <length> sheet-h: self.info-y - self.sheet-y + self.info-rows.length * self.info-row-h + self.sheet-pad;
|
|
property <length> sheet-pad: 56 * self.u;
|
|
property <length> info-row-h: 80 * self.u;
|
|
property <[{k: string, v: string}]> info-rows: self.focused.kind == "service"
|
|
? [{ k: "Működés", v: self.focused.kind-label }, { k: "Verzió", v: self.focused.version }]
|
|
: [{ k: "Verzió", v: self.focused.version }];
|
|
property <length> info-y: self.sheet-y + self.sheet-pad + 296 * self.u + sheet-desc.preferred-height + 48 * self.u;
|
|
|
|
// Drawn below the app cards.
|
|
out property <[GlassRect]> glass-under: [
|
|
// Status capsule and the toast that grows out of it (group 1).
|
|
{
|
|
x: self.capsule-x, y: self.capsule-y, w: self.capsule-w, h: self.capsule-h,
|
|
r: self.capsule-h / 2, focus: 0, alpha: self.home-vis * (1 - self.pair-t), blur: 1.2,
|
|
glow: #ffffff, tint: #ffffff06, group: 1,
|
|
},
|
|
{
|
|
x: self.toast-x, y: self.toast-y, w: self.toast-w, h: self.toast-h,
|
|
r: self.toast-h / 2, focus: 0.35, alpha: clamp(self.toast-t * 3, 0, 1) * (1 - self.launch-t), blur: 1.4,
|
|
glow: self.focused.accent, tint: #ffffff08, group: 1,
|
|
},
|
|
];
|
|
|
|
// Context menu, drawn right after the focused card (same group, so it
|
|
// buds out of the icon like a droplet). Then the selected-item pill.
|
|
out property <[GlassRect]> glass-menu: [
|
|
{
|
|
x: self.mx, y: self.my, w: self.mw, h: self.mh,
|
|
r: self.card-r * (1 + self.lift) + (32 * self.u - self.card-r * (1 + self.lift)) * clamp(self.me, 0, 1),
|
|
focus: 0.12, alpha: clamp(self.menu-t * 3, 0, 1), blur: 3.0,
|
|
glow: self.focused.accent, tint: #0b0c12.with-alpha(0.42), group: 2,
|
|
},
|
|
{
|
|
x: self.mx + self.menu-pad, y: self.my + self.menu-pad + self.menu-pos * self.menu-item-h,
|
|
w: self.mw - 2 * self.menu-pad, h: self.menu-item-h,
|
|
r: self.menu-item-h / 2, focus: 0.6, alpha: self.menu-in, blur: -1,
|
|
glow: #ffffff, tint: #ffffff.with-alpha(0.86),
|
|
},
|
|
];
|
|
|
|
// Drawn above the app cards.
|
|
out property <[GlassRect]> glass-over: [
|
|
{
|
|
x: self.lm-x, y: self.lm-y, w: self.lm-w, h: self.lm-h,
|
|
r: self.card-r * (1 + self.lift) * pow(1 - self.le, 0.7), focus: 1 - 0.7 * self.le,
|
|
alpha: clamp(self.le * 8, 0, 1), blur: 1.6 + 2.6 * self.le,
|
|
glow: self.focused.accent, tint: self.focused.accent.darker(0.75).with-alpha(0.10 + 0.55 * self.le),
|
|
},
|
|
// Splash: loading track, nested on the full-screen glass.
|
|
{
|
|
x: (self.width - 280 * self.u) / 2, y: self.height / 2 + 144 * self.u, w: 280 * self.u, h: 16 * self.u,
|
|
r: 8 * self.u, focus: 0, alpha: self.splash-bar, blur: -1,
|
|
glow: self.focused.accent, tint: #00000030,
|
|
},
|
|
{
|
|
x: self.pane-x, y: self.pane-y,
|
|
w: self.pane-w, h: self.pane-h,
|
|
r: 56 * self.u, focus: 0.2 * self.pair-t, alpha: self.pair-t, blur: 3.8,
|
|
glow: #ff7a35, tint: #0b0c12.with-alpha(0.48),
|
|
},
|
|
// Pairing: step beads, live status pill and the skip chip.
|
|
{
|
|
x: self.pc-x, y: self.pc-y + self.pair-steps[0], w: 48 * self.u, h: 48 * self.u,
|
|
r: 24 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1,
|
|
glow: #ff7a35, tint: #ff7a3526,
|
|
},
|
|
{
|
|
x: self.pc-x, y: self.pc-y + self.pair-steps[1], w: 48 * self.u, h: 48 * self.u,
|
|
r: 24 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1,
|
|
glow: #ff7a35, tint: #ff7a3526,
|
|
},
|
|
{
|
|
x: self.pc-x, y: self.pc-y + self.pair-steps[2], w: 48 * self.u, h: 48 * self.u,
|
|
r: 24 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1,
|
|
glow: #ff7a35, tint: #ff7a3526,
|
|
},
|
|
{
|
|
x: self.pc-x, y: self.pc-y + self.pair-pill-y, w: 520 * self.u, h: 64 * self.u,
|
|
r: 32 * self.u, focus: self.remote-ok ? 0.6 : 0.15, alpha: self.pair-in * (self.remote-ok || self.remote-broken ? 1 : 0), blur: -1,
|
|
glow: self.remote-ok ? #34c759 : self.remote-broken ? #ff9f0a : #ff7a35,
|
|
tint: self.remote-ok ? #34c75940 : self.remote-broken ? #ff9f0a38 : #ffffff0a,
|
|
},
|
|
{
|
|
x: self.pc-x + 544 * self.u, y: self.pc-y + self.pair-pill-y, w: 200 * self.u, h: 64 * self.u,
|
|
r: 32 * self.u, focus: 0, alpha: self.pair-in, blur: -1,
|
|
glow: #ffffff, tint: #ffffff08,
|
|
},
|
|
{
|
|
x: self.sheet-x, y: self.sheet-y, w: self.sheet-w, h: self.sheet-h,
|
|
r: 48 * self.u, focus: 0.15 * self.sheet-t, alpha: self.sheet-t, blur: 3.4,
|
|
glow: self.focused.accent, tint: #0a0b10.with-alpha(0.38),
|
|
},
|
|
// Sheet: the icon tile and one grouped info platter, nested on the sheet.
|
|
{
|
|
x: self.sheet-x + self.sheet-pad, y: self.sheet-y + self.sheet-pad, w: 128 * self.u, h: 128 * self.u,
|
|
r: 36 * self.u, focus: 0.25, alpha: self.sheet-t, blur: -1,
|
|
glow: self.focused.accent, tint: self.focused.accent.darker(0.6).with-alpha(0.12),
|
|
},
|
|
];
|
|
|
|
function open-settings() {
|
|
root.set-area = 0;
|
|
root.settings-open = true;
|
|
root.settings-opened();
|
|
}
|
|
|
|
function menu-choose() {
|
|
root.menu-open = false;
|
|
if root.menu-index == 0 {
|
|
root.activate();
|
|
} else {
|
|
root.sheet-open = true;
|
|
}
|
|
}
|
|
|
|
function activate() {
|
|
if root.apps.length == 0 { return; }
|
|
if root.focused.kind == "builtin" {
|
|
// The store tile opens the settings pane in store mode.
|
|
if root.set-mode != (root.focused.id == "store" ? "store" : "settings") {
|
|
root.set-mode = root.focused.id == "store" ? "store" : "settings";
|
|
root.set-nav = 0;
|
|
}
|
|
root.open-settings();
|
|
} else if root.focused.kind == "service" {
|
|
// Receivers run all the time; the sheet explains how to connect.
|
|
root.sheet-open = true;
|
|
} else {
|
|
root.launching = true;
|
|
root.launch(root.focus-index);
|
|
}
|
|
}
|
|
|
|
keys := FocusScope {
|
|
key-pressed(event) => {
|
|
if root.standby {
|
|
root.wake-requested();
|
|
return accept;
|
|
}
|
|
if root.kb-open {
|
|
// Siri Remote: arrows/swipes move, select types, Back (Esc) cancels.
|
|
// A real keyboard can type directly; Backspace deletes.
|
|
if event.text == Key.Escape {
|
|
root.kb-open = false;
|
|
} else if event.text == Key.Backspace {
|
|
root.kb-delete();
|
|
} else if event.text == Key.Return {
|
|
if root.kb-area == 0 { root.kb-press-key(); } else { root.kb-press-chip(); }
|
|
} else if event.text == Key.LeftArrow {
|
|
if root.kb-area == 0 {
|
|
root.kb-index = root.kb-index <= 0 ? root.kb-n - 1 : root.kb-index - 1;
|
|
} else {
|
|
root.kb-chip = max(0, root.kb-chip - 1);
|
|
}
|
|
} else if event.text == Key.RightArrow {
|
|
if root.kb-area == 0 {
|
|
root.kb-index = root.kb-index >= root.kb-n - 1 ? 0 : root.kb-index + 1;
|
|
} else {
|
|
root.kb-chip = min(5, root.kb-chip + 1);
|
|
}
|
|
} else if event.text == Key.DownArrow {
|
|
if root.kb-area == 0 {
|
|
root.kb-area = 1;
|
|
root.kb-chip = root.kb-can-submit ? 5 : root.kb-mode;
|
|
}
|
|
} else if event.text == Key.UpArrow {
|
|
root.kb-area = 0;
|
|
} else if !event.modifiers.control && !event.modifiers.alt && !event.modifiers.meta {
|
|
root.kb-type(event.text);
|
|
}
|
|
return accept;
|
|
}
|
|
if root.pairing-open {
|
|
if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return {
|
|
root.pairing-open = false;
|
|
root.pairing-skipped = true;
|
|
root.pairing-dismissed();
|
|
}
|
|
return accept;
|
|
}
|
|
if root.launching {
|
|
if event.text == Key.Escape || event.text == Key.Backspace {
|
|
root.launching = false;
|
|
root.cancel-launch();
|
|
}
|
|
return accept;
|
|
}
|
|
if root.settings-open {
|
|
let back = event.text == Key.Escape || event.text == Key.Backspace;
|
|
let ok = event.text == Key.Return || event.text == " ";
|
|
if root.set-area == 0 {
|
|
if event.text == Key.UpArrow {
|
|
root.set-nav = max(0, root.set-nav - 1);
|
|
} else if event.text == Key.DownArrow {
|
|
root.set-nav = min(root.set-nav-count - 1, root.set-nav + 1);
|
|
} else if ok || event.text == Key.RightArrow {
|
|
root.set-area = 1;
|
|
root.set-row = 0;
|
|
} else if back {
|
|
root.settings-open = false;
|
|
}
|
|
} else {
|
|
if event.text == Key.UpArrow {
|
|
root.set-row = max(0, root.set-row - 1);
|
|
} else if event.text == Key.DownArrow {
|
|
root.set-row = min(root.set-rows.length - 1, root.set-row + 1);
|
|
} else if ok {
|
|
root.settings-activate(root.set-row);
|
|
} else if back || event.text == Key.LeftArrow {
|
|
if root.set-sub {
|
|
root.settings-back();
|
|
} else {
|
|
root.set-area = 0;
|
|
}
|
|
}
|
|
}
|
|
return accept;
|
|
}
|
|
if root.sheet-open {
|
|
if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return {
|
|
root.sheet-open = false;
|
|
}
|
|
return accept;
|
|
}
|
|
let ok = event.text == Key.Return || event.text == " ";
|
|
if root.menu-open {
|
|
if event.text == Key.UpArrow {
|
|
root.menu-index = max(0, root.menu-index - 1);
|
|
} else if event.text == Key.DownArrow {
|
|
root.menu-index = min(root.menu-items.length - 1, root.menu-index + 1);
|
|
} else if ok && !event.repeat && !root.ok-down {
|
|
root.menu-choose();
|
|
} else if event.text == Key.Escape || event.text == Key.Backspace {
|
|
root.menu-open = false;
|
|
}
|
|
return accept;
|
|
}
|
|
// Grid: arrows move focus, OK acts on release (short) or after a hold (menu).
|
|
if event.text == Key.LeftArrow {
|
|
if root.focus-col > 0 { root.focus-index -= 1; }
|
|
} else if event.text == Key.RightArrow {
|
|
if root.focus-col < root.cols - 1 && root.focus-index < root.apps.length - 1 { root.focus-index += 1; }
|
|
} else if event.text == Key.DownArrow {
|
|
if root.focus-index + root.cols < root.apps.length {
|
|
root.focus-index += root.cols;
|
|
} else if (root.focus-row + 1) * root.cols < root.apps.length {
|
|
root.focus-index = root.apps.length - 1;
|
|
}
|
|
} else if event.text == Key.UpArrow {
|
|
if root.focus-row > 0 { root.focus-index -= root.cols; }
|
|
} else if event.text == Key.Escape || event.text == Key.Backspace {
|
|
// Back from a lower row jumps to the top (like tvOS).
|
|
if root.focus-row > 0 { root.focus-index = root.focus-col; }
|
|
} else if ok && !event.repeat {
|
|
root.ok-down = true;
|
|
hold-timer.running = false;
|
|
hold-timer.running = true;
|
|
}
|
|
accept
|
|
}
|
|
key-released(event) => {
|
|
if (event.text == Key.Return || event.text == " ") && root.ok-down {
|
|
root.ok-down = false;
|
|
// Released before the hold timer fired: a normal click.
|
|
if hold-timer.running {
|
|
hold-timer.running = false;
|
|
if !root.menu-open && !root.sheet-open && !root.launching && !root.settings-open {
|
|
root.activate();
|
|
}
|
|
}
|
|
return accept;
|
|
}
|
|
reject
|
|
}
|
|
}
|
|
|
|
init => {
|
|
root.intro = 1;
|
|
keys.focus();
|
|
}
|
|
|
|
// ---- top bar: the time on the left ------------------------------------------
|
|
Rectangle {
|
|
x: 96 * root.u;
|
|
y: 44 * root.u;
|
|
width: 720 * root.u;
|
|
height: 136 * root.u;
|
|
opacity: root.home-vis * (1 - root.pair-t);
|
|
Text {
|
|
x: 0;
|
|
y: 0;
|
|
width: parent.width;
|
|
height: 88 * root.u;
|
|
vertical-alignment: center;
|
|
text: root.clock;
|
|
font-size: 64 * root.u;
|
|
font-weight: 600;
|
|
letter-spacing: -1 * root.u;
|
|
color: #ffffff;
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: 84 * root.u;
|
|
width: parent.width;
|
|
text: root.date;
|
|
font-size: 26 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffffb8;
|
|
}
|
|
}
|
|
|
|
// ---- status capsule: remote battery and network --------------------------------
|
|
Rectangle {
|
|
x: root.capsule-x;
|
|
y: root.capsule-y;
|
|
width: root.capsule-w;
|
|
height: root.capsule-h;
|
|
opacity: root.home-vis * (1 - root.pair-t);
|
|
status-row := HorizontalLayout {
|
|
padding-left: 24 * root.u;
|
|
padding-right: 28 * root.u;
|
|
spacing: 12 * root.u;
|
|
|
|
if root.remote-battery >= 0: Rectangle {
|
|
width: 30 * root.u;
|
|
NamedIcon {
|
|
y: (parent.height - self.height) / 2;
|
|
width: 30 * root.u;
|
|
height: 30 * root.u;
|
|
name: "remote";
|
|
ink: root.remote-battery <= 15 ? #ffb340 : #ffffffd0;
|
|
}
|
|
}
|
|
if root.remote-battery >= 0: Text {
|
|
vertical-alignment: center;
|
|
text: root.remote-battery + "%";
|
|
font-size: 24 * root.u;
|
|
font-weight: 600;
|
|
color: root.remote-battery <= 15 ? #ffb340 : #ffffff;
|
|
}
|
|
if root.remote-battery >= 0: Rectangle {
|
|
width: 20 * root.u;
|
|
Rectangle {
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
width: 1.5 * root.u;
|
|
height: 26 * root.u;
|
|
background: #ffffff38;
|
|
}
|
|
}
|
|
Rectangle {
|
|
width: 30 * root.u;
|
|
NamedIcon {
|
|
y: (parent.height - self.height) / 2;
|
|
width: 30 * root.u;
|
|
height: 30 * root.u;
|
|
name: root.net-icon == "wifi" ? "wifi" : root.net-icon == "none" ? "alert" : "wired";
|
|
ink: root.net-icon == "none" ? #ffb340 : #ffffffd0;
|
|
}
|
|
}
|
|
Text {
|
|
vertical-alignment: center;
|
|
text: root.net-label;
|
|
font-size: 24 * root.u;
|
|
font-weight: 500;
|
|
color: root.net-icon == "none" ? #ffb340 : #ffffffd8;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- Top Shelf: Netflex cards ------------------------------------------------
|
|
if root.show-shelf: Rectangle {
|
|
x: 96 * root.u + (1 - root.hero-fade) * 16 * root.u;
|
|
y: 0;
|
|
width: 1728 * root.u;
|
|
height: 720 * root.u;
|
|
opacity: root.shelf-vis * root.hero-fade;
|
|
|
|
Text {
|
|
x: 0;
|
|
y: 268 * root.u;
|
|
width: parent.width;
|
|
text: root.shelf-title;
|
|
font-size: 36 * root.u;
|
|
font-weight: 600;
|
|
color: #ffffff;
|
|
}
|
|
for item[i] in root.shelf-items: Rectangle {
|
|
property <length> cw: 402 * root.u;
|
|
x: i * (self.cw + 40 * root.u);
|
|
y: 336 * root.u;
|
|
width: self.cw;
|
|
height: 226 * root.u;
|
|
visible: i < 4;
|
|
// Shadow under the artwork.
|
|
Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 24 * root.u;
|
|
background: #000000;
|
|
drop-shadow-blur: 28 * root.u;
|
|
drop-shadow-offset-y: 12 * root.u;
|
|
drop-shadow-color: #00000080;
|
|
}
|
|
Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 24 * root.u;
|
|
clip: true;
|
|
background: #ffffff12;
|
|
if item.has-image: Image {
|
|
width: 100%;
|
|
height: 100%;
|
|
source: item.image;
|
|
image-fit: cover;
|
|
}
|
|
if !item.has-image: Text {
|
|
x: 24 * root.u;
|
|
width: parent.width - 48 * root.u;
|
|
height: 100%;
|
|
vertical-alignment: center;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
text: item.title;
|
|
font-size: 32 * root.u;
|
|
font-weight: 700;
|
|
color: #ffffffd0;
|
|
}
|
|
if item.progress > 0: Rectangle {
|
|
y: parent.height - 72 * root.u;
|
|
height: 72 * root.u;
|
|
background: @linear-gradient(180deg, #00000000 0%, #000000a0 100%);
|
|
}
|
|
if item.progress > 0: Rectangle {
|
|
x: 24 * root.u;
|
|
y: parent.height - 26 * root.u;
|
|
width: parent.width - 48 * root.u;
|
|
height: 6 * root.u;
|
|
border-radius: self.height / 2;
|
|
background: #ffffff47;
|
|
Rectangle {
|
|
width: parent.width * clamp(item.progress, 0.04, 1);
|
|
border-radius: self.height / 2;
|
|
background: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: parent.height + 20 * root.u;
|
|
width: parent.width;
|
|
text: item.title;
|
|
font-size: 26 * root.u;
|
|
font-weight: 600;
|
|
color: #ffffff;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: parent.height + 56 * root.u;
|
|
width: parent.width;
|
|
text: item.detail;
|
|
font-size: 22 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffffa6;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- Top Shelf: the focused app itself ---------------------------------------------
|
|
if !root.show-shelf: Rectangle {
|
|
x: 96 * root.u + (1 - root.hero-fade) * 16 * root.u;
|
|
y: 0;
|
|
width: 1400 * root.u;
|
|
height: 720 * root.u;
|
|
opacity: root.shelf-vis * root.hero-fade;
|
|
|
|
Text {
|
|
x: 0;
|
|
y: 260 * root.u;
|
|
width: parent.width;
|
|
text: root.hero.name;
|
|
font-size: 96 * root.u;
|
|
font-weight: 700;
|
|
letter-spacing: -2 * root.u;
|
|
color: #ffffff;
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: 384 * root.u;
|
|
width: 1040 * root.u;
|
|
height: 80 * root.u;
|
|
text: root.hero.description;
|
|
wrap: word-wrap;
|
|
overflow: elide;
|
|
font-size: 28 * root.u;
|
|
color: #ffffffcc;
|
|
}
|
|
HorizontalLayout {
|
|
x: 0;
|
|
y: 512 * root.u;
|
|
height: 40 * root.u;
|
|
alignment: start;
|
|
spacing: 40 * root.u;
|
|
for fact in root.hero.facts: HorizontalLayout {
|
|
spacing: 12 * root.u;
|
|
Rectangle {
|
|
width: 30 * root.u;
|
|
NamedIcon {
|
|
y: (parent.height - self.height) / 2;
|
|
width: 30 * root.u;
|
|
height: 30 * root.u;
|
|
name: fact.icon;
|
|
ink: fact.tone == "ok" ? #5ee07a : fact.tone == "warn" ? #ffb340 : #ffffffc0;
|
|
}
|
|
}
|
|
Text {
|
|
vertical-alignment: center;
|
|
text: fact.text;
|
|
font-size: 26 * root.u;
|
|
font-weight: 500;
|
|
color: fact.tone == "warn" ? #ffc66b : #ffffffe0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- app row: icon cards, the name under each ------------------------------------
|
|
for app[i] in root.apps: Rectangle {
|
|
// Keep these formulas in sync with `card_rects` in src/main.rs.
|
|
property <int> gc: Math.mod(i, root.cols);
|
|
property <int> gr: Math.floor(i / root.cols);
|
|
property <float> f: max(0, 1 - abs(root.focus-x - self.gc)) * max(0, 1 - abs(root.focus-y - self.gr)) * root.row-active;
|
|
property <float> s: 1 + (root.lift - root.press-in * root.press) * self.f;
|
|
property <float> appear: clamp(root.intro * 2.2 - self.gc * 0.12 - self.gr * 0.2 - 0.4, 0, 1);
|
|
property <float> others: (i == root.focus-index ? 1 : 1 - 0.55 * clamp(root.menu-t, 0, 1))
|
|
* (self.gr > 0 ? 1 - root.shelf-t : 1);
|
|
// Slint draws above the glass, so icons under the menu must go away entirely.
|
|
property <bool> under-menu: i != root.focus-index
|
|
&& self.x < root.menu-x-end + root.menu-w && self.x + self.width > root.menu-x-end
|
|
&& self.y < root.menu-y-end + root.menu-h && self.y + self.height + 56 * root.u > root.menu-y-end;
|
|
property <float> covered: self.under-menu ? clamp(root.menu-t * 2, 0, 1) : 0;
|
|
width: root.card-w * self.s;
|
|
height: root.card-h * self.s;
|
|
x: root.row-x + self.gc * (root.card-w + root.card-gap) + (root.card-w - self.width) / 2;
|
|
y: root.row-y + self.gr * root.row-step - root.grid-scroll + (root.card-h - self.height) / 2 + (1 - self.appear) * 60 * root.u;
|
|
opacity: self.appear * self.others * (1 - self.covered) * (1 - root.launch-t) * (1 - root.sheet-t) * root.dim;
|
|
|
|
AppIcon {
|
|
icon: app.icon;
|
|
image: app.image;
|
|
has-image: app.has-image;
|
|
letter: app.initial;
|
|
width: 104 * root.u * parent.s;
|
|
height: self.width;
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
x: (parent.width - self.width) / 2;
|
|
y: parent.height + 16 * root.u;
|
|
width: root.card-w + 24 * root.u;
|
|
horizontal-alignment: center;
|
|
text: app.name;
|
|
font-size: 24 * root.u;
|
|
font-weight: 600;
|
|
color: #ffffff.with-alpha(0.56 + 0.44 * parent.f);
|
|
overflow: elide;
|
|
opacity: 1 - clamp(root.menu-t * 2, 0, 1) * (i == root.focus-index && !root.menu-above ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
// ---- context menu (long press on OK) -------------------------------------
|
|
if root.menu-t > 0.001: Rectangle {
|
|
x: root.mx;
|
|
y: root.my;
|
|
width: root.mw;
|
|
height: root.mh;
|
|
opacity: root.menu-in;
|
|
for item[k] in root.menu-items: Rectangle {
|
|
property <float> sel: max(0, 1 - abs(root.menu-pos - k));
|
|
property <color> ink: self.sel > 0.5 ? #101114 : #ffffff;
|
|
x: root.menu-pad;
|
|
y: root.menu-pad + k * root.menu-item-h;
|
|
width: parent.width - 2 * root.menu-pad;
|
|
height: root.menu-item-h;
|
|
if k == 0: PlayIcon {
|
|
x: 28 * root.u;
|
|
y: (parent.height - self.height) / 2;
|
|
width: 26 * root.u;
|
|
height: 26 * root.u;
|
|
ink: parent.ink;
|
|
}
|
|
if k == 1: InfoIcon {
|
|
x: 27 * root.u;
|
|
y: (parent.height - self.height) / 2;
|
|
width: 28 * root.u;
|
|
height: 28 * root.u;
|
|
ink: parent.ink;
|
|
}
|
|
Text {
|
|
x: 76 * root.u;
|
|
width: parent.width - 96 * root.u;
|
|
height: parent.height;
|
|
vertical-alignment: center;
|
|
text: item;
|
|
color: parent.ink;
|
|
font-size: 26 * root.u;
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- details sheet ---------------------------------------------------------
|
|
Rectangle {
|
|
x: root.sheet-x;
|
|
y: root.sheet-y;
|
|
width: root.sheet-w;
|
|
height: root.sheet-h;
|
|
opacity: root.sheet-t;
|
|
|
|
AppIcon {
|
|
x: root.sheet-pad + (128 * root.u - self.width) / 2;
|
|
y: root.sheet-pad + (128 * root.u - self.height) / 2;
|
|
width: 84 * root.u;
|
|
height: 84 * root.u;
|
|
icon: root.focused.icon;
|
|
image: root.focused.image;
|
|
has-image: root.focused.has-image;
|
|
letter: root.focused.initial;
|
|
}
|
|
Text {
|
|
x: root.sheet-pad;
|
|
y: root.sheet-pad + 160 * root.u;
|
|
width: parent.width - 2 * root.sheet-pad;
|
|
text: root.focused.name;
|
|
font-weight: 700;
|
|
font-size: 60 * root.u;
|
|
letter-spacing: -1.2 * root.u;
|
|
color: #ffffff;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
x: root.sheet-pad;
|
|
y: root.sheet-pad + 240 * root.u;
|
|
width: parent.width - 2 * root.sheet-pad;
|
|
text: root.focused.category;
|
|
font-size: 24 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffff99;
|
|
overflow: elide;
|
|
}
|
|
sheet-desc := Text {
|
|
x: root.sheet-pad;
|
|
y: root.sheet-pad + 296 * root.u;
|
|
width: parent.width - 2 * root.sheet-pad;
|
|
text: root.focused.description;
|
|
wrap: word-wrap;
|
|
font-size: 28 * root.u;
|
|
color: #ffffffd8;
|
|
}
|
|
|
|
// Info rows straight on the sheet, a hairline above each.
|
|
for row[k] in root.info-rows: Rectangle {
|
|
x: root.sheet-pad;
|
|
y: root.info-y - root.sheet-y + k * root.info-row-h;
|
|
width: parent.width - 2 * root.sheet-pad;
|
|
height: root.info-row-h;
|
|
Rectangle {
|
|
x: 0;
|
|
y: 0;
|
|
width: parent.width;
|
|
height: 1.5 * root.u;
|
|
background: #ffffff24;
|
|
}
|
|
Text {
|
|
x: 0;
|
|
width: 180 * root.u;
|
|
height: parent.height;
|
|
vertical-alignment: center;
|
|
text: row.k;
|
|
font-size: 24 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffffa0;
|
|
}
|
|
Text {
|
|
x: 180 * root.u;
|
|
width: parent.width - 180 * root.u;
|
|
height: parent.height;
|
|
vertical-alignment: center;
|
|
horizontal-alignment: right;
|
|
text: row.v;
|
|
font-size: 24 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffff;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- settings screen ------------------------------------------------------
|
|
if root.set-t > 0.001 && root.kb-t < 0.999: SettingsView {
|
|
width: 100%;
|
|
height: 100%;
|
|
opacity: root.set-t * (1 - root.kb-t);
|
|
u: root.u;
|
|
pane-x: root.sp-x;
|
|
pane-y: root.sp-y;
|
|
pane-h: root.sp-h;
|
|
nav-x: root.nav-x;
|
|
nav-y: root.nav-y;
|
|
nav-w: root.nav-w;
|
|
nav-h: root.nav-h;
|
|
nav-step: root.nav-step;
|
|
rows-x: root.rows-x;
|
|
rows-y: root.rows-y;
|
|
rows-w: root.rows-w;
|
|
row-h: root.set-row-h;
|
|
row-step: root.set-row-step;
|
|
rows-view-h: root.rows-view-h;
|
|
rows-scroll: root.rows-scroll;
|
|
nav-pos: root.nav-pos;
|
|
nav-active: root.nav-active;
|
|
row-pos: root.row-pos;
|
|
content-active: root.content-active;
|
|
title: root.set-title;
|
|
subtitle: root.set-subtitle;
|
|
rows: root.set-rows;
|
|
categories: root.set-categories;
|
|
heading: root.set-mode == "store" ? "App Store" : "Beállítások";
|
|
icon-base: root.set-mode == "store" ? 6 : 0;
|
|
}
|
|
|
|
// ---- on-screen keyboard ---------------------------------------------------------
|
|
if root.kb-t > 0.001: KeyboardView {
|
|
width: 100%;
|
|
height: 100%;
|
|
opacity: root.kb-t * root.set-t;
|
|
u: root.u;
|
|
pane-x: root.sp-x;
|
|
pane-y: root.sp-y;
|
|
pane-w: root.sp-w;
|
|
pane-h: root.sp-h;
|
|
field-x: root.kb-field-x;
|
|
field-y: root.kb-field-y;
|
|
field-w: root.kb-field-w;
|
|
field-h: root.kb-field-h;
|
|
row-x: root.kb-row-x;
|
|
row-y: root.kb-row-y;
|
|
row-h: root.kb-row-h;
|
|
key-w: root.kb-key-w;
|
|
chip-x: root.kb-chip-x;
|
|
chip-y: root.kb-chip-y;
|
|
chip-w: root.kb-chip-w;
|
|
chip-h: root.kb-chip-h;
|
|
chip-step: root.kb-chip-step;
|
|
keys: root.kb-keys;
|
|
chips: root.kb-chips;
|
|
mode: root.kb-mode;
|
|
pos: root.kb-pos;
|
|
cpos: root.kb-cpos;
|
|
keys-active: root.kb-keys-active;
|
|
chips-active: root.kb-chips-active;
|
|
title: root.kb-title;
|
|
subtitle: root.kb-subtitle;
|
|
shown-text: (root.kb-secret && !root.kb-reveal) ? root.kb-masked : root.kb-text;
|
|
placeholder: root.kb-placeholder;
|
|
hint: root.kb-hint;
|
|
hint-error: root.kb-hint-error;
|
|
can-submit: root.kb-can-submit;
|
|
}
|
|
|
|
// ---- remote pairing guide -------------------------------------------------
|
|
if root.pair-t > 0.001: PairingGuide {
|
|
x: root.pane-x;
|
|
y: root.pane-y;
|
|
width: root.pane-w;
|
|
height: root.pane-h;
|
|
u: root.u;
|
|
state: root.remote-state;
|
|
content-x: root.pc-x - root.pane-x;
|
|
content-y: root.pc-y - root.pane-y;
|
|
steps: root.pair-steps;
|
|
pill-y: root.pair-pill-y;
|
|
opacity: root.pair-t;
|
|
}
|
|
|
|
// ---- launch splash -------------------------------------------------------
|
|
if root.launch-t > 0.001: Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
// The app icon flies from its card to the center and grows.
|
|
AppIcon {
|
|
property <length> size: (104 * (1 + root.lift) + 80 * root.le) * root.u;
|
|
property <length> cx: (root.lc-x + root.lc-w / 2) * (1 - root.le) + (parent.width / 2) * root.le;
|
|
property <length> cy: (root.lc-y + root.lc-h / 2) * (1 - root.le) + (parent.height / 2 - 48 * root.u) * root.le;
|
|
icon: root.focused.icon;
|
|
image: root.focused.image;
|
|
has-image: root.focused.has-image;
|
|
letter: root.focused.initial;
|
|
width: self.size;
|
|
height: self.size;
|
|
x: self.cx - self.size / 2;
|
|
y: self.cy - self.size / 2;
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: parent.height / 2 + 72 * root.u + (1 - root.splash) * 16 * root.u;
|
|
width: parent.width;
|
|
horizontal-alignment: center;
|
|
text: root.focused.name;
|
|
font-weight: 700;
|
|
font-size: 48 * root.u;
|
|
letter-spacing: -0.8 * root.u;
|
|
color: #ffffff;
|
|
opacity: root.splash;
|
|
}
|
|
// Indeterminate shimmer while the app loads (inside the glass track).
|
|
Rectangle {
|
|
property <float> phase: mod(animation-tick() / 1400ms, 1);
|
|
x: (parent.width - self.width) / 2;
|
|
y: parent.height / 2 + 149 * root.u;
|
|
width: 264 * root.u;
|
|
height: 6 * root.u;
|
|
border-radius: self.height / 2;
|
|
clip: true;
|
|
opacity: root.splash-bar;
|
|
Rectangle {
|
|
x: (parent.width + self.width) * parent.phase - self.width;
|
|
width: 90 * root.u;
|
|
height: parent.height;
|
|
border-radius: self.height / 2;
|
|
background: @linear-gradient(90deg, #ffffff00 0%, root.focused.accent.brighter(0.6) 50%, #ffffff00 100%);
|
|
}
|
|
}
|
|
Text {
|
|
x: 0;
|
|
y: parent.height - 64 * root.u - 32 * root.u;
|
|
width: parent.width;
|
|
height: 32 * root.u;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
text: "A Vissza gombbal bezárhatod";
|
|
font-size: 22 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffff8c;
|
|
opacity: root.splash;
|
|
}
|
|
}
|
|
|
|
// ---- toast ---------------------------------------------------------
|
|
Rectangle {
|
|
x: root.toast-x;
|
|
y: root.toast-y;
|
|
width: root.toast-w;
|
|
height: root.toast-h;
|
|
opacity: clamp((root.toast-t - 0.55) * 2.5, 0, 1);
|
|
Rectangle {
|
|
x: 28 * root.u;
|
|
y: (parent.height - self.height) / 2;
|
|
width: 12 * root.u;
|
|
height: 12 * root.u;
|
|
border-radius: self.width / 2;
|
|
background: root.focused.accent.brighter(0.3);
|
|
}
|
|
Text {
|
|
x: 56 * root.u;
|
|
width: parent.width - 84 * root.u;
|
|
height: parent.height;
|
|
vertical-alignment: center;
|
|
text: root.toast-text;
|
|
font-size: 24 * root.u;
|
|
font-weight: 500;
|
|
color: #ffffff;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
|
|
// ---- standby -------------------------------------------------------------
|
|
if root.standby-t > 0.001: Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #000000;
|
|
opacity: root.standby-t;
|
|
// Only seen if the TV signal stays on (or in dev mode).
|
|
Text {
|
|
width: 100%;
|
|
height: 100%;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
text: "Készenlét · nyomj meg egy gombot";
|
|
font-size: 24 * root.u;
|
|
color: #ffffff38;
|
|
}
|
|
}
|
|
}
|