Userland: Use Widget::add_spacer() everywhere

This commit is contained in:
Sam Atkins 2023-02-17 10:47:04 +00:00 committed by Sam Atkins
parent 43dddafd16
commit 9561ec15f4
17 changed files with 23 additions and 23 deletions

View file

@ -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) {

View file

@ -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);

View file

@ -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) {

View file

@ -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) {

View file

@ -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)

View file

@ -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) {

View file

@ -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); };

View file

@ -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>();

View file

@ -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));

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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);

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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) {