Merge pull request #1445 from clarkmoody/tweak-sysinfo
Tweak System Information
This commit is contained in:
commit
3c2a8b70ad
3 changed files with 28 additions and 9 deletions
|
|
@ -9,12 +9,14 @@ pub fn main() -> iced::Result {
|
||||||
Example::run(Settings::default())
|
Example::run(Settings::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum Example {
|
enum Example {
|
||||||
Loading,
|
Loading,
|
||||||
Loaded { information: system::Information },
|
Loaded { information: system::Information },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum Message {
|
enum Message {
|
||||||
InformationReceived(system::Information),
|
InformationReceived(system::Information),
|
||||||
Refresh,
|
Refresh,
|
||||||
|
|
@ -80,6 +82,14 @@ impl Application for Example {
|
||||||
.unwrap_or(&"unknown".to_string())
|
.unwrap_or(&"unknown".to_string())
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let system_short_version = text(format!(
|
||||||
|
"System short version: {}",
|
||||||
|
information
|
||||||
|
.system_short_version
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&"unknown".to_string())
|
||||||
|
));
|
||||||
|
|
||||||
let cpu_brand =
|
let cpu_brand =
|
||||||
text(format!("Processor brand: {}", information.cpu_brand));
|
text(format!("Processor brand: {}", information.cpu_brand));
|
||||||
|
|
||||||
|
|
@ -126,6 +136,7 @@ impl Application for Example {
|
||||||
system_name.size(30),
|
system_name.size(30),
|
||||||
system_kernel.size(30),
|
system_kernel.size(30),
|
||||||
system_version.size(30),
|
system_version.size(30),
|
||||||
|
system_short_version.size(30),
|
||||||
cpu_brand.size(30),
|
cpu_brand.size(30),
|
||||||
cpu_cores.size(30),
|
cpu_cores.size(30),
|
||||||
memory_total.size(30),
|
memory_total.size(30),
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,29 @@
|
||||||
/// Contains informations about the system (e.g. system name, processor, memory, graphics adapter).
|
/// Contains informations about the system (e.g. system name, processor, memory, graphics adapter).
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Information {
|
pub struct Information {
|
||||||
/// Contains the system name.
|
/// The operating system name
|
||||||
pub system_name: Option<String>,
|
pub system_name: Option<String>,
|
||||||
/// Contains the kernel version.
|
/// Operating system kernel version
|
||||||
pub system_kernel: Option<String>,
|
pub system_kernel: Option<String>,
|
||||||
/// Contains the systme version.
|
/// Long operating system version
|
||||||
|
///
|
||||||
|
/// Examples:
|
||||||
|
/// - MacOS 10.15 Catalina
|
||||||
|
/// - Windows 10 Pro
|
||||||
|
/// - Ubuntu 20.04 LTS (Focal Fossa)
|
||||||
pub system_version: Option<String>,
|
pub system_version: Option<String>,
|
||||||
/// Contains the processor brand.
|
/// Short operating system version number
|
||||||
|
pub system_short_version: Option<String>,
|
||||||
|
/// Detailed processor model information
|
||||||
pub cpu_brand: String,
|
pub cpu_brand: String,
|
||||||
/// Contains the number of physical cores on the processor.
|
/// The number of physical cores on the processor
|
||||||
pub cpu_cores: Option<usize>,
|
pub cpu_cores: Option<usize>,
|
||||||
/// Contains the total RAM size in KB.
|
/// Total RAM size, KB
|
||||||
pub memory_total: u64,
|
pub memory_total: u64,
|
||||||
/// Contains the system used RAM size in KB.
|
/// Memory used by this process, KB
|
||||||
pub memory_used: Option<u64>,
|
pub memory_used: Option<u64>,
|
||||||
/// Contains the graphics backend.
|
/// Underlying graphics backend for rendering
|
||||||
pub graphics_backend: String,
|
pub graphics_backend: String,
|
||||||
/// Contains the graphics adapter.
|
/// Model information for the active graphics adapter
|
||||||
pub graphics_adapter: String,
|
pub graphics_adapter: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ pub(crate) fn information(
|
||||||
system_name: system.name(),
|
system_name: system.name(),
|
||||||
system_kernel: system.kernel_version(),
|
system_kernel: system.kernel_version(),
|
||||||
system_version: system.long_os_version(),
|
system_version: system.long_os_version(),
|
||||||
|
system_short_version: system.os_version(),
|
||||||
cpu_brand: cpu.brand().into(),
|
cpu_brand: cpu.brand().into(),
|
||||||
cpu_cores: system.physical_core_count(),
|
cpu_cores: system.physical_core_count(),
|
||||||
memory_total: system.total_memory(),
|
memory_total: system.total_memory(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue