1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:57:46 +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

@ -76,7 +76,7 @@ ErrorOr<NonnullRefPtr<MainWidget>> MainWidget::try_create(GUI::Icon const& icon)
main_widget->m_preview_window = GUI::Window::construct(main_widget);
main_widget->m_preview_window->set_title("Preview - GML Playground");
main_widget->m_preview_window->set_icon(icon.bitmap_for_size(16));
main_widget->m_preview_window_widget = TRY(main_widget->m_preview_window->set_main_widget<GUI::Widget>());
main_widget->m_preview_window_widget = main_widget->m_preview_window->set_main_widget<GUI::Widget>();
main_widget->m_preview_window_widget->set_fill_with_background_color(true);
main_widget->m_preview = main_widget->m_preview_frame_widget;

View file

@ -45,7 +45,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
window->resize(800, 600);
auto main_widget = TRY(window->set_main_widget<MainWidget>(app_icon));
auto main_widget = TRY(MainWidget::try_create(app_icon));
window->set_main_widget(main_widget);
TRY(main_widget->initialize_menubar(window));

View file

@ -17,7 +17,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
set_title("Commit");
set_icon(parent->icon());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
auto widget = set_main_widget<GUI::Widget>();
widget->load_from_gml(git_commit_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_message_editor = widget->find_descendant_of_type_named<GUI::TextEditor>("message_editor");

View file

@ -49,7 +49,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
set_resizable(false);
set_title("New Project");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
auto main_widget = set_main_widget<GUI::Widget>();
main_widget->load_from_gml(new_project_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_icon_view_container = *main_widget->find_descendant_of_type_named<GUI::Widget>("icon_view_container");

View file

@ -132,7 +132,7 @@ ErrorOr<void> Editor::initialize_tooltip_window()
s_tooltip_window->set_window_type(GUI::WindowType::Tooltip);
}
if (s_tooltip_page_view.is_null()) {
s_tooltip_page_view = TRY(s_tooltip_window->set_main_widget<WebView::OutOfProcessWebView>());
s_tooltip_page_view = s_tooltip_window->set_main_widget<WebView::OutOfProcessWebView>();
}
return {};
}

View file

@ -149,7 +149,7 @@ Locator::Locator(Core::EventReceiver* parent)
m_popup_window->set_window_type(GUI::WindowType::Popup);
m_popup_window->set_rect(0, 0, 500, 200);
m_suggestion_view = m_popup_window->set_main_widget<GUI::TableView>().release_value_but_fixme_should_propagate_errors();
m_suggestion_view = m_popup_window->set_main_widget<GUI::TableView>();
m_suggestion_view->set_column_headers_visible(false);
m_suggestion_view->on_activation = [this](auto& index) {

View file

@ -88,7 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
window->resize(800, 600);
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>();
@ -319,7 +319,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
window->center_on_screen();
auto widget = window->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
auto widget = window->set_main_widget<GUI::Widget>();
widget->set_fill_with_background_color(true);
widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 0, 0, 16 });