Link existing output errors to GUI overwrite settings

This commit is contained in:
Dandaedre 2026-11-05 07:41:02 +01:00
parent a6739ff0a9
commit c663f32ccc
3 changed files with 53 additions and 4 deletions

View File

@ -164,6 +164,7 @@ struct App {
rx: Option<mpsc::Receiver<Update>>,
cancel: Arc<AtomicBool>,
overwrite: bool,
focus_output_settings: bool,
export_choice: ExportChoice,
completed: Option<PathBuf>,
settings: bool,
@ -224,6 +225,7 @@ impl Default for App {
rx: None,
cancel: Arc::new(AtomicBool::new(false)),
overwrite: false,
focus_output_settings: false,
export_choice: ExportChoice::default(),
completed: None,
settings: false,
@ -881,7 +883,12 @@ impl App {
self.output = p.to_string_lossy().into();
}
});
ui.checkbox(&mut self.overwrite, "Replace existing output");
let overwrite = ui.checkbox(&mut self.overwrite, "Replace existing output");
if self.focus_output_settings {
overwrite.scroll_to_me(Some(egui::Align::Center));
overwrite.request_focus();
self.focus_output_settings = false;
}
ui.separator();
if ui.button("Manual header mapping").clicked() {
self.settings = !self.settings;
@ -1003,9 +1010,19 @@ impl App {
.strong(),
);
ui.indent("operation_error", |ui| {
ui.add(egui::Label::new(e).wrap());
ui.strong("Next step");
ui.label("Resolve the problem described above, then try again.");
if e == "Output exists; use --overwrite or choose another path" {
ui.label("A file already exists at the selected output path.");
ui.strong("Next step");
ui.add(egui::Label::new("Enable Replace existing output in Setup, or choose a different output filename, then export again.").wrap());
if ui.button("Go to output settings…").clicked() {
self.tab = Tab::Setup;
self.focus_output_settings = true;
}
} else {
ui.add(egui::Label::new(e).wrap());
ui.strong("Next step");
ui.label("Resolve the problem described above, then try again.");
}
});
});
}

View File

@ -3054,6 +3054,36 @@ mod tests {
);
}
#[test]
fn existing_output_error_links_to_setup_without_enabling_overwrite() {
let mut app = sample();
app.error = Some("Output exists; use --overwrite or choose another path".into());
let ctx = egui::Context::default();
configure_style(&ctx);
let size = [860.0, 900.0];
render(&mut app, &ctx, size, vec![]);
let labels = render(&mut app, &ctx, size, vec![]);
assert!(!labels.iter().any(|(text, _)| text.contains("--overwrite")));
let button = labels
.iter()
.find(|(text, _)| text == "Go to output settings…")
.unwrap()
.1
.center();
click_size(&mut app, &ctx, button, size);
assert!(app.tab == Tab::Setup);
assert!(!app.overwrite);
for _ in 0..3 {
render(&mut app, &ctx, size, vec![]);
}
let labels = render(&mut app, &ctx, size, vec![]);
assert!(
labels
.iter()
.any(|(text, _)| text == "Replace existing output")
);
}
#[test]
fn missing_title_does_not_blame_a_detected_timing_column() {
let mut app = sample();

View File

@ -113,6 +113,8 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
Scrollable panels and dialogs use always-visible, solid scrollbars.
The export confirmation wraps paths and instructions without a horizontal
scrollbar; a vertical scrollbar appears only if the content exceeds the window.
If an output file already exists, **Go to output settings…** opens Setup and
focuses **Replace existing output**. Enable it explicitly or choose another filename.
Preview cells align at the top; blank title lines are omitted without changing
original values in the inspector or exports. On narrow windows,
timing values stack so corrections remain accessible. The table reserves space