Clipp suggested this

This commit is contained in:
2023-07-05 22:26:01 +01:00
parent 9f62e4894b
commit 88e6033b99
2 changed files with 9 additions and 6 deletions

View File

@@ -20,8 +20,8 @@ pub enum CommandErrors {
NoIwad,
}
impl CommandManager {
pub fn new() -> Self {
impl Default for CommandManager {
fn default() -> Self {
Self {
launcher: None,
iwad: None,
@@ -33,6 +33,9 @@ impl CommandManager {
command_string: "".to_string(),
}
}
}
impl CommandManager {
pub fn remove_iwad(&mut self) {
self.iwad = None;
self.update_command();

View File

@@ -52,7 +52,7 @@ impl Default for RustDoomLauncher {
launcher_manager: SingleManager::new(),
iwad_manager: SingleManager::new(),
pwad_manager: MultiManager::new(),
command_manager: CommandManager::new(),
command_manager: CommandManager::default(),
add_name: "".to_string(),
config_filename: default_save_filename(),
config_file_loaded: false,
@@ -399,9 +399,8 @@ impl eframe::App for RustDoomLauncher {
});
}
egui::Window::new("Add WAD or Launcher")
.open(&mut self.add_stuff_window_displayed)
.show(ctx, |ui| {
if self.add_stuff_window_displayed {
egui::Window::new("Add WAD or Launcher").show(ctx, |ui| {
ui.horizontal(|ui| {
let name_label = ui.label("Name");
ui.text_edit_singleline(&mut self.add_name)
@@ -479,4 +478,5 @@ impl eframe::App for RustDoomLauncher {
}
});
}
}
}