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.
This commit is contained in:
@@ -25,6 +25,7 @@ pub struct ProcessingJob {
|
|||||||
pub preserve_directory_structure: bool,
|
pub preserve_directory_structure: bool,
|
||||||
pub progressive_jpeg: bool,
|
pub progressive_jpeg: bool,
|
||||||
pub avif_speed: u8,
|
pub avif_speed: u8,
|
||||||
|
pub output_dpi: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProcessingJob {
|
impl ProcessingJob {
|
||||||
@@ -47,6 +48,7 @@ impl ProcessingJob {
|
|||||||
preserve_directory_structure: false,
|
preserve_directory_structure: false,
|
||||||
progressive_jpeg: false,
|
progressive_jpeg: false,
|
||||||
avif_speed: 6,
|
avif_speed: 6,
|
||||||
|
output_dpi: 72,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ impl Preset {
|
|||||||
preserve_directory_structure: false,
|
preserve_directory_structure: false,
|
||||||
progressive_jpeg: false,
|
progressive_jpeg: false,
|
||||||
avif_speed: 6,
|
avif_speed: 6,
|
||||||
|
output_dpi: 72,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub struct JobConfig {
|
|||||||
pub resize_height: u32,
|
pub resize_height: u32,
|
||||||
pub allow_upscale: bool,
|
pub allow_upscale: bool,
|
||||||
pub resize_algorithm: u32,
|
pub resize_algorithm: u32,
|
||||||
|
pub output_dpi: u32,
|
||||||
// Adjustments
|
// Adjustments
|
||||||
pub adjustments_enabled: bool,
|
pub adjustments_enabled: bool,
|
||||||
pub rotation: u32,
|
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 },
|
resize_height: if remember { sess_state.resize_height.unwrap_or(0) } else { 0 },
|
||||||
allow_upscale: false,
|
allow_upscale: false,
|
||||||
resize_algorithm: 0,
|
resize_algorithm: 0,
|
||||||
|
output_dpi: 72,
|
||||||
adjustments_enabled: false,
|
adjustments_enabled: false,
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
flip: 0,
|
flip: 0,
|
||||||
@@ -1454,6 +1456,7 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
job.preserve_directory_structure = cfg.preserve_dir_structure;
|
job.preserve_directory_structure = cfg.preserve_dir_structure;
|
||||||
|
job.output_dpi = cfg.output_dpi;
|
||||||
job.overwrite_behavior = match cfg.overwrite_behavior {
|
job.overwrite_behavior = match cfg.overwrite_behavior {
|
||||||
1 => pixstrip_core::operations::OverwriteBehavior::AutoRename,
|
1 => pixstrip_core::operations::OverwriteBehavior::AutoRename,
|
||||||
2 => pixstrip_core::operations::OverwriteBehavior::Overwrite,
|
2 => pixstrip_core::operations::OverwriteBehavior::Overwrite,
|
||||||
|
|||||||
@@ -460,6 +460,12 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
jc.borrow_mut().resize_algorithm = row.selected();
|
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));
|
scrolled.set_child(Some(&content));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user