mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
App: a lost graphics device tells the user why the window closes and where the recovery copy is (#591)
Ported from #673: a native error dialog names the auto-saved recovery copy before the window closes; agent runs through the control channel skip it. The UI calls Hooks::device_lost once. Co-Authored-By: Dennis M. Francis <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
1 parent
7fd1d09088
commit
cb37c2511c
3 files changed
+35
-5
No files matched your search
@@ -210,6 +210,22 @@ fn main() -> eframe::Result {
|
||||
app.hooks.pick_save = Some(Box::new(|name: &str| {
|
||||
rfd::FileDialog::new().add_filter("EffectCraft Project", &["ecproj"]).set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string())
|
||||
}));
|
||||
// The window closes after a lost graphics device (#591); say why, unless an agent drives
|
||||
// the app through the control channel.
|
||||
if control_port.is_none() {
|
||||
app.hooks.device_lost = Some(Box::new(|saved: Option<Result<String, String>>| {
|
||||
let saved = match saved {
|
||||
Some(Ok(path)) => format!("\n\nYour unsaved changes were saved to:\n{path}\n\nReopen EffectCraft to recover them."),
|
||||
Some(Err(e)) => format!("\n\nYour unsaved changes could not be saved ({e})."),
|
||||
None => String::new(),
|
||||
};
|
||||
rfd::MessageDialog::new()
|
||||
.set_level(rfd::MessageLevel::Error)
|
||||
.set_title("EffectCraft: graphics device lost")
|
||||
.set_description(format!("The graphics driver stopped responding, so EffectCraft has to close.{saved}"))
|
||||
.show();
|
||||
}));
|
||||
}
|
||||
app.hooks.pick_open_project = Some(Box::new(|| {
|
||||
rfd::FileDialog::new().add_filter("EffectCraft Project", &["ecproj", "ecprojx"]).pick_file().map(|p| p.to_string_lossy().to_string())
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user