feat: add fullscreen bilingual photobooth interface

This commit is contained in:
2026-11-08 12:52:08 +01:00
parent ae004379a7
commit 16c4c03318
3 changed files with 198 additions and 11 deletions

6
AGENTS.md Normal file
View File

@@ -0,0 +1,6 @@
# Photobooth app conventions
- Use primary color `#84bf65` and secondary color `#4caee3` throughout the UI and camera overlays.
- Keep the UI professional, with playful, concise instructions in German and English directly below.
- Show the camera edge to edge, preserving aspect ratio with a centered cover crop.
- Make sensible, focused commits using Conventional Commits (`feat:`, `fix:`, `docs:`, etc.).

View File

@@ -44,6 +44,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut detector = palm::Detector::new()?;
let ui = AppWindow::new()?;
ui.window().set_fullscreen(true);
ui.window()
.on_close_requested(|| slint::CloseRequestResponse::KeepWindowShown);
@@ -56,6 +57,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let tracker = Arc::new(Mutex::new(palm::Tracker::default()));
let detection_tracker = Arc::clone(&tracker);
let ui_tracker = Arc::clone(&tracker);
// A rendezvous channel drops samples while inference is busy, avoiding a backlog.
let (detection_tx, detection_rx) = mpsc::sync_channel::<Mat>(0);
let detection_worker = thread::spawn(move || {
@@ -108,6 +110,7 @@ fn main() -> Result<(), Box<dyn Error>> {
if let (Some(app), Some(buffer)) = (ui_handle.upgrade(), buffer) {
app.set_video_frame(slint::Image::from_rgb8(buffer));
app.set_hand_detected(ui_tracker.lock().unwrap().has_palm(Instant::now()));
}
},
);

View File

@@ -1,15 +1,193 @@
import { Button, VerticalBox } from "std-widgets.slint";
component Instruction inherits Rectangle {
in property <string> number;
in property <string> german;
in property <string> english;
in property <color> accent;
in property <bool> active;
background: active ? #ffffff0c : transparent;
border-radius: 18px;
export component AppWindow inherits Window {
in property <image> video-frame <=> image.source;
VerticalBox {
x: root.safe-area-insets.left;
y: root.safe-area-insets.top;
width: root.width - root.safe-area-insets.left - root.safe-area-insets.right;
height: root.height - root.safe-area-insets.top - root.safe-area-insets.bottom;
image := Image {}
HorizontalLayout {
padding: 18px;
spacing: 16px;
Rectangle {
width: 40px;
height: 40px;
vertical-stretch: 0;
border-radius: 20px;
background: root.active ? root.accent : #ffffff14;
Text {
text: root.number;
color: root.active ? #102017 : #ffffffaa;
font-size: 18px;
font-weight: 700;
horizontal-alignment: center;
vertical-alignment: center;
}
}
VerticalLayout {
spacing: 5px;
Text {
text: root.german;
color: white;
font-size: 21px;
font-weight: 600;
wrap: word-wrap;
}
Text {
text: root.english;
color: #e5edf0bb;
font-size: 14px;
wrap: word-wrap;
}
}
}
}
export component AppWindow inherits Window {
title: "Fotomoment";
preferred-width: 1280px;
preferred-height: 800px;
min-width: 360px;
min-height: 600px;
background: #101a20;
default-font-family: "DejaVu Sans";
in property <image> video-frame;
in property <bool> hand-detected: false;
private property <color> primary: #84bf65;
private property <color> secondary: #4caee3;
private property <length> inset: root.width < 600px ? 20px : 40px;
Image {
width: parent.width;
height: parent.height;
source: root.video-frame;
image-fit: cover;
}
// One continuous shade keeps copy readable without edges across the preview.
Rectangle {
width: parent.width;
height: parent.height;
background: @linear-gradient(180deg, #08131ba0 0%, #08131b00 23%, #08131b00 48%, #08131be8 100%);
}
HorizontalLayout {
x: root.inset + root.safe-area-insets.left;
y: 30px + root.safe-area-insets.top;
width: root.width - root.inset * 2 - root.safe-area-insets.left - root.safe-area-insets.right;
height: 44px;
spacing: 12px;
VerticalLayout {
Text {
text: "fotomoment";
color: white;
font-size: 25px;
font-weight: 700;
}
Text {
text: "DEIN MOMENT. DEIN LÄCHELN.";
color: #ffffffa8;
font-size: 9px;
letter-spacing: 1.5px;
}
}
Rectangle { horizontal-stretch: 1; background: transparent; }
Rectangle {
width: root.width < 600px ? 112px : 148px;
border-radius: 22px;
background: #102027bb;
border-width: 1px;
border-color: #ffffff25;
HorizontalLayout {
padding-left: 15px;
padding-right: 15px;
spacing: 8px;
alignment: center;
Rectangle {
width: 7px;
height: 7px;
vertical-stretch: 0;
y: (parent.height - self.height) / 2;
border-radius: 4px;
background: root.primary;
}
Text {
text: root.width < 600px ? "LIVE" : "KAMERA LIVE";
color: #ffffffd9;
font-size: 10px;
font-weight: 600;
vertical-alignment: center;
}
}
}
}
panel := Rectangle {
x: (root.width - self.width) / 2;
y: root.height - self.height - root.inset - root.safe-area-insets.bottom;
width: min(920px, root.width - root.inset * 2);
height: root.width < 700px ? 300px : 210px;
border-radius: 24px;
background: #101e28e8;
border-width: 1px;
border-color: #ffffff20;
VerticalLayout {
padding: 14px;
spacing: 8px;
VerticalLayout {
padding-left: 16px;
padding-right: 16px;
padding-top: 8px;
height: 64px;
spacing: 10px;
Text {
text: root.hand-detected ? "Perfekt, bleib kurz so!" : "Na, bereit für deinen Moment?";
color: root.hand-detected ? root.primary : white;
font-size: root.width < 700px ? 19px : 23px;
font-weight: 600;
wrap: word-wrap;
}
Text {
text: root.hand-detected ? "Perfect, hold that pose for a moment!" : "Ready for your moment?";
color: #e5edf0bb;
font-size: 13px;
}
}
if root.width >= 700px: HorizontalLayout {
spacing: 8px;
Instruction {
number: "1";
german: "Hand hoch, los geht’s!";
english: "Raise your open hand to get started.";
accent: root.primary;
active: !root.hand-detected;
}
Instruction {
number: "2";
german: "Kurz stillhalten. Gleich soweit!";
english: "Hold it steady while the circle fills.";
accent: root.secondary;
active: root.hand-detected;
}
}
if root.width < 700px: VerticalLayout {
spacing: 4px;
Instruction {
number: "1";
german: "Hand hoch, los geht’s!";
english: "Raise your open hand to get started.";
accent: root.primary;
active: !root.hand-detected;
}
Instruction {
number: "2";
german: "Kurz stillhalten. Gleich soweit!";
english: "Hold it steady while the circle fills.";
accent: root.secondary;
active: root.hand-detected;
}
}
}
}
}