diff --git a/src/main.rs b/src/main.rs index 59e40f5..9ffc582 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,9 +25,7 @@ struct RustDoomLauncher { selected_launcher: Option, selected_iwad: Option, selected_pwads: Vec, - launcher_name: String, - iwad_name: String, - pwad_name: String, + name: String, } impl Default for RustDoomLauncher { @@ -39,9 +37,7 @@ impl Default for RustDoomLauncher { selected_launcher: None, selected_iwad: None, selected_pwads: Vec::new(), - launcher_name: "".to_string(), - iwad_name: "".to_string(), - pwad_name: "".to_string(), + name: "".to_string(), } } } @@ -52,8 +48,7 @@ impl eframe::App for RustDoomLauncher { ui.heading("RustDoomLauncher"); ui.horizontal_wrapped(|ui| { ui.vertical(|ui| { - ui.label("Launchers"); - + ui.label("Launchers"); for launcher in &self.all_launchers { if ui .add(egui::SelectableLabel::new( @@ -67,11 +62,10 @@ impl eframe::App for RustDoomLauncher { } } }); + ui.separator(); ui.vertical(|ui| { - ui.horizontal(|ui| { - ui.label("IWADs"); - - }); + ui.set_min_width(100.0); + ui.label("IWADs"); for (pos, iwad) in self.all_iwads.iter().enumerate() { if ui .add(egui::SelectableLabel::new( @@ -85,8 +79,10 @@ impl eframe::App for RustDoomLauncher { } } }); + ui.separator(); ui.vertical(|ui| { - ui.label("PWADs and Mods"); + ui.set_min_width(100.0); + ui.label("PWADs and Mods"); for (pos, pwad) in self.all_pwads.iter().enumerate() { if ui .add(egui::SelectableLabel::new( @@ -99,28 +95,35 @@ impl eframe::App for RustDoomLauncher { } } }); + ui.separator(); ui.vertical(|ui| { ui.label("Add WADs etc"); + ui.set_max_width(180.0); + ui.horizontal(|ui| { + let name_label = ui.label("Name:"); + ui.text_edit_singleline(&mut self.name) + .labelled_by(name_label.id); + }); if ui.button("Add Launcher").clicked() { - if let Some(path) = rfd::FileDialog::new().pick_file() { - self.all_launchers.push(path.display().to_string()); - } + if let Some(path) = rfd::FileDialog::new().pick_file() { + self.all_launchers.push(path.display().to_string()); } + } if ui.button("Add IWAD").clicked() { - if let Some(path) = rfd::FileDialog::new().pick_file() { - self.all_iwads.push(WadInfo { - name: path.display().to_string(), - path: path, - }); - } + if let Some(path) = rfd::FileDialog::new().pick_file() { + self.all_iwads.push(WadInfo { + name: self.name.clone(), + path: path, + }); } + } if ui.button("Add PWAD or Mod").clicked() { - if let Some(path) = rfd::FileDialog::new().pick_file() { - self.all_pwads.push(WadInfo { - path: path.clone(), - name: path.display().to_string(), - }); - } + if let Some(path) = rfd::FileDialog::new().pick_file() { + self.all_pwads.push(WadInfo { + path: path.clone(), + name: self.name.clone(), + }); + } } }); });