mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: wip gtk4
This commit is contained in:
173
Cargo.lock
generated
173
Cargo.lock
generated
@@ -46,30 +46,6 @@ dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atk"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39991bc421ddf72f70159011b323ff49b0f783cc676a7287c59453da2e2531cf"
|
||||
dependencies = [
|
||||
"atk-sys",
|
||||
"bitflags",
|
||||
"glib",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atk-sys"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11ad703eb64dc058024f0e57ccfa069e15a413b98dbd50a1a950e743b7f11148"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
@@ -374,22 +350,6 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk"
|
||||
version = "0.16.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa9cb33da481c6c040404a11f8212d193889e9b435db2c14fd86987f630d3ce1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"gdk-pixbuf",
|
||||
"gdk-sys",
|
||||
"gio",
|
||||
"glib",
|
||||
"libc",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-pixbuf"
|
||||
version = "0.16.7"
|
||||
@@ -417,10 +377,26 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-sys"
|
||||
version = "0.16.0"
|
||||
name = "gdk4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d76354f97a913e55b984759a997b693aa7dc71068c9e98bcce51aa167a0a5c5a"
|
||||
checksum = "bb2181330ebf9d091f8ea7fed6877f7adc92114128592e1fdaeb1da28e0d01e9"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"gdk-pixbuf",
|
||||
"gdk4-sys",
|
||||
"gio",
|
||||
"glib",
|
||||
"libc",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk4-sys"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de55cb49432901fe2b3534177fa06844665b9b0911d85d8601a8d8b88b7791db"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
@@ -536,51 +512,88 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk"
|
||||
version = "0.16.2"
|
||||
name = "graphene-rs"
|
||||
version = "0.16.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4d3507d43908c866c805f74c9dd593c0ce7ba5c38e576e41846639cdcd4bee6"
|
||||
checksum = "95ecb4d347e6d09820df3bdfd89a74a8eec07753a06bb92a3aac3ad31d04447b"
|
||||
dependencies = [
|
||||
"atk",
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"field-offset",
|
||||
"futures-channel",
|
||||
"gdk",
|
||||
"gdk-pixbuf",
|
||||
"gio",
|
||||
"glib",
|
||||
"gtk-sys",
|
||||
"gtk3-macros",
|
||||
"graphene-sys",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"pango",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk-sys"
|
||||
version = "0.16.0"
|
||||
name = "graphene-sys"
|
||||
version = "0.16.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89b5f8946685d5fe44497007786600c2f368ff6b1e61a16251c89f72a97520a3"
|
||||
checksum = "b9aa82337d3972b4eafdea71e607c23f47be6f27f749aab613f1ad8ddbe6dcd6"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gsk4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "591239f5c52ca803b222124ac9c47f230cd180cee9b114c4d672e4a94b74f491"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"gdk4",
|
||||
"glib",
|
||||
"graphene-rs",
|
||||
"gsk4-sys",
|
||||
"libc",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gsk4-sys"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "195a63f0be42529f98c3eb3bae0decfd0428ba2cc683b3e20ced88f340904ec5"
|
||||
dependencies = [
|
||||
"atk-sys",
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk-sys",
|
||||
"gio-sys",
|
||||
"gdk4-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"graphene-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk3-macros"
|
||||
version = "0.16.0"
|
||||
name = "gtk4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cfd6557b1018b773e43c8de9d0d13581d6b36190d0501916cbec4731db5ccff"
|
||||
checksum = "fd89dba65def483a233dc4fdd3f3dab01576e3d83f80f6c9303ebe421661855e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"field-offset",
|
||||
"futures-channel",
|
||||
"gdk-pixbuf",
|
||||
"gdk4",
|
||||
"gio",
|
||||
"glib",
|
||||
"graphene-rs",
|
||||
"gsk4",
|
||||
"gtk4-macros",
|
||||
"gtk4-sys",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk4-macros"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "832687a415d9d8bc11fe9c17dda1bf13ee262c41b995dd4df1d1cce33cead405"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"proc-macro-crate",
|
||||
@@ -590,6 +603,25 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk4-sys"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e370564e3fdacff7cffc99f7366b6a4689feb44e819d3ccee598a9a215b71605"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk4-sys",
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"graphene-sys",
|
||||
"gsk4-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.1.0"
|
||||
@@ -704,9 +736,10 @@ name = "lact-gui"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"gtk",
|
||||
"gtk4",
|
||||
"lact-client",
|
||||
"nix",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
|
||||
@@ -6,7 +6,8 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
lact-client = { path = "../lact-client" }
|
||||
gtk = "0.16"
|
||||
gtk = { version = "0.5", package = "gtk4" }
|
||||
once_cell = "1.17.0"
|
||||
# pango = "0.16"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
|
||||
@@ -17,7 +17,7 @@ impl ApplyRevealer {
|
||||
|
||||
apply_button.set_label("Apply");
|
||||
|
||||
container.add(&apply_button);
|
||||
container.set_child(Some(&apply_button));
|
||||
|
||||
Self {
|
||||
container,
|
||||
|
||||
@@ -14,9 +14,10 @@ impl Header {
|
||||
pub fn new() -> Self {
|
||||
let container = HeaderBar::new();
|
||||
|
||||
container.set_custom_title(Some(&Grid::new())); // Bad workaround to hide the title
|
||||
// TODO Check if this is this still needed
|
||||
container.set_title_widget(Some(&Grid::new())); // Bad workaround to hide the title
|
||||
|
||||
container.set_show_close_button(true);
|
||||
container.set_show_title_buttons(true);
|
||||
|
||||
let gpu_selector = ComboBoxText::new();
|
||||
container.pack_start(&gpu_selector);
|
||||
|
||||
@@ -10,6 +10,7 @@ use std::time::Duration;
|
||||
use anyhow::Context;
|
||||
use apply_revealer::ApplyRevealer;
|
||||
use glib::clone;
|
||||
use gtk::gio::ApplicationFlags;
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use header::Header;
|
||||
@@ -23,7 +24,8 @@ const STATS_POLL_INTERVAL: u64 = 250;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct App {
|
||||
pub window: Window,
|
||||
application: Application,
|
||||
pub window: ApplicationWindow,
|
||||
pub header: Header,
|
||||
root_stack: RootStack,
|
||||
apply_revealer: ApplyRevealer,
|
||||
@@ -32,19 +34,21 @@ pub struct App {
|
||||
|
||||
impl App {
|
||||
pub fn new(daemon_client: DaemonClient) -> Self {
|
||||
let window = Window::new(WindowType::Toplevel);
|
||||
let application = Application::new(None, ApplicationFlags::default());
|
||||
|
||||
let header = Header::new();
|
||||
let window = ApplicationWindow::builder()
|
||||
.title("LACT")
|
||||
.default_width(500)
|
||||
.default_height(600)
|
||||
.build();
|
||||
|
||||
window.set_titlebar(Some(&header.container));
|
||||
window.set_title("LACT");
|
||||
|
||||
window.set_default_size(500, 600);
|
||||
|
||||
window.connect_delete_event(move |_, _| {
|
||||
main_quit();
|
||||
Inhibit(false)
|
||||
});
|
||||
// window.connect_close_request(move |_, _| {
|
||||
// // main_quit();
|
||||
// Inhibit(false)
|
||||
// });
|
||||
|
||||
let root_stack = RootStack::new();
|
||||
|
||||
@@ -52,15 +56,16 @@ impl App {
|
||||
|
||||
let root_box = Box::new(Orientation::Vertical, 5);
|
||||
|
||||
root_box.add(&root_stack.container);
|
||||
root_box.append(&root_stack.container);
|
||||
|
||||
let apply_revealer = ApplyRevealer::new();
|
||||
|
||||
root_box.add(&apply_revealer.container);
|
||||
root_box.append(&apply_revealer.container);
|
||||
|
||||
window.add(&root_box);
|
||||
window.set_child(Some(&root_box));
|
||||
|
||||
App {
|
||||
application,
|
||||
window,
|
||||
header,
|
||||
root_stack,
|
||||
@@ -69,79 +74,87 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(&self) -> anyhow::Result<()> {
|
||||
self.window.show_all();
|
||||
pub fn run(self) -> anyhow::Result<()> {
|
||||
self.application
|
||||
.connect_activate(clone!(@strong self as app => move |_| {
|
||||
app.window.set_application(Some(&app.application));
|
||||
|
||||
let current_gpu_id = Arc::new(RwLock::new(String::new()));
|
||||
let current_gpu_id = Arc::new(RwLock::new(String::new()));
|
||||
|
||||
{
|
||||
let current_gpu_id = current_gpu_id.clone();
|
||||
let app = self.clone();
|
||||
{
|
||||
let current_gpu_id = current_gpu_id.clone();
|
||||
|
||||
self.header.connect_gpu_selection_changed(move |gpu_id| {
|
||||
info!("GPU Selection changed");
|
||||
app.set_info(&gpu_id);
|
||||
*current_gpu_id.write().unwrap() = gpu_id;
|
||||
});
|
||||
}
|
||||
|
||||
let devices_buf = self.daemon_client.list_devices()?;
|
||||
let devices = devices_buf.inner()?;
|
||||
self.header.set_devices(&devices);
|
||||
|
||||
// Show apply button on setting changes
|
||||
{
|
||||
let apply_revealer = self.apply_revealer.clone();
|
||||
|
||||
self.root_stack
|
||||
.thermals_page
|
||||
.connect_settings_changed(move || {
|
||||
debug!("Settings changed, showing apply button");
|
||||
apply_revealer.show();
|
||||
});
|
||||
|
||||
let apply_revealer = self.apply_revealer.clone();
|
||||
|
||||
self.root_stack.oc_page.connect_settings_changed(move || {
|
||||
debug!("Settings changed, showing apply button");
|
||||
apply_revealer.show();
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
let app = self.clone();
|
||||
let current_gpu_id = current_gpu_id.clone();
|
||||
|
||||
// TODO
|
||||
/*self.root_stack.oc_page.connect_clocks_reset(move || {
|
||||
info!("Resetting clocks, but not applying");
|
||||
|
||||
let gpu_id = current_gpu_id.load(Ordering::SeqCst);
|
||||
|
||||
app.daemon_client
|
||||
.reset_gpu_power_states(gpu_id)
|
||||
.expect("Failed to reset clocks");
|
||||
|
||||
app.set_info(gpu_id);
|
||||
|
||||
app.apply_revealer.show();
|
||||
})*/
|
||||
}
|
||||
|
||||
self.apply_revealer.connect_apply_button_clicked(
|
||||
clone!(@strong self as app, @strong current_gpu_id => move || {
|
||||
if let Err(err) = app.apply_settings(current_gpu_id.clone()) {
|
||||
show_error(err.context("Could not apply settings"));
|
||||
|
||||
let gpu_id = current_gpu_id.read().unwrap();
|
||||
app.set_info(&gpu_id)
|
||||
app.header.connect_gpu_selection_changed(clone!(@strong app => move |gpu_id| {
|
||||
info!("GPU Selection changed");
|
||||
app.set_info(&gpu_id);
|
||||
*current_gpu_id.write().unwrap() = gpu_id;
|
||||
}));
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
self.start_stats_update_loop(current_gpu_id.clone());
|
||||
let devices_buf = app
|
||||
.daemon_client
|
||||
.list_devices()
|
||||
.expect("Could not list devices");
|
||||
let devices = devices_buf.inner().expect("Could not access devices");
|
||||
app.header.set_devices(&devices);
|
||||
|
||||
Ok(gtk::main())
|
||||
// Show apply button on setting changes
|
||||
{
|
||||
let apply_revealer = app.apply_revealer.clone();
|
||||
|
||||
app.root_stack
|
||||
.thermals_page
|
||||
.connect_settings_changed(move || {
|
||||
debug!("Settings changed, showing apply button");
|
||||
apply_revealer.show();
|
||||
});
|
||||
|
||||
let apply_revealer = app.apply_revealer.clone();
|
||||
|
||||
app.root_stack.oc_page.connect_settings_changed(move || {
|
||||
debug!("Settings changed, showing apply button");
|
||||
apply_revealer.show();
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
let app = app.clone();
|
||||
let current_gpu_id = current_gpu_id.clone();
|
||||
|
||||
// TODO
|
||||
/*app.root_stack.oc_page.connect_clocks_reset(move || {
|
||||
info!("Resetting clocks, but not applying");
|
||||
|
||||
let gpu_id = current_gpu_id.load(Ordering::SeqCst);
|
||||
|
||||
app.daemon_client
|
||||
.reset_gpu_power_states(gpu_id)
|
||||
.expect("Failed to reset clocks");
|
||||
|
||||
app.set_info(gpu_id);
|
||||
|
||||
app.apply_revealer.show();
|
||||
})*/
|
||||
}
|
||||
|
||||
app.apply_revealer.connect_apply_button_clicked(
|
||||
clone!(@strong app as app, @strong current_gpu_id => move || {
|
||||
if let Err(err) = app.apply_settings(current_gpu_id.clone()) {
|
||||
show_error(err.context("Could not apply settings"));
|
||||
|
||||
let gpu_id = current_gpu_id.read().unwrap();
|
||||
app.set_info(&gpu_id)
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
app.start_stats_update_loop(current_gpu_id.clone());
|
||||
|
||||
app.window.show();
|
||||
}));
|
||||
|
||||
self.application.run();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_info(&self, gpu_id: &str) {
|
||||
@@ -326,7 +339,7 @@ fn show_error(err: anyhow::Error) {
|
||||
.text(&text)
|
||||
.buttons(ButtonsType::Close)
|
||||
.build();
|
||||
diag.run();
|
||||
diag.set_modal(true);
|
||||
diag.hide();
|
||||
glib::Continue(false)
|
||||
});
|
||||
|
||||
@@ -200,8 +200,6 @@ impl InformationPage {
|
||||
if let Some(vulkan_info) = &gpu_info.vulkan_info {
|
||||
self.vulkan_info_frame.set_info(vulkan_info);
|
||||
}
|
||||
|
||||
self.container.show_all();
|
||||
}
|
||||
|
||||
pub fn set_stats(&self, stats: &DeviceStats) {
|
||||
|
||||
@@ -22,9 +22,9 @@ impl VulkanInfoFrame {
|
||||
label.set_markup("<span font_desc='11'><b>Vulkan Information</b></span>");
|
||||
label
|
||||
}));
|
||||
container.set_label_align(0.5, 0.5);
|
||||
container.set_label_align(0.5);
|
||||
|
||||
container.set_shadow_type(ShadowType::None);
|
||||
// container.set_shadow_type(ShadowType::None); // TODO
|
||||
|
||||
let features_listbox = ListBox::builder().halign(Align::Fill).build();
|
||||
let extensions_listbox = ListBox::builder().halign(Align::Fill).build();
|
||||
@@ -102,7 +102,7 @@ impl VulkanInfoFrame {
|
||||
grid.attach(&extensions_label, 0, 3, 2, 1);
|
||||
grid.attach(&show_extensions_button, 2, 3, 2, 1);
|
||||
|
||||
vbox.pack_start(&grid, false, true, 5);
|
||||
vbox.prepend(&grid);
|
||||
|
||||
/*let features_expander = Expander::builder().label("Feature support").build();
|
||||
|
||||
@@ -130,7 +130,7 @@ impl VulkanInfoFrame {
|
||||
|
||||
vbox.pack_start(&extensions_expander, false, true, 5);*/
|
||||
|
||||
container.add(&vbox);
|
||||
container.set_child(Some(&vbox));
|
||||
|
||||
Self {
|
||||
container,
|
||||
@@ -149,37 +149,37 @@ impl VulkanInfoFrame {
|
||||
self.version_label
|
||||
.set_markup(&format!("<b>{}</b>", vulkan_info.api_version));
|
||||
|
||||
self.features_listbox.children().clear();
|
||||
// self.features_listbox.children().clear();
|
||||
for (i, (feature, supported)) in vulkan_info.features.iter().enumerate() {
|
||||
let vbox = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
let feature_name_label = Label::new(Some(&feature));
|
||||
|
||||
vbox.pack_start(&feature_name_label, false, false, 0);
|
||||
vbox.append(&feature_name_label);
|
||||
|
||||
let feature_supported_checkbutton = CheckButton::new();
|
||||
|
||||
feature_supported_checkbutton.set_sensitive(false);
|
||||
feature_supported_checkbutton.set_active(*supported);
|
||||
|
||||
vbox.pack_end(&feature_supported_checkbutton, false, false, 0);
|
||||
vbox.append(&feature_supported_checkbutton);
|
||||
|
||||
self.features_listbox.insert(&vbox, i.try_into().unwrap());
|
||||
}
|
||||
|
||||
self.extensions_listbox.children().clear();
|
||||
// self.extensions_listbox.children().clear();
|
||||
for (i, (extension, supported)) in vulkan_info.extensions.iter().enumerate() {
|
||||
let vbox = Box::new(Orientation::Horizontal, 5);
|
||||
vbox.set_hexpand(true);
|
||||
|
||||
let extension_name_label = Label::new(Some(&extension));
|
||||
vbox.pack_start(&extension_name_label, false, false, 0);
|
||||
vbox.append(&extension_name_label);
|
||||
|
||||
let extension_supported_checkbutton = CheckButton::builder()
|
||||
.sensitive(false)
|
||||
.active(*supported)
|
||||
.build();
|
||||
vbox.pack_end(&extension_supported_checkbutton, false, false, 0);
|
||||
vbox.append(&extension_supported_checkbutton);
|
||||
|
||||
self.extensions_listbox.insert(&vbox, i.try_into().unwrap());
|
||||
}
|
||||
@@ -188,12 +188,11 @@ impl VulkanInfoFrame {
|
||||
|
||||
fn show_list_window(title: &str, child: &ListBox) {
|
||||
let window = Window::builder()
|
||||
.type_(WindowType::Toplevel)
|
||||
.title(title)
|
||||
.width_request(500)
|
||||
.height_request(700)
|
||||
.build();
|
||||
let scroll = ScrolledWindow::builder().child(child).margin(10).build();
|
||||
window.add(&scroll);
|
||||
window.show_all();
|
||||
let scroll = ScrolledWindow::builder().child(child).build();
|
||||
window.set_child(Some(&scroll));
|
||||
window.show();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ mod oc_page;
|
||||
mod software_page;
|
||||
mod thermals_page;
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
|
||||
use info_page::InformationPage;
|
||||
@@ -26,19 +25,19 @@ impl RootStack {
|
||||
|
||||
let info_page = InformationPage::new();
|
||||
|
||||
container.add_titled(&info_page.container, "info_page", "Information");
|
||||
container.add_titled(&info_page.container, Some("info_page"), "Information");
|
||||
|
||||
let oc_page = OcPage::new();
|
||||
|
||||
container.add_titled(&oc_page.container, "oc_page", "OC");
|
||||
container.add_titled(&oc_page.container, Some("oc_page"), "OC");
|
||||
|
||||
let thermals_page = ThermalsPage::new();
|
||||
|
||||
container.add_titled(&thermals_page.container, "thermals_page", "Thermals");
|
||||
container.add_titled(&thermals_page.container, Some("thermals_page"), "Thermals");
|
||||
|
||||
let software_page = SoftwarePage::new();
|
||||
|
||||
container.add_titled(&software_page.container, "software_page", "Software");
|
||||
container.add_titled(&software_page.container, Some("software_page"), "Software");
|
||||
|
||||
Self {
|
||||
container,
|
||||
|
||||
@@ -7,7 +7,7 @@ mod warning_frame;
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use lact_client::schema::{DeviceInfo, DeviceStats, PerformanceLevel, PowerStats};
|
||||
use lact_client::schema::{DeviceStats, PerformanceLevel, PowerStats};
|
||||
use performance_level_frame::PowerProfileFrame;
|
||||
use power_cap_frame::PowerCapFrame;
|
||||
use stats_grid::StatsGrid;
|
||||
@@ -29,19 +29,19 @@ impl OcPage {
|
||||
|
||||
let warning_frame = WarningFrame::new();
|
||||
|
||||
container.pack_start(&warning_frame.container, false, true, 5);
|
||||
container.append(&warning_frame.container);
|
||||
|
||||
let stats_grid = StatsGrid::new();
|
||||
|
||||
container.pack_start(&stats_grid.container, false, true, 5);
|
||||
container.append(&stats_grid.container);
|
||||
|
||||
let power_cap_frame = PowerCapFrame::new();
|
||||
|
||||
container.pack_start(&power_cap_frame.container, false, true, 0);
|
||||
container.append(&power_cap_frame.container);
|
||||
|
||||
let power_profile_frame = PowerProfileFrame::new();
|
||||
|
||||
container.pack_start(&power_profile_frame.container, false, true, 0);
|
||||
container.append(&power_profile_frame.container);
|
||||
|
||||
// let clocks_frame = ClocksFrame::new();
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ impl PowerProfileFrame {
|
||||
pub fn new() -> Self {
|
||||
let container = Frame::new(None);
|
||||
|
||||
container.set_shadow_type(ShadowType::None);
|
||||
// container.set_shadow_type(ShadowType::None);
|
||||
|
||||
container.set_label_widget(Some(&{
|
||||
let label = Label::new(None);
|
||||
label.set_markup("<span font_desc='11'><b>Power Profile</b></span>");
|
||||
label
|
||||
}));
|
||||
container.set_label_align(0.2, 0.0);
|
||||
container.set_label_align(0.2);
|
||||
|
||||
let root_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
@@ -30,11 +30,11 @@ impl PowerProfileFrame {
|
||||
combo_box.append(Some("1"), "Highest clocks");
|
||||
combo_box.append(Some("2"), "Lowest clocks");
|
||||
|
||||
root_box.pack_start(&combo_box, false, true, 5);
|
||||
root_box.append(&combo_box);
|
||||
|
||||
let description_label = Label::new(Some("A description is supposed to be here"));
|
||||
|
||||
root_box.pack_start(&description_label, false, true, 5);
|
||||
root_box.append(&description_label);
|
||||
|
||||
{
|
||||
let description_label = description_label.clone();
|
||||
@@ -49,7 +49,7 @@ impl PowerProfileFrame {
|
||||
});
|
||||
}
|
||||
|
||||
container.add(&root_box);
|
||||
container.set_child(Some(&root_box));
|
||||
Self {
|
||||
container,
|
||||
combo_box,
|
||||
|
||||
@@ -12,20 +12,20 @@ impl PowerCapFrame {
|
||||
pub fn new() -> Self {
|
||||
let container = Frame::new(None);
|
||||
|
||||
container.set_shadow_type(ShadowType::None);
|
||||
// container.set_shadow_type(ShadowType::None);
|
||||
|
||||
container.set_label_widget(Some(&{
|
||||
let label = Label::new(None);
|
||||
label.set_markup("<span font_desc='11'><b>Power Usage Limit</b></span>");
|
||||
label
|
||||
}));
|
||||
container.set_label_align(0.2, 0.0);
|
||||
container.set_label_align(0.2);
|
||||
|
||||
let root_box = Box::new(Orientation::Horizontal, 0);
|
||||
|
||||
let label = Label::new(None);
|
||||
|
||||
root_box.pack_start(&label, false, true, 5);
|
||||
root_box.append(&label);
|
||||
|
||||
let adjustment = Adjustment::new(0.0, 0.0, 0.0, 1.0, 10.0, 0.0);
|
||||
{
|
||||
@@ -39,9 +39,9 @@ impl PowerCapFrame {
|
||||
|
||||
scale.set_draw_value(false);
|
||||
|
||||
root_box.pack_start(&scale, true, true, 5);
|
||||
root_box.append(&scale);
|
||||
|
||||
container.add(&root_box);
|
||||
container.set_child(Some(&root_box));
|
||||
|
||||
Self {
|
||||
container,
|
||||
|
||||
@@ -37,7 +37,7 @@ impl StatsGrid {
|
||||
|
||||
vram_usage_label.set_text("0/0 MiB");
|
||||
|
||||
vram_usage_overlay.add(&vram_usage_bar);
|
||||
vram_usage_overlay.set_child(Some(&vram_usage_bar));
|
||||
vram_usage_overlay.add_overlay(&vram_usage_label);
|
||||
|
||||
container.attach(&vram_usage_overlay, 1, 0, 2, 1);
|
||||
@@ -47,11 +47,11 @@ impl StatsGrid {
|
||||
{
|
||||
let gpu_clock_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
gpu_clock_box.pack_start(&Label::new(Some("GPU Clock:")), false, false, 2);
|
||||
gpu_clock_box.append(&Label::new(Some("GPU Clock:")));
|
||||
|
||||
gpu_clock_label.set_markup("<b>0MHz</b>");
|
||||
|
||||
gpu_clock_box.pack_start(&gpu_clock_label, false, false, 2);
|
||||
gpu_clock_box.append(&gpu_clock_label);
|
||||
|
||||
gpu_clock_box.set_halign(Align::Center);
|
||||
|
||||
@@ -62,11 +62,11 @@ impl StatsGrid {
|
||||
{
|
||||
let vram_clock_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
vram_clock_box.pack_start(&Label::new(Some("VRAM Clock:")), false, false, 2);
|
||||
vram_clock_box.append(&Label::new(Some("VRAM Clock:")));
|
||||
|
||||
vram_clock_label.set_markup("<b>0MHz</b>");
|
||||
|
||||
vram_clock_box.pack_start(&vram_clock_label, false, false, 2);
|
||||
vram_clock_box.append(&vram_clock_label);
|
||||
|
||||
vram_clock_box.set_halign(Align::Center);
|
||||
|
||||
@@ -76,11 +76,11 @@ impl StatsGrid {
|
||||
{
|
||||
let gpu_voltage_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
gpu_voltage_box.pack_start(&Label::new(Some("GPU Voltage:")), false, false, 2);
|
||||
gpu_voltage_box.append(&Label::new(Some("GPU Voltage:")));
|
||||
|
||||
gpu_voltage_label.set_markup("<b>0.000V</b>");
|
||||
|
||||
gpu_voltage_box.pack_start(&gpu_voltage_label, false, false, 2);
|
||||
gpu_voltage_box.append(&gpu_voltage_label);
|
||||
|
||||
gpu_voltage_box.set_halign(Align::Center);
|
||||
|
||||
@@ -91,11 +91,11 @@ impl StatsGrid {
|
||||
{
|
||||
let power_usage_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
power_usage_box.pack_start(&Label::new(Some("Power Usage:")), false, false, 2);
|
||||
power_usage_box.append(&Label::new(Some("Power Usage:")));
|
||||
|
||||
power_usage_label.set_markup("<b>00/000W</b>");
|
||||
|
||||
power_usage_box.pack_start(&power_usage_label, false, false, 2);
|
||||
power_usage_box.append(&power_usage_label);
|
||||
|
||||
power_usage_box.set_halign(Align::Center);
|
||||
|
||||
@@ -106,11 +106,11 @@ impl StatsGrid {
|
||||
{
|
||||
let gpu_temperature_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
gpu_temperature_box.pack_start(&Label::new(Some("GPU Temperature:")), false, false, 2);
|
||||
gpu_temperature_box.append(&Label::new(Some("GPU Temperature:")));
|
||||
|
||||
// gpu_temperature_label.set_markup("<b>0°C</b>");
|
||||
|
||||
gpu_temperature_box.pack_start(&gpu_temperature_label, false, false, 2);
|
||||
gpu_temperature_box.append(&gpu_temperature_label);
|
||||
|
||||
gpu_temperature_box.set_halign(Align::Center);
|
||||
|
||||
@@ -121,9 +121,9 @@ impl StatsGrid {
|
||||
{
|
||||
let gpu_usage_box = Box::new(Orientation::Horizontal, 5);
|
||||
|
||||
gpu_usage_box.pack_start(&Label::new(Some("GPU Usage:")), false, false, 2);
|
||||
gpu_usage_box.append(&Label::new(Some("GPU Usage:")));
|
||||
|
||||
gpu_usage_box.pack_start(&gpu_usage_label, false, false, 2);
|
||||
gpu_usage_box.append(&gpu_usage_label);
|
||||
|
||||
gpu_usage_box.set_halign(Align::Center);
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ impl WarningFrame {
|
||||
pub fn new() -> Self {
|
||||
let container = Frame::new(Some("Overclocking information"));
|
||||
|
||||
container.set_label_align(0.3, 0.5);
|
||||
container.set_label_align(0.3);
|
||||
|
||||
let warning_label = Label::new(None);
|
||||
|
||||
warning_label.set_line_wrap(true);
|
||||
warning_label.set_wrap(true);
|
||||
warning_label.set_markup("Overclocking support is not enabled! To enable overclocking support, you need to add <b>amdgpu.ppfeaturemask=0xffffffff</b> to your kernel boot options. Look for the documentation of your distro.");
|
||||
warning_label.set_selectable(true);
|
||||
|
||||
container.add(&warning_label);
|
||||
container.set_child(Some(&warning_label));
|
||||
|
||||
Self { container }
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use lact_client::schema::DeviceStats;
|
||||
use std::collections::BTreeMap;
|
||||
use tracing::trace;
|
||||
|
||||
// use fan_curve_frame::FanCurveFrame;
|
||||
|
||||
pub struct ThermalsSettings {
|
||||
@@ -92,7 +90,7 @@ impl ThermalsPage {
|
||||
|
||||
grid.attach(&fan_control_enabled_switch, 2, 2, 1, 1);
|
||||
|
||||
container.pack_start(&grid, false, false, 5);
|
||||
container.prepend(&grid);
|
||||
|
||||
/*let fan_curve_frame = FanCurveFrame::new();
|
||||
|
||||
@@ -178,8 +176,9 @@ impl ThermalsPage {
|
||||
|
||||
pub fn connect_settings_changed<F: Fn() + 'static + Clone>(&self, f: F) {
|
||||
self.fan_control_enabled_switch
|
||||
.connect_changed_active(clone!(@strong f => move |_| {
|
||||
.connect_state_set(clone!(@strong f => move |_, _| {
|
||||
f();
|
||||
Inhibit(false)
|
||||
}));
|
||||
|
||||
/*self.fan_curve_frame.connect_adjusted(move || {
|
||||
|
||||
@@ -20,7 +20,5 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
let app = App::new(connection);
|
||||
|
||||
app.run()?;
|
||||
|
||||
Ok(())
|
||||
app.run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user