mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Add option for enable/disable apply AC/Bat policy on change
This commit is contained in:
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Add a config option to set if throttle policy is changed on ac/bat change (UI only)
|
||||||
|
|
||||||
## [v6.0.6]
|
## [v6.0.6]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
28
Cargo.lock
generated
28
Cargo.lock
generated
@@ -117,7 +117,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -135,7 +135,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd"
|
name = "asusd"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -161,7 +161,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd-user"
|
name = "asusd-user"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"config-traits",
|
"config-traits",
|
||||||
@@ -828,7 +828,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config-traits"
|
name = "config-traits"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -934,7 +934,7 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpuctl"
|
name = "cpuctl"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
@@ -1134,7 +1134,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dmi_id"
|
name = "dmi_id"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"udev 0.8.0",
|
"udev 0.8.0",
|
||||||
@@ -3309,7 +3309,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"betrayer",
|
"betrayer",
|
||||||
@@ -3341,7 +3341,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -3358,7 +3358,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -3372,7 +3372,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -3386,7 +3386,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -3401,7 +3401,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -3415,7 +3415,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_simulators"
|
name = "rog_simulators"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -3425,7 +3425,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_slash"
|
name = "rog_slash"
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "6.0.6"
|
version = "6.0.7"
|
||||||
rust-version = "1.77"
|
rust-version = "1.77"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ pub struct Config {
|
|||||||
pub throttle_policy_linked_epp: bool,
|
pub throttle_policy_linked_epp: bool,
|
||||||
/// Which throttle/profile to use on battery power
|
/// Which throttle/profile to use on battery power
|
||||||
pub throttle_policy_on_battery: ThrottlePolicy,
|
pub throttle_policy_on_battery: ThrottlePolicy,
|
||||||
|
/// Should the throttle policy be set on bat/ac change?
|
||||||
|
pub change_throttle_policy_on_battery: bool,
|
||||||
/// Which throttle/profile to use on AC power
|
/// Which throttle/profile to use on AC power
|
||||||
pub throttle_policy_on_ac: ThrottlePolicy,
|
pub throttle_policy_on_ac: ThrottlePolicy,
|
||||||
|
/// Should the throttle policy be set on bat/ac change?
|
||||||
|
pub change_throttle_policy_on_ac: bool,
|
||||||
/// The energy_performance_preference for this throttle/platform profile
|
/// The energy_performance_preference for this throttle/platform profile
|
||||||
pub throttle_quiet_epp: CPUEPP,
|
pub throttle_quiet_epp: CPUEPP,
|
||||||
/// The energy_performance_preference for this throttle/platform profile
|
/// The energy_performance_preference for this throttle/platform profile
|
||||||
@@ -68,7 +72,9 @@ impl Default for Config {
|
|||||||
bat_command: Default::default(),
|
bat_command: Default::default(),
|
||||||
throttle_policy_linked_epp: true,
|
throttle_policy_linked_epp: true,
|
||||||
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
||||||
|
change_throttle_policy_on_battery: true,
|
||||||
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
||||||
|
change_throttle_policy_on_ac: true,
|
||||||
throttle_quiet_epp: CPUEPP::Power,
|
throttle_quiet_epp: CPUEPP::Power,
|
||||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||||
throttle_performance_epp: CPUEPP::Performance,
|
throttle_performance_epp: CPUEPP::Performance,
|
||||||
@@ -142,7 +148,9 @@ impl From<Config507> for Config {
|
|||||||
mini_led_mode: c.mini_led_mode,
|
mini_led_mode: c.mini_led_mode,
|
||||||
throttle_policy_linked_epp: true,
|
throttle_policy_linked_epp: true,
|
||||||
throttle_policy_on_battery: c.platform_policy_on_battery,
|
throttle_policy_on_battery: c.platform_policy_on_battery,
|
||||||
|
change_throttle_policy_on_battery: true,
|
||||||
throttle_policy_on_ac: c.platform_policy_on_ac,
|
throttle_policy_on_ac: c.platform_policy_on_ac,
|
||||||
|
change_throttle_policy_on_ac: true,
|
||||||
throttle_quiet_epp: CPUEPP::Power,
|
throttle_quiet_epp: CPUEPP::Power,
|
||||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||||
throttle_performance_epp: CPUEPP::Performance,
|
throttle_performance_epp: CPUEPP::Performance,
|
||||||
|
|||||||
@@ -9,17 +9,12 @@ use rog_platform::platform::{GpuMode, Properties, RogPlatform, ThrottlePolicy};
|
|||||||
use rog_platform::power::AsusPower;
|
use rog_platform::power::AsusPower;
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
use zbus::fdo::Error as FdoErr;
|
use zbus::fdo::Error as FdoErr;
|
||||||
use zbus::{interface, Connection, ObjectServer, SignalContext};
|
use zbus::{interface, Connection, SignalContext};
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::ctrl_anime::trait_impls::{CtrlAnimeZbus, ANIME_ZBUS_NAME, ANIME_ZBUS_PATH};
|
|
||||||
use crate::ctrl_aura::trait_impls::{CtrlAuraZbus, AURA_ZBUS_NAME, AURA_ZBUS_PATH};
|
|
||||||
use crate::ctrl_fancurves::{CtrlFanCurveZbus, FAN_CURVE_ZBUS_NAME, FAN_CURVE_ZBUS_PATH};
|
|
||||||
use crate::ctrl_slash::trait_impls::{CtrlSlashZbus, SLASH_ZBUS_NAME, SLASH_ZBUS_PATH};
|
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify};
|
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify};
|
||||||
|
|
||||||
const PLATFORM_ZBUS_NAME: &str = "Platform";
|
|
||||||
const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux";
|
const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux";
|
||||||
|
|
||||||
macro_rules! platform_get_value {
|
macro_rules! platform_get_value {
|
||||||
@@ -258,6 +253,21 @@ impl CtrlPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
|
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
|
||||||
|
if power_plugged && !self.config.lock().await.change_throttle_policy_on_ac {
|
||||||
|
debug!(
|
||||||
|
"Power status changed but set_throttle_policy_on_ac set false. Not setting the \
|
||||||
|
thing"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if !power_plugged && !self.config.lock().await.change_throttle_policy_on_battery {
|
||||||
|
debug!(
|
||||||
|
"Power status changed but set_throttle_policy_on_battery set false. Not setting \
|
||||||
|
the thing"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let throttle = if power_plugged {
|
let throttle = if power_plugged {
|
||||||
self.config.lock().await.throttle_policy_on_ac
|
self.config.lock().await.throttle_policy_on_ac
|
||||||
} else {
|
} else {
|
||||||
@@ -328,49 +338,6 @@ impl CtrlPlatform {
|
|||||||
supported
|
supported
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn supported_interfaces(
|
|
||||||
&self,
|
|
||||||
#[zbus(object_server)] server: &ObjectServer,
|
|
||||||
) -> Vec<String> {
|
|
||||||
let mut interfaces = Vec::default();
|
|
||||||
if server
|
|
||||||
.interface::<_, CtrlAnimeZbus>(ANIME_ZBUS_PATH)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
interfaces.push(ANIME_ZBUS_NAME.to_owned());
|
|
||||||
}
|
|
||||||
if server
|
|
||||||
.interface::<_, CtrlAuraZbus>(AURA_ZBUS_PATH)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
interfaces.push(AURA_ZBUS_NAME.to_owned());
|
|
||||||
}
|
|
||||||
if server
|
|
||||||
.interface::<_, CtrlFanCurveZbus>(FAN_CURVE_ZBUS_PATH)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
interfaces.push(FAN_CURVE_ZBUS_NAME.to_owned());
|
|
||||||
}
|
|
||||||
if server
|
|
||||||
.interface::<_, CtrlPlatform>(PLATFORM_ZBUS_PATH)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
interfaces.push(PLATFORM_ZBUS_NAME.to_owned());
|
|
||||||
}
|
|
||||||
if server
|
|
||||||
.interface::<_, CtrlSlashZbus>(SLASH_ZBUS_PATH)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
interfaces.push(SLASH_ZBUS_NAME.to_owned());
|
|
||||||
}
|
|
||||||
interfaces
|
|
||||||
}
|
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn charge_control_end_threshold(&self) -> Result<u8, FdoErr> {
|
fn charge_control_end_threshold(&self) -> Result<u8, FdoErr> {
|
||||||
let limit = self.power.get_charge_control_end_threshold()?;
|
let limit = self.power.get_charge_control_end_threshold()?;
|
||||||
@@ -496,6 +463,18 @@ impl CtrlPlatform {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
async fn change_throttle_policy_on_battery(&self) -> Result<bool, FdoErr> {
|
||||||
|
Ok(self.config.lock().await.change_throttle_policy_on_battery)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
async fn set_change_throttle_policy_on_battery(&mut self, change: bool) -> Result<(), FdoErr> {
|
||||||
|
self.config.lock().await.change_throttle_policy_on_battery = change;
|
||||||
|
self.config.lock().await.write();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_policy_on_ac(&self) -> Result<ThrottlePolicy, FdoErr> {
|
async fn throttle_policy_on_ac(&self) -> Result<ThrottlePolicy, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_policy_on_ac)
|
Ok(self.config.lock().await.throttle_policy_on_ac)
|
||||||
@@ -509,6 +488,18 @@ impl CtrlPlatform {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
async fn change_throttle_policy_on_ac(&self) -> Result<bool, FdoErr> {
|
||||||
|
Ok(self.config.lock().await.change_throttle_policy_on_ac)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
async fn set_change_throttle_policy_on_ac(&mut self, change: bool) -> Result<(), FdoErr> {
|
||||||
|
self.config.lock().await.change_throttle_policy_on_ac = change;
|
||||||
|
self.config.lock().await.write();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// The energy_performance_preference for the quiet throttle/platform
|
/// The energy_performance_preference for the quiet throttle/platform
|
||||||
/// profile
|
/// profile
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
@@ -905,6 +896,8 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
// This block is commented out due to some kind of issue reported. Maybe the
|
||||||
|
// desktops used were storing a value whcih was then read here.
|
||||||
// Don't store it on suspend, assume that the current config setting is desired
|
// Don't store it on suspend, assume that the current config setting is desired
|
||||||
// if sleeping && platform1.power.has_charge_control_end_threshold() {
|
// if sleeping && platform1.power.has_charge_control_end_threshold() {
|
||||||
// platform1.config.lock().await.charge_control_end_threshold = platform1
|
// platform1.config.lock().await.charge_control_end_threshold = platform1
|
||||||
|
|||||||
@@ -60,7 +60,19 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
|
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_quiet_epp);
|
set_ui_props_async!(handle, platform, SystemPageData, throttle_quiet_epp);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_battery);
|
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_battery);
|
||||||
|
set_ui_props_async!(
|
||||||
|
handle,
|
||||||
|
platform,
|
||||||
|
SystemPageData,
|
||||||
|
change_throttle_policy_on_battery
|
||||||
|
);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_ac);
|
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_ac);
|
||||||
|
set_ui_props_async!(
|
||||||
|
handle,
|
||||||
|
platform,
|
||||||
|
SystemPageData,
|
||||||
|
change_throttle_policy_on_ac
|
||||||
|
);
|
||||||
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, panel_od);
|
set_ui_props_async!(handle, platform, SystemPageData, panel_od);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, boot_sound);
|
set_ui_props_async!(handle, platform, SystemPageData, boot_sound);
|
||||||
@@ -94,6 +106,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
throttle_thermal_policy: sys_props.contains(&Properties::ThrottlePolicy),
|
throttle_thermal_policy: sys_props.contains(&Properties::ThrottlePolicy),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: move the fail/sucess messages to slint
|
||||||
handle
|
handle
|
||||||
.upgrade_in_event_loop(move |handle| {
|
.upgrade_in_event_loop(move |handle| {
|
||||||
handle.global::<SystemPageData>().set_available(props);
|
handle.global::<SystemPageData>().set_available(props);
|
||||||
@@ -163,13 +176,24 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
"Throttle policy on AC set to {}",
|
"Throttle policy on AC set to {}",
|
||||||
"Setting Throttle policy on AC failed"
|
"Setting Throttle policy on AC failed"
|
||||||
);
|
);
|
||||||
|
set_ui_callbacks!(handle,
|
||||||
|
SystemPageData(as bool),
|
||||||
|
platform.change_throttle_policy_on_ac(.into()),
|
||||||
|
"Throttle policy on AC enabled: {}",
|
||||||
|
"Setting Throttle policy on AC failed"
|
||||||
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform.throttle_policy_on_battery(.into()),
|
platform.throttle_policy_on_battery(.into()),
|
||||||
"Throttle policy on abttery set to {}",
|
"Throttle policy on abttery set to {}",
|
||||||
"Setting Throttle policy on battery failed"
|
"Setting Throttle policy on battery failed"
|
||||||
);
|
);
|
||||||
|
set_ui_callbacks!(handle,
|
||||||
|
SystemPageData(as bool),
|
||||||
|
platform.change_throttle_policy_on_battery(.into()),
|
||||||
|
"Throttle policy on battery enabled: {}",
|
||||||
|
"Setting Throttle policy on AC failed"
|
||||||
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as f32),
|
SystemPageData(as f32),
|
||||||
platform.ppt_pl1_spl(as u8),
|
platform.ppt_pl1_spl(as u8),
|
||||||
|
|||||||
@@ -43,8 +43,12 @@ export global SystemPageData {
|
|||||||
callback set_throttle_policy_linked_epp(bool);
|
callback set_throttle_policy_linked_epp(bool);
|
||||||
in-out property <int> throttle_policy_on_ac: 0;
|
in-out property <int> throttle_policy_on_ac: 0;
|
||||||
callback set_throttle_policy_on_ac(int);
|
callback set_throttle_policy_on_ac(int);
|
||||||
|
in-out property <bool> change_throttle_policy_on_ac: true;
|
||||||
|
callback set_change_throttle_policy_on_ac(bool);
|
||||||
in-out property <int> throttle_policy_on_battery: 0;
|
in-out property <int> throttle_policy_on_battery: 0;
|
||||||
callback set_throttle_policy_on_battery(int);
|
callback set_throttle_policy_on_battery(int);
|
||||||
|
in-out property <bool> change_throttle_policy_on_battery: true;
|
||||||
|
callback set_change_throttle_policy_on_battery(bool);
|
||||||
in-out property <bool> panel_od;
|
in-out property <bool> panel_od;
|
||||||
callback set_panel_od(bool);
|
callback set_panel_od(bool);
|
||||||
in-out property <bool> boot_sound;
|
in-out property <bool> boot_sound;
|
||||||
@@ -340,23 +344,45 @@ export component PageSystem inherits Rectangle {
|
|||||||
text: @tr("Throttle Policy for power state");
|
text: @tr("Throttle Policy for power state");
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDropdown {
|
HorizontalLayout {
|
||||||
text: @tr("Throttle Policy on Battery");
|
spacing: 10px;
|
||||||
current_index <=> SystemPageData.throttle_policy_on_battery;
|
SystemDropdown {
|
||||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
|
text: @tr("Throttle Policy on Battery");
|
||||||
model <=> SystemPageData.throttle_policy_choices;
|
current_index <=> SystemPageData.throttle_policy_on_battery;
|
||||||
selected => {
|
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
|
||||||
SystemPageData.set_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
|
model <=> SystemPageData.throttle_policy_choices;
|
||||||
|
selected => {
|
||||||
|
SystemPageData.set_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemToggle {
|
||||||
|
text: @tr("Enabled");
|
||||||
|
checked <=> SystemPageData.change_throttle_policy_on_battery;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.set_change_throttle_policy_on_battery(SystemPageData.change_throttle_policy_on_battery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDropdown {
|
HorizontalLayout {
|
||||||
text: @tr("Throttle Policy on AC");
|
spacing: 10px;
|
||||||
current_index <=> SystemPageData.throttle_policy_on_ac;
|
SystemDropdown {
|
||||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
|
text: @tr("Throttle Policy on AC");
|
||||||
model <=> SystemPageData.throttle_policy_choices;
|
current_index <=> SystemPageData.throttle_policy_on_ac;
|
||||||
selected => {
|
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
|
||||||
SystemPageData.set_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
|
model <=> SystemPageData.throttle_policy_choices;
|
||||||
|
selected => {
|
||||||
|
SystemPageData.set_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemToggle {
|
||||||
|
text: @tr("Enabled");
|
||||||
|
checked <=> SystemPageData.change_throttle_policy_on_ac;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.set_change_throttle_policy_on_ac(SystemPageData.change_throttle_policy_on_ac);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ export component RogItem inherits Rectangle {
|
|||||||
border-color: Palette.border;
|
border-color: Palette.border;
|
||||||
border-width: 3px;
|
border-width: 3px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
min-height: 46px;
|
min-height: 48px;
|
||||||
|
max-height: 56px;
|
||||||
}
|
}
|
||||||
|
|
||||||
export component SystemSlider inherits RogItem {
|
export component SystemSlider inherits RogItem {
|
||||||
@@ -54,6 +55,7 @@ export component SystemToggle inherits RogItem {
|
|||||||
in-out property <bool> checked;
|
in-out property <bool> checked;
|
||||||
callback toggled(bool);
|
callback toggled(bool);
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
|
spacing: 6px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: LayoutAlignment.start;
|
alignment: LayoutAlignment.start;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -195,7 +197,7 @@ export component PopupNotification {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show() {
|
public function show(){
|
||||||
_p.show();
|
_p.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,24 @@ trait Platform {
|
|||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_policy_on_ac(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_throttle_policy_on_ac(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
/// ChangeThrottlePolicyOnAc property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn change_throttle_policy_on_ac(&self) -> zbus::Result<bool>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_change_throttle_policy_on_ac(&self, change: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePolicyOnBattery property
|
/// ThrottlePolicyOnBattery property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
|
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_policy_on_battery(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_throttle_policy_on_battery(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
/// ChangeThrottlePolicyOnAc property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn change_throttle_policy_on_battery(&self) -> zbus::Result<bool>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_change_throttle_policy_on_battery(&self, change: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottleQuietEpp property
|
/// ThrottleQuietEpp property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
||||||
|
|||||||
Reference in New Issue
Block a user