More layout tweaks
This commit is contained in:
59
src/main.rs
59
src/main.rs
@@ -25,9 +25,7 @@ struct RustDoomLauncher {
|
|||||||
selected_launcher: Option<String>,
|
selected_launcher: Option<String>,
|
||||||
selected_iwad: Option<usize>,
|
selected_iwad: Option<usize>,
|
||||||
selected_pwads: Vec<usize>,
|
selected_pwads: Vec<usize>,
|
||||||
launcher_name: String,
|
name: String,
|
||||||
iwad_name: String,
|
|
||||||
pwad_name: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RustDoomLauncher {
|
impl Default for RustDoomLauncher {
|
||||||
@@ -39,9 +37,7 @@ impl Default for RustDoomLauncher {
|
|||||||
selected_launcher: None,
|
selected_launcher: None,
|
||||||
selected_iwad: None,
|
selected_iwad: None,
|
||||||
selected_pwads: Vec::new(),
|
selected_pwads: Vec::new(),
|
||||||
launcher_name: "".to_string(),
|
name: "".to_string(),
|
||||||
iwad_name: "".to_string(),
|
|
||||||
pwad_name: "".to_string(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,8 +48,7 @@ impl eframe::App for RustDoomLauncher {
|
|||||||
ui.heading("RustDoomLauncher");
|
ui.heading("RustDoomLauncher");
|
||||||
ui.horizontal_wrapped(|ui| {
|
ui.horizontal_wrapped(|ui| {
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.label("Launchers");
|
ui.label("Launchers");
|
||||||
|
|
||||||
for launcher in &self.all_launchers {
|
for launcher in &self.all_launchers {
|
||||||
if ui
|
if ui
|
||||||
.add(egui::SelectableLabel::new(
|
.add(egui::SelectableLabel::new(
|
||||||
@@ -67,11 +62,10 @@ impl eframe::App for RustDoomLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ui.separator();
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.horizontal(|ui| {
|
ui.set_min_width(100.0);
|
||||||
ui.label("IWADs");
|
ui.label("IWADs");
|
||||||
|
|
||||||
});
|
|
||||||
for (pos, iwad) in self.all_iwads.iter().enumerate() {
|
for (pos, iwad) in self.all_iwads.iter().enumerate() {
|
||||||
if ui
|
if ui
|
||||||
.add(egui::SelectableLabel::new(
|
.add(egui::SelectableLabel::new(
|
||||||
@@ -85,8 +79,10 @@ impl eframe::App for RustDoomLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ui.separator();
|
||||||
ui.vertical(|ui| {
|
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() {
|
for (pos, pwad) in self.all_pwads.iter().enumerate() {
|
||||||
if ui
|
if ui
|
||||||
.add(egui::SelectableLabel::new(
|
.add(egui::SelectableLabel::new(
|
||||||
@@ -99,28 +95,35 @@ impl eframe::App for RustDoomLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ui.separator();
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.label("Add WADs etc");
|
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 ui.button("Add Launcher").clicked() {
|
||||||
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
||||||
self.all_launchers.push(path.display().to_string());
|
self.all_launchers.push(path.display().to_string());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ui.button("Add IWAD").clicked() {
|
if ui.button("Add IWAD").clicked() {
|
||||||
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
||||||
self.all_iwads.push(WadInfo {
|
self.all_iwads.push(WadInfo {
|
||||||
name: path.display().to_string(),
|
name: self.name.clone(),
|
||||||
path: path,
|
path: path,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ui.button("Add PWAD or Mod").clicked() {
|
if ui.button("Add PWAD or Mod").clicked() {
|
||||||
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
if let Some(path) = rfd::FileDialog::new().pick_file() {
|
||||||
self.all_pwads.push(WadInfo {
|
self.all_pwads.push(WadInfo {
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
name: path.display().to_string(),
|
name: self.name.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user