// Sign-in with a phone: a QR code and the code to type at // youtube.com/activate, on a modal glass pane. Rust polls YouTube until the // user confirms (src/app.rs, sign_in). Back cancels; OK asks for a new code // after an error. import { Tv, GlassRect, GlassPane, Spinner, Title, Label, Caption, Icon } from "@sf-ui/sf-ui.slint"; export component LinkScreen inherits Rectangle { in property alpha: 1; in property qr; in property code; in property url; in property status; in property busy; pane := GlassPane { x: (root.width - self.width) / 2; y: (root.height - self.height) / 2; width: 1500 * Tv.u; height: 700 * Tv.u; radius: 56 * Tv.u; frost: 3.8; tint: Tv.smoke.with-alpha(0.5); glow: #ff0033; alpha: root.alpha; // The QR code on a white card (Slint over glass is fine: it sits on // the pane, nothing glass is under it). Rectangle { x: 80 * Tv.u; y: (parent.height - self.height) / 2; width: 460 * Tv.u; height: 460 * Tv.u; border-radius: 28 * Tv.u; background: #ffffff; opacity: root.alpha; if root.qr.width > 0: Image { 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; } } VerticalLayout { x: 620 * Tv.u; y: 96 * Tv.u; width: parent.width - 700 * Tv.u; height: parent.height - 160 * Tv.u; spacing: 22 * Tv.u; alignment: start; opacity: root.alpha; Title { text: "Bejelentkezés a YouTube-ba"; } Label { text: "1. Olvasd be a QR-kódot a telefonoddal, vagy nyisd meg ezt az oldalt:"; wrap: word-wrap; color: Tv.text-secondary; } Text { text: root.url == "" ? "youtube.com/activate" : root.url; font-size: 34 * Tv.u; font-weight: 700; color: Tv.text; } Label { text: "2. Írd be ezt a kódot, és válaszd ki a fiókodat:"; wrap: word-wrap; color: Tv.text-secondary; } Text { text: root.code == "" ? "…" : root.code; font-size: 72 * Tv.u; font-weight: 800; letter-spacing: 6 * Tv.u; color: #ffffff; } HorizontalLayout { spacing: 16 * Tv.u; alignment: start; if root.busy: Spinner { size: 36 * Tv.u; } if !root.busy: Icon { name: "warning"; size: 34 * Tv.u; ink: Tv.warn-ink; } Caption { vertical-alignment: center; text: root.status; wrap: word-wrap; } } } Caption { x: 620 * Tv.u; y: parent.height - 72 * Tv.u; text: "Vissza: mégse"; opacity: root.alpha; } } out property <[GlassRect]> glass: [pane.glass]; }