Add software page

This commit is contained in:
Ilya Zlobintsev 2021-03-23 08:17:55 +02:00
parent e63dae366f
commit 664f3a1b44
2 changed files with 61 additions and 0 deletions

View File

@ -1,11 +1,13 @@
mod info_page; mod info_page;
mod oc_page; mod oc_page;
mod software_page;
mod thermals_page; mod thermals_page;
use gtk::*; use gtk::*;
use info_page::InformationPage; use info_page::InformationPage;
use oc_page::OcPage; use oc_page::OcPage;
use software_page::SoftwarePage;
use thermals_page::ThermalsPage; use thermals_page::ThermalsPage;
#[derive(Clone)] #[derive(Clone)]
@ -13,6 +15,7 @@ pub struct RootStack {
pub container: Stack, pub container: Stack,
pub info_page: InformationPage, pub info_page: InformationPage,
pub thermals_page: ThermalsPage, pub thermals_page: ThermalsPage,
pub software_page: SoftwarePage,
pub oc_page: OcPage, pub oc_page: OcPage,
} }
@ -32,11 +35,16 @@ impl RootStack {
container.add_titled(&thermals_page.container, "thermals_page", "Thermals"); container.add_titled(&thermals_page.container, "thermals_page", "Thermals");
let software_page = SoftwarePage::new();
container.add_titled(&software_page.container, "software_page", "Software");
Self { Self {
container, container,
info_page, info_page,
thermals_page, thermals_page,
oc_page, oc_page,
software_page,
} }
} }
} }

View File

@ -0,0 +1,53 @@
use gtk::*;
#[derive(Debug, Clone)]
pub struct SoftwarePage {
pub container: Grid,
lact_version_label: Label,
}
impl SoftwarePage {
pub fn new() -> Self {
let container = Grid::new();
container.set_margin_start(5);
container.set_margin_end(5);
container.set_margin_bottom(5);
container.set_margin_top(5);
container.set_column_spacing(10);
container.attach(
&{
let label = Label::new(None);
label.set_markup("<b>LACT Version:</b>");
label.set_halign(Align::End);
label.set_hexpand(true);
label
},
0,
0,
1,
1,
);
let lact_version_label = Label::new(None);
let lact_version = env!("CARGO_PKG_VERSION");
let lact_release_type = match cfg!(debug_assertions) {
true => "debug",
false => "release",
};
lact_version_label.set_markup(&format!("{}-{}", lact_version, lact_release_type));
lact_version_label.set_hexpand(true);
lact_version_label.set_halign(Align::Start);
container.attach(&lact_version_label, 1, 0, 1, 1);
Self {
container,
lact_version_label,
}
}
}