From 1d33be1e3d345a431fb3a481481f98152e58121a Mon Sep 17 00:00:00 2001 From: lashman Date: Fri, 6 Mar 2026 15:41:25 +0200 Subject: [PATCH] Wire DPI setting from resize step through to processing job Add output_dpi field to JobConfig, ProcessingJob, and Preset. Connect the DPI SpinRow in the resize step's advanced options to update the config value. --- pixstrip-core/src/pipeline.rs | 2 ++ pixstrip-core/src/preset.rs | 1 + pixstrip-gtk/src/app.rs | 3 +++ pixstrip-gtk/src/steps/step_resize.rs | 6 ++++++ 4 files changed, 12 insertions(+) diff --git a/pixstrip-core/src/pipeline.rs b/pixstrip-core/src/pipeline.rs index 89e1bbb..01390e1 100644 --- a/pixstrip-core/src/pipeline.rs +++ b/pixstrip-core/src/pipeline.rs @@ -25,6 +25,7 @@ pub struct ProcessingJob { pub preserve_directory_structure: bool, pub progressive_jpeg: bool, pub avif_speed: u8, + pub output_dpi: u32, } impl ProcessingJob { @@ -47,6 +48,7 @@ impl ProcessingJob { preserve_directory_structure: false, progressive_jpeg: false, avif_speed: 6, + output_dpi: 72, } } diff --git a/pixstrip-core/src/preset.rs b/pixstrip-core/src/preset.rs index f3ba1a8..fc55d63 100644 --- a/pixstrip-core/src/preset.rs +++ b/pixstrip-core/src/preset.rs @@ -44,6 +44,7 @@ impl Preset { preserve_directory_structure: false, progressive_jpeg: false, avif_speed: 6, + output_dpi: 72, } } diff --git a/pixstrip-gtk/src/app.rs b/pixstrip-gtk/src/app.rs index f1d316f..37eebe9 100644 --- a/pixstrip-gtk/src/app.rs +++ b/pixstrip-gtk/src/app.rs @@ -19,6 +19,7 @@ pub struct JobConfig { pub resize_height: u32, pub allow_upscale: bool, pub resize_algorithm: u32, + pub output_dpi: u32, // Adjustments pub adjustments_enabled: bool, pub rotation: u32, @@ -226,6 +227,7 @@ fn build_ui(app: &adw::Application) { resize_height: if remember { sess_state.resize_height.unwrap_or(0) } else { 0 }, allow_upscale: false, resize_algorithm: 0, + output_dpi: 72, adjustments_enabled: false, rotation: 0, flip: 0, @@ -1454,6 +1456,7 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) { } job.preserve_directory_structure = cfg.preserve_dir_structure; + job.output_dpi = cfg.output_dpi; job.overwrite_behavior = match cfg.overwrite_behavior { 1 => pixstrip_core::operations::OverwriteBehavior::AutoRename, 2 => pixstrip_core::operations::OverwriteBehavior::Overwrite, diff --git a/pixstrip-gtk/src/steps/step_resize.rs b/pixstrip-gtk/src/steps/step_resize.rs index fc7e6dc..840785c 100644 --- a/pixstrip-gtk/src/steps/step_resize.rs +++ b/pixstrip-gtk/src/steps/step_resize.rs @@ -460,6 +460,12 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage { jc.borrow_mut().resize_algorithm = row.selected(); }); } + { + let jc = state.job_config.clone(); + dpi_row.connect_value_notify(move |row| { + jc.borrow_mut().output_dpi = row.value() as u32; + }); + } scrolled.set_child(Some(&content));