feat(io): show loading overlay while opening CAD files

Big DWG/DXF files block the UI for seconds during parse + cache build,
leaving the user wondering whether the app froze. Split the file-open
flow into pick → load and show a modal overlay during the load: file
name, size, phase label (Reading / Parsing / Building caches /
Finalizing), animated indeterminate bar, and Cancel button.

Phase is tracked via a shared AtomicU8 written by the loader thread
and read by the overlay each frame. Cancel hides the overlay and
discards the result; the parser thread runs to completion in the
background since acadrust has no interrupt hook.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan 2026-05-13 09:59:07 +03:00
commit 586df77b2c
7 changed files with 369 additions and 19 deletions

View file

@ -18,7 +18,8 @@ impl H7CAD {
if let Some(path_str) = cmd.strip_prefix("OPEN_RECENT:") {
let path = PathBuf::from(path_str);
return Task::perform(crate::io::open_path(path), Message::FileOpened);
let size = std::fs::metadata(&path).map(|m| m.len()).unwrap_or(0);
return Task::done(Message::OpenPathPicked(Some((path, size))));
}
match cmd {