From b81f1159896c91974472274fd65c0eea1a1ee612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Stefa=C5=84ski?= Date: Sat, 23 May 2026 18:40:13 +0200 Subject: [PATCH] GUI Progress counter --- svldgui/src/main.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/svldgui/src/main.rs b/svldgui/src/main.rs index ecd0dd9..ffcad24 100644 --- a/svldgui/src/main.rs +++ b/svldgui/src/main.rs @@ -302,9 +302,10 @@ fn main() { } drop(s); + let total = asc_paths.len(); if let Some(w) = window_weak.upgrade() { w.set_busy(true); - w.set_status("Decoding...".into()); + w.set_status(format!("Decoding... 0/{}", total).into()); } let window_weak = window_weak.clone(); @@ -314,10 +315,18 @@ fn main() { .map_err(|e| format!("Failed to read DBC: {}", e))?; let dbc = Dbc::try_from(data.as_str()) .map_err(|e| format!("Failed to parse DBC: {:?}", e))?; - let mut out = Vec::with_capacity(asc_paths.len()); - for asc in &asc_paths { + let mut out = Vec::with_capacity(total); + for (i, asc) in asc_paths.iter().enumerate() { let info = libsvld::decode(&dbc, asc, &output_dir); out.push(build_file_result(asc, info)); + let done = i + 1; + let w = window_weak.clone(); + slint::invoke_from_event_loop(move || { + if let Some(w) = w.upgrade() { + w.set_status(format!("Decoding... {}/{}", done, total).into()); + } + }) + .ok(); } Ok(out) })();