Skip to content

Commit

Permalink
Refactors menu tab (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuchAFuriousDeath authored Nov 17, 2024
1 parent 4497832 commit b16c8d5
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 114 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
"rust-analyzer.imports.granularity.group": "module",
"rust-analyzer.imports.group.enable": false,
"rust-analyzer.imports.prefix": "self"
"slint.preview.style": "fluent-dark"
}
1 change: 0 additions & 1 deletion gui/slint/main.slint
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export component MainWindow inherits Window {

pure callback open_new_issue_link();

pure callback install_pkg();
pure callback open_system_folder();
pure callback quit();

Expand Down
171 changes: 60 additions & 111 deletions gui/slint/main/menu.slint
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
import { Button, StandardButton, AboutSlint } from "std-widgets.slint";
import { Button, StandardButton, AboutSlint, HorizontalBox, Palette } from "std-widgets.slint";

component MenuItem inherits Rectangle {
background: Palette.background;

in property <string> title;

Button {
text: title;
clicked => { submenu.show(); }
}

submenu := PopupWindow {
x: parent.x + parent.width;

VerticalLayout {
spacing: 0;

@children
}
}
}

export component Menu {
in property <brush> background;
in property <length> popup_width;
Expand All @@ -9,30 +31,14 @@ export component Menu {
pure callback quit();
pure callback open_new_issue_link();
pure callback open_system_folder();
pure callback install_pkg();

install_pkg_dialog := PopupWindow {
width: popup_width;
height: popup_height;
x: popup_x;
y: popup_y;

Dialog {
Text {
text: "This is a dialog box";
}
StandardButton { kind: ok; }
StandardButton { kind: cancel; }
}
}

about_dialog := PopupWindow {
width: popup_width;
height: popup_height;
x: popup_x;
y: popup_y;

Rectangle {
Rectangle {
Dialog {
Text {
text: "Obliteration is a free and open-source software for playing your PlayStation 4 titles on PC.";
Expand All @@ -48,7 +54,7 @@ export component Menu {
x: popup_x;
y: popup_y;

Rectangle {
Rectangle {
Dialog {
AboutSlint {}
StandardButton { kind: ok; }
Expand All @@ -62,117 +68,60 @@ export component Menu {
x: popup_x;
y: popup_y;

Rectangle {
Rectangle {
Text {
text: "Obliteration is a free and open-source software for playing your PlayStation 4 titles on PC.";
}
}
}

HorizontalLayout {
HorizontalBox {
alignment: start;
spacing: 5px;
padding-left: 5px;

VerticalLayout {
TouchArea {
clicked => { files_popup.show(); }
Rectangle {
background: Palette.background;

VerticalLayout {
alignment: start;
spacing: 0;

Rectangle {
Text {
text: "File";
MenuItem {
title: "File";

Button {
text: "Open System Folder";
clicked => { open_system_folder(); }
}
}
}

files_popup := PopupWindow {
y: parent.y + parent.height;

Rectangle {
background: background;

VerticalLayout {
spacing: 0px;

Button {
text: "Install PKG";
clicked => { install_pkg(); }
}
Button {
text: "Open System Folder";
clicked => { open_system_folder(); }
}
Button {
text: "Quit";
clicked => { quit() }
}
Button {
text: "Quit";
clicked => { quit() }
}
}
}
}
VerticalLayout {
TouchArea {
clicked => { view_popup.show(); }
MenuItem {
title: "View";

Rectangle {
Text {
text: "View";
}
}
}

view_popup := PopupWindow {
y: parent.y + parent.height;

Rectangle {
background: background;

VerticalLayout {
spacing: 0px;

Button {
text: "Logs";
clicked => { logs.show(); }
}
Button {
text: "Logs";
clicked => { logs.show(); }
}
}
}
}
VerticalLayout {
TouchArea {
clicked => { help_popup.show(); }
MenuItem {
title: "Help";

Rectangle {
Text {
text: "Help";
Button {
text: "Report an Issue";
clicked => { open_new_issue_link(); }
}
}
}

help_popup := PopupWindow {
y: parent.y + parent.height;

Rectangle {
background: background;

VerticalLayout {
spacing: 0px;

Button {
text: "Report an Issue";
clicked => { open_new_issue_link(); }
}
Button {
text: "About Slint";
clicked => { about_slint.show(); }
}
Button {
text: "About Obliteration";
clicked => { about_dialog.show(); }
}
Button {
text: "About Slint";
clicked => { about_slint.show(); }
}
Button {
text: "About Obliteration";
clicked => { about_dialog.show(); }
}
}
}
}
}
}
}
3 changes: 1 addition & 2 deletions gui/slint/main/tabs/cpu.slint
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export component CpuTab {
vertical-alignment: center;
}
LineEdit {
text: "127.0.0.1";
max-height: 30px;
text: "127.0.0.1:1234";
}
Button {
text: "Start";
Expand Down

0 comments on commit b16c8d5

Please sign in to comment.