mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:25:08 +00:00
Userspace: Use Core::Object::add() when building interfaces
This commit is contained in:
parent
7ec758773c
commit
3d20da9ee4
87 changed files with 403 additions and 438 deletions
|
@ -38,13 +38,13 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent)
|
|||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
auto adapters_group_box = GUI::GroupBox::construct("Adapters", this);
|
||||
auto adapters_group_box = add<GUI::GroupBox>("Adapters");
|
||||
adapters_group_box->set_layout(make<GUI::VerticalBoxLayout>());
|
||||
adapters_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
adapters_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
adapters_group_box->set_preferred_size(0, 120);
|
||||
|
||||
m_adapter_table_view = GUI::TableView::construct(adapters_group_box);
|
||||
m_adapter_table_view = adapters_group_box->add<GUI::TableView>();
|
||||
m_adapter_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields;
|
||||
|
@ -58,13 +58,13 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent)
|
|||
net_adapters_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight);
|
||||
m_adapter_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields)));
|
||||
|
||||
auto sockets_group_box = GUI::GroupBox::construct("Sockets", this);
|
||||
auto sockets_group_box = add<GUI::GroupBox>("Sockets");
|
||||
sockets_group_box->set_layout(make<GUI::VerticalBoxLayout>());
|
||||
sockets_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
sockets_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
sockets_group_box->set_preferred_size(0, 0);
|
||||
|
||||
m_socket_table_view = GUI::TableView::construct(sockets_group_box);
|
||||
m_socket_table_view = sockets_group_box->add<GUI::TableView>();
|
||||
m_socket_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> net_tcp_fields;
|
||||
|
@ -81,11 +81,10 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent)
|
|||
net_tcp_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight);
|
||||
m_socket_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
|
||||
|
||||
m_update_timer = Core::Timer::construct(
|
||||
m_update_timer = add<Core::Timer>(
|
||||
1000, [this] {
|
||||
update_models();
|
||||
},
|
||||
this);
|
||||
});
|
||||
|
||||
update_models();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue