mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
fix: reconnect signals after setting power states
This commit is contained in:
parent
2206ca47be
commit
083601fd56
@ -521,10 +521,7 @@ impl AppModel {
|
|||||||
|
|
||||||
match self.daemon_client.get_power_states(&gpu_id).await {
|
match self.daemon_client.get_power_states(&gpu_id).await {
|
||||||
Ok(power_states) => {
|
Ok(power_states) => {
|
||||||
self.oc_page
|
self.oc_page.emit(OcPageMsg::PowerStates(power_states));
|
||||||
.model()
|
|
||||||
.power_states_frame
|
|
||||||
.set_power_states(power_states);
|
|
||||||
}
|
}
|
||||||
Err(err) => warn!("could not get power states: {err:?}"),
|
Err(err) => warn!("could not get power states: {err:?}"),
|
||||||
}
|
}
|
||||||
@ -645,7 +642,7 @@ impl AppModel {
|
|||||||
.context("Could not commit config")?;
|
.context("Could not commit config")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clocks_commands = self.oc_page.model().clocks_frame.get_commands();
|
let clocks_commands = self.oc_page.model().get_clocks_commands();
|
||||||
|
|
||||||
debug!("applying clocks commands {clocks_commands:#?}");
|
debug!("applying clocks commands {clocks_commands:#?}");
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ use gtk::{
|
|||||||
prelude::{BoxExt, ButtonExt, FrameExt, OrientableExt, WidgetExt},
|
prelude::{BoxExt, ButtonExt, FrameExt, OrientableExt, WidgetExt},
|
||||||
};
|
};
|
||||||
use lact_daemon::MODULE_CONF_PATH;
|
use lact_daemon::MODULE_CONF_PATH;
|
||||||
use lact_schema::{ClocksTable, SystemInfo};
|
use lact_schema::{request::SetClocksCommand, ClocksTable, PowerStates, SystemInfo};
|
||||||
use performance_frame::PerformanceFrame;
|
use performance_frame::PerformanceFrame;
|
||||||
use power_cap_section::PowerCapSection;
|
use power_cap_section::PowerCapSection;
|
||||||
use power_states::power_states_frame::PowerStatesFrame;
|
use power_states::power_states_frame::PowerStatesFrame;
|
||||||
@ -33,8 +33,8 @@ pub struct OcPage {
|
|||||||
stats_section: GpuStatsSection,
|
stats_section: GpuStatsSection,
|
||||||
pub performance_frame: PerformanceFrame,
|
pub performance_frame: PerformanceFrame,
|
||||||
power_cap_section: PowerCapSection,
|
power_cap_section: PowerCapSection,
|
||||||
pub power_states_frame: PowerStatesFrame,
|
power_states_frame: PowerStatesFrame,
|
||||||
pub clocks_frame: ClocksFrame,
|
clocks_frame: ClocksFrame,
|
||||||
// TODO: refactor this out when child components use senders
|
// TODO: refactor this out when child components use senders
|
||||||
signals_blocked: Rc<Cell<bool>>,
|
signals_blocked: Rc<Cell<bool>>,
|
||||||
}
|
}
|
||||||
@ -44,6 +44,7 @@ pub enum OcPageMsg {
|
|||||||
Update { update: PageUpdate, initial: bool },
|
Update { update: PageUpdate, initial: bool },
|
||||||
ClocksTable(Option<ClocksTable>),
|
ClocksTable(Option<ClocksTable>),
|
||||||
ProfileModesTable(Option<PowerProfileModesTable>),
|
ProfileModesTable(Option<PowerProfileModesTable>),
|
||||||
|
PowerStates(PowerStates),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[relm4::component(pub)]
|
#[relm4::component(pub)]
|
||||||
@ -207,6 +208,9 @@ impl relm4::Component for OcPage {
|
|||||||
OcPageMsg::ProfileModesTable(modes_table) => {
|
OcPageMsg::ProfileModesTable(modes_table) => {
|
||||||
self.performance_frame.set_power_profile_modes(modes_table);
|
self.performance_frame.set_power_profile_modes(modes_table);
|
||||||
}
|
}
|
||||||
|
OcPageMsg::PowerStates(states) => {
|
||||||
|
self.power_states_frame.set_power_states(states);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.signals_blocked.set(false);
|
self.signals_blocked.set(false);
|
||||||
@ -239,6 +243,10 @@ impl OcPage {
|
|||||||
self.power_cap_section.get_user_cap()
|
self.power_cap_section.get_user_cap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_clocks_commands(&self) -> Vec<SetClocksCommand> {
|
||||||
|
self.clocks_frame.get_commands()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_enabled_power_states(&self) -> HashMap<PowerLevelKind, Vec<u8>> {
|
pub fn get_enabled_power_states(&self) -> HashMap<PowerLevelKind, Vec<u8>> {
|
||||||
if self.performance_frame.get_selected_performance_level() == PerformanceLevel::Manual {
|
if self.performance_frame.get_selected_performance_level() == PerformanceLevel::Manual {
|
||||||
self.power_states_frame.get_enabled_power_states()
|
self.power_states_frame.get_enabled_power_states()
|
||||||
|
Loading…
Reference in New Issue
Block a user