diff --git a/src/main.rs b/src/main.rs index 43ceeb5..9c0552c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,11 +32,7 @@ mod conf; slint::include_modules!(); fn main() -> Result<(), slint::PlatformError> { - println!("╔═════╗"); - println!("║ ▄▄ ║ Boxedmino"); - println!("║ ▀▀ ║ Sandboxed Techmino runner"); - println!("╚═════╝"); - println!("2024 - 26F-Studio | https://github.com/26F-Studio/Boxedmino\n\n"); + print_intro(); if let Err(missing_dependencies) = check_dependencies() { let mut message = "The following dependencies are missing:".to_string(); @@ -64,7 +60,7 @@ fn main() -> Result<(), slint::PlatformError> { } if config.use_gui { - open_window(&config)?; + open_main_window(&config)?; } else { run_game(&config); } @@ -72,6 +68,15 @@ fn main() -> Result<(), slint::PlatformError> { return Ok(()); } +fn print_intro() { + let version = env!("CARGO_PKG_VERSION"); + println!("╔═════╗"); + println!("║ ▄▄ ║ Boxedmino v{version}"); + println!("║ ▀▀ ║ Sandboxed Techmino runner"); + println!("╚═════╝"); + println!("2024 - 26F-Studio | https://github.com/26F-Studio/Boxedmino\n\n"); +} + fn run_game(cfg: &Config) { let path = PathBuf::from(cfg.game_repo_path.clone()); @@ -268,7 +273,7 @@ fn safe_todo(feature: Option<&str>) { ); } -fn open_window(cfg: &Config) -> Result { +fn open_main_window(cfg: &Config) -> Result { let main_window = MainWindow::new()?; main_window.on_open_game(|_| { run_game(&Config::load()); @@ -279,6 +284,7 @@ fn open_window(cfg: &Config) -> Result { .to_string() .into() ); + main_window.set_boxedmino_version(env!("CARGO_PKG_VERSION").into()); main_window.on_open_link(open_link); main_window.on_copy_text(|string| { copy_text_handled(string.as_str()); diff --git a/ui/main.slint b/ui/main.slint index 3fe9a43..4e05fd7 100644 --- a/ui/main.slint +++ b/ui/main.slint @@ -42,6 +42,7 @@ export component MainWindow inherits Window { pure callback filter([string], string) -> [string]; in property sandbox_path; + in property boxedmino_version: "0.0.0"; in-out property <[string]> versions: ["Uninitialized A", "Uninitialized B", "Uninitialized C", "Uninitialized D"]; in-out property <[string]> matched_versions: versions; in-out property selected_version: "Uninitialized A"; @@ -288,8 +289,7 @@ export component MainWindow inherits Window { font-size: 1.25rem; } Text { - text: "(C) 26F-Studio - 2024"; - accessible-role: AccessibleRole.text; + text: "Version " + boxedmino_version + " | (C) 26F-Studio - 2024"; horizontal-alignment: TextHorizontalAlignment.center; } Text {