clear races
This commit is contained in:
parent
33d4024d2c
commit
89c5fca0bc
11
src/main.rs
11
src/main.rs
|
@ -43,9 +43,9 @@ fn main() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let options = eframe::NativeOptions::default();
|
let options = eframe::NativeOptions::default();
|
||||||
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("supper.exe"));
|
let current_exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("supper.exe"));
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
&format!("Supper OCR ({:?})", exe),
|
&format!("Supper OCR ({})", current_exe.file_name().unwrap().to_string_lossy()),
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(AppUi::new(state))),
|
Box::new(|_cc| Box::new(AppUi::new(state))),
|
||||||
);
|
);
|
||||||
|
@ -386,6 +386,7 @@ impl eframe::App for AppUi {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let len = state.past_races.len();
|
let len = state.past_races.len();
|
||||||
|
let mut races_to_remove = Vec::new();
|
||||||
for (i, race) in state.past_races.iter_mut().enumerate() {
|
for (i, race) in state.past_races.iter_mut().enumerate() {
|
||||||
ui.separator();
|
ui.separator();
|
||||||
ui.heading(format!("Race #{}: {}", len - i, race.name()));
|
ui.heading(format!("Race #{}: {}", len - i, race.name()));
|
||||||
|
@ -429,6 +430,12 @@ impl eframe::App for AppUi {
|
||||||
} else {
|
} else {
|
||||||
ui.label("Exported ✅");
|
ui.label("Exported ✅");
|
||||||
}
|
}
|
||||||
|
if ui.button("Clear").clicked() {
|
||||||
|
races_to_remove.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for index in races_to_remove {
|
||||||
|
state.past_races.remove(index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue