Respect excluded files in output step counts and processing validation

- Output step now shows only included (non-excluded) image count and size
- Navigate-to-step refresh accounts for exclusions
- Process action checks for included images, not just loaded files
This commit is contained in:
2026-03-06 13:31:35 +02:00
parent a74010a121
commit 819ac963de
2 changed files with 13 additions and 5 deletions

View File

@@ -569,18 +569,21 @@ fn navigate_to_step(ui: &WizardUi, target: usize) {
if target == 9 { if target == 9 {
// Output step - update image count, total size, and operation summary // Output step - update image count, total size, and operation summary
let files = ui.state.loaded_files.borrow(); let files = ui.state.loaded_files.borrow();
let count = files.len(); let excluded = ui.state.excluded_files.borrow();
let included_count = files.iter().filter(|p| !excluded.contains(*p)).count();
let total_size: u64 = files.iter() let total_size: u64 = files.iter()
.filter(|p| !excluded.contains(*p))
.filter_map(|p| std::fs::metadata(p).ok()) .filter_map(|p| std::fs::metadata(p).ok())
.map(|m| m.len()) .map(|m| m.len())
.sum(); .sum();
drop(excluded);
drop(files); drop(files);
if let Some(page) = ui.pages.get(9) { if let Some(page) = ui.pages.get(9) {
walk_widgets(&page.child(), &|widget| { walk_widgets(&page.child(), &|widget| {
if let Some(row) = widget.downcast_ref::<adw::ActionRow>() if let Some(row) = widget.downcast_ref::<adw::ActionRow>()
&& row.title().as_str() == "Images to process" && row.title().as_str() == "Images to process"
{ {
row.set_subtitle(&format!("{} images ({})", count, format_bytes(total_size))); row.set_subtitle(&format!("{} images ({})", included_count, format_bytes(total_size)));
} }
}); });
} }

View File

@@ -97,15 +97,20 @@ pub fn build_output_page(state: &AppState) -> adw::NavigationPage {
.title("Batch Info") .title("Batch Info")
.build(); .build();
let file_count = state.loaded_files.borrow().len(); let excluded = state.excluded_files.borrow();
let total_size: u64 = state.loaded_files.borrow().iter() let files = state.loaded_files.borrow();
let included_count = files.iter().filter(|p| !excluded.contains(*p)).count();
let total_size: u64 = files.iter()
.filter(|p| !excluded.contains(*p))
.filter_map(|p| std::fs::metadata(p).ok()) .filter_map(|p| std::fs::metadata(p).ok())
.map(|m| m.len()) .map(|m| m.len())
.sum(); .sum();
drop(files);
drop(excluded);
let count_row = adw::ActionRow::builder() let count_row = adw::ActionRow::builder()
.title("Images to process") .title("Images to process")
.subtitle(format!("{} images ({})", file_count, format_size(total_size))) .subtitle(format!("{} images ({})", included_count, format_size(total_size)))
.build(); .build();
count_row.add_prefix(&gtk::Image::from_icon_name("image-x-generic-symbolic")); count_row.add_prefix(&gtk::Image::from_icon_name("image-x-generic-symbolic"));