1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

Userland: Make Window::set_main_widget() non-fallible

This commit is contained in:
Tim Ledbetter 2023-09-19 01:13:48 +01:00 committed by Andreas Kling
parent c9297126db
commit 3aa49f268c
120 changed files with 144 additions and 133 deletions

View file

@ -61,7 +61,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
advice_window->set_has_alpha_channel(true);
advice_window->set_alpha_hit_threshold(1.0f);
auto advice_widget = TRY(advice_window->set_main_widget<SpeechBubble>(catdog_widget));
auto advice_widget = advice_window->set_main_widget<SpeechBubble>(catdog_widget);
advice_widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0);
auto advice_timer = TRY(Core::Timer::create_single_shot(15'000, [&] {

View file

@ -96,7 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}));
help_menu->add_action(GUI::CommonActions::make_about_action("Eyes Demo"_string, app_icon, window));
auto eyes_widget = TRY(window->set_main_widget<EyesWidget>(num_eyes, full_rows, extra_columns));
auto eyes_widget = window->set_main_widget<EyesWidget>(num_eyes, full_rows, extra_columns);
eyes_widget->on_context_menu_request = [&](auto& event) {
file_menu->popup(event.screen_position());
};

View file

@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(Desktop::Screensaver::create_window("Gradient"sv, "app-gradient"sv));
auto gradient_widget = TRY(window->set_main_widget<Gradient>(64, 48, 10000));
auto gradient_widget = window->set_main_widget<Gradient>(64, 48, 10000);
gradient_widget->set_fill_with_background_color(false);
gradient_widget->set_override_cursor(Gfx::StandardCursor::Hidden);
gradient_widget->update();

View file

@ -202,7 +202,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-libgfx-demo"sv));
window->set_icon(app_icon.bitmap_for_size(16));
(void)TRY(window->set_main_widget<Canvas>());
(void)window->set_main_widget<Canvas>();
window->show();
return app->exec();

View file

@ -121,7 +121,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-libgfx-demo"sv));
window->set_icon(app_icon.bitmap_for_size(16));
(void)TRY(window->set_main_widget<Canvas>());
(void)window->set_main_widget<Canvas>();
window->show();
return app->exec();

View file

@ -411,7 +411,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_obey_widget_min_size(false);
window->set_minimum_size(320, 240);
window->resize(window->minimum_size() * 2);
auto mandelbrot = TRY(window->set_main_widget<Mandelbrot>());
auto mandelbrot = window->set_main_widget<Mandelbrot>();
auto file_menu = window->add_menu("&File"_string);

View file

@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Model Gallery");
window->set_icon(app_icon.bitmap_for_size(16));
window->resize(430, 480);
(void)TRY(window->set_main_widget<GalleryWidget>());
(void)window->set_main_widget<GalleryWidget>();
window->show();
return app->exec();

View file

@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu->add_action(GUI::CommonActions::make_about_action("Screensaver"_string, app_icon, window));
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
auto main_widget = window->set_main_widget<GUI::Widget>();
main_widget->set_fill_with_background_color(true);
main_widget->set_layout<GUI::VerticalBoxLayout>();

View file

@ -167,7 +167,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(Desktop::Screensaver::create_window("Starfield"sv, "app-starfield"sv));
auto starfield_widget = TRY(window->set_main_widget<Starfield>(refresh_rate));
auto starfield_widget = window->set_main_widget<Starfield>(refresh_rate);
starfield_widget->set_fill_with_background_color(false);
starfield_widget->set_override_cursor(Gfx::StandardCursor::Hidden);
starfield_widget->update();

View file

@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(Desktop::Screensaver::create_window("Tubes"sv, "app-tubes"sv));
window->update();
auto tubes_widget = TRY(window->set_main_widget<Tubes>(refresh_rate));
auto tubes_widget = window->set_main_widget<Tubes>(refresh_rate);
tubes_widget->set_fill_with_background_color(false);
tubes_widget->set_override_cursor(Gfx::StandardCursor::Hidden);
window->show();

View file

@ -27,7 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(430, 480);
window->set_title("Widget Gallery");
window->set_icon(app_icon.bitmap_for_size(16));
(void)TRY(window->set_main_widget<GalleryWidget>());
(void)window->set_main_widget<GalleryWidget>();
window->show();
return app->exec();