Wire missing UI controls to job config
This commit is contained in:
@@ -318,25 +318,25 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage {
|
||||
let avif_row = adw::SpinRow::builder()
|
||||
.title("AVIF Quality")
|
||||
.subtitle("1-100, higher is better quality")
|
||||
.adjustment(>k::Adjustment::new(50.0, 1.0, 100.0, 1.0, 10.0, 0.0))
|
||||
.adjustment(>k::Adjustment::new(cfg.avif_quality as f64, 1.0, 100.0, 1.0, 10.0, 0.0))
|
||||
.build();
|
||||
|
||||
let progressive_row = adw::SwitchRow::builder()
|
||||
.title("Progressive JPEG")
|
||||
.subtitle("Loads gradually, slightly larger files")
|
||||
.active(false)
|
||||
.active(cfg.progressive_jpeg)
|
||||
.build();
|
||||
|
||||
let webp_effort_row = adw::SpinRow::builder()
|
||||
.title("WebP Encoding Effort")
|
||||
.subtitle("0-6, higher is slower but smaller files")
|
||||
.adjustment(>k::Adjustment::new(4.0, 0.0, 6.0, 1.0, 1.0, 0.0))
|
||||
.adjustment(>k::Adjustment::new(cfg.webp_effort as f64, 0.0, 6.0, 1.0, 1.0, 0.0))
|
||||
.build();
|
||||
|
||||
let avif_speed_row = adw::SpinRow::builder()
|
||||
.title("AVIF Encoding Speed")
|
||||
.subtitle("1-10, lower is slower but better compression")
|
||||
.adjustment(>k::Adjustment::new(6.0, 1.0, 10.0, 1.0, 1.0, 0.0))
|
||||
.adjustment(>k::Adjustment::new(cfg.avif_speed as f64, 1.0, 10.0, 1.0, 1.0, 0.0))
|
||||
.build();
|
||||
|
||||
advanced_expander.add_row(&jpeg_row);
|
||||
@@ -493,6 +493,30 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage {
|
||||
jc.borrow_mut().webp_quality = row.value() as u8;
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
avif_row.connect_value_notify(move |row| {
|
||||
jc.borrow_mut().avif_quality = row.value() as u8;
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
progressive_row.connect_active_notify(move |row| {
|
||||
jc.borrow_mut().progressive_jpeg = row.is_active();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
webp_effort_row.connect_value_notify(move |row| {
|
||||
jc.borrow_mut().webp_effort = row.value() as u8;
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
avif_speed_row.connect_value_notify(move |row| {
|
||||
jc.borrow_mut().avif_speed = row.value() as u8;
|
||||
});
|
||||
}
|
||||
|
||||
scrolled.set_child(Some(&content));
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage {
|
||||
let progressive_row = adw::SwitchRow::builder()
|
||||
.title("Progressive JPEG")
|
||||
.subtitle("Loads gradually in browsers, slightly larger")
|
||||
.active(false)
|
||||
.active(cfg.progressive_jpeg)
|
||||
.build();
|
||||
|
||||
// Format mapping rows - per input format output selection
|
||||
@@ -167,24 +167,28 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage {
|
||||
.subtitle("Output format for JPEG source files")
|
||||
.build();
|
||||
jpeg_mapping.set_model(Some(>k::StringList::new(&output_choices)));
|
||||
jpeg_mapping.set_selected(cfg.format_mapping_jpeg);
|
||||
|
||||
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)));
|
||||
png_mapping.set_selected(cfg.format_mapping_png);
|
||||
|
||||
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)));
|
||||
webp_mapping.set_selected(cfg.format_mapping_webp);
|
||||
|
||||
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)));
|
||||
tiff_mapping.set_selected(cfg.format_mapping_tiff);
|
||||
|
||||
advanced_expander.add_row(&progressive_row);
|
||||
advanced_expander.add_row(&mapping_header);
|
||||
@@ -222,6 +226,36 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage {
|
||||
label.set_label(&format_info(c.convert_format));
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
progressive_row.connect_active_notify(move |row| {
|
||||
jc.borrow_mut().progressive_jpeg = row.is_active();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
jpeg_mapping.connect_selected_notify(move |row| {
|
||||
jc.borrow_mut().format_mapping_jpeg = row.selected();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
png_mapping.connect_selected_notify(move |row| {
|
||||
jc.borrow_mut().format_mapping_png = row.selected();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
webp_mapping.connect_selected_notify(move |row| {
|
||||
jc.borrow_mut().format_mapping_webp = row.selected();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
tiff_mapping.connect_selected_notify(move |row| {
|
||||
jc.borrow_mut().format_mapping_tiff = row.selected();
|
||||
});
|
||||
}
|
||||
|
||||
scrolled.set_child(Some(&content));
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ pub fn build_workflow_page(state: &AppState) -> adw::NavigationPage {
|
||||
let adjustments_check = adw::SwitchRow::builder()
|
||||
.title("Adjustments")
|
||||
.subtitle("Rotate, flip, brightness, contrast, effects")
|
||||
.active(false)
|
||||
.active(state.job_config.borrow().adjustments_enabled)
|
||||
.build();
|
||||
|
||||
let convert_check = adw::SwitchRow::builder()
|
||||
@@ -117,6 +117,12 @@ pub fn build_workflow_page(state: &AppState) -> adw::NavigationPage {
|
||||
jc.borrow_mut().resize_enabled = row.is_active();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
adjustments_check.connect_active_notify(move |row| {
|
||||
jc.borrow_mut().adjustments_enabled = row.is_active();
|
||||
});
|
||||
}
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
convert_check.connect_active_notify(move |row| {
|
||||
|
||||
Reference in New Issue
Block a user