From 37cf74cda57b9876fb6fc1078336f3be0c1cbd5d Mon Sep 17 00:00:00 2001 From: Chad Lax Date: Sat, 23 Mar 2024 22:50:36 -0500 Subject: [PATCH] added startup dialog Simple app welcome screen gets displayed on first startup More instructions are shown after a user selects a valid game directory app also now moves back to the home page after selecting valid directory --- README.md | 6 ++---- src/main.rs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d7d3f87..e14cfb7 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,8 @@ Work in progress ### To-do: -* Work on GUI: -* Polish Error dialog -* Create confirm dialog -* Better error handling +* App Icon +* Handle edge cases for selecting mod files ### feats: diff --git a/src/main.rs b/src/main.rs index 2b38cfd..f779b0a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,18 +41,21 @@ fn main() -> Result<(), slint::PlatformError> { ); }); { + let first_startup: bool; let ini_valid = match get_cfg(&CURRENT_INI) { Ok(ini) => { if ini.is_setup() { info!("Config file found at \"{}\"", &CURRENT_INI.display()); + first_startup = false; true } else { + first_startup = false; false } } Err(err) => { error!("Error: {}", err); - ui.display_err("Welcome to Elden Mod Loader GUI!\nThanks for downloading, please report any bugs"); + first_startup = true; false } }; @@ -113,6 +116,13 @@ fn main() -> Result<(), slint::PlatformError> { .to_string() .into(), ); + if first_startup && !game_verified { + ui.display_err( + "Welcome to Elden Mod Loader GUI!\nThanks for downloading, please report any bugs\n\nPlease select the game directory containing \"eldenring.exe\"", + ); + } else if first_startup && game_verified { + ui.display_err("Welcome to Elden Mod Loader GUI!\nThanks for downloading, please report any bugs\n\nGame Files Found!\nAdd mods to the app by entering a name and selecting mod files with \"Select Files\"\n\nYou can always add more files to a mod or de-register a mod at any time from within the app"); + } if !game_verified { ui.global::().set_current_subpage(1); ui.global::().set_current_mods(deserialize( @@ -227,6 +237,8 @@ fn main() -> Result<(), slint::PlatformError> { .set_game_path(try_path.to_string_lossy().to_string().into()); save_path(&CURRENT_INI, Some("paths"), "game_dir", &try_path) .unwrap_or_else(|err| ui.display_err(&err.to_string())); + ui.global::().set_current_subpage(0); + ui.display_err("Game Files Found!\nAdd mods to the app by entering a name and selecting mod files with \"Select Files\"\n\nYou can always add more files to a mod or de-register a mod at any time from within the app") } Err(err) => { match err.kind() {