diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-02-17 10:47:04 +0000 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-02-18 16:56:56 +0000 |
commit | 9561ec15f47fdba66a4e8872fd03aae8d0f2df22 (patch) | |
tree | 68cf03d814588d7bba1dc8703e81ffabbef04722 | |
parent | 43dddafd1684bec9a3ba083b58d2bc438cf726f5 (diff) | |
download | serenity-9561ec15f47fdba66a4e8872fd03aae8d0f2df22.zip |
Userland: Use Widget::add_spacer() everywhere
17 files changed, 23 insertions, 23 deletions
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 1f377c2996..c440eb1311 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -64,11 +64,11 @@ DownloadWidget::DownloadWidget(const URL& url) auto& animation_container = add<GUI::Widget>(); animation_container.set_fixed_height(32); - auto& animation_layout = animation_container.set_layout<GUI::HorizontalBoxLayout>(); + animation_container.set_layout<GUI::HorizontalBoxLayout>(); m_browser_image = animation_container.add<GUI::ImageWidget>(); m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); - animation_layout.add_spacer(); + animation_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& source_label = add<GUI::Label>(DeprecatedString::formatted("From: {}", url)); source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); @@ -93,8 +93,8 @@ DownloadWidget::DownloadWidget(const URL& url) }; auto& button_container = add<GUI::Widget>(); - auto& button_container_layout = button_container.set_layout<GUI::HorizontalBoxLayout>(); - button_container_layout.add_spacer(); + button_container.set_layout<GUI::HorizontalBoxLayout>(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); m_cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); m_cancel_button->set_fixed_size(100, 22); m_cancel_button->on_click = [this](auto) { diff --git a/Userland/Applications/Calculator/RoundingDialog.cpp b/Userland/Applications/Calculator/RoundingDialog.cpp index 8bda2d898f..759c17c5e2 100644 --- a/Userland/Applications/Calculator/RoundingDialog.cpp +++ b/Userland/Applications/Calculator/RoundingDialog.cpp @@ -53,7 +53,7 @@ RoundingDialog::RoundingDialog(GUI::Window* parent_window, StringView title) main_widget->add_child(*m_buttons_container); m_buttons_container->set_layout<GUI::HorizontalBoxLayout>(); - m_buttons_container->layout()->add_spacer(); + m_buttons_container->add_spacer().release_value_but_fixme_should_propagate_errors(); m_buttons_container->add_child(*m_ok_button); m_buttons_container->add_child(*m_cancel_button); diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 945ad8760f..973871ed6c 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -87,12 +87,12 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) starting_meridiem_combo.set_model(MeridiemListModel::create()); starting_meridiem_combo.set_selected_index(0); - widget->layout()->add_spacer(); + widget->add_spacer().release_value_but_fixme_should_propagate_errors(); auto& button_container = widget->add<GUI::Widget>(); button_container.set_fixed_height(20); button_container.set_layout<GUI::HorizontalBoxLayout>(); - button_container.layout()->add_spacer(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); ok_button.set_fixed_size(80, 20); ok_button.on_click = [this](auto) { diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 6e0a537cd6..47b5a60a04 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -155,7 +155,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) button_widget->set_fixed_height(22); button_widget->layout()->set_spacing(5); - button_widget->layout()->add_spacer(); + TRY(button_widget->add_spacer()); auto ok_button = TRY(make_button(String::from_utf8_short_string("OK"sv), button_widget)); ok_button->on_click = [this](auto) { diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index e42d863d2e..8ddcbe394f 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -95,7 +95,7 @@ void KeyboardMapperWidget::create_frame() add_map_radio_button("alt_map"sv, String::from_utf8_short_string("Alt"sv)); add_map_radio_button("shift_altgr_map"sv, String::from_utf8("Shift+AltGr"sv).release_value_but_fixme_should_propagate_errors()); - bottom_widget.layout()->add_spacer(); + bottom_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); } void KeyboardMapperWidget::add_map_radio_button(const StringView map_name, String button_text) diff --git a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp index 10d1867c58..22b7ee06d0 100644 --- a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp @@ -214,8 +214,8 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() auto button_container = TRY(properties_widget->try_add<GUI::Widget>()); button_container->set_fixed_height(22); - auto button_container_layout = TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>()); - button_container_layout->add_spacer(); + (void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>()); + button_container->add_spacer().release_value_but_fixme_should_propagate_errors(); auto apply_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Apply"sv))); apply_button->on_click = [this](auto) { diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index c1ef552e9c..de0f822e7e 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -56,7 +56,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet, buttonbox.set_shrink_to_fit(true); auto& button_layout = buttonbox.set_layout<GUI::HorizontalBoxLayout>(); button_layout.set_spacing(10); - button_layout.add_spacer(); + buttonbox.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& ok_button = buttonbox.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); ok_button.set_fixed_width(80); ok_button.on_click = [&](auto) { done(ExecResult::OK); }; diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index 0fae2fcb0d..f481924c7f 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -331,7 +331,7 @@ void ColorPicker::build_ui_custom(Widget& root_container) // Preview selected color m_preview_widget = preview_container.add<ColorPreview>(m_color); - vertical_container.layout()->add_spacer(); + vertical_container.add_spacer().release_value_but_fixme_should_propagate_errors(); // HTML auto& html_container = vertical_container.add<GUI::Widget>(); diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index e9c690099f..1417727e23 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -104,7 +104,7 @@ void InputBox::build() button_container_inner.set_layout<HorizontalBoxLayout>(); button_container_inner.set_preferred_height(SpecialDimension::Fit); button_container_inner.layout()->set_spacing(6); - button_container_inner.layout()->add_spacer(); + button_container_inner.add_spacer().release_value_but_fixme_should_propagate_errors(); m_ok_button = button_container_inner.add<DialogButton>(); m_ok_button->set_text(String::from_utf8_short_string("OK"sv)); diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 53b83eca27..b76692407a 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -165,7 +165,7 @@ void MessageBox::build() return button; }; - button_container.layout()->add_spacer(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); if (should_include_ok_button()) m_ok_button = add_button(String::from_utf8_short_string("OK"sv), ExecResult::OK); if (should_include_yes_button()) @@ -174,7 +174,7 @@ void MessageBox::build() m_no_button = add_button(String::from_utf8_short_string("No"sv), ExecResult::No); if (should_include_cancel_button()) m_cancel_button = add_button(String::from_utf8_short_string("Cancel"sv), ExecResult::Cancel); - button_container.layout()->add_spacer(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); int width = (button_count * button_width) + ((button_count - 1) * button_container.layout()->spacing()) + 32; width = max(width, text_width + icon_width + 56); diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 9368ec3cc2..58f6d545ac 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -50,7 +50,7 @@ ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx button_container.set_fixed_height(30); button_container.set_layout<GUI::HorizontalBoxLayout>(); button_container.layout()->set_margins({ 0, 4, 0 }); - button_container.layout()->add_spacer(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& select_button = button_container.add<GUI::Button>(m_button_label); select_button.set_fixed_width(80); diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index c121fe6462..3e35e1d18d 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -52,7 +52,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t }; } - TRY(button_container->layout()->try_add_spacer()); + TRY(button_container->add_spacer()); window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("OK"sv))); window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index b69ca90e57..d09306eb13 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -176,7 +176,7 @@ ErrorOr<void> Toolbar::create_overflow_objects() m_overflow_action->set_status_tip("Show hidden toolbar actions"); m_overflow_action->set_enabled(false); - TRY(layout()->try_add_spacer()); + TRY(add_spacer()); m_overflow_button = TRY(try_add_action(*m_overflow_action)); m_overflow_button->set_visible(false); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp index 060518ad26..d17fc553bc 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp @@ -44,7 +44,7 @@ WizardDialog::WizardDialog(Window* parent_window) nav_container_widget.set_fixed_height(42); nav_container_widget.layout()->set_margins({ 0, 10 }); nav_container_widget.layout()->set_spacing(0); - nav_container_widget.layout()->add_spacer(); + nav_container_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); m_back_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("< Back"sv)); m_back_button->on_click = [&](auto) { diff --git a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp index b52d47980e..48899acb83 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp @@ -34,7 +34,7 @@ WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString cons m_subtitle_label = header_widget.add<Label>(subtitle_text); m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft); m_subtitle_label->set_fixed_height(m_subtitle_label->font().glyph_height()); - header_widget.layout()->add_spacer(); + header_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& separator = add<SeparatorWidget>(Gfx::Orientation::Horizontal); separator.set_fixed_height(2); diff --git a/Userland/Services/Taskbar/ClockWidget.cpp b/Userland/Services/Taskbar/ClockWidget.cpp index 36d7569998..931193bb80 100644 --- a/Userland/Services/Taskbar/ClockWidget.cpp +++ b/Userland/Services/Taskbar/ClockWidget.cpp @@ -135,7 +135,7 @@ ClockWidget::ClockWidget() settings_container.set_fixed_height(24); settings_container.set_layout<GUI::HorizontalBoxLayout>(); settings_container.layout()->set_margins({ 2 }); - settings_container.layout()->add_spacer(); + settings_container.add_spacer().release_value_but_fixme_should_propagate_errors(); m_jump_to_button = settings_container.add<GUI::Button>(); m_jump_to_button->set_button_style(Gfx::ButtonStyle::Coolbar); diff --git a/Userland/Services/Taskbar/ShutdownDialog.cpp b/Userland/Services/Taskbar/ShutdownDialog.cpp index ae4d93aa7f..5cc972af29 100644 --- a/Userland/Services/Taskbar/ShutdownDialog.cpp +++ b/Userland/Services/Taskbar/ShutdownDialog.cpp @@ -96,7 +96,7 @@ ShutdownDialog::ShutdownDialog() button_container.set_fixed_height(23); button_container.set_layout<GUI::HorizontalBoxLayout>(); button_container.layout()->set_spacing(5); - button_container.layout()->add_spacer(); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); ok_button.set_fixed_size(80, 23); ok_button.on_click = [this](auto) { |