Skip to content

Commit

Permalink
Merges Tabs and Actions component into MainWindow (#1247)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Jan 13, 2025
1 parent f2ef2e2 commit b545f68
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 848 deletions.
112 changes: 99 additions & 13 deletions gui/ui/main.slint
Original file line number Diff line number Diff line change
@@ -1,42 +1,128 @@
import { Tabs } from "main/tabs.slint";
import { Actions } from "main/actions.slint";
import { VerticalBox } from "std-widgets.slint";
import { VerticalBox, HorizontalBox, Button, ComboBox } from "std-widgets.slint";
import { Menu } from "main/menu.slint";
import { DisplayTab } from "main/display.slint";
import { CpuTab } from "main/cpu.slint";

export { WaitForDebugger } from "debug.slint";
export { ErrorWindow } from "error.slint";
export { InstallFirmware, SetupWizard } from "setup.slint";

enum Tab {
menu,
display,
cpu
}

export component MainWindow inherits Window {
in property <[string]> devices;
in property <[string]> resolutions;
in-out property <int> selected-resolution;
in property <[string]> profiles;
in-out property <int> selected-profile <=> actions.selected-profile;
in-out property <int> selected-profile;

callback profile-selected <=> actions.profile-selected;
pure callback save-profile <=> actions.save;
callback profile-selected();
pure callback save-profile();
pure callback report-issue();
pure callback start-vmm <=> actions.start;
pure callback start-debug <=> tabs.start-debug;
pure callback start-vmm();
pure callback start-debug();

title: "Obliteration";
icon: @image-url("icon.png");
min-width: 1000px;
min-height: 500px;

private property <Tab> tab: Tab.display;

VerticalBox {
tabs := Tabs {
// Tab bar.
HorizontalBox {
padding: 0;

Button {
icon: @image-url("main/menu.svg");
colorize-icon: true;
primary: tab == Tab.menu;
clicked => {
tab = Tab.menu
}
}

Button {
text: "Display";
icon: @image-url("main/monitor.svg");
colorize-icon: true;
primary: tab == Tab.display;
horizontal-stretch: 1;
clicked => {
tab = Tab.display
}
}

Button {
text: "CPU";
icon: @image-url("main/cpu-64-bit.svg");
colorize-icon: true;
primary: tab == Tab.cpu;
horizontal-stretch: 1;
clicked => {
tab = Tab.cpu
}
}
}

// Tab content.
if tab == Tab.menu: Menu {
vertical-stretch: 1;

report-issue => {
report-issue();
}
}

if tab == Tab.display: DisplayTab {
devices: devices;
resolutions: resolutions;
selected-resolution <=> selected-resolution;
vertical-stretch: 1;
report-issue => {
report-issue();
}

if tab == Tab.cpu: CpuTab {
vertical-stretch: 1;
start-debug => {
start-debug();
}
}

actions := Actions {
profiles: profiles;
// 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();
}
}
}
}
}
41 changes: 0 additions & 41 deletions gui/ui/main/actions.slint

This file was deleted.

File renamed without changes
File renamed without changes
82 changes: 0 additions & 82 deletions gui/ui/main/tabs.slint

This file was deleted.

Loading

0 comments on commit b545f68

Please sign in to comment.