obliteration/gui/ui/main.slint
2025-03-29 10:04:27 +01:00

122 lines
3.1 KiB
Text

import { VerticalBox, HorizontalBox, Button, ComboBox } from "std-widgets.slint";
import { TabBar, TabContainer } from "@root/widgets/tab.slint";
import { DisplayTab } from "main/display.slint";
import { CpuTab } from "main/cpu.slint";
export component MainWindow inherits Window {
in property <[string]> devices;
in-out property <int> selected-device;
in property <[string]> resolutions;
in-out property <int> selected-resolution;
in-out property <string> debug-address;
in property <[string]> profiles;
in-out property <int> selected-profile;
callback settings();
callback report-issue();
pure callback about();
callback profile-selected();
pure callback save-profile();
pure callback start-vmm();
pure callback start-debug();
title: "Obliteration";
icon: @image-url("@root/assets/icon.png");
min-width: 1000px;
min-height: 500px;
// Menu.
MenuBar {
// Edit
Menu {
title: "Edit";
MenuItem {
title: "Settings";
activated => {
settings();
}
}
}
// Help.
Menu {
title: "Help";
MenuItem {
title: "Report Issue";
activated => {
report-issue();
}
}
MenuItem {
title: "About";
activated => {
about();
}
}
}
}
// Content.
VerticalBox {
// Tab.
TabContainer {
vertical-stretch: 1;
tab := TabBar {
tabs: [
{ text: "Display", icon: @image-url("@root/assets/monitor.svg") },
{ text: "CPU", icon: @image-url("main/cpu-64-bit.svg") }
];
}
if tab.current-page == 0: DisplayTab {
devices: root.devices;
selected-device <=> root.selected-device;
resolutions: root.resolutions;
selected-resolution <=> root.selected-resolution;
}
if tab.current-page == 1: CpuTab {
debug-address <=> debug-address;
start-debug => {
start-debug();
}
}
}
// Profile + actions.
HorizontalBox {
padding: 0;
ComboBox {
model: profiles;
current-index <=> selected-profile;
horizontal-stretch: 1;
selected => {
profile-selected();
}
}
Button {
text: "Save";
icon: @image-url("main/save.svg");
colorize-icon: true;
clicked => {
save-profile();
}
}
Button {
text: "Start";
icon: @image-url("main/start.svg");
colorize-icon: true;
clicked => {
start-vmm();
}
}
}
}
}