PPT restor defaults (WIP)

This commit is contained in:
Luke D. Jones
2025-01-19 12:02:22 +13:00
parent f9cebf9221
commit 2d6d669c22
9 changed files with 94 additions and 41 deletions

View File

@@ -132,6 +132,23 @@ macro_rules! setup_callback {
};
}
// For handling callbacks from UI value changes
macro_rules! setup_callback_restore_default {
($property:ident, $handle:expr, $attr:expr) => {
let proxy_copy = $attr.clone();
concat_idents!(on_callback = on_cb_default_, $property {
$handle
.global::<SystemPageData>()
.on_callback(move || {
let proxy_copy = proxy_copy.clone();
tokio::spawn(async move {
proxy_copy.restore_default().await.ok();
});
});
});
};
}
macro_rules! setup_external {
($property:ident, $type:tt, $handle:expr, $attr:expr, $value:expr) => {{
// EXTERNAL CHANGES
@@ -358,41 +375,49 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
FirmwareAttribute::PptPl1Spl => {
init_minmax_property!(ppt_pl1_spl, handle, attr);
setup_callback!(ppt_pl1_spl, handle, attr, i32);
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
}
FirmwareAttribute::PptPl2Sppt => {
init_minmax_property!(ppt_pl2_sppt, handle, attr);
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
}
FirmwareAttribute::PptPl3Fppt => {
init_minmax_property!(ppt_pl3_fppt, handle, attr);
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
}
FirmwareAttribute::PptFppt => {
init_minmax_property!(ppt_fppt, handle, attr);
setup_callback!(ppt_fppt, handle, attr, i32);
setup_callback_restore_default!(ppt_fppt, handle, attr);
setup_minmax_external!(ppt_fppt, handle, attr, platform);
}
FirmwareAttribute::PptApuSppt => {
init_minmax_property!(ppt_apu_sppt, handle, attr);
setup_callback!(ppt_apu_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
}
FirmwareAttribute::PptPlatformSppt => {
init_minmax_property!(ppt_platform_sppt, handle, attr);
setup_callback!(ppt_platform_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
}
FirmwareAttribute::NvDynamicBoost => {
init_minmax_property!(nv_dynamic_boost, handle, attr);
setup_callback!(nv_dynamic_boost, handle, attr, i32);
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
}
FirmwareAttribute::NvTempTarget => {
init_minmax_property!(nv_temp_target, handle, attr);
setup_callback!(nv_temp_target, handle, attr, i32);
setup_callback_restore_default!(nv_temp_target, handle, attr);
setup_minmax_external!(nv_temp_target, handle, attr, platform);
}
FirmwareAttribute::DgpuBaseTgp => {}

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-01-18 22:33+0000\n"
"POT-Creation-Date: 2025-01-18 23:02+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -292,142 +292,142 @@ msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:130
#: rog-control-center/ui/pages/system.slint:138
msgctxt "PageSystem"
msgid "Power settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:135
#: rog-control-center/ui/pages/system.slint:143
msgctxt "PageSystem"
msgid "Charge limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:147
#: rog-control-center/ui/pages/system.slint:155
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:157
#: rog-control-center/ui/pages/system.slint:165
msgctxt "PageSystem"
msgid "Advanced"
msgstr ""
#: rog-control-center/ui/pages/system.slint:175
#: rog-control-center/ui/pages/system.slint:183
msgctxt "PageSystem"
msgid "Armoury settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:183
#: rog-control-center/ui/pages/system.slint:191
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:191
#: rog-control-center/ui/pages/system.slint:199
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:199
#: rog-control-center/ui/pages/system.slint:207
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:210
#: rog-control-center/ui/pages/system.slint:218
msgctxt "PageSystem"
msgid "The asus-armoury driver is not loaded"
msgstr ""
#: rog-control-center/ui/pages/system.slint:215
#: rog-control-center/ui/pages/system.slint:223
msgctxt "PageSystem"
msgid "For advanced features you will require a kernel with this driver added."
msgstr ""
#: rog-control-center/ui/pages/system.slint:226
#: rog-control-center/ui/pages/system.slint:234
msgctxt "ppt_warning"
msgid "The following settings may not be safe, please take care."
msgstr ""
#: rog-control-center/ui/pages/system.slint:231
#: rog-control-center/ui/pages/system.slint:239
msgctxt "ppt_pl1_spl"
msgid "PL1, sustained power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:242
#: rog-control-center/ui/pages/system.slint:250
msgctxt "ppt_pl2_sppt"
msgid "PL2, turbo power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:253
#: rog-control-center/ui/pages/system.slint:261
msgctxt "ppt_pl3_fppt"
msgid "PL3, Fast Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:263
#: rog-control-center/ui/pages/system.slint:271
msgctxt "ppt_fppt"
msgid "FPPT, Fast Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:274
#: rog-control-center/ui/pages/system.slint:282
msgctxt "ppt_apu_sppt"
msgid "SPPT, APU slow power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:285
#: rog-control-center/ui/pages/system.slint:293
msgctxt "ppt_platform_sppt"
msgid "Slow package power tracking limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:296
#: rog-control-center/ui/pages/system.slint:304
msgctxt "nv_dynamic_boost"
msgid "dGPU boost overclock"
msgstr ""
#: rog-control-center/ui/pages/system.slint:307
#: rog-control-center/ui/pages/system.slint:315
msgctxt "nv_temp_target"
msgid "dGPU temperature max"
msgstr ""
#: rog-control-center/ui/pages/system.slint:354
#: rog-control-center/ui/pages/system.slint:362
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:358
#: rog-control-center/ui/pages/system.slint:366
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:366
#: rog-control-center/ui/pages/system.slint:374
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:376
#: rog-control-center/ui/pages/system.slint:384
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:386
#: rog-control-center/ui/pages/system.slint:394
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:404
#: rog-control-center/ui/pages/system.slint:412
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr ""
#: rog-control-center/ui/pages/system.slint:410
#: rog-control-center/ui/pages/system.slint:418
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr ""
#: rog-control-center/ui/pages/system.slint:420 rog-control-center/ui/pages/system.slint:441
#: rog-control-center/ui/pages/system.slint:428 rog-control-center/ui/pages/system.slint:449
msgctxt "PageSystem"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/system.slint:431
#: rog-control-center/ui/pages/system.slint:439
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""

View File

@@ -57,6 +57,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_pl1_spl(int);
callback cb_default_ppt_pl1_spl();
in-out property <AttrMinMax> ppt_pl2_sppt: {
min: 0,
@@ -64,6 +65,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_pl2_sppt(int);
callback cb_default_ppt_pl2_sppt();
in-out property <AttrMinMax> ppt_pl3_fppt: {
min: 0,
@@ -71,6 +73,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_pl3_fppt(int);
callback cb_default_ppt_pl3_fppt();
in-out property <AttrMinMax> ppt_fppt: {
min: 0,
@@ -78,6 +81,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_fppt(int);
callback cb_default_ppt_fppt();
in-out property <AttrMinMax> ppt_apu_sppt: {
min: 0,
@@ -85,6 +89,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_apu_sppt(int);
callback cb_default_ppt_apu_sppt();
in-out property <AttrMinMax> ppt_platform_sppt: {
min: 0,
@@ -92,6 +97,7 @@ export global SystemPageData {
val: 20,
};
callback cb_ppt_platform_sppt(int);
callback cb_default_ppt_platform_sppt();
in-out property <AttrMinMax> nv_dynamic_boost: {
min: 0,
@@ -99,6 +105,7 @@ export global SystemPageData {
val: 5,
};
callback cb_nv_dynamic_boost(int);
callback cb_default_nv_dynamic_boost();
in-out property <AttrMinMax> nv_temp_target: {
min: 0,
@@ -106,6 +113,7 @@ export global SystemPageData {
val: 75,
};
callback cb_nv_temp_target(int);
callback cb_default_nv_temp_target();
}
export component PageSystem inherits Rectangle {