GUI Progress counter

This commit is contained in:
2026-05-23 18:40:13 +02:00
parent e38b6dae6d
commit b81f115989
+12 -3
View File
@@ -302,9 +302,10 @@ fn main() {
} }
drop(s); drop(s);
let total = asc_paths.len();
if let Some(w) = window_weak.upgrade() { if let Some(w) = window_weak.upgrade() {
w.set_busy(true); w.set_busy(true);
w.set_status("Decoding...".into()); w.set_status(format!("Decoding... 0/{}", total).into());
} }
let window_weak = window_weak.clone(); let window_weak = window_weak.clone();
@@ -314,10 +315,18 @@ fn main() {
.map_err(|e| format!("Failed to read DBC: {}", e))?; .map_err(|e| format!("Failed to read DBC: {}", e))?;
let dbc = Dbc::try_from(data.as_str()) let dbc = Dbc::try_from(data.as_str())
.map_err(|e| format!("Failed to parse DBC: {:?}", e))?; .map_err(|e| format!("Failed to parse DBC: {:?}", e))?;
let mut out = Vec::with_capacity(asc_paths.len()); let mut out = Vec::with_capacity(total);
for asc in &asc_paths { for (i, asc) in asc_paths.iter().enumerate() {
let info = libsvld::decode(&dbc, asc, &output_dir); let info = libsvld::decode(&dbc, asc, &output_dir);
out.push(build_file_result(asc, info)); 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) Ok(out)
})(); })();