All checks were successful
release / release (push) Successful in 12m14s
Rust + Slint on sf-ui's Liquid Glass, with the page engine of Netflex TV. librespot plays (GStreamer on the TV) and makes the TV a Spotify Connect device; the Web API (token from the session) feeds the pages. - Sign-in with the phone: a pairing code / QR code (spotify.com/pair, OAuth device flow) or picking the TV in the Spotify app (zeroconf). - Home, search, library, playlist / album / liked songs / podcast pages, artist pages, settings; the user's picture top right. - Now playing: seek, shuffle, repeat, like, synced lyrics, queue. - package.sh builds x86-64 and aarch64 (Raspberry Pi); the Gitea CI releases both on a tag. - tools/mock_server.py and SPOTIFY_MOCK for work without an account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
245 lines
7.8 KiB
Plaintext
245 lines
7.8 KiB
Plaintext
// Sign-in from the phone (Spotify Connect), the text input overlay (on a
|
|
// modal glass pane with the on-screen keyboard) and a plain message screen.
|
|
|
|
import { Tv, GlassRect, GlassPane, Keyboard, Spinner, Display, Title, Body, Label, Caption, Icon } from "@sf-ui/sf-ui.slint";
|
|
import { SpIcon } from "icons.slint";
|
|
|
|
// Sign-in, two ways: a pairing code (QR code or spotify.com/pair) or this
|
|
// TV picked in the Spotify app on the phone (Spotify Connect).
|
|
export component ConnectScreen inherits Rectangle {
|
|
in property <float> alpha: 1;
|
|
in property <string> device;
|
|
in property <string> code;
|
|
in property <image> qr;
|
|
in property <bool> busy;
|
|
in property <string> error;
|
|
|
|
pane := GlassPane {
|
|
x: (root.width - self.width) / 2;
|
|
y: (root.height - self.height) / 2 - 20 * Tv.u;
|
|
width: 1640 * Tv.u;
|
|
height: 760 * Tv.u;
|
|
radius: 56 * Tv.u;
|
|
frost: 3.6;
|
|
tint: Tv.smoke.with-alpha(0.46);
|
|
glow: #1ed760;
|
|
alpha: root.alpha;
|
|
|
|
// ---- left: title and the two ways ----
|
|
VerticalLayout {
|
|
x: 80 * Tv.u;
|
|
y: 72 * Tv.u;
|
|
width: 860 * Tv.u;
|
|
height: parent.height - 144 * Tv.u;
|
|
spacing: 18 * Tv.u;
|
|
opacity: root.alpha;
|
|
HorizontalLayout {
|
|
spacing: 24 * Tv.u;
|
|
alignment: start;
|
|
Rectangle {
|
|
width: 80 * Tv.u;
|
|
height: 80 * Tv.u;
|
|
border-radius: self.width / 2;
|
|
background: #1ed760;
|
|
SpIcon {
|
|
name: "audio";
|
|
size: 44 * Tv.u;
|
|
ink: #121317;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Title { text: "Jelentkezz be a telefonoddal"; }
|
|
Caption { text: "Spotify Premium fiók kell hozzá"; }
|
|
}
|
|
}
|
|
Rectangle { height: 14 * Tv.u; }
|
|
Text {
|
|
text: "QR-KÓDDAL";
|
|
font-size: 20 * Tv.u;
|
|
font-weight: 700;
|
|
letter-spacing: 3 * Tv.u;
|
|
color: #1ed760;
|
|
}
|
|
Body {
|
|
text: "Olvasd be a kódot a telefon kamerájával, és jelentkezz be. Vagy nyisd meg a spotify.com/pair oldalt, és írd be a kódot.";
|
|
font-size: 26 * Tv.u;
|
|
color: Tv.text;
|
|
}
|
|
Rectangle { height: 10 * Tv.u; }
|
|
Text {
|
|
text: "A SPOTIFY APPBÓL";
|
|
font-size: 20 * Tv.u;
|
|
font-weight: 700;
|
|
letter-spacing: 3 * Tv.u;
|
|
color: #1ed760;
|
|
}
|
|
Body {
|
|
text: "Ha a telefon ugyanazon a Wi-Fin van: indíts el egy számot, koppints az eszközök ikonjára, és válaszd: „" + root.device + "”.";
|
|
font-size: 26 * Tv.u;
|
|
color: Tv.text;
|
|
}
|
|
Rectangle { }
|
|
HorizontalLayout {
|
|
spacing: 16 * Tv.u;
|
|
alignment: start;
|
|
height: 48 * Tv.u;
|
|
Spinner { size: 40 * Tv.u; }
|
|
Label {
|
|
vertical-alignment: center;
|
|
text: root.busy ? "Bejelentkezés…" : root.error != "" ? root.error : "Várakozás a telefonra…";
|
|
color: root.error != "" && !root.busy ? Tv.warn-ink : Tv.text-secondary;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- right: the QR code and the code ----
|
|
qr-box := Rectangle {
|
|
x: parent.width - self.width - 96 * Tv.u;
|
|
y: 80 * Tv.u;
|
|
width: 440 * Tv.u;
|
|
height: 440 * Tv.u;
|
|
border-radius: 28 * Tv.u;
|
|
background: #ffffff;
|
|
opacity: root.alpha;
|
|
clip: true;
|
|
if root.qr.width > 0: Image {
|
|
x: 20 * Tv.u;
|
|
y: 20 * Tv.u;
|
|
width: parent.width - 40 * Tv.u;
|
|
height: parent.height - 40 * Tv.u;
|
|
source: root.qr;
|
|
image-rendering: pixelated;
|
|
}
|
|
if root.qr.width == 0: Spinner {
|
|
size: 64 * Tv.u;
|
|
ink: #121317;
|
|
}
|
|
}
|
|
Text {
|
|
x: qr-box.x;
|
|
y: qr-box.y + qr-box.height + 28 * Tv.u;
|
|
width: qr-box.width;
|
|
horizontal-alignment: center;
|
|
text: "spotify.com/pair";
|
|
font-size: 24 * Tv.u;
|
|
font-weight: 600;
|
|
color: Tv.text-secondary;
|
|
opacity: root.alpha;
|
|
}
|
|
Text {
|
|
x: qr-box.x;
|
|
y: qr-box.y + qr-box.height + 66 * Tv.u;
|
|
width: qr-box.width;
|
|
horizontal-alignment: center;
|
|
text: root.code;
|
|
font-size: 64 * Tv.u;
|
|
font-weight: 700;
|
|
letter-spacing: 10 * Tv.u;
|
|
color: Tv.text;
|
|
opacity: root.alpha;
|
|
}
|
|
}
|
|
Caption {
|
|
x: pane.x;
|
|
y: pane.y + pane.height + 28 * Tv.u;
|
|
width: pane.width;
|
|
horizontal-alignment: center;
|
|
text: "Vissza: kilépés";
|
|
opacity: root.alpha;
|
|
}
|
|
|
|
out property <[GlassRect]> glass: [pane.glass];
|
|
}
|
|
|
|
// A text field over everything (the TV's name...).
|
|
export component InputScreen inherits Rectangle {
|
|
in property <float> alpha: 1;
|
|
in property <string> title;
|
|
in property <string> subtitle;
|
|
in property <string> placeholder;
|
|
in property <string> submit-label: "Kész";
|
|
in property <int> min-length: 1;
|
|
in-out property <string> text;
|
|
in-out property <string> error;
|
|
callback submitted(string);
|
|
callback cancelled();
|
|
|
|
public function key(event: KeyEvent) -> EventResult {
|
|
kb.key(event)
|
|
}
|
|
|
|
public function reset() {
|
|
kb.reset();
|
|
}
|
|
|
|
pane := GlassPane {
|
|
x: (root.width - self.width) / 2;
|
|
y: (root.height - self.height) / 2 - 24 * Tv.u;
|
|
width: 1720 * Tv.u;
|
|
height: 720 * Tv.u;
|
|
radius: 56 * Tv.u;
|
|
frost: 3.8;
|
|
tint: Tv.smoke.with-alpha(0.48);
|
|
glow: #1ed760;
|
|
alpha: root.alpha;
|
|
kb := Keyboard {
|
|
x: 0;
|
|
y: 72 * Tv.u;
|
|
width: parent.width;
|
|
title: root.title;
|
|
subtitle: root.subtitle;
|
|
placeholder: root.placeholder;
|
|
submit-label: root.submit-label;
|
|
min-length: root.min-length;
|
|
max-length: 60;
|
|
alpha: root.alpha;
|
|
active: true;
|
|
text <=> root.text;
|
|
error <=> root.error;
|
|
submitted(t) => { root.submitted(t); }
|
|
cancelled => { root.cancelled(); }
|
|
}
|
|
}
|
|
|
|
out property <[GlassRect]> glass: [pane.glass];
|
|
out property <[GlassRect]> glass-keyboard: kb.glass;
|
|
}
|
|
|
|
// Loading and errors.
|
|
export component MessageScreen inherits Rectangle {
|
|
in property <float> alpha: 1;
|
|
in property <bool> busy;
|
|
in property <string> title;
|
|
in property <string> text;
|
|
|
|
VerticalLayout {
|
|
x: Tv.safe-x;
|
|
width: root.width - 2 * Tv.safe-x;
|
|
y: 340 * Tv.u;
|
|
height: 400 * Tv.u;
|
|
spacing: 24 * Tv.u;
|
|
alignment: start;
|
|
opacity: root.alpha;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
if root.busy: Spinner { size: 72 * Tv.u; }
|
|
if !root.busy: Icon { name: "warning"; size: 64 * Tv.u; ink: Tv.warn-ink; }
|
|
}
|
|
Title {
|
|
horizontal-alignment: center;
|
|
text: root.title;
|
|
}
|
|
Label {
|
|
horizontal-alignment: center;
|
|
text: root.text;
|
|
wrap: word-wrap;
|
|
}
|
|
Caption {
|
|
horizontal-alignment: center;
|
|
text: root.busy ? "" : "Újrapróbálkozik magától. Vissza: kilépés";
|
|
}
|
|
}
|
|
}
|