ROGCC: refactor many more parts of the PPT settings

This commit is contained in:
Luke Jones
2025-02-04 17:48:52 +13:00
parent 5833a011ce
commit 16700e55f4
6 changed files with 69 additions and 59 deletions

View File

@@ -21,7 +21,7 @@ const MINMAX: AttrMinMax = AttrMinMax {
pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let conn = zbus::blocking::Connection::system().unwrap();
let platform = PlatformProxyBlocking::new(&conn).unwrap();
let platform = PlatformProxyBlocking::builder(&conn).build().unwrap();
// let armoury_attrs =
// find_iface::<AsusArmouryProxyBlocking>("xyz.ljones.AsusArmoury").unwrap();
@@ -191,7 +191,6 @@ macro_rules! setup_value_watch {
let mut tmp: AttrMinMax =
handle.global::<SystemPageData>().getter();
tmp.$value_type = out $($conv)*;
dbg!(tmp.$value_type);
concat_idents!(setter = set_, $property {
handle.global::<SystemPageData>().setter(tmp);
});
@@ -260,7 +259,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
tokio::spawn(async move {
// Create the connections/proxies here to prevent future delays in process
let conn = zbus::Connection::system().await.unwrap();
let platform = PlatformProxy::new(&conn).await.unwrap();
let platform = PlatformProxy::builder(&conn).build().await.unwrap();
set_ui_props_async!(
handle,

View File

@@ -265,6 +265,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_pl1_spl.min;
maximum: SystemPageData.ppt_pl1_spl.max;
value: SystemPageData.ppt_pl1_spl.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl1_spl();
@@ -282,6 +283,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_pl2_sppt.min;
maximum: SystemPageData.ppt_pl2_sppt.max;
value: SystemPageData.ppt_pl2_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl2_sppt();
@@ -299,6 +301,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_pl3_fppt.min;
maximum: SystemPageData.ppt_pl3_fppt.max;
value: SystemPageData.ppt_pl3_fppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl3_fppt();
@@ -315,6 +318,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_fppt.min;
maximum: SystemPageData.ppt_fppt.max;
value: SystemPageData.ppt_fppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_fppt();
@@ -332,6 +336,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_apu_sppt.min;
maximum: SystemPageData.ppt_apu_sppt.max;
value: SystemPageData.ppt_apu_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_apu_sppt();
@@ -349,6 +354,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.ppt_platform_sppt.min;
maximum: SystemPageData.ppt_platform_sppt.max;
value: SystemPageData.ppt_platform_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_platform_sppt();
@@ -366,6 +372,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.nv_dynamic_boost.min;
maximum: SystemPageData.nv_dynamic_boost.max;
value: SystemPageData.nv_dynamic_boost.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_nv_dynamic_boost();
@@ -383,6 +390,7 @@ export component PageSystem inherits Rectangle {
minimum: SystemPageData.nv_temp_target.min;
maximum: SystemPageData.nv_temp_target.max;
value: SystemPageData.nv_temp_target.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_nv_temp_target();

View File

@@ -12,6 +12,7 @@ export component RogItem inherits Rectangle {
export component SystemSlider inherits RogItem {
in property <string> title;
in property <string> text;
in-out property <bool> enabled;
in-out property <float> value;
in-out property <float> minimum;
in-out property <float> maximum;
@@ -27,6 +28,7 @@ export component SystemSlider inherits RogItem {
alignment: LayoutAlignment.stretch;
padding-left: 10px;
TouchArea {
enabled <=> root.enabled;
clicked => {
slider.value += 1;
if slider.value > slider.maximum {
@@ -57,6 +59,7 @@ export component SystemSlider inherits RogItem {
// alignment: LayoutAlignment.end;
padding-right: 20px;
slider := Slider {
enabled <=> root.enabled;
maximum: root.maximum;
minimum: root.minimum;
value <=> root.value;
@@ -150,6 +153,7 @@ export component SystemSlider inherits RogItem {
reset := HorizontalBox {
if (has_reset): StandardButton {
kind: StandardButtonKind.reset;
enabled <=> root.enabled;
clicked => {
reset_popup.show();
}