Skip to content

Commit

Permalink
Fixes layout on CPU tab (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Jan 12, 2025
1 parent 9f1c61f commit a5972f0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 61 deletions.
12 changes: 1 addition & 11 deletions gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,7 @@ async fn run_launcher(
let win = win.as_weak();
let exit = exit.clone();

move |addr| {
let addr = match addr.parse() {
Ok(addr) => addr,
// TODO: Display error instead of panic.
Err(_e) => todo!(),
};

win.unwrap().hide().unwrap();

exit.set(Some(ExitAction::RunDebug(addr)));
}
move || todo!()
});

// Set window properties.
Expand Down
117 changes: 72 additions & 45 deletions gui/ui/main/cpu.slint
Original file line number Diff line number Diff line change
@@ -1,70 +1,97 @@
import { Button, Slider, LineEdit, HorizontalBox, VerticalBox } from "std-widgets.slint";
import { Button, Slider, LineEdit, HorizontalBox, VerticalBox, GroupBox } from "std-widgets.slint";

export component CpuTab {
property <string> debug-address: "127.0.0.1:1234";

pure callback start-debug(string);
component CpuCount {
in-out property <float> value;

HorizontalBox {
VerticalBox {
padding: 0;
alignment: start;

VerticalBox {
alignment: start;
HorizontalBox {
padding: 0;

property <float> cpus: 8;
Slider {
value: value;
minimum: 1;
maximum: 16;
changed(v) => {
value = Math.round(v);
}
}

Text {
text: "Count";
text: value;
width: 20px;
}
}

HorizontalBox {
Slider {
value <=> cpus;
minimum: 1;
maximum: 16;
changed => {
cpus = Math.round(cpus);
}
}
Text {
text: "Changing this value to other than 8 may crash the game.";
wrap: word-wrap;
}
}
}

Text {
vertical-alignment: center;
text: cpus;
}
component DebugAddr {
in-out property <string> value;

pure callback start();

VerticalBox {
padding: 0;
alignment: LayoutAlignment.start;

HorizontalBox {
padding: 0;

LineEdit {
text <=> value;
}

Text {
text: "Changing this value to other than 8 may crash the game.";
Button {
text: "Start";
clicked => {
start();
}
}
}

VerticalBox {
alignment: start;
Text {
text: "Specify a TCP address to listen for a debugger. The VMM will wait for a debugger to connect before start.";
wrap: word-wrap;
}
}
}

Text {
text: "Debug";
}
export component CpuTab {
in-out property <float> cpu-count: 8;
in-out property <string> debug-address: "127.0.0.1:1234";

HorizontalBox {
Text {
text: "Listen address";
vertical-alignment: center;
}
pure callback start-debug();

LineEdit {
text <=> debug-address;
}
VerticalBox {
padding: 0;
alignment: start;

Button {
text: "Start";
clicked => {
start-debug(debug-address);
}
HorizontalBox {
padding: 0;

GroupBox {
title: "Count";
width: 50%;
CpuCount {
value <=> cpu-count;
}
}

Text {
text: "Specify a TCP address to listen for a debugger. The kernel will wait for a debugger to connect before start.";
GroupBox {
title: "GDB Server";
DebugAddr {
value <=> debug-address;
start => {
start-debug();
}
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions gui/ui/main/display.slint
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export component DisplayTab {

GroupBox {
title: "Device";
width: 50%;
ComboBox {
model: devices;
preferred-width: 0; // Override content-based width.
}
}

Expand All @@ -25,7 +25,6 @@ export component DisplayTab {
ComboBox {
model: resolutions;
current-index <=> selected-resolution;
preferred-width: 0; // Same here.
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions gui/ui/main/tabs.slint
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export component Tabs {
in property <[string]> resolutions;
in-out property <int> selected-resolution;

pure callback start-debug();
pure callback report-issue();
pure callback start-debug(string);

private property <Tab> tab: Tab.display;

Expand Down Expand Up @@ -74,8 +74,8 @@ export component Tabs {

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

0 comments on commit a5972f0

Please sign in to comment.