Add format mapping to convert step, orientation controls to resize step
Add per-format mapping rows in convert step advanced options so each input format can target a different output format. Move basic orientation controls (rotate/flip) into the resize step per design doc specification that these should be folded into the resize step.
This commit is contained in:
@@ -153,7 +153,45 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
.active(false)
|
.active(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Format mapping rows - per input format output selection
|
||||||
|
let mapping_header = adw::ActionRow::builder()
|
||||||
|
.title("Per-Format Mapping")
|
||||||
|
.subtitle("Override the output format for specific input types")
|
||||||
|
.build();
|
||||||
|
mapping_header.add_prefix(>k::Image::from_icon_name("preferences-system-symbolic"));
|
||||||
|
|
||||||
|
let output_choices = ["Same as above", "JPEG", "PNG", "WebP", "AVIF", "Keep Original"];
|
||||||
|
|
||||||
|
let jpeg_mapping = adw::ComboRow::builder()
|
||||||
|
.title("JPEG inputs")
|
||||||
|
.subtitle("Output format for JPEG source files")
|
||||||
|
.build();
|
||||||
|
jpeg_mapping.set_model(Some(>k::StringList::new(&output_choices)));
|
||||||
|
|
||||||
|
let png_mapping = adw::ComboRow::builder()
|
||||||
|
.title("PNG inputs")
|
||||||
|
.subtitle("Output format for PNG source files")
|
||||||
|
.build();
|
||||||
|
png_mapping.set_model(Some(>k::StringList::new(&output_choices)));
|
||||||
|
|
||||||
|
let webp_mapping = adw::ComboRow::builder()
|
||||||
|
.title("WebP inputs")
|
||||||
|
.subtitle("Output format for WebP source files")
|
||||||
|
.build();
|
||||||
|
webp_mapping.set_model(Some(>k::StringList::new(&output_choices)));
|
||||||
|
|
||||||
|
let tiff_mapping = adw::ComboRow::builder()
|
||||||
|
.title("TIFF inputs")
|
||||||
|
.subtitle("Output format for TIFF source files")
|
||||||
|
.build();
|
||||||
|
tiff_mapping.set_model(Some(>k::StringList::new(&output_choices)));
|
||||||
|
|
||||||
advanced_expander.add_row(&progressive_row);
|
advanced_expander.add_row(&progressive_row);
|
||||||
|
advanced_expander.add_row(&mapping_header);
|
||||||
|
advanced_expander.add_row(&jpeg_mapping);
|
||||||
|
advanced_expander.add_row(&png_mapping);
|
||||||
|
advanced_expander.add_row(&webp_mapping);
|
||||||
|
advanced_expander.add_row(&tiff_mapping);
|
||||||
advanced_group.add(&advanced_expander);
|
advanced_group.add(&advanced_expander);
|
||||||
content.append(&advanced_group);
|
content.append(&advanced_group);
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,38 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
|
|
||||||
content.append(&mode_stack);
|
content.append(&mode_stack);
|
||||||
|
|
||||||
|
// Basic orientation adjustments (folded into resize step per design doc)
|
||||||
|
let orientation_group = adw::PreferencesGroup::builder()
|
||||||
|
.title("Orientation")
|
||||||
|
.description("Rotate and flip applied before resize")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let rotate_row = adw::ComboRow::builder()
|
||||||
|
.title("Rotate")
|
||||||
|
.subtitle("Rotation applied to all images")
|
||||||
|
.build();
|
||||||
|
let rotate_model = gtk::StringList::new(&[
|
||||||
|
"None",
|
||||||
|
"90 clockwise",
|
||||||
|
"180",
|
||||||
|
"270 clockwise",
|
||||||
|
"Auto-orient (from EXIF)",
|
||||||
|
]);
|
||||||
|
rotate_row.set_model(Some(&rotate_model));
|
||||||
|
rotate_row.set_selected(cfg.rotation);
|
||||||
|
|
||||||
|
let flip_row = adw::ComboRow::builder()
|
||||||
|
.title("Flip")
|
||||||
|
.subtitle("Mirror the image")
|
||||||
|
.build();
|
||||||
|
let flip_model = gtk::StringList::new(&["None", "Horizontal", "Vertical"]);
|
||||||
|
flip_row.set_model(Some(&flip_model));
|
||||||
|
flip_row.set_selected(cfg.flip);
|
||||||
|
|
||||||
|
orientation_group.add(&rotate_row);
|
||||||
|
orientation_group.add(&flip_row);
|
||||||
|
content.append(&orientation_group);
|
||||||
|
|
||||||
// Advanced options (AdwExpanderRow per design doc)
|
// Advanced options (AdwExpanderRow per design doc)
|
||||||
let advanced_group = adw::PreferencesGroup::builder()
|
let advanced_group = adw::PreferencesGroup::builder()
|
||||||
.title("Advanced")
|
.title("Advanced")
|
||||||
@@ -292,6 +324,18 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
jc.borrow_mut().allow_upscale = row.is_active();
|
jc.borrow_mut().allow_upscale = row.is_active();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
let jc = state.job_config.clone();
|
||||||
|
rotate_row.connect_selected_notify(move |row| {
|
||||||
|
jc.borrow_mut().rotation = row.selected();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let jc = state.job_config.clone();
|
||||||
|
flip_row.connect_selected_notify(move |row| {
|
||||||
|
jc.borrow_mut().flip = row.selected();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
scrolled.set_child(Some(&content));
|
scrolled.set_child(Some(&content));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user