Wire skill level and accessibility settings to UI
- Add detailed_mode to AppState, derived from skill_level setting - Expand advanced option sections by default in Detailed mode (resize, convert, compress, watermark steps) - Fix high contrast to use HighContrast GTK theme - Add completion sound via canberra-gtk-play
This commit is contained in:
@@ -94,6 +94,7 @@ pub struct AppState {
|
|||||||
pub excluded_files: Rc<RefCell<std::collections::HashSet<std::path::PathBuf>>>,
|
pub excluded_files: Rc<RefCell<std::collections::HashSet<std::path::PathBuf>>>,
|
||||||
pub output_dir: Rc<RefCell<Option<std::path::PathBuf>>>,
|
pub output_dir: Rc<RefCell<Option<std::path::PathBuf>>>,
|
||||||
pub job_config: Rc<RefCell<JobConfig>>,
|
pub job_config: Rc<RefCell<JobConfig>>,
|
||||||
|
pub detailed_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -218,6 +219,7 @@ fn build_ui(app: &adw::Application) {
|
|||||||
loaded_files: Rc::new(RefCell::new(Vec::new())),
|
loaded_files: Rc::new(RefCell::new(Vec::new())),
|
||||||
excluded_files: Rc::new(RefCell::new(std::collections::HashSet::new())),
|
excluded_files: Rc::new(RefCell::new(std::collections::HashSet::new())),
|
||||||
output_dir: Rc::new(RefCell::new(None)),
|
output_dir: Rc::new(RefCell::new(None)),
|
||||||
|
detailed_mode: app_cfg.skill_level.is_advanced(),
|
||||||
job_config: Rc::new(RefCell::new(JobConfig {
|
job_config: Rc::new(RefCell::new(JobConfig {
|
||||||
resize_enabled: if remember { sess_state.resize_enabled.unwrap_or(true) } else { true },
|
resize_enabled: if remember { sess_state.resize_enabled.unwrap_or(true) } else { true },
|
||||||
resize_width: if remember { sess_state.resize_width.unwrap_or(1200) } else { 1200 },
|
resize_width: if remember { sess_state.resize_width.unwrap_or(1200) } else { 1200 },
|
||||||
@@ -2503,11 +2505,10 @@ fn apply_accessibility_settings() {
|
|||||||
let config = config_store.load().unwrap_or_default();
|
let config = config_store.load().unwrap_or_default();
|
||||||
|
|
||||||
if config.high_contrast {
|
if config.high_contrast {
|
||||||
// Use libadwaita's high contrast mode
|
// Request high contrast by switching to the HighContrast theme.
|
||||||
let style_manager = adw::StyleManager::default();
|
// This works on GNOME systems with the standard HC theme installed.
|
||||||
style_manager.set_color_scheme(adw::ColorScheme::ForceLight);
|
let settings = gtk::Settings::default().unwrap();
|
||||||
// High contrast is best achieved via the GTK_THEME env or system
|
settings.set_gtk_theme_name(Some("HighContrast"));
|
||||||
// settings; the app respects system high contrast automatically
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let settings = gtk::Settings::default().unwrap();
|
let settings = gtk::Settings::default().unwrap();
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
let advanced_expander = adw::ExpanderRow::builder()
|
let advanced_expander = adw::ExpanderRow::builder()
|
||||||
.title("Per-Format Quality")
|
.title("Per-Format Quality")
|
||||||
.subtitle("Fine-tune quality for each format individually")
|
.subtitle("Fine-tune quality for each format individually")
|
||||||
|
.expanded(state.detailed_mode)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let jpeg_row = adw::SpinRow::builder()
|
let jpeg_row = adw::SpinRow::builder()
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
.title("Format Mapping")
|
.title("Format Mapping")
|
||||||
.subtitle("Different input formats can convert to different outputs")
|
.subtitle("Different input formats can convert to different outputs")
|
||||||
.show_enable_switch(false)
|
.show_enable_switch(false)
|
||||||
|
.expanded(state.detailed_mode)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let progressive_row = adw::SwitchRow::builder()
|
let progressive_row = adw::SwitchRow::builder()
|
||||||
|
|||||||
@@ -372,6 +372,7 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
.title("Advanced Options")
|
.title("Advanced Options")
|
||||||
.subtitle("Resize algorithm, DPI, upscale behavior")
|
.subtitle("Resize algorithm, DPI, upscale behavior")
|
||||||
.show_enable_switch(false)
|
.show_enable_switch(false)
|
||||||
|
.expanded(state.detailed_mode)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let upscale_row = adw::SwitchRow::builder()
|
let upscale_row = adw::SwitchRow::builder()
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ pub fn build_watermark_page(state: &AppState) -> adw::NavigationPage {
|
|||||||
.title("Advanced Options")
|
.title("Advanced Options")
|
||||||
.subtitle("Opacity, rotation, tiling, margin")
|
.subtitle("Opacity, rotation, tiling, margin")
|
||||||
.show_enable_switch(false)
|
.show_enable_switch(false)
|
||||||
|
.expanded(state.detailed_mode)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let opacity_row = adw::SpinRow::builder()
|
let opacity_row = adw::SpinRow::builder()
|
||||||
|
|||||||
Reference in New Issue
Block a user