Feat: add screen_auto_brightness

This commit is contained in:
Denis Benato
2025-10-20 02:08:59 +02:00
parent 60fce30a06
commit 415712143b
3 changed files with 42 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
ui.global::<SystemPageData>().set_platform_profile(-1);
ui.global::<SystemPageData>().set_panel_overdrive(-1);
ui.global::<SystemPageData>().set_boot_sound(-1);
ui.global::<SystemPageData>().set_screen_auto_brightness(-1);
ui.global::<SystemPageData>().set_mini_led_mode(-1);
ui.global::<SystemPageData>().set_screenpad_brightness(-1);
ui.global::<SystemPageData>().set_ppt_pl1_spl(MINMAX);
@@ -666,6 +667,11 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
setup_callback!(boot_sound, handle, attr, i32);
setup_external!(boot_sound, i32, handle, attr, value)
}
FirmwareAttribute::ScreenAutoBrightness => {
init_property!(screen_auto_brightness, handle, value, i32);
setup_callback!(screen_auto_brightness, handle, attr, i32);
setup_external!(screen_auto_brightness, i32, handle, attr, value)
}
FirmwareAttribute::McuPowersave => {}
FirmwareAttribute::PanelOverdrive => {
init_property!(panel_overdrive, handle, value, i32);

View File

@@ -51,6 +51,8 @@ export global SystemPageData {
callback cb_panel_overdrive(int);
in-out property <int> boot_sound;
callback cb_boot_sound(int);
in-out property <int> screen_auto_brightness;
callback cb_screen_auto_brightness(int);
in-out property <int> mini_led_mode;
callback cb_mini_led_mode(int);
@@ -300,6 +302,14 @@ export component PageSystem inherits Rectangle {
SystemPageData.cb_boot_sound(SystemPageData.boot_sound)
}
}
if SystemPageData.screen_auto_brightness != -1: SystemToggleInt {
text: @tr("Screen Auto Brightness");
checked_int <=> SystemPageData.screen_auto_brightness;
toggled => {
SystemPageData.cb_screen_auto_brightness(SystemPageData.screen_auto_brightness)
}
}
}
if (SystemPageData.ppt_pl1_spl.max > 0 && SystemPageData.ppt_pl1_spl.current != -1) || (SystemPageData.ppt_pl2_sppt.max > 0 && SystemPageData.ppt_pl2_sppt.current != -1) || (SystemPageData.ppt_pl3_fppt.max > 0 && SystemPageData.ppt_pl3_fppt.current != -1) || (SystemPageData.ppt_fppt.max > 0 && SystemPageData.ppt_fppt.current != -1) || (SystemPageData.ppt_apu_sppt.max > 0 && SystemPageData.ppt_apu_sppt.current != -1) || (SystemPageData.nv_temp_target.max > 0 && SystemPageData.nv_temp_target.current != -1) || (SystemPageData.nv_dynamic_boost.max > 0 && SystemPageData.nv_dynamic_boost.current != -1): HorizontalLayout {