summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/SystemMonitor/NetworkStatisticsWidget.cpp7
-rw-r--r--Applications/SystemMonitor/NetworkStatisticsWidget.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index 0908239e81..74dd18aec7 100644
--- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -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] {
diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.h b/Applications/SystemMonitor/NetworkStatisticsWidget.h
index 554bd255f0..d49a9641c8 100644
--- a/Applications/SystemMonitor/NetworkStatisticsWidget.h
+++ b/Applications/SystemMonitor/NetworkStatisticsWidget.h
@@ -40,5 +40,7 @@ private:
RefPtr<GUI::TableView> m_adapter_table_view;
RefPtr<GUI::TableView> m_socket_table_view;
+ RefPtr<GUI::JsonArrayModel> m_adapter_model;
+ RefPtr<GUI::JsonArrayModel> m_socket_model;
RefPtr<Core::Timer> m_update_timer;
};