mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
SystemMonitor: Move NetworkStatisticsWidget into namespace + register it
We don't want to clobber the global namespace with registered widgets.
This commit is contained in:
parent
7e34b88ed4
commit
6d00932612
3 changed files with 11 additions and 1 deletions
|
@ -13,6 +13,10 @@
|
||||||
#include <LibGUI/TableView.h>
|
#include <LibGUI/TableView.h>
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
|
|
||||||
|
REGISTER_WIDGET(SystemMonitor, NetworkStatisticsWidget)
|
||||||
|
|
||||||
|
namespace SystemMonitor {
|
||||||
|
|
||||||
NetworkStatisticsWidget::NetworkStatisticsWidget()
|
NetworkStatisticsWidget::NetworkStatisticsWidget()
|
||||||
{
|
{
|
||||||
on_first_show = [this](auto&) {
|
on_first_show = [this](auto&) {
|
||||||
|
@ -118,3 +122,5 @@ void NetworkStatisticsWidget::update_models()
|
||||||
m_tcp_socket_model->update();
|
m_tcp_socket_model->update();
|
||||||
m_udp_socket_model->update();
|
m_udp_socket_model->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibGUI/LazyWidget.h>
|
#include <LibGUI/LazyWidget.h>
|
||||||
|
|
||||||
|
namespace SystemMonitor {
|
||||||
|
|
||||||
class NetworkStatisticsWidget final : public GUI::LazyWidget {
|
class NetworkStatisticsWidget final : public GUI::LazyWidget {
|
||||||
C_OBJECT(NetworkStatisticsWidget)
|
C_OBJECT(NetworkStatisticsWidget)
|
||||||
public:
|
public:
|
||||||
|
@ -30,3 +32,5 @@ private:
|
||||||
RefPtr<Gfx::Bitmap> m_network_disconnected_bitmap;
|
RefPtr<Gfx::Bitmap> m_network_disconnected_bitmap;
|
||||||
RefPtr<Gfx::Bitmap> m_network_link_down_bitmap;
|
RefPtr<Gfx::Bitmap> m_network_link_down_bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
storage_widget->set_title("Storage");
|
storage_widget->set_title("Storage");
|
||||||
tabwidget.add_widget(storage_widget);
|
tabwidget.add_widget(storage_widget);
|
||||||
|
|
||||||
auto network_stats_widget = NetworkStatisticsWidget::construct();
|
auto network_stats_widget = SystemMonitor::NetworkStatisticsWidget::construct();
|
||||||
network_stats_widget->set_title("Network");
|
network_stats_widget->set_title("Network");
|
||||||
tabwidget.add_widget(network_stats_widget);
|
tabwidget.add_widget(network_stats_widget);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue