summaryrefslogtreecommitdiff
path: root/Userland/Applications/SystemMonitor
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-03-18 22:57:05 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-03 12:21:05 +0200
commit7e34b88ed406dc38fec5875188bc8f912412a128 (patch)
treef3a1abcdec4cdab7664d922045bd5bb99972f73d /Userland/Applications/SystemMonitor
parent0410414455149ae4622a9600c83e1df6003b3174 (diff)
downloadserenity-7e34b88ed406dc38fec5875188bc8f912412a128.zip
LibGUI: Fully support TabWidget in GML
TabWidgets couldn't be used in GML properly, as the GML creation routines didn't actually call the necessary functions in the TabWidget to get a new tab added. This commit fixes that by making the name of the tab a normal property, the previously introduced "title", which can be trivially set from GML. Therefore, try_add_widget() loses an argument (while try_add_tab doesn't, because it newly constructs the widget). This allows us to get rid of the silly "fixing my widget tree after the fact" code in Help and will make it super easy to use TabWidget in future GML. :^)
Diffstat (limited to 'Userland/Applications/SystemMonitor')
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index e3f96643b1..7df0eaa925 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -168,16 +168,20 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& process_table_container = tabwidget.add_tab<GUI::Widget>("Processes");
auto performance_widget = build_performance_tab();
- tabwidget.add_widget("Performance", performance_widget);
+ performance_widget->set_title("Performance");
+ tabwidget.add_widget(performance_widget);
auto storage_widget = build_storage_widget();
- tabwidget.add_widget("Storage", storage_widget);
+ storage_widget->set_title("Storage");
+ tabwidget.add_widget(storage_widget);
auto network_stats_widget = NetworkStatisticsWidget::construct();
- tabwidget.add_widget("Network", network_stats_widget);
+ network_stats_widget->set_title("Network");
+ tabwidget.add_widget(network_stats_widget);
auto hardware_widget = build_hardware_tab();
- tabwidget.add_widget("Hardware", hardware_widget);
+ hardware_widget->set_title("Hardware");
+ tabwidget.add_widget(hardware_widget);
process_table_container.set_layout<GUI::VerticalBoxLayout>();
process_table_container.layout()->set_margins(4);