mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:27:45 +00:00
Userland: Use non-fallible EventReceiver::add()
where possible
This commit is contained in:
parent
707ca984bd
commit
b4e134cb52
54 changed files with 934 additions and 934 deletions
|
@ -25,19 +25,19 @@ ErrorOr<void> CoverWizardPage::build(String title, String subtitle)
|
|||
set_fill_with_background_color(true);
|
||||
set_background_role(Gfx::ColorRole::Base);
|
||||
set_layout<HorizontalBoxLayout>();
|
||||
m_banner_image_widget = TRY(try_add<ImageWidget>());
|
||||
m_banner_image_widget = add<ImageWidget>();
|
||||
m_banner_image_widget->set_fixed_size(160, 315);
|
||||
m_banner_image_widget->load_from_file("/res/graphics/wizard-banner-simple.png"sv);
|
||||
|
||||
m_content_widget = TRY(try_add<Widget>());
|
||||
m_content_widget = add<Widget>();
|
||||
m_content_widget->set_layout<VerticalBoxLayout>(20);
|
||||
|
||||
m_header_label = TRY(m_content_widget->try_add<Label>(move(title)));
|
||||
m_header_label = m_content_widget->add<Label>(move(title));
|
||||
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton"_fly_string, 14, 700, Gfx::FontWidth::Normal, 0));
|
||||
m_header_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
m_header_label->set_fixed_height(48);
|
||||
|
||||
m_body_label = TRY(m_content_widget->try_add<Label>(move(subtitle)));
|
||||
m_body_label = m_content_widget->add<Label>(move(subtitle));
|
||||
m_body_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
|
||||
return {};
|
||||
|
|
|
@ -29,24 +29,24 @@ ErrorOr<void> WizardDialog::build()
|
|||
main_widget->set_fill_with_background_color(true);
|
||||
main_widget->set_layout<VerticalBoxLayout>(Margins {}, 0);
|
||||
|
||||
m_page_container_widget = TRY(main_widget->try_add<Widget>());
|
||||
m_page_container_widget = main_widget->add<Widget>();
|
||||
m_page_container_widget->set_fixed_size(500, 315);
|
||||
m_page_container_widget->set_layout<VerticalBoxLayout>();
|
||||
|
||||
auto separator = TRY(main_widget->try_add<SeparatorWidget>(Gfx::Orientation::Horizontal));
|
||||
separator->set_fixed_height(2);
|
||||
auto& separator = main_widget->add<SeparatorWidget>(Gfx::Orientation::Horizontal);
|
||||
separator.set_fixed_height(2);
|
||||
|
||||
auto nav_container_widget = TRY(main_widget->try_add<Widget>());
|
||||
nav_container_widget->set_layout<HorizontalBoxLayout>(Margins { 0, 10 }, 0);
|
||||
nav_container_widget->set_fixed_height(42);
|
||||
nav_container_widget->add_spacer();
|
||||
auto& nav_container_widget = main_widget->add<Widget>();
|
||||
nav_container_widget.set_layout<HorizontalBoxLayout>(Margins { 0, 10 }, 0);
|
||||
nav_container_widget.set_fixed_height(42);
|
||||
nav_container_widget.add_spacer();
|
||||
|
||||
m_back_button = TRY(nav_container_widget->try_add<DialogButton>("< Back"_string));
|
||||
m_back_button = nav_container_widget.add<DialogButton>("< Back"_string);
|
||||
m_back_button->on_click = [&](auto) {
|
||||
pop_page();
|
||||
};
|
||||
|
||||
m_next_button = TRY(nav_container_widget->try_add<DialogButton>("Next >"_string));
|
||||
m_next_button = nav_container_widget.add<DialogButton>("Next >"_string);
|
||||
m_next_button->on_click = [&](auto) {
|
||||
VERIFY(has_pages());
|
||||
|
||||
|
@ -60,10 +60,10 @@ ErrorOr<void> WizardDialog::build()
|
|||
push_page(*next_page);
|
||||
};
|
||||
|
||||
auto button_spacer = TRY(nav_container_widget->try_add<Widget>());
|
||||
button_spacer->set_fixed_width(10);
|
||||
auto& button_spacer = nav_container_widget.add<Widget>();
|
||||
button_spacer.set_fixed_width(10);
|
||||
|
||||
m_cancel_button = TRY(nav_container_widget->try_add<DialogButton>("Cancel"_string));
|
||||
m_cancel_button = nav_container_widget.add<DialogButton>("Cancel"_string);
|
||||
m_cancel_button->on_click = [&](auto) {
|
||||
handle_cancel();
|
||||
};
|
||||
|
|
|
@ -25,26 +25,26 @@ ErrorOr<void> WizardPage::build(String title, String subtitle)
|
|||
{
|
||||
set_layout<VerticalBoxLayout>(Margins {}, 0);
|
||||
|
||||
auto header_widget = TRY(try_add<Widget>());
|
||||
header_widget->set_fill_with_background_color(true);
|
||||
header_widget->set_background_role(Gfx::ColorRole::Base);
|
||||
header_widget->set_fixed_height(58);
|
||||
auto& header_widget = add<Widget>();
|
||||
header_widget.set_fill_with_background_color(true);
|
||||
header_widget.set_background_role(Gfx::ColorRole::Base);
|
||||
header_widget.set_fixed_height(58);
|
||||
|
||||
header_widget->set_layout<VerticalBoxLayout>(Margins { 15, 30, 0 });
|
||||
m_title_label = TRY(header_widget->try_add<Label>(move(title)));
|
||||
header_widget.set_layout<VerticalBoxLayout>(Margins { 15, 30, 0 });
|
||||
m_title_label = header_widget.add<Label>(move(title));
|
||||
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
|
||||
m_title_label->set_fixed_height(m_title_label->font().pixel_size_rounded_up() + 2);
|
||||
m_title_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
|
||||
m_subtitle_label = TRY(header_widget->try_add<Label>(move(subtitle)));
|
||||
m_subtitle_label = header_widget.add<Label>(move(subtitle));
|
||||
m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
m_subtitle_label->set_fixed_height(m_subtitle_label->font().pixel_size_rounded_up());
|
||||
header_widget->add_spacer();
|
||||
header_widget.add_spacer();
|
||||
|
||||
auto separator = TRY(try_add<SeparatorWidget>(Gfx::Orientation::Horizontal));
|
||||
separator->set_fixed_height(2);
|
||||
auto& separator = add<SeparatorWidget>(Gfx::Orientation::Horizontal);
|
||||
separator.set_fixed_height(2);
|
||||
|
||||
m_body_widget = TRY(try_add<Widget>());
|
||||
m_body_widget = add<Widget>();
|
||||
m_body_widget->set_layout<VerticalBoxLayout>(20);
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue