SmartFox: launcher, Siri Remote driver, Debian image and installer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
190
crates/sf-launcher/ui/keyboard.slint
Normal file
190
crates/sf-launcher/ui/keyboard.slint
Normal file
@@ -0,0 +1,190 @@
|
||||
// On-screen keyboard in the tvOS style: one horizontal row of characters,
|
||||
// the text field above it and the mode chips below.
|
||||
//
|
||||
// Drawn inside the settings pane, which stays; the settings content fades out.
|
||||
// Only text and icons are drawn here. The glass (field, key track, focus lens,
|
||||
// chips) comes from `keyboard::glass` in Rust, which mirrors the geometry the
|
||||
// App exports (kb-* properties): keep the two in sync.
|
||||
//
|
||||
// Key row: index 0 = space, 1..n-2 = characters, n-1 = delete.
|
||||
|
||||
import { SpaceIcon, DeleteIcon } from "icons.slint";
|
||||
|
||||
export component KeyboardView inherits Rectangle {
|
||||
in property <length> u;
|
||||
in property <length> pane-x;
|
||||
in property <length> pane-y;
|
||||
in property <length> pane-w;
|
||||
in property <length> pane-h;
|
||||
in property <length> back-x;
|
||||
in property <length> field-x;
|
||||
in property <length> field-y;
|
||||
in property <length> field-w;
|
||||
in property <length> field-h;
|
||||
in property <length> row-x;
|
||||
in property <length> row-y;
|
||||
in property <length> row-h;
|
||||
in property <length> key-w;
|
||||
in property <length> chip-x;
|
||||
in property <length> chip-y;
|
||||
in property <length> chip-w;
|
||||
in property <length> chip-h;
|
||||
in property <length> chip-step;
|
||||
in property <[string]> keys;
|
||||
in property <[string]> chips;
|
||||
in property <int> mode;
|
||||
in property <float> pos;
|
||||
in property <float> cpos;
|
||||
in property <float> keys-active;
|
||||
in property <float> chips-active;
|
||||
in property <string> title;
|
||||
in property <string> subtitle;
|
||||
in property <string> shown-text;
|
||||
in property <string> placeholder;
|
||||
in property <string> hint;
|
||||
in property <bool> hint-error;
|
||||
in property <bool> can-submit;
|
||||
|
||||
property <int> n: self.keys.length + 2;
|
||||
|
||||
// ---- heading ----------------------------------------------------------
|
||||
Text {
|
||||
x: root.pane-x;
|
||||
y: root.pane-y + 58 * root.u;
|
||||
width: root.pane-w;
|
||||
horizontal-alignment: center;
|
||||
text: root.title;
|
||||
font-family: "Inter Display";
|
||||
font-weight: 800;
|
||||
font-size: 46 * root.u;
|
||||
letter-spacing: -1.2 * root.u;
|
||||
color: #ffffff;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
x: root.pane-x + 80 * root.u;
|
||||
y: root.pane-y + 128 * root.u;
|
||||
width: root.pane-w - 160 * root.u;
|
||||
horizontal-alignment: center;
|
||||
text: root.subtitle;
|
||||
font-size: 23 * root.u;
|
||||
color: #ffffffa8;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
// ---- text field ---------------------------------------------------------
|
||||
Rectangle {
|
||||
x: root.field-x;
|
||||
y: root.field-y;
|
||||
width: root.field-w;
|
||||
height: root.field-h;
|
||||
clip: true;
|
||||
HorizontalLayout {
|
||||
padding-left: 36 * root.u;
|
||||
padding-right: 36 * root.u;
|
||||
alignment: start;
|
||||
spacing: 4 * root.u;
|
||||
if root.shown-text == "": Text {
|
||||
vertical-alignment: center;
|
||||
text: root.placeholder;
|
||||
font-size: 32 * root.u;
|
||||
color: #ffffff59;
|
||||
}
|
||||
if root.shown-text != "": Text {
|
||||
vertical-alignment: center;
|
||||
text: root.shown-text;
|
||||
font-size: 34 * root.u;
|
||||
font-weight: 500;
|
||||
letter-spacing: 1 * root.u;
|
||||
color: #ffffff;
|
||||
}
|
||||
// Blinking caret.
|
||||
Rectangle {
|
||||
width: 3 * root.u;
|
||||
Rectangle {
|
||||
y: (parent.height - self.height) / 2;
|
||||
width: 100%;
|
||||
height: 44 * root.u;
|
||||
border-radius: self.width / 2;
|
||||
background: #ff9a5c;
|
||||
opacity: mod(animation-tick() / 1000ms, 1) < 0.55 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
x: root.field-x;
|
||||
y: root.field-y + root.field-h + 18 * root.u;
|
||||
width: root.field-w;
|
||||
horizontal-alignment: center;
|
||||
text: root.hint;
|
||||
font-size: 21 * root.u;
|
||||
color: root.hint-error ? #ff8278 : #ffffff8c;
|
||||
}
|
||||
|
||||
// ---- key row ---------------------------------------------------------------
|
||||
// Keys grow as the focus lens passes them (fish-eye), like on tvOS.
|
||||
for key[i] in root.keys: Text {
|
||||
property <float> f: max(0, 1 - abs(root.pos - (i + 1))) * root.keys-active;
|
||||
x: root.row-x + (i + 1) * root.key-w - 20 * root.u;
|
||||
y: root.row-y;
|
||||
width: root.key-w + 40 * root.u;
|
||||
height: root.row-h;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
text: key;
|
||||
font-size: (31 + 17 * self.f) * root.u;
|
||||
font-weight: self.f > 0.5 ? 700 : 500;
|
||||
color: self.f > 0.5 ? #121317 : #ffffffd8;
|
||||
}
|
||||
SpaceIcon {
|
||||
property <float> f: max(0, 1 - abs(root.pos)) * root.keys-active;
|
||||
property <length> size: (30 + 10 * self.f) * root.u;
|
||||
x: root.row-x + (root.key-w - self.size) / 2;
|
||||
y: root.row-y + (root.row-h - self.size) / 2;
|
||||
width: self.size;
|
||||
height: self.size;
|
||||
ink: self.f > 0.5 ? #121317 : #ffffffd8;
|
||||
}
|
||||
DeleteIcon {
|
||||
property <float> f: max(0, 1 - abs(root.pos - (root.n - 1))) * root.keys-active;
|
||||
property <length> size: (32 + 10 * self.f) * root.u;
|
||||
x: root.row-x + (root.n - 1) * root.key-w + (root.key-w - self.size) / 2;
|
||||
y: root.row-y + (root.row-h - self.size) / 2;
|
||||
width: self.size;
|
||||
height: self.size;
|
||||
ink: self.f > 0.5 ? #121317 : #ffffffd8;
|
||||
}
|
||||
|
||||
// ---- mode and action chips -------------------------------------------------------
|
||||
for label[i] in root.chips: Text {
|
||||
property <float> f: max(0, 1 - abs(root.cpos - i)) * root.chips-active;
|
||||
property <bool> submit: i == root.chips.length - 1;
|
||||
property <bool> selected: i < 4 && i == root.mode;
|
||||
x: root.chip-x + i * root.chip-step;
|
||||
y: root.chip-y;
|
||||
width: root.chip-w;
|
||||
height: root.chip-h;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
text: label;
|
||||
font-size: 24 * root.u;
|
||||
font-weight: self.submit || self.selected ? 700 : 500;
|
||||
color: self.submit
|
||||
? (root.can-submit ? #ffffff : #ffffff66)
|
||||
: self.f > 0.5 ? #121317 : self.selected ? #ff9a5c : #ffffffc8;
|
||||
}
|
||||
|
||||
Text {
|
||||
x: root.back-x;
|
||||
y: root.pane-y + root.pane-h - 92 * root.u;
|
||||
width: 300 * root.u;
|
||||
height: 56 * root.u;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
text: "‹ Mégse · Vissza";
|
||||
font-size: 21 * root.u;
|
||||
font-weight: 500;
|
||||
color: #ffffffc0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user