319 lines
10 KiB
Plaintext
319 lines
10 KiB
Plaintext
// First-run pairing guide for the Apple Siri Remote. The frosted pane behind
|
||
// it is drawn by the glass layer (see `glass-over` in app.slint).
|
||
|
||
// Pulsing ring that draws the eye to a button.
|
||
component Pulse inherits Rectangle {
|
||
in property <length> size;
|
||
in property <color> tint;
|
||
in property <duration> delay;
|
||
property <float> phase: mod((animation-tick() + root.delay) / 1400ms, 1);
|
||
width: self.size * (1 + 0.9 * self.phase);
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
border-width: 3px;
|
||
border-color: root.tint.with-alpha(0.9 * (1 - self.phase));
|
||
background: root.tint.with-alpha(0.18 * (1 - self.phase));
|
||
}
|
||
|
||
component RemoteButton inherits Rectangle {
|
||
in property <length> u;
|
||
in property <string> glyph;
|
||
in property <bool> hot;
|
||
in property <color> accent;
|
||
width: 52 * self.u;
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
background: self.hot ? #2a2a2e : #1b1b1d;
|
||
drop-shadow-blur: 3 * self.u;
|
||
drop-shadow-color: #00000080;
|
||
drop-shadow-offset-y: 1 * self.u;
|
||
if root.hot: Pulse {
|
||
size: root.width;
|
||
tint: root.accent;
|
||
x: (parent.width - self.width) / 2;
|
||
y: (parent.height - self.height) / 2;
|
||
}
|
||
if root.hot: Pulse {
|
||
size: root.width;
|
||
tint: root.accent;
|
||
delay: 700ms;
|
||
x: (parent.width - self.width) / 2;
|
||
y: (parent.height - self.height) / 2;
|
||
}
|
||
Text {
|
||
text: root.glyph;
|
||
color: root.hot ? root.accent.brighter(0.5) : #e8e8ea;
|
||
font-size: 24 * root.u;
|
||
font-weight: 600;
|
||
horizontal-alignment: center;
|
||
vertical-alignment: center;
|
||
}
|
||
}
|
||
|
||
// Apple Siri Remote (2nd gen, aluminium), drawn front-on.
|
||
export component SiriRemote inherits Rectangle {
|
||
in property <length> u;
|
||
in property <color> accent;
|
||
width: 150 * self.u;
|
||
height: 560 * self.u;
|
||
border-radius: 44 * self.u;
|
||
background: @linear-gradient(90deg, #8d929a 0%, #d9dde2 22%, #f1f3f5 45%, #c6cad0 75%, #959aa2 100%);
|
||
drop-shadow-blur: 30 * self.u;
|
||
drop-shadow-color: #000000a0;
|
||
drop-shadow-offset-y: 16 * self.u;
|
||
|
||
// Siri button on the right edge.
|
||
Rectangle {
|
||
x: parent.width - 2 * root.u;
|
||
y: 200 * root.u;
|
||
width: 5 * root.u;
|
||
height: 46 * root.u;
|
||
border-radius: 2 * root.u;
|
||
background: #8b9097;
|
||
}
|
||
// Power button.
|
||
Rectangle {
|
||
x: parent.width - 34 * root.u;
|
||
y: 16 * root.u;
|
||
width: 18 * root.u;
|
||
height: 18 * root.u;
|
||
border-radius: self.width / 2;
|
||
background: #1b1b1d;
|
||
Text {
|
||
text: "⏻";
|
||
color: #d0d0d4;
|
||
font-size: 11 * root.u;
|
||
horizontal-alignment: center;
|
||
vertical-alignment: center;
|
||
}
|
||
}
|
||
// Clickpad: outer touch ring and center.
|
||
Rectangle {
|
||
x: (parent.width - self.width) / 2;
|
||
y: 44 * root.u;
|
||
width: 128 * root.u;
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
background: @radial-gradient(circle, #2b2c30 0%, #1a1b1d 100%);
|
||
Rectangle {
|
||
x: (parent.width - self.width) / 2;
|
||
y: (parent.height - self.height) / 2;
|
||
width: 64 * root.u;
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
background: #232427;
|
||
border-width: 1px;
|
||
border-color: #ffffff14;
|
||
}
|
||
for d in [{ x: 0.5, y: 0.1 }, { x: 0.5, y: 0.9 }, { x: 0.1, y: 0.5 }, { x: 0.9, y: 0.5 }]: Rectangle {
|
||
x: parent.width * d.x - 2.5 * root.u;
|
||
y: parent.height * d.y - 2.5 * root.u;
|
||
width: 5 * root.u;
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
background: #ffffff60;
|
||
}
|
||
}
|
||
|
||
// Button grid below the clickpad.
|
||
property <length> col1: 18 * root.u;
|
||
property <length> col2: root.width - 18 * root.u - 52 * root.u;
|
||
RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 200 * root.u; glyph: "‹"; hot: true; }
|
||
RemoteButton { u: root.u; accent: root.accent; x: root.col2; y: 200 * root.u; glyph: "▭"; }
|
||
RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 268 * root.u; glyph: "⏯"; }
|
||
RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 336 * root.u; glyph: "🔇"; }
|
||
// Volume rocker: + is the one to hold.
|
||
Rectangle {
|
||
x: root.col2;
|
||
y: 268 * root.u;
|
||
width: 52 * root.u;
|
||
height: 120 * root.u;
|
||
border-radius: self.width / 2;
|
||
background: #1b1b1d;
|
||
RemoteButton {
|
||
u: root.u;
|
||
accent: root.accent;
|
||
x: 0;
|
||
y: 0;
|
||
glyph: "+";
|
||
hot: true;
|
||
background: transparent;
|
||
}
|
||
Text {
|
||
y: parent.height - 52 * root.u;
|
||
width: parent.width;
|
||
height: 52 * root.u;
|
||
text: "−";
|
||
color: #e8e8ea;
|
||
font-size: 24 * root.u;
|
||
horizontal-alignment: center;
|
||
vertical-alignment: center;
|
||
}
|
||
}
|
||
}
|
||
|
||
component Step inherits Rectangle {
|
||
in property <length> u;
|
||
in property <int> n;
|
||
in property <string> label;
|
||
in property <color> accent;
|
||
height: 70 * self.u;
|
||
Rectangle {
|
||
x: 0;
|
||
y: 4 * root.u;
|
||
width: 40 * root.u;
|
||
height: self.width;
|
||
// The glass bead behind the number is drawn by the glass layer (app.slint).
|
||
Text {
|
||
text: root.n;
|
||
color: root.accent.brighter(0.6);
|
||
font-size: 20 * root.u;
|
||
font-weight: 700;
|
||
horizontal-alignment: center;
|
||
vertical-alignment: center;
|
||
}
|
||
}
|
||
Text {
|
||
x: 60 * root.u;
|
||
y: 10 * root.u;
|
||
width: parent.width - 60 * root.u;
|
||
text: root.label;
|
||
wrap: word-wrap;
|
||
font-size: 24 * root.u;
|
||
color: #ffffffd8;
|
||
}
|
||
}
|
||
|
||
// Pane content; `state` is the remote status from sf-remote.
|
||
export component PairingGuide inherits Rectangle {
|
||
in property <length> u;
|
||
in property <string> state;
|
||
in property <color> accent: #ff7a35;
|
||
property <bool> ok: self.state == "paired" || self.state == "connected";
|
||
property <bool> broken: self.state == "no-adapter";
|
||
|
||
SiriRemote {
|
||
u: root.u;
|
||
accent: root.accent;
|
||
x: 120 * root.u;
|
||
y: (parent.height - self.height) / 2;
|
||
}
|
||
|
||
Rectangle {
|
||
x: 420 * root.u;
|
||
y: 70 * root.u;
|
||
width: parent.width - 420 * root.u - 80 * root.u;
|
||
height: parent.height - 140 * root.u;
|
||
|
||
Text {
|
||
x: 0;
|
||
y: 0;
|
||
text: "ELSŐ LÉPÉS";
|
||
font-size: 20 * root.u;
|
||
font-weight: 600;
|
||
letter-spacing: 3 * root.u;
|
||
color: root.accent.brighter(0.3);
|
||
}
|
||
Text {
|
||
x: 0;
|
||
y: 34 * root.u;
|
||
width: parent.width;
|
||
text: "Párosítsd a Siri Remote-ot";
|
||
wrap: word-wrap;
|
||
font-family: "Inter Display";
|
||
font-weight: 800;
|
||
font-size: 58 * root.u;
|
||
letter-spacing: -1.6 * root.u;
|
||
color: #ffffff;
|
||
}
|
||
Step {
|
||
u: root.u;
|
||
accent: root.accent;
|
||
x: 0;
|
||
y: 150 * root.u;
|
||
width: parent.width;
|
||
n: 1;
|
||
label: "Vidd a távirányítót a TV közelébe.";
|
||
}
|
||
Step {
|
||
u: root.u;
|
||
accent: root.accent;
|
||
x: 0;
|
||
y: 226 * root.u;
|
||
width: parent.width;
|
||
n: 2;
|
||
label: "Tartsd nyomva egyszerre a Vissza (‹) és a Hangerő + gombot kb. 5 másodpercig.";
|
||
}
|
||
Step {
|
||
u: root.u;
|
||
accent: root.accent;
|
||
x: 0;
|
||
y: 330 * root.u;
|
||
width: parent.width;
|
||
n: 3;
|
||
label: "Engedd el. A TV magától megtalálja és párosítja.";
|
||
}
|
||
|
||
// Live status.
|
||
Rectangle {
|
||
x: 0;
|
||
y: parent.height - 70 * root.u;
|
||
width: 520 * root.u;
|
||
height: 64 * root.u;
|
||
// Glass pill (tinted by state) is drawn by the glass layer (app.slint).
|
||
|
||
// Searching: three breathing dots. Done: check mark. Error: "!".
|
||
if !root.ok && !root.broken: HorizontalLayout {
|
||
x: 26 * root.u;
|
||
width: 60 * root.u;
|
||
spacing: 8 * root.u;
|
||
alignment: start;
|
||
for i in 3: Rectangle {
|
||
property <float> p: mod((animation-tick() + i * 180ms) / 900ms, 1);
|
||
y: (parent.height - self.height) / 2;
|
||
width: 10 * root.u;
|
||
height: self.width;
|
||
border-radius: self.width / 2;
|
||
background: root.accent.brighter(0.4);
|
||
opacity: 0.25 + 0.75 * abs(sin(self.p * 180deg));
|
||
}
|
||
}
|
||
if root.ok || root.broken: Text {
|
||
x: 26 * root.u;
|
||
width: 40 * root.u;
|
||
height: parent.height;
|
||
text: root.ok ? "✓" : "!";
|
||
color: root.ok ? #34c759 : #ff9f0a;
|
||
font-size: 30 * root.u;
|
||
font-weight: 800;
|
||
vertical-alignment: center;
|
||
}
|
||
Text {
|
||
x: 92 * root.u;
|
||
width: parent.width - 110 * root.u;
|
||
height: parent.height;
|
||
vertical-alignment: center;
|
||
font-size: 24 * root.u;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
text: root.ok ? "Sikeres párosítás!"
|
||
: root.broken ? "Nem található Bluetooth adapter"
|
||
: root.state == "pairing" ? "Párosítás…"
|
||
: "Távirányító keresése…";
|
||
}
|
||
}
|
||
Text {
|
||
x: 556 * root.u;
|
||
y: parent.height - 68 * root.u;
|
||
width: 204 * root.u;
|
||
height: 60 * root.u;
|
||
horizontal-alignment: center;
|
||
vertical-alignment: center;
|
||
text: "Kihagyás · Esc";
|
||
font-size: 21 * root.u;
|
||
font-weight: 500;
|
||
color: #ffffffc0;
|
||
}
|
||
}
|
||
}
|