More layout tweaks

This commit is contained in:
2023-06-02 17:43:51 +01:00
parent 757867754e
commit c668e85810

View File

@@ -25,9 +25,7 @@ struct RustDoomLauncher {
selected_launcher: Option<String>,
selected_iwad: Option<usize>,
selected_pwads: Vec<usize>,
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(),
}
}
}
@@ -53,7 +49,6 @@ impl eframe::App for RustDoomLauncher {
ui.horizontal_wrapped(|ui| {
ui.vertical(|ui| {
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.set_min_width(100.0);
ui.label("IWADs");
});
for (pos, iwad) in self.all_iwads.iter().enumerate() {
if ui
.add(egui::SelectableLabel::new(
@@ -85,7 +79,9 @@ impl eframe::App for RustDoomLauncher {
}
}
});
ui.separator();
ui.vertical(|ui| {
ui.set_min_width(100.0);
ui.label("PWADs and Mods");
for (pos, pwad) in self.all_pwads.iter().enumerate() {
if ui
@@ -99,8 +95,15 @@ 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());
@@ -109,7 +112,7 @@ impl eframe::App for RustDoomLauncher {
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(),
name: self.name.clone(),
path: path,
});
}
@@ -118,7 +121,7 @@ impl eframe::App for RustDoomLauncher {
if let Some(path) = rfd::FileDialog::new().pick_file() {
self.all_pwads.push(WadInfo {
path: path.clone(),
name: path.display().to_string(),
name: self.name.clone(),
});
}
}