1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

Userland: Specify margins and spacing in the GUI::Layout constructor

This commit is contained in:
Sam Atkins 2023-02-16 21:07:06 +00:00 committed by Sam Atkins
parent 9561ec15f4
commit 77ad0fdb07
64 changed files with 136 additions and 288 deletions

View file

@ -43,9 +43,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
set_fixed_height(110);
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 8, 0, 0 });
layout()->set_spacing(3);
set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 0, 0 }, 3);
auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr<GUI::Label> {
auto& container = add<GUI::Widget>();

View file

@ -22,8 +22,7 @@ namespace SystemMonitor {
NetworkStatisticsWidget::NetworkStatisticsWidget()
{
on_first_show = [this](auto&) {
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
set_fill_with_background_color(true);
m_network_connected_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors();
@ -38,8 +37,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
}
auto& adapters_group_box = add<GUI::GroupBox>("Adapters"sv);
adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
adapters_group_box.layout()->set_margins(6);
adapters_group_box.set_layout<GUI::VerticalBoxLayout>(6);
adapters_group_box.set_fixed_height(120);
m_adapter_table_view = adapters_group_box.add<GUI::TableView>();
@ -94,8 +92,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
};
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"sv);
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
tcp_sockets_group_box.layout()->set_margins(6);
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(6);
m_tcp_socket_table_view = tcp_sockets_group_box.add<GUI::TableView>();
@ -115,8 +112,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model)));
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"sv);
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
udp_sockets_group_box.layout()->set_margins(6);
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(6);
m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>();

View file

@ -17,8 +17,7 @@ namespace SystemMonitor {
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields;

View file

@ -51,8 +51,7 @@ public:
ProcessMemoryMapWidget::ProcessMemoryMapWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
pid_vm_fields.empend(

View file

@ -95,8 +95,7 @@ private:
ProcessStateWidget::ProcessStateWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
m_table_view->set_model(adopt_ref(*new ProcessStateModel(ProcessModel::the(), 0)));
m_table_view->column_header().set_visible(false);

View file

@ -18,8 +18,7 @@ namespace SystemMonitor {
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;

View file

@ -73,8 +73,7 @@ private:
ThreadStackWidget::ThreadStackWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins(4);
set_layout<GUI::VerticalBoxLayout>(4);
m_stack_table = add<GUI::TableView>();
m_stack_table->set_model(adopt_ref(*new ThreadStackModel()));
}

View file

@ -561,8 +561,7 @@ void build_performance_tab(GUI::Widget& graphs_container)
Vector<SystemMonitor::GraphWidget&> cpu_graphs;
for (auto row = 0u; row < cpu_graph_rows; ++row) {
auto& cpu_graph_row = cpu_graph_group_box.add<GUI::Widget>();
cpu_graph_row.set_layout<GUI::HorizontalBoxLayout>();
cpu_graph_row.layout()->set_margins(6);
cpu_graph_row.set_layout<GUI::HorizontalBoxLayout>(6);
cpu_graph_row.set_fixed_height(108);
for (auto i = 0u; i < cpu_graphs_per_row; ++i) {
auto& cpu_graph = cpu_graph_row.add<SystemMonitor::GraphWidget>();