SystemMonitor: Add a Processors tab
This commit is contained in:
parent
5c60a6a8fb
commit
4dfe797263
Notes:
sideshowbarker
2024-07-19 03:22:59 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/4dfe797263c Pull-request: https://github.com/SerenityOS/serenity/pull/3239
1 changed files with 29 additions and 0 deletions
|
@ -66,6 +66,7 @@ static NonnullRefPtr<GUI::Widget> build_file_systems_tab();
|
|||
static NonnullRefPtr<GUI::Widget> build_pci_devices_tab();
|
||||
static NonnullRefPtr<GUI::Widget> build_devices_tab();
|
||||
static NonnullRefPtr<GUI::Widget> build_graphs_tab();
|
||||
static NonnullRefPtr<GUI::Widget> build_processors_tab();
|
||||
|
||||
class UnavailableProcessWidget final : public GUI::Frame {
|
||||
C_OBJECT(UnavailableProcessWidget)
|
||||
|
@ -173,6 +174,8 @@ int main(int argc, char** argv)
|
|||
auto network_stats_widget = NetworkStatisticsWidget::construct();
|
||||
tabwidget.add_widget("Network", network_stats_widget);
|
||||
|
||||
tabwidget.add_widget("Processors", build_processors_tab());
|
||||
|
||||
process_table_container.set_layout<GUI::VerticalBoxLayout>();
|
||||
process_table_container.layout()->set_spacing(0);
|
||||
|
||||
|
@ -566,3 +569,29 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
|
|||
};
|
||||
return graphs_container;
|
||||
}
|
||||
|
||||
NonnullRefPtr<GUI::Widget> build_processors_tab()
|
||||
{
|
||||
auto processors_widget = GUI::LazyWidget::construct();
|
||||
|
||||
processors_widget->on_first_show = [](GUI::LazyWidget& self) {
|
||||
self.set_layout<GUI::VerticalBoxLayout>();
|
||||
self.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> processors_field;
|
||||
processors_field.empend("processor", "Processor", Gfx::TextAlignment::CenterRight);
|
||||
processors_field.empend("cpuid", "CPUID", Gfx::TextAlignment::CenterLeft);
|
||||
processors_field.empend("brandstr", "Brand", Gfx::TextAlignment::CenterLeft);
|
||||
processors_field.empend("features", "Features", Gfx::TextAlignment::CenterLeft);
|
||||
processors_field.empend("family", "Family", Gfx::TextAlignment::CenterRight);
|
||||
processors_field.empend("model", "Model", Gfx::TextAlignment::CenterRight);
|
||||
processors_field.empend("stepping", "Stepping", Gfx::TextAlignment::CenterRight);
|
||||
processors_field.empend("type", "Type", Gfx::TextAlignment::CenterRight);
|
||||
|
||||
auto& processors_table_view = self.add<GUI::TableView>();
|
||||
processors_table_view.set_model(GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field)));
|
||||
processors_table_view.model()->update();
|
||||
};
|
||||
|
||||
return processors_widget;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue