mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 15:15:08 +00:00
SystemMonitor: Wrap adapters and sockets model into a SortingProxyModel
This commit is contained in:
parent
2c1b244889
commit
e596b1da88
2 changed files with 7 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
#include <LibGUI/SortingProxyModel.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
|
||||
NetworkStatisticsWidget::NetworkStatisticsWidget()
|
||||
|
@ -54,7 +55,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight);
|
||||
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)));
|
||||
m_adapter_model = GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields));
|
||||
m_adapter_table_view->set_model(GUI::SortingProxyModel::create(*m_adapter_model));
|
||||
|
||||
auto& sockets_group_box = add<GUI::GroupBox>("Sockets");
|
||||
sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
|
||||
|
@ -76,7 +78,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_tcp_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight);
|
||||
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_socket_model = GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields));
|
||||
m_socket_table_view->set_model(GUI::SortingProxyModel::create(*m_socket_model));
|
||||
|
||||
m_update_timer = add<Core::Timer>(
|
||||
1000, [this] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue