Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializes Slint gui #1084

Merged
merged 64 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
4b17fe1
Initializes Slint gui
Nov 3, 2024
1e67a1d
Merge branch 'main' into slint
SuchAFuriousDeath Nov 3, 2024
1657360
fix typo
Nov 3, 2024
916837b
Merge branch 'main' into slint
SuchAFuriousDeath Nov 3, 2024
ad52ee0
rename method
Nov 3, 2024
777e552
Merge branch 'main' into slint
SuchAFuriousDeath Nov 3, 2024
0b52aef
screen
Nov 4, 2024
fdbe083
use python 3.11 on mac
Nov 4, 2024
1373cee
up to python 3.12
Nov 4, 2024
362b9c6
ref, revert
Nov 5, 2024
8dfb183
reff
Nov 5, 2024
11d5ab4
cs
Nov 5, 2024
7c75e88
ref
Nov 5, 2024
a45b7d4
ref
Nov 5, 2024
b1b8a24
ref
Nov 5, 2024
4c17edd
static vulkan
Nov 5, 2024
2d0bc28
fmt
Nov 5, 2024
590c638
remove vulkan.cpp
Nov 5, 2024
098a10a
remove optional slint
Nov 5, 2024
8e48e5b
return vulkan.cpp
Nov 5, 2024
d84589c
link vulkan
Nov 5, 2024
559dd3b
revert tabs
Nov 6, 2024
c2fc9c9
tabs
Nov 6, 2024
28ac620
tabs
Nov 6, 2024
1b1d12a
dedup python
Nov 6, 2024
0d772e2
ref
Nov 6, 2024
d2e829d
rename module
Nov 6, 2024
15cc7cd
fmt
Nov 6, 2024
b20413d
remove destroy_instance
Nov 6, 2024
4e73ace
ref
Nov 6, 2024
6398dce
ref
Nov 7, 2024
d5713f2
ref build script
Nov 7, 2024
f797def
put qt ffi behind a feature flag
Nov 8, 2024
c3401bf
fmt
Nov 8, 2024
09aadaa
fmt
Nov 8, 2024
8585302
ref
Nov 8, 2024
7a72719
cbindgen
Nov 8, 2024
15b39cd
revert cbindgen
Nov 9, 2024
8c84cde
Merge branch 'main' into slint
SuchAFuriousDeath Nov 9, 2024
cfada2b
fix after merge
Nov 9, 2024
8370f74
fix error
Nov 9, 2024
3d3eb74
ref build script
Nov 9, 2024
fbcdd1d
fix build script
Nov 9, 2024
5a61bd7
addres review
Nov 9, 2024
e40bf5e
qt_ffi -> qt
Nov 9, 2024
708643b
rename bin
Nov 9, 2024
7ab324c
optional features
Nov 9, 2024
1f5ca0e
ref cmake
Nov 9, 2024
0f4a2eb
address review
Nov 9, 2024
7a65adc
ref vulkan
Nov 9, 2024
8cd4791
improve error handling
Nov 9, 2024
13cc743
slice from ref
Nov 9, 2024
f8feb82
rlim dialog
Nov 9, 2024
76a0052
ref error displaying logic
Nov 9, 2024
4869dd1
ref
Nov 9, 2024
ea735e3
format error
Nov 9, 2024
b6fd935
fmt
Nov 9, 2024
d173e5f
Merge branch 'main' into slint
SuchAFuriousDeath Nov 9, 2024
f26cea2
rename to hypervisor error
Nov 10, 2024
8117259
Vmm error rename
Nov 10, 2024
e0ff198
fmt
Nov 10, 2024
57d45e1
ref errors
Nov 10, 2024
246e1c1
address review
Nov 10, 2024
51b4808
fmt
Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci-mac.yml
SuchAFuriousDeath marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
type: string
required: true
env:
CMAKE_BUILD_PARALLEL_LEVEL: '3'
CMAKE_BUILD_PARALLEL_LEVEL: "3"
jobs:
build:
name: ${{ inputs.name }}
Expand All @@ -25,6 +25,10 @@ jobs:
QT_URL_BASE: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt6_672/qt.qt6.672.clang_64/6.7.2-0-202406110330qtbase-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64.7z
QT_URL_SVG: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt6_672/qt.qt6.672.clang_64/6.7.2-0-202406110330qtsvg-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64.7z
steps:
- name: Set up Python 3.12 (the latest version that is able to build skia-bindings)
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Checkout source
uses: actions/checkout@v4
- name: Generate cache keys
Expand Down
26 changes: 22 additions & 4 deletions .vscode/launch.json
SuchAFuriousDeath marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"configurations": [
{
"name": "GUI",
"name": "GUI (Qt)",
"type": "lldb",
"request": "launch",
"args": [
Expand All @@ -22,6 +22,24 @@
"program": "${workspaceFolder}/build/gui/obliteration.app/Contents/MacOS/obliteration"
}
},
{
"name": "GUI (Slint)",
"type": "lldb",
"request": "launch",
"cargo": {
"args": [
"build",
"--manifest-path",
"${workspaceFolder}/gui/Cargo.toml",
"--features",
"slint"
],
"filter": {
"kind": "bin"
}
},
"cwd": "${workspaceFolder}"
},
{
"name": "Kernel",
"type": "lldb",
Expand All @@ -31,10 +49,10 @@
"target create ${workspaceFolder}/build/obkrnl",
"target modules load --file ${workspaceFolder}/build/obkrnl -s 0xffffffff82200000"
],
"processCreateCommands": [
"gdb-remote 1234"
]
"processCreateCommands": ["gdb-remote 1234"]
}
],
"version": "2.0.0"
}


2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ else()
endif()

add_cargo(MANIFEST Cargo.toml)
add_crate(gui)
add_crate(gui LIBRARY ARGS --features "qt")
add_crate(obkrnl
TOOLCHAIN ${kernel_toolchain}
VENDOR "unknown"
Expand Down
3 changes: 3 additions & 0 deletions cmake/cargo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ function(add_crate crate)

if(${kind} STREQUAL "staticlib")
add_library(${crate} STATIC IMPORTED)

list(APPEND build_args "--lib")

if(WIN32)
set(debug_artifact "${debug_outputs}/${crate}.lib")
set(release_artifact "${release_outputs}/${crate}.lib")
Expand Down
4 changes: 4 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ target_link_libraries(obliteration PRIVATE Qt6::Svg Qt6::Widgets)
target_link_libraries(obliteration PRIVATE Threads::Threads)
target_link_libraries(obliteration PRIVATE gui)

if(WIN32 OR (UNIX AND NOT APPLE))
target_link_libraries(obliteration PRIVATE Vulkan::Vulkan)
endif()

if(WIN32)
target_link_libraries(obliteration PRIVATE bcrypt imm32 ntdll setupapi userenv version winhvplatform winmm ws2_32)
elseif(APPLE)
Expand Down
26 changes: 25 additions & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ edition = "2021"

[lib]
crate-type = ["staticlib"]
required-features = ["qt"]

[[bin]]
name = "obliteration"
path = "src/main.rs"
required-features = ["slint"]

[features]
slint = [
"dep:slint",
"dep:clap",
"dep:raw-window-handle",
]
qt = []

[dependencies]
bitfield-struct = "0.8.0"
Expand All @@ -23,9 +37,18 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86-64 = { path = "../arch/x86-64" }
raw-window-handle = { version = "0.6", optional = true }
clap = { version = "4.5.20", features = ["derive"], optional = true }

[dependencies.slint]
git = "https://github.com/slint-ui/slint"
rev = "875ca075fb5b2dfe4c3ab0a499d5759412fc1395"
SuchAFuriousDeath marked this conversation as resolved.
Show resolved Hide resolved
features = ["compat-1-2", "std", "accessibility", "raw-window-handle-06", "backend-winit", "renderer-skia"]
default-features = false
optional = true

[target.'cfg(not(target_os = "macos"))'.dependencies]
ash = "0.38.0"
ash = { version = "0.38.0", features = ["linked", "std"], default-features = false }

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52.0"
Expand All @@ -46,3 +69,4 @@ objc = "0.2.7"

[build-dependencies]
cbindgen = "0.26.0"
slint-build = { git = "https://github.com/slint-ui/slint", rev = "875ca075fb5b2dfe4c3ab0a499d5759412fc1395" }
ultimaweapon marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions gui/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cbindgen::{Builder, Config, Language, Style};
use slint_build::CompilerConfiguration;
use std::path::PathBuf;

const LINUX_INCLUDE: &str = r#"
Expand All @@ -8,6 +9,25 @@ const LINUX_INCLUDE: &str = r#"
"#;

fn main() {
if std::env::var("CARGO_FEATURE_SLINT").is_ok_and(|var| var == "1") {
build_bin();
}

if std::env::var("CARGO_FEATURE_QT").is_ok_and(|var| var == "1") {
build_lib();
}
}

fn build_bin() {
// Compile main
slint_build::compile_with_config(
"slint/main.slint",
CompilerConfiguration::new().with_style(String::from("fluent-dark")),
)
.unwrap();
SuchAFuriousDeath marked this conversation as resolved.
Show resolved Hide resolved
}

fn build_lib() {
let root = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
let mut conf = Config::default();
let mut buf = String::new();
Expand Down
2 changes: 1 addition & 1 deletion gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int main(int argc, char *argv[])
QMessageBox::critical(
nullptr,
"Error",
"No any Vulkan device supports Vulkan 1.3.");
"No Vulkan device supports Vulkan 1.3.");
return 1;
}

Expand Down
54 changes: 54 additions & 0 deletions gui/slint/main.slint
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Game } from "structs.slint";
import { Tabs } from "main/tabs.slint";
import { Menu } from "main/menu.slint";
import { Actions } from "main/actions.slint";

export component MainWindow inherits Window {
preferred-width: 1920px;
preferred-height: 1080px;
icon: @image-url("../resources/obliteration-icon.png");
title: "Obliteration";

in property <[Game]> games: [];
in property <[string]> profiles: [];
in property <[string]> devices: [];

pure callback start_game(int);

pure callback clear_log();
pure callback get_log_text() -> string;

pure callback open_new_issue_link();

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

VerticalLayout {
Menu {
background: root.background;
popup_width: root.width / 2;
popup_height: root.height / 2;
popup_x: root.width / 4;
popup_y: root.height / 4;

quit => { quit(); }
open_new_issue_link => { open_new_issue_link(); }
install_pkg => { install_pkg(); }
open_system_folder => { open_system_folder(); }
}
Tabs {
devices: devices;
games: games;
select_game(index) => { }
}
Actions {
profiles: profiles;
start_game => {
start_game(0)
}
}
}
}

export component Screen inherits Window {}
29 changes: 29 additions & 0 deletions gui/slint/main/actions.slint
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ComboBox, Button } from "std-widgets.slint";

export component Actions {
in property <[string]> profiles: [];

pure callback start_game();

HorizontalLayout {

alignment: stretch;
spacing: 5px;

ComboBox {
model: profiles;
horizontal-stretch: 1;
}
Button {
text: "Start";
horizontal-stretch: 0;
icon: @image-url("../../resources/play.svg");
clicked => { start_game(); }
}
Button {
text: "Save";
horizontal-stretch: 0;
icon: @image-url("../../resources/content-save.svg");
}
}
}
Loading
Loading