mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2026-08-19 01:14:43 -05:00
power stats
This commit is contained in:
@@ -6,7 +6,7 @@ mod warning_frame;
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use lact_schema::{DeviceInfo, DeviceStats, PerformanceLevel};
|
||||
use lact_schema::{DeviceInfo, DeviceStats, PerformanceLevel, PowerStats};
|
||||
use performance_level_frame::PowerProfileFrame;
|
||||
use power_cap_frame::PowerCapFrame;
|
||||
use stats_grid::StatsGrid;
|
||||
@@ -58,6 +58,10 @@ impl OcPage {
|
||||
|
||||
pub fn set_stats(&self, stats: &DeviceStats) {
|
||||
self.stats_grid.set_stats(stats);
|
||||
self.power_cap_frame.set_data(
|
||||
stats.power_stats.power_cap_current,
|
||||
stats.power_stats.power_cap_max,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn connect_clocks_reset<F: Fn() + 'static + Clone>(&self, f: F) {
|
||||
@@ -108,7 +112,7 @@ impl OcPage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_info(&self, info: &DeviceInfo) {
|
||||
pub fn set_power_stats(&self, power_stats: PowerStats) {
|
||||
// TODO
|
||||
/*match &info.clocks_table {
|
||||
Some(clocks_table) => {
|
||||
@@ -117,9 +121,6 @@ impl OcPage {
|
||||
}
|
||||
None => self.clocks_frame.hide(),
|
||||
}*/
|
||||
|
||||
/*self.power_cap_frame
|
||||
.set_data(info.power_cap, info.power_cap_max);*/
|
||||
}
|
||||
|
||||
/*pub fn get_clocks(&self) -> Option<ClocksSettings> {
|
||||
|
||||
@@ -50,14 +50,14 @@ impl PowerCapFrame {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_data(&self, power_cap: Option<i64>, power_cap_max: Option<i64>) {
|
||||
pub fn set_data(&self, power_cap: Option<f64>, power_cap_max: Option<f64>) {
|
||||
if let Some(power_cap_max) = power_cap_max {
|
||||
self.adjustment.set_upper(power_cap_max as f64);
|
||||
self.adjustment.set_upper(power_cap_max);
|
||||
} else {
|
||||
self.container.set_visible(false);
|
||||
}
|
||||
if let Some(power_cap) = power_cap {
|
||||
self.adjustment.set_value(power_cap as f64);
|
||||
self.adjustment.set_value(power_cap);
|
||||
} else {
|
||||
self.container.set_visible(false);
|
||||
}
|
||||
|
||||
@@ -177,8 +177,7 @@ impl StatsGrid {
|
||||
let PowerStats {
|
||||
power_average,
|
||||
power_cap_current,
|
||||
power_cap_max,
|
||||
power_cap_min,
|
||||
..
|
||||
} = stats.power_stats;
|
||||
|
||||
self.power_usage_label.set_markup(&format!(
|
||||
|
||||
Reference in New Issue
Block a user