mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
This commit is contained in:
parent
d223477bc6
commit
0c24522635
121 changed files with 441 additions and 449 deletions
|
@ -110,21 +110,21 @@ bool MessageBox::should_include_no_button() const
|
|||
|
||||
void MessageBox::build()
|
||||
{
|
||||
auto& widget = set_main_widget<Widget>();
|
||||
auto widget = set_main_widget<Widget>().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
int text_width = widget.font().width(m_text);
|
||||
int text_width = widget->font().width(m_text);
|
||||
auto number_of_lines = m_text.split('\n').size();
|
||||
int padded_text_height = widget.font().glyph_height() * 1.6;
|
||||
int padded_text_height = widget->font().glyph_height() * 1.6;
|
||||
int total_text_height = number_of_lines * padded_text_height;
|
||||
int icon_width = 0;
|
||||
|
||||
widget.set_layout<VerticalBoxLayout>();
|
||||
widget.set_fill_with_background_color(true);
|
||||
widget->set_layout<VerticalBoxLayout>();
|
||||
widget->set_fill_with_background_color(true);
|
||||
|
||||
widget.layout()->set_margins(8);
|
||||
widget.layout()->set_spacing(6);
|
||||
widget->layout()->set_margins(8);
|
||||
widget->layout()->set_spacing(6);
|
||||
|
||||
auto& message_container = widget.add<Widget>();
|
||||
auto& message_container = widget->add<Widget>();
|
||||
message_container.set_layout<HorizontalBoxLayout>();
|
||||
message_container.layout()->set_spacing(8);
|
||||
|
||||
|
@ -143,7 +143,7 @@ void MessageBox::build()
|
|||
if (m_type != Type::None)
|
||||
label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
auto& button_container = widget.add<Widget>();
|
||||
auto& button_container = widget->add<Widget>();
|
||||
button_container.set_layout<HorizontalBoxLayout>();
|
||||
button_container.set_fixed_height(24);
|
||||
button_container.layout()->set_spacing(8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue