feat(aten-gui): add toolbar and error dialog to Slint UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Davíð Steinn Geirsson 2026-03-12 00:04:25 +00:00
parent d1c8da025a
commit c1d973b131

View file

@ -1,14 +1,90 @@
import { Button } from "std-widgets.slint";
export component Main inherits Window {
title: "aten-kvm";
preferred-width: 800px;
preferred-height: 600px;
in-out property <image> frame;
in-out property <string> error-text;
in-out property <bool> show-error: false;
Image {
source: root.frame;
callback ctrl-toggled(bool);
callback alt-toggled(bool);
callback ctrl-alt-del-pressed();
HorizontalLayout {
VerticalLayout {
padding: 4px;
spacing: 4px;
alignment: start;
ctrl-btn := Button {
text: "Ctrl";
checkable: true;
clicked => {
root.ctrl-toggled(self.checked);
}
}
alt-btn := Button {
text: "Alt";
checkable: true;
clicked => {
root.alt-toggled(self.checked);
}
}
Button {
text: "C+A+D";
clicked => {
ctrl-btn.checked = false;
alt-btn.checked = false;
root.ctrl-alt-del-pressed();
}
}
}
Image {
source: root.frame;
image-fit: contain;
}
}
if root.show-error: Rectangle {
width: 100%;
height: 100%;
image-fit: contain;
background: #00000080;
Rectangle {
width: 400px;
height: 150px;
background: white;
border-radius: 8px;
VerticalLayout {
padding: 16px;
spacing: 12px;
alignment: center;
Text {
text: root.error-text;
wrap: word-wrap;
horizontal-alignment: center;
color: black;
}
HorizontalLayout {
alignment: center;
Button {
text: "OK";
clicked => {
root.show-error = false;
}
}
}
}
}
}
}