diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index a217edde68..2ec64907eb 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -80,7 +80,7 @@ private: m_slider_window = add(window()); m_slider_window->set_window_type(GUI::WindowType::Popup); - m_root_container = TRY(m_slider_window->try_set_main_widget()); + m_root_container = TRY(m_slider_window->set_main_widget()); m_root_container->set_fill_with_background_color(true); m_root_container->set_layout(); m_root_container->layout()->set_margins({ 4 }); @@ -245,7 +245,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Audio"); window->set_window_type(GUI::WindowType::Applet); - auto audio_widget = TRY(window->try_set_main_widget()); + auto audio_widget = TRY(window->set_main_widget()); window->show(); // This positioning code depends on the window actually existing. diff --git a/Userland/Applets/ClipboardHistory/main.cpp b/Userland/Applets/ClipboardHistory/main.cpp index 0902ccb8c2..cc2ed9a054 100644 --- a/Userland/Applets/ClipboardHistory/main.cpp +++ b/Userland/Applets/ClipboardHistory/main.cpp @@ -33,7 +33,7 @@ ErrorOr serenity_main(Main::Arguments arguments) main_window->set_rect(670, 65, 325, 500); main_window->set_icon(app_icon.bitmap_for_size(16)); - auto table_view = TRY(main_window->try_set_main_widget()); + auto table_view = TRY(main_window->set_main_widget()); auto model = ClipboardHistoryModel::create(); table_view->set_model(model); @@ -65,7 +65,7 @@ ErrorOr serenity_main(Main::Arguments arguments) applet_window->set_title("ClipboardHistory"); applet_window->set_window_type(GUI::WindowType::Applet); applet_window->set_has_alpha_channel(true); - auto icon_widget = TRY(applet_window->try_set_main_widget()); + auto icon_widget = TRY(applet_window->set_main_widget()); icon_widget->set_tooltip("Clipboard History"); icon_widget->load_from_file("/res/icons/16x16/edit-copy.png"sv); icon_widget->on_click = [&main_window = *main_window] { diff --git a/Userland/Applets/Keymap/KeymapStatusWindow.cpp b/Userland/Applets/Keymap/KeymapStatusWindow.cpp index 7a0fc2b29f..661a1fa46c 100644 --- a/Userland/Applets/Keymap/KeymapStatusWindow.cpp +++ b/Userland/Applets/Keymap/KeymapStatusWindow.cpp @@ -14,7 +14,7 @@ KeymapStatusWindow::KeymapStatusWindow() { set_window_type(GUI::WindowType::Applet); set_has_alpha_channel(true); - m_status_widget = &set_main_widget(); + m_status_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); auto current_keymap = MUST(Keyboard::CharacterMap::fetch_system_map()); auto current_keymap_name = current_keymap.character_map_name(); diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp index 7a3f3bac75..637a4da533 100644 --- a/Userland/Applets/Network/main.cpp +++ b/Userland/Applets/Network/main.cpp @@ -187,7 +187,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_window_type(GUI::WindowType::Applet); window->set_has_alpha_channel(true); window->resize(16, 16); - auto icon = TRY(window->try_set_main_widget(display_notifications)); + auto icon = TRY(window->set_main_widget(display_notifications)); icon->load_from_file("/res/icons/16x16/network.png"sv); window->resize(16, 16); window->show(); diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index 442ac13be6..1c43ba4843 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -276,7 +276,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_window_type(GUI::WindowType::Applet); window->resize(GraphWidget::history_size + 2, 15); - auto graph_widget = TRY(window->try_set_main_widget(graph_type, graph_color, Optional {})); + auto graph_widget = TRY(window->set_main_widget(graph_type, graph_color, Optional {})); window->show(); applet_windows.append(move(window)); diff --git a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp index 03f0298b9f..0f67aac595 100644 --- a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp +++ b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp @@ -148,7 +148,7 @@ DesktopStatusWindow::DesktopStatusWindow() { set_window_type(GUI::WindowType::Applet); set_has_alpha_channel(true); - m_widget = &set_main_widget(); + m_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); } void DesktopStatusWindow::wm_event(GUI::WMEvent& event) diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 70451f07fd..9c1ed57315 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -385,7 +385,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(640 + 4, 480 + 4); window->set_resizable(false); window->set_double_buffering_enabled(true); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); auto& time = widget->add(); time.set_visible(false); diff --git a/Userland/Applications/AnalogClock/main.cpp b/Userland/Applications/AnalogClock/main.cpp index a4cdf5ab93..fefa207ed8 100644 --- a/Userland/Applications/AnalogClock/main.cpp +++ b/Userland/Applications/AnalogClock/main.cpp @@ -30,7 +30,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(170, 170); window->set_resizable(false); - auto clock = TRY(window->try_set_main_widget()); + auto clock = TRY(window->set_main_widget()); auto show_window_frame_action = GUI::Action::create_checkable( "Show Window &Frame", { Mod_Alt, KeyCode::Key_F }, [&](auto& action) { diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 54ed65abd8..503df2583d 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -165,14 +165,14 @@ ErrorOr serenity_main(Main::Arguments arguments) Assistant::AppState app_state; Assistant::Database db { app_state }; - auto& container = window->set_main_widget(); - container.set_fill_with_background_color(true); - container.set_frame_shape(Gfx::FrameShape::Window); - auto& layout = container.set_layout(); + auto container = TRY(window->set_main_widget()); + container->set_fill_with_background_color(true); + container->set_frame_shape(Gfx::FrameShape::Window); + auto& layout = container->set_layout(); layout.set_margins({ 8 }); - auto& text_box = container.add(); - auto& results_container = container.add(); + auto& text_box = container->add(); + auto& results_container = container->add(); auto& results_layout = results_container.set_layout(); auto mark_selected_item = [&]() { diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 76942649f8..f2dc64baeb 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -47,28 +47,28 @@ private: BookmarkEditor(Window* parent_window, StringView title, StringView url) : Dialog(parent_window) { - auto& widget = set_main_widget(); - if (!widget.load_from_gml(edit_bookmark_gml)) + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!widget->load_from_gml(edit_bookmark_gml)) VERIFY_NOT_REACHED(); set_resizable(false); resize(260, 85); - m_title_textbox = *widget.find_descendant_of_type_named("title_textbox"); + m_title_textbox = *widget->find_descendant_of_type_named("title_textbox"); m_title_textbox->set_text(title); m_title_textbox->set_focus(true); m_title_textbox->select_all(); - m_url_textbox = *widget.find_descendant_of_type_named("url_textbox"); + m_url_textbox = *widget->find_descendant_of_type_named("url_textbox"); m_url_textbox->set_text(url); - auto& ok_button = *widget.find_descendant_of_type_named("ok_button"); + auto& ok_button = *widget->find_descendant_of_type_named("ok_button"); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; ok_button.set_default(true); - auto& cancel_button = *widget.find_descendant_of_type_named("cancel_button"); + auto& cancel_button = *widget->find_descendant_of_type_named("cancel_button"); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index c7029a3384..f11b259814 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -73,12 +73,12 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) set_icon(app_icon.bitmap_for_size(16)); set_title("Browser"); - auto& widget = set_main_widget(); - widget.load_from_gml(browser_window_gml); + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->load_from_gml(browser_window_gml); - auto& top_line = *widget.find_descendant_of_type_named("top_line"); + auto& top_line = *widget->find_descendant_of_type_named("top_line"); - m_tab_widget = *widget.find_descendant_of_type_named("tab_widget"); + m_tab_widget = *widget->find_descendant_of_type_named("tab_widget"); m_tab_widget->on_tab_count_change = [&top_line](size_t tab_count) { top_line.set_visible(tab_count > 1); }; diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 477162a62f..9c989b20c4 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -70,18 +70,18 @@ void Tab::start_download(const URL& url) window->resize(300, 170); window->set_title(DeprecatedString::formatted("0% of {}", url.basename())); window->set_resizable(false); - window->set_main_widget(url); + (void)window->set_main_widget(url).release_value_but_fixme_should_propagate_errors(); window->show(); } void Tab::view_source(const URL& url, DeprecatedString const& source) { auto window = GUI::Window::construct(&this->window()); - auto& editor = window->set_main_widget(); - editor.set_text(source); - editor.set_mode(GUI::TextEditor::ReadOnly); - editor.set_syntax_highlighter(make()); - editor.set_ruler_visible(true); + auto editor = window->set_main_widget().release_value_but_fixme_should_propagate_errors(); + editor->set_text(source); + editor->set_mode(GUI::TextEditor::ReadOnly); + editor->set_syntax_highlighter(make()); + editor->set_ruler_visible(true); window->resize(640, 480); window->set_title(url.to_deprecated_string()); window->set_icon(g_icon_bag.filetype_text); @@ -663,7 +663,7 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target) window->on_close = [&]() { m_web_content_view->clear_inspected_dom_node(); }; - m_dom_inspector_widget = window->set_main_widget(); + m_dom_inspector_widget = window->set_main_widget().release_value_but_fixme_should_propagate_errors(); m_dom_inspector_widget->set_web_view(*m_web_content_view); m_web_content_view->inspect_dom_tree(); } @@ -702,7 +702,7 @@ void Tab::show_console_window() console_window->resize(500, 300); console_window->set_title("JS Console"); console_window->set_icon(g_icon_bag.filetype_javascript); - m_console_widget = console_window->set_main_widget(); + m_console_widget = console_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); m_console_widget->on_js_input = [this](DeprecatedString const& js_source) { m_web_content_view->js_console_input(js_source); }; @@ -723,7 +723,7 @@ void Tab::show_storage_inspector() storage_window->resize(500, 300); storage_window->set_title("Storage inspector"); storage_window->set_icon(g_icon_bag.cookie); - m_storage_widget = storage_window->set_main_widget(); + m_storage_widget = storage_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); m_storage_widget->on_update_cookie = [this](Web::Cookie::Cookie cookie) { if (on_update_cookie) on_update_cookie(move(cookie)); @@ -760,7 +760,7 @@ void Tab::show_history_inspector() history_window->resize(500, 300); history_window->set_title("History"); history_window->set_icon(g_icon_bag.history); - m_history_widget = history_window->set_main_widget(); + m_history_widget = history_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); } m_history_widget->clear_history_entries(); diff --git a/Userland/Applications/Calculator/RoundingDialog.cpp b/Userland/Applications/Calculator/RoundingDialog.cpp index 4492404f06..3e2e0c3e50 100644 --- a/Userland/Applications/Calculator/RoundingDialog.cpp +++ b/Userland/Applications/Calculator/RoundingDialog.cpp @@ -39,18 +39,18 @@ RoundingDialog::RoundingDialog(GUI::Window* parent_window, StringView title) set_resizable(false); set_title(title); - auto& main_widget = set_main_widget(); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); - main_widget.set_fill_with_background_color(true); - main_widget.set_layout(); + main_widget->set_fill_with_background_color(true); + main_widget->set_layout(); m_rounding_spinbox = GUI::SpinBox::construct(); m_buttons_container = GUI::Widget::construct(); m_ok_button = GUI::DialogButton::construct("OK"); m_cancel_button = GUI::DialogButton::construct("Cancel"); - main_widget.add_child(*m_rounding_spinbox); - main_widget.add_child(*m_buttons_container); + main_widget->add_child(*m_rounding_spinbox); + main_widget->add_child(*m_buttons_container); m_buttons_container->set_layout(); m_buttons_container->layout()->add_spacer(); diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp index af00b85f9d..275d10b071 100644 --- a/Userland/Applications/Calculator/main.cpp +++ b/Userland/Applications/Calculator/main.cpp @@ -35,7 +35,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_resizable(false); window->resize(250, 215); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 4951885d2c..058bd52cdd 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -28,11 +28,11 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) set_resizable(false); set_icon(parent_window->icon()); - auto& widget = set_main_widget(); - widget.set_fill_with_background_color(true); - widget.set_layout(); + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->set_fill_with_background_color(true); + widget->set_layout(); - auto& top_container = widget.add(); + auto& top_container = widget->add(); top_container.set_layout(); top_container.set_fixed_height(45); top_container.layout()->set_margins(4); @@ -45,12 +45,12 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) auto& event_title_textbox = top_container.add(); event_title_textbox.set_fixed_height(20); - auto& middle_container = widget.add(); + auto& middle_container = widget->add(); middle_container.set_layout(); middle_container.set_fixed_height(25); middle_container.layout()->set_margins(4); - auto& time_container = widget.add(); + auto& time_container = widget->add(); time_container.set_layout(); time_container.set_fixed_height(25); time_container.layout()->set_margins(4); @@ -87,9 +87,9 @@ 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->layout()->add_spacer(); - auto& button_container = widget.add(); + auto& button_container = widget->add(); button_container.set_fixed_height(20); button_container.set_layout(); button_container.layout()->add_spacer(); diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp index 7b73eb2070..56940b1633 100644 --- a/Userland/Applications/Calendar/main.cpp +++ b/Userland/Applications/Calendar/main.cpp @@ -42,7 +42,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(600, 480); window->set_icon(app_icon.bitmap_for_size(16)); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(calendar_window_gml); auto toolbar = main_widget->find_descendant_of_type_named("toolbar"); diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index d9569b5568..62aa121de1 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -86,8 +86,8 @@ CharacterMapWidget::CharacterMapWidget() m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { if (m_find_window.is_null()) { m_find_window = GUI::Window::construct(window()); - auto& search_widget = m_find_window->set_main_widget(); - search_widget.on_character_selected = [&](auto code_point) { + auto search_widget = m_find_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); + search_widget->on_character_selected = [&](auto code_point) { m_glyph_map->set_active_glyph(code_point); m_glyph_map->scroll_to_glyph(code_point); }; diff --git a/Userland/Applications/CharacterMap/main.cpp b/Userland/Applications/CharacterMap/main.cpp index 87eeec7bdf..4b3bcb0171 100644 --- a/Userland/Applications/CharacterMap/main.cpp +++ b/Userland/Applications/CharacterMap/main.cpp @@ -68,7 +68,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(600, 400); - auto character_map_widget = TRY(window->try_set_main_widget()); + auto character_map_widget = TRY(window->set_main_widget()); character_map_widget->initialize_menubar(*window); auto font_query = Config::read_string("CharacterMap"sv, "History"sv, "Font"sv, Gfx::FontDatabase::the().default_font_query()); diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index b7a41f52c2..7a89b20535 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -181,7 +181,7 @@ ErrorOr serenity_main(Main::Arguments arguments) unlink_coredump(coredump_path); }; - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->load_from_gml(crash_reporter_window_gml); auto& icon_image_widget = *widget->find_descendant_of_type_named("icon"); diff --git a/Userland/Applications/Escalator/EscalatorWindow.cpp b/Userland/Applications/Escalator/EscalatorWindow.cpp index 82645a7931..08f60d76b7 100644 --- a/Userland/Applications/Escalator/EscalatorWindow.cpp +++ b/Userland/Applications/Escalator/EscalatorWindow.cpp @@ -31,10 +31,10 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum set_resizable(false); set_minimizable(false); - auto& main_widget = set_main_widget(); - main_widget.load_from_gml(escalator_gml); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->load_from_gml(escalator_gml); - RefPtr app_label = *main_widget.find_descendant_of_type_named("description"); + RefPtr app_label = *main_widget->find_descendant_of_type_named("description"); DeprecatedString prompt; if (options.description.is_empty()) @@ -44,10 +44,10 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum app_label->set_text(prompt); - m_icon_image_widget = *main_widget.find_descendant_of_type_named("icon"); + m_icon_image_widget = *main_widget->find_descendant_of_type_named("icon"); m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32)); - m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); + m_ok_button = *main_widget->find_descendant_of_type_named("ok_button"); m_ok_button->on_click = [this](auto) { auto result = check_password(); if (result.is_error()) { @@ -57,12 +57,12 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum }; m_ok_button->set_default(true); - m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); + m_cancel_button = *main_widget->find_descendant_of_type_named("cancel_button"); m_cancel_button->on_click = [this](auto) { close(); }; - m_password_input = *main_widget.find_descendant_of_type_named("password"); + m_password_input = *main_widget->find_descendant_of_type_named("password"); } ErrorOr EscalatorWindow::check_password() diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp index 5a853980e2..468994a515 100644 --- a/Userland/Applications/FileManager/FileUtils.cpp +++ b/Userland/Applications/FileManager/FileUtils.cpp @@ -99,7 +99,7 @@ ErrorOr run_file_operation(FileOperation operation, Vectortry_set_main_widget(operation, move(buffered_pipe), pipe_fds[0])); + (void)TRY(window->set_main_widget(operation, move(buffered_pipe), pipe_fds[0])); window->resize(320, 190); if (parent_window) window->center_within(*parent_window); diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 93ed82b47c..146cf99356 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -31,18 +31,18 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_re { auto lexical_path = LexicalPath(path); - auto& main_widget = set_main_widget(); - main_widget.set_layout(); - main_widget.layout()->set_spacing(6); - main_widget.layout()->set_margins(4); - main_widget.set_fill_with_background_color(true); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_layout(); + main_widget->layout()->set_spacing(6); + main_widget->layout()->set_margins(4); + main_widget->set_fill_with_background_color(true); set_rect({ 0, 0, 360, 420 }); set_resizable(false); set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors()); - auto& tab_widget = main_widget.add(); + auto& tab_widget = main_widget->add(); auto& general_tab = tab_widget.add_tab("General"); general_tab.load_from_gml(properties_window_general_tab_gml); @@ -142,7 +142,7 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_re auto others_execute = general_tab.find_descendant_of_type_named("others_execute"); setup_permission_checkboxes(*others_read, *others_write, *others_execute, { S_IROTH, S_IWOTH, S_IXOTH }, m_mode); - auto& button_widget = main_widget.add(); + auto& button_widget = main_widget->add(); button_widget.set_layout(); button_widget.set_fixed_height(22); button_widget.layout()->set_spacing(5); diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 6e53198eab..37c5658eaf 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -351,7 +351,7 @@ ErrorOr run_in_desktop_mode() window->set_window_type(GUI::WindowType::Desktop); window->set_has_alpha_channel(true); - auto desktop_widget = TRY(window->try_set_main_widget()); + auto desktop_widget = TRY(window->set_main_widget()); (void)TRY(desktop_widget->try_set_layout()); auto directory_view = TRY(desktop_widget->try_add(DirectoryView::Mode::Desktop)); @@ -579,7 +579,7 @@ ErrorOr run_in_windowed_mode(DeprecatedString const& initial_location, Depr auto height = Config::read_i32("FileManager"sv, "Window"sv, "Height"sv, 480); auto was_maximized = Config::read_bool("FileManager"sv, "Window"sv, "Maximized"sv, false); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->load_from_gml(file_manager_window_gml); diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index 285fec9fb1..52be7f840f 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -65,7 +65,7 @@ ErrorOr> MainWidget::create_preview_window() window->resize(400, 150); window->center_within(*this->window()); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(font_preview_window_gml); m_preview_label = find_descendant_of_type_named("preview_label"); diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index 7447a95bad..167f40b9e4 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(640, 470); - auto font_editor = TRY(window->try_set_main_widget()); + auto font_editor = TRY(window->set_main_widget()); TRY(font_editor->initialize_menubar(*window)); if (path) { diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index ec4c867387..2a67ad6e36 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -61,7 +61,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Help"); window->resize(570, 500); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); TRY(main_widget->initialize_fallibles(window)); TRY(main_widget->set_start_page(query_parameters)); diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 9f2c2472d8..40c7669e76 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -99,16 +99,16 @@ FindDialog::FindDialog() set_resizable(false); set_title("Find"); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(find_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(find_dialog_gml)) VERIFY_NOT_REACHED(); - m_text_editor = *main_widget.find_descendant_of_type_named("text_editor"); - m_find_button = *main_widget.find_descendant_of_type_named("find_button"); - m_find_all_button = *main_widget.find_descendant_of_type_named("find_all_button"); - m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); + m_text_editor = *main_widget->find_descendant_of_type_named("text_editor"); + m_find_button = *main_widget->find_descendant_of_type_named("find_button"); + m_find_all_button = *main_widget->find_descendant_of_type_named("find_all_button"); + m_cancel_button = *main_widget->find_descendant_of_type_named("cancel_button"); - auto& radio_container = *main_widget.find_descendant_of_type_named("radio_container"); + auto& radio_container = *main_widget->find_descendant_of_type_named("radio_container"); for (size_t i = 0; i < options.size(); i++) { auto action = options[i]; auto& radio = radio_container.add(); diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp index 0918603f8a..c89d0a06d4 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp @@ -96,15 +96,15 @@ GoToOffsetDialog::GoToOffsetDialog() set_resizable(false); set_title("Go to Offset"); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(go_to_offset_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(go_to_offset_dialog_gml)) VERIFY_NOT_REACHED(); - m_text_editor = *main_widget.find_descendant_of_type_named("text_editor"); - m_go_button = *main_widget.find_descendant_of_type_named("go_button"); - m_offset_type_box = *main_widget.find_descendant_of_type_named("offset_type"); - m_offset_from_box = *main_widget.find_descendant_of_type_named("offset_from"); - m_statusbar = *main_widget.find_descendant_of_type_named("statusbar"); + m_text_editor = *main_widget->find_descendant_of_type_named("text_editor"); + m_go_button = *main_widget->find_descendant_of_type_named("go_button"); + m_offset_type_box = *main_widget->find_descendant_of_type_named("offset_type"); + m_offset_from_box = *main_widget->find_descendant_of_type_named("offset_from"); + m_statusbar = *main_widget->find_descendant_of_type_named("statusbar"); m_offset_type.append("Decimal"); m_offset_type.append("Hexadecimal"); diff --git a/Userland/Applications/HexEditor/main.cpp b/Userland/Applications/HexEditor/main.cpp index 7821b2e6b2..cd36a0b2d2 100644 --- a/Userland/Applications/HexEditor/main.cpp +++ b/Userland/Applications/HexEditor/main.cpp @@ -35,7 +35,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Hex Editor"); window->resize(640, 400); - auto hex_editor_widget = TRY(window->try_set_main_widget()); + auto hex_editor_widget = TRY(window->set_main_widget()); window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision { if (hex_editor_widget->request_close()) diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index e0feaa703f..0e914e144c 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -56,7 +56,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->set_title("Image Viewer"); - auto root_widget = TRY(window->try_set_main_widget()); + auto root_widget = TRY(window->set_main_widget()); root_widget->set_fill_with_background_color(true); root_widget->set_layout(); root_widget->layout()->set_spacing(2); diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index f2cedca48c..77ef321792 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = GUI::Window::construct(); window->set_title("Keyboard Mapper"); window->set_icon(app_icon.bitmap_for_size(16)); - auto keyboard_mapper_widget = TRY(window->try_set_main_widget()); + auto keyboard_mapper_widget = TRY(window->set_main_widget()); window->resize(775, 315); window->set_resizable(false); diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 74e4305681..890dbee993 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -51,8 +51,8 @@ private: KeymapSelectionDialog(Window* parent_window, Vector const& selected_keymaps) : Dialog(parent_window) { - auto& widget = set_main_widget(); - if (!widget.load_from_gml(keymap_dialog_gml)) + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!widget->load_from_gml(keymap_dialog_gml)) VERIFY_NOT_REACHED(); set_resizable(false); @@ -77,7 +77,7 @@ private: m_selected_keymap = m_character_map_files.first(); - m_keymaps_combobox = *widget.find_descendant_of_type_named("keymaps_combobox"); + m_keymaps_combobox = *widget->find_descendant_of_type_named("keymaps_combobox"); m_keymaps_combobox->set_only_allow_values_from_model(true); m_keymaps_combobox->set_model(*GUI::ItemListModel::create(m_character_map_files)); m_keymaps_combobox->set_selected_index(0); @@ -86,12 +86,12 @@ private: m_selected_keymap = keymap; }; - auto& ok_button = *widget.find_descendant_of_type_named("ok_button"); + auto& ok_button = *widget->find_descendant_of_type_named("ok_button"); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; - auto& cancel_button = *widget.find_descendant_of_type_named("cancel_button"); + auto& cancel_button = *widget->find_descendant_of_type_named("cancel_button"); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index ee6420466c..cf949eab88 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -61,7 +61,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(window_dimensions, window_dimensions); window->set_minimizable(false); window->set_icon(app_icon.bitmap_for_size(16)); - auto magnifier = TRY(window->try_set_main_widget()); + auto magnifier = TRY(window->set_main_widget()); auto file_menu = TRY(window->try_add_menu("&File")); TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) { diff --git a/Userland/Applications/Mail/main.cpp b/Userland/Applications/Mail/main.cpp index 5e853baa84..909b80c5ca 100644 --- a/Userland/Applications/Mail/main.cpp +++ b/Userland/Applications/Mail/main.cpp @@ -41,7 +41,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app_icon = GUI::Icon::default_icon("app-mail"sv); window->set_icon(app_icon.bitmap_for_size(16)); - auto mail_widget = TRY(window->try_set_main_widget()); + auto mail_widget = TRY(window->set_main_widget()); window->set_title("Mail"); window->resize(640, 400); diff --git a/Userland/Applications/PDFViewer/main.cpp b/Userland/Applications/PDFViewer/main.cpp index 0ec2c36309..2a3e5d689a 100644 --- a/Userland/Applications/PDFViewer/main.cpp +++ b/Userland/Applications/PDFViewer/main.cpp @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto pdf_viewer_widget = TRY(window->try_set_main_widget()); + auto pdf_viewer_widget = TRY(window->set_main_widget()); pdf_viewer_widget->initialize_menubar(*window); diff --git a/Userland/Applications/PartitionEditor/main.cpp b/Userland/Applications/PartitionEditor/main.cpp index 3bc10b069d..e9d5278a7d 100644 --- a/Userland/Applications/PartitionEditor/main.cpp +++ b/Userland/Applications/PartitionEditor/main.cpp @@ -52,7 +52,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return Error::from_string_view(error_message); } - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->load_from_gml(partition_editor_window_gml); auto device_paths = get_device_paths(); diff --git a/Userland/Applications/Piano/main.cpp b/Userland/Applications/Piano/main.cpp index 042dfec8b1..b8ad18c16c 100644 --- a/Userland/Applications/Piano/main.cpp +++ b/Userland/Applications/Piano/main.cpp @@ -42,7 +42,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app_icon = GUI::Icon::default_icon("app-piano"sv); auto window = GUI::Window::construct(); - auto main_widget = TRY(window->try_set_main_widget(track_manager, audio_loop)); + auto main_widget = TRY(window->set_main_widget(track_manager, audio_loop)); window->set_title("Piano"); window->resize(840, 600); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index da0d2d4870..ba551d9b08 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -27,31 +27,31 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) set_icon(parent_window->icon()); resize(200, 220); - auto& main_widget = set_main_widget(); - main_widget.set_fill_with_background_color(true); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_fill_with_background_color(true); - auto& layout = main_widget.set_layout(); + auto& layout = main_widget->set_layout(); layout.set_margins(4); - auto& name_label = main_widget.add("Name:"); + auto& name_label = main_widget->add("Name:"); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - m_name_textbox = main_widget.add(); + m_name_textbox = main_widget->add(); m_name_textbox->on_change = [this] { m_image_name = m_name_textbox->text(); }; auto default_name = Config::read_string("PixelPaint"sv, "NewImage"sv, "Name"sv); m_name_textbox->set_text(default_name); - auto& width_label = main_widget.add("Width:"); + auto& width_label = main_widget->add("Width:"); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto& width_spinbox = main_widget.add(); + auto& width_spinbox = main_widget->add(); - auto& height_label = main_widget.add("Height:"); + auto& height_label = main_widget->add("Height:"); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto& height_spinbox = main_widget.add(); + auto& height_spinbox = main_widget->add(); enum class BackgroundIndex { Transparent = 0, @@ -81,10 +81,10 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) return BackgroundIndex::Custom; }(); - auto& background_label = main_widget.add("Background:"); + auto& background_label = main_widget->add("Background:"); background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto& background_color_combo = main_widget.add(); - auto& background_color_input = main_widget.add(); + auto& background_color_combo = main_widget->add(); + auto& background_color_input = main_widget->add(); background_color_input.set_visible(false); background_color_combo.set_only_allow_values_from_model(true); background_color_combo.set_model(*GUI::ItemListModel::create(suggested_backgrounds)); @@ -110,10 +110,10 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) m_background_color = background_color_input.color(); }; - auto& set_defaults_checkbox = main_widget.add(); + auto& set_defaults_checkbox = main_widget->add(); set_defaults_checkbox.set_text("Use these settings as default"); - auto& button_container = main_widget.add(); + auto& button_container = main_widget->add(); button_container.set_layout(); auto& ok_button = button_container.add("OK"); diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index d923451e32..f8fd22806f 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -20,33 +20,33 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win set_icon(parent_window->icon()); resize(200, 200); - auto& main_widget = set_main_widget(); - main_widget.set_fill_with_background_color(true); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_fill_with_background_color(true); - auto& layout = main_widget.set_layout(); + auto& layout = main_widget->set_layout(); layout.set_margins(4); - auto& name_label = main_widget.add("Name:"); + auto& name_label = main_widget->add("Name:"); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - m_name_textbox = main_widget.add(); + m_name_textbox = main_widget->add(); m_name_textbox->set_text("Layer"sv); m_name_textbox->select_all(); m_name_textbox->on_change = [this] { m_layer_name = m_name_textbox->text(); }; - auto& width_label = main_widget.add("Width:"); + auto& width_label = main_widget->add("Width:"); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto& width_spinbox = main_widget.add(); + auto& width_spinbox = main_widget->add(); - auto& height_label = main_widget.add("Height:"); + auto& height_label = main_widget->add("Height:"); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto& height_spinbox = main_widget.add(); + auto& height_spinbox = main_widget->add(); - auto& button_container = main_widget.add(); + auto& button_container = main_widget->add(); button_container.set_layout(); auto& ok_button = button_container.add("OK"); diff --git a/Userland/Applications/PixelPaint/EditGuideDialog.cpp b/Userland/Applications/PixelPaint/EditGuideDialog.cpp index f33bf27c2d..e5b82a2a3b 100644 --- a/Userland/Applications/PixelPaint/EditGuideDialog.cpp +++ b/Userland/Applications/PixelPaint/EditGuideDialog.cpp @@ -23,15 +23,15 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, DeprecatedString co resize(200, 130); set_resizable(false); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(edit_guide_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(edit_guide_dialog_gml)) VERIFY_NOT_REACHED(); - auto horizontal_radio = main_widget.find_descendant_of_type_named("orientation_horizontal_radio"); - auto vertical_radio = main_widget.find_descendant_of_type_named("orientation_vertical_radio"); - auto ok_button = main_widget.find_descendant_of_type_named("ok_button"); - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); - m_offset_text_box = main_widget.find_descendant_of_type_named("offset_text_box"); + auto horizontal_radio = main_widget->find_descendant_of_type_named("orientation_horizontal_radio"); + auto vertical_radio = main_widget->find_descendant_of_type_named("orientation_vertical_radio"); + auto ok_button = main_widget->find_descendant_of_type_named("ok_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); + m_offset_text_box = main_widget->find_descendant_of_type_named("offset_text_box"); VERIFY(horizontal_radio); VERIFY(ok_button); diff --git a/Userland/Applications/PixelPaint/FilterGallery.cpp b/Userland/Applications/PixelPaint/FilterGallery.cpp index 4fd9f3dad8..59aa45154f 100644 --- a/Userland/Applications/PixelPaint/FilterGallery.cpp +++ b/Userland/Applications/PixelPaint/FilterGallery.cpp @@ -21,15 +21,15 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor) resize(400, 250); set_resizable(true); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(filter_gallery_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(filter_gallery_gml)) VERIFY_NOT_REACHED(); - m_filter_tree = main_widget.find_descendant_of_type_named("tree_view"); - auto apply_button = main_widget.find_descendant_of_type_named("apply_button"); - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); - m_config_widget = main_widget.find_descendant_of_type_named("config_widget"); - m_preview_widget = main_widget.find_descendant_of_type_named("preview_widget"); + m_filter_tree = main_widget->find_descendant_of_type_named("tree_view"); + auto apply_button = main_widget->find_descendant_of_type_named("apply_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); + m_config_widget = main_widget->find_descendant_of_type_named("config_widget"); + m_preview_widget = main_widget->find_descendant_of_type_named("preview_widget"); VERIFY(m_filter_tree); VERIFY(apply_button); diff --git a/Userland/Applications/PixelPaint/FilterParams.h b/Userland/Applications/PixelPaint/FilterParams.h index 57d602ff88..58568ccf26 100644 --- a/Userland/Applications/PixelPaint/FilterParams.h +++ b/Userland/Applications/PixelPaint/FilterParams.h @@ -48,11 +48,11 @@ private: set_title(builder.string_view()); resize(200, 250); - auto& main_widget = set_main_widget(); - main_widget.set_frame_shape(Gfx::FrameShape::Container); - main_widget.set_frame_shadow(Gfx::FrameShadow::Raised); - main_widget.set_fill_with_background_color(true); - auto& layout = main_widget.template set_layout(); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_frame_shape(Gfx::FrameShape::Container); + main_widget->set_frame_shadow(Gfx::FrameShadow::Raised); + main_widget->set_fill_with_background_color(true); + auto& layout = main_widget->template set_layout(); layout.set_margins(4); size_t index = 0; @@ -60,7 +60,7 @@ private: size_t rows = N; for (size_t row = 0; row < rows; ++row) { - auto& horizontal_container = main_widget.template add(); + auto& horizontal_container = main_widget->template add(); horizontal_container.template set_layout(); for (size_t column = 0; column < columns; ++column) { if (index < columns * rows) { @@ -81,13 +81,13 @@ private: } } - auto& norm_checkbox = main_widget.template add("Normalize"); + auto& norm_checkbox = main_widget->template add("Normalize"); norm_checkbox.set_checked(false); - auto& wrap_checkbox = main_widget.template add("Wrap"); + auto& wrap_checkbox = main_widget->template add("Wrap"); wrap_checkbox.set_checked(m_should_wrap); - auto& button = main_widget.template add("Done"); + auto& button = main_widget->template add("Done"); button.on_click = [&](auto) { m_should_wrap = wrap_checkbox.is_checked(); if (norm_checkbox.is_checked()) diff --git a/Userland/Applications/PixelPaint/LevelsDialog.cpp b/Userland/Applications/PixelPaint/LevelsDialog.cpp index 6babdbdd16..833cca39b1 100644 --- a/Userland/Applications/PixelPaint/LevelsDialog.cpp +++ b/Userland/Applications/PixelPaint/LevelsDialog.cpp @@ -18,8 +18,8 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor) set_title("Levels"); set_icon(parent_window->icon()); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(levels_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(levels_dialog_gml)) VERIFY_NOT_REACHED(); resize(305, 202); @@ -27,12 +27,12 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor) m_editor = editor; - m_brightness_slider = main_widget.find_descendant_of_type_named("brightness_slider"); - m_contrast_slider = main_widget.find_descendant_of_type_named("contrast_slider"); - m_gamma_slider = main_widget.find_descendant_of_type_named("gamma_slider"); - auto context_label = main_widget.find_descendant_of_type_named("context_label"); - auto apply_button = main_widget.find_descendant_of_type_named("apply_button"); - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); + m_brightness_slider = main_widget->find_descendant_of_type_named("brightness_slider"); + m_contrast_slider = main_widget->find_descendant_of_type_named("contrast_slider"); + m_gamma_slider = main_widget->find_descendant_of_type_named("gamma_slider"); + auto context_label = main_widget->find_descendant_of_type_named("context_label"); + auto apply_button = main_widget->find_descendant_of_type_named("apply_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); VERIFY(m_brightness_slider); VERIFY(m_contrast_slider); diff --git a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp index d198fc5c7b..0dddc0789f 100644 --- a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp +++ b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp @@ -27,13 +27,13 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p resize(260, 228); set_icon(parent_window->icon()); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(resize_image_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(resize_image_dialog_gml)) VERIFY_NOT_REACHED(); - auto width_spinbox = main_widget.find_descendant_of_type_named("width_spinbox"); - auto height_spinbox = main_widget.find_descendant_of_type_named("height_spinbox"); - auto keep_aspect_ratio_checkbox = main_widget.find_descendant_of_type_named("keep_aspect_ratio_checkbox"); + auto width_spinbox = main_widget->find_descendant_of_type_named("width_spinbox"); + auto height_spinbox = main_widget->find_descendant_of_type_named("height_spinbox"); + auto keep_aspect_ratio_checkbox = main_widget->find_descendant_of_type_named("keep_aspect_ratio_checkbox"); VERIFY(width_spinbox); VERIFY(height_spinbox); @@ -67,10 +67,10 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p } }; - auto nearest_neighbor_radio = main_widget.find_descendant_of_type_named("nearest_neighbor_radio"); - auto smooth_pixels_radio = main_widget.find_descendant_of_type_named("smooth_pixels_radio"); - auto bilinear_radio = main_widget.find_descendant_of_type_named("bilinear_radio"); - auto resize_canvas_radio = main_widget.find_descendant_of_type_named("resize_canvas"); + auto nearest_neighbor_radio = main_widget->find_descendant_of_type_named("nearest_neighbor_radio"); + auto smooth_pixels_radio = main_widget->find_descendant_of_type_named("smooth_pixels_radio"); + auto bilinear_radio = main_widget->find_descendant_of_type_named("bilinear_radio"); + auto resize_canvas_radio = main_widget->find_descendant_of_type_named("resize_canvas"); VERIFY(nearest_neighbor_radio); VERIFY(smooth_pixels_radio); @@ -99,8 +99,8 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p m_scaling_mode = Gfx::Painter::ScalingMode::None; }; - auto ok_button = main_widget.find_descendant_of_type_named("ok_button"); - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); + auto ok_button = main_widget->find_descendant_of_type_named("ok_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); VERIFY(ok_button); VERIFY(cancel_button); diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index e25f17de89..9f67d1be40 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -48,7 +48,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(800, 510); window->set_icon(app_icon.bitmap_for_size(16)); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); TRY(main_widget->initialize_menubar(*window)); diff --git a/Userland/Applications/Presenter/main.cpp b/Userland/Applications/Presenter/main.cpp index 327c7392e0..71d2c41cd9 100644 --- a/Userland/Applications/Presenter/main.cpp +++ b/Userland/Applications/Presenter/main.cpp @@ -26,7 +26,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(GUI::Window::try_create()); window->set_title("Presenter"); window->set_icon(GUI::Icon::default_icon("app-display-settings"sv).bitmap_for_size(16)); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); TRY(main_widget->initialize_menubar()); window->show(); diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index 11b6f9231e..b29f736630 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -41,24 +41,24 @@ RunWindow::RunWindow() set_resizable(false); set_minimizable(false); - auto& main_widget = set_main_widget(); - main_widget.load_from_gml(run_gml); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->load_from_gml(run_gml); - m_icon_image_widget = *main_widget.find_descendant_of_type_named("icon"); + m_icon_image_widget = *main_widget->find_descendant_of_type_named("icon"); m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32)); - m_path_combo_box = *main_widget.find_descendant_of_type_named("path"); + m_path_combo_box = *main_widget->find_descendant_of_type_named("path"); m_path_combo_box->set_model(m_path_history_model); if (!m_path_history.is_empty()) m_path_combo_box->set_selected_index(0); - m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); + m_ok_button = *main_widget->find_descendant_of_type_named("ok_button"); m_ok_button->on_click = [this](auto) { do_run(); }; m_ok_button->set_default(true); - m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); + m_cancel_button = *main_widget->find_descendant_of_type_named("cancel_button"); m_cancel_button->on_click = [this](auto) { close(); }; diff --git a/Userland/Applications/Settings/main.cpp b/Userland/Applications/Settings/main.cpp index 073bd2b13e..0332a70ffc 100644 --- a/Userland/Applications/Settings/main.cpp +++ b/Userland/Applications/Settings/main.cpp @@ -102,7 +102,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Settings", app_icon, window))); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->set_fill_with_background_color(true); main_widget->set_layout(); diff --git a/Userland/Applications/SoundPlayer/main.cpp b/Userland/Applications/SoundPlayer/main.cpp index 67e8f04eae..47200616a8 100644 --- a/Userland/Applications/SoundPlayer/main.cpp +++ b/Userland/Applications/SoundPlayer/main.cpp @@ -48,7 +48,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); // start in advanced view by default - Player* player = TRY(window->try_set_main_widget(window, audio_client)); + Player* player = TRY(window->set_main_widget(window, audio_client)); if (!file_path.is_empty()) { player->play_file_path(file_path); diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 8882fe845f..05a83da401 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -141,14 +141,14 @@ static NonnullRefPtr create_progress_window() window->resize(240, 50); window->center_on_screen(); - auto& main_widget = window->set_main_widget(); - main_widget.set_fill_with_background_color(true); - main_widget.set_layout(); + auto main_widget = window->set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_fill_with_background_color(true); + main_widget->set_layout(); - auto& label = main_widget.add("Analyzing storage space..."); + auto& label = main_widget->add("Analyzing storage space..."); label.set_fixed_height(22); - auto& progresslabel = main_widget.add(); + auto& progresslabel = main_widget->add(); progresslabel.set_name("progresslabel"); progresslabel.set_fixed_height(22); @@ -321,11 +321,11 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); // Load widgets. - auto& mainwidget = window->set_main_widget(); - mainwidget.load_from_gml(space_analyzer_gml); - auto& breadcrumbbar = *mainwidget.find_descendant_of_type_named("breadcrumbbar"); - auto& treemapwidget = *mainwidget.find_descendant_of_type_named("tree_map"); - auto& statusbar = *mainwidget.find_descendant_of_type_named("statusbar"); + auto mainwidget = TRY(window->set_main_widget()); + mainwidget->load_from_gml(space_analyzer_gml); + auto& breadcrumbbar = *mainwidget->find_descendant_of_type_named("breadcrumbbar"); + auto& treemapwidget = *mainwidget->find_descendant_of_type_named("tree_map"); + auto& statusbar = *mainwidget->find_descendant_of_type_named("statusbar"); treemapwidget.set_focus(true); diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 508353a40b..e9b6a8b3d4 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -45,14 +45,14 @@ CellTypeDialog::CellTypeDialog(Vector const& positions, Sheet& sheet, set_icon(parent->icon()); resize(285, 360); - auto& main_widget = set_main_widget(); - main_widget.set_layout().set_margins(4); - main_widget.set_fill_with_background_color(true); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_layout().set_margins(4); + main_widget->set_fill_with_background_color(true); - auto& tab_widget = main_widget.add(); + auto& tab_widget = main_widget->add(); setup_tabs(tab_widget, positions, sheet); - auto& buttonbox = main_widget.add(); + auto& buttonbox = main_widget->add(); buttonbox.set_shrink_to_fit(true); auto& button_layout = buttonbox.set_layout(); button_layout.set_spacing(10); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 811ce6034a..de8f7d446b 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -67,11 +67,11 @@ HelpWindow::HelpWindow(GUI::Window* parent) set_title("Spreadsheet Functions Help"); set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors()); - auto& widget = set_main_widget(); - widget.set_layout(); - widget.set_fill_with_background_color(true); + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->set_layout(); + widget->set_fill_with_background_color(true); - auto& splitter = widget.add(); + auto& splitter = widget->add(); auto& left_frame = splitter.add(); left_frame.set_layout(); // FIXME: Get rid of the magic number, dynamically calculate initial size based on left frame contents @@ -112,14 +112,14 @@ HelpWindow::HelpWindow(GUI::Window* parent) window->set_title(DeprecatedString::formatted("Spreadsheet Help - Example {} for {}", name, entry)); window->on_close = [window = window.ptr()] { window->remove_from_parent(); }; - auto& widget = window->set_main_widget(window, NonnullRefPtrVector {}, false); - auto sheet = Sheet::from_json(value.as_object(), widget.workbook()); + auto widget = window->set_main_widget(window, NonnullRefPtrVector {}, false).release_value_but_fixme_should_propagate_errors(); + auto sheet = Sheet::from_json(value.as_object(), widget->workbook()); if (!sheet) { GUI::MessageBox::show_error(this, DeprecatedString::formatted("Corrupted example '{}' in '{}'", name, url.path())); return; } - widget.add_sheet(sheet.release_nonnull()); + widget->add_sheet(sheet.release_nonnull()); window->show(); } else if (url.host() == "doc") { auto entry = LexicalPath::basename(url.path()); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 20e11e2695..5500f28a41 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -81,11 +81,11 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_inline_documentation_window->set_rect(m_cell_value_editor->rect().translated(0, m_cell_value_editor->height() + 7).inflated(6, 6)); m_inline_documentation_window->set_window_type(GUI::WindowType::Tooltip); m_inline_documentation_window->set_resizable(false); - auto& inline_widget = m_inline_documentation_window->set_main_widget(); - inline_widget.set_fill_with_background_color(true); - inline_widget.set_layout().set_margins(4); - inline_widget.set_frame_shape(Gfx::FrameShape::Box); - m_inline_documentation_label = inline_widget.add(); + auto inline_widget = m_inline_documentation_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); + inline_widget->set_fill_with_background_color(true); + inline_widget->set_layout().set_margins(4); + inline_widget->set_frame_shape(Gfx::FrameShape::Box); + m_inline_documentation_label = inline_widget->add(); m_inline_documentation_label->set_fill_with_background_color(true); m_inline_documentation_label->set_autosize(false); m_inline_documentation_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index 1ded04cc03..106ee79fe8 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -58,13 +58,13 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(640, 480); window->set_icon(app_icon.bitmap_for_size(16)); - auto& spreadsheet_widget = window->set_main_widget(*window, NonnullRefPtrVector {}, filename == nullptr); + auto spreadsheet_widget = TRY(window->set_main_widget(*window, NonnullRefPtrVector {}, filename == nullptr)); - spreadsheet_widget.initialize_menubar(*window); - spreadsheet_widget.update_window_title(); + spreadsheet_widget->initialize_menubar(*window); + spreadsheet_widget->update_window_title(); window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision { - if (spreadsheet_widget.request_close()) + if (spreadsheet_widget->request_close()) return GUI::Window::CloseRequestDecision::Close; return GUI::Window::CloseRequestDecision::StayOpen; }; @@ -73,7 +73,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (filename) { auto file = TRY(FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, filename)); - spreadsheet_widget.load_file(file); + spreadsheet_widget->load_file(file); } return app->exec(); diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 9d32074cfe..2c31b2df6e 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -278,7 +278,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("System Monitor"); window->resize(560, 430); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(system_monitor_gml); auto& tabwidget = *main_widget->find_descendant_of_type_named("main_tabs"); statusbar = main_widget->find_descendant_of_type_named("statusbar"); @@ -512,7 +512,7 @@ ErrorOr> build_process_window(pid_t pid) auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv); window->set_icon(app_icon.bitmap_for_size(16)); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(process_window_gml); GUI::ModelIndex process_index; diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 6a1ab7245b..4a8289a810 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -172,7 +172,7 @@ static ErrorOr> create_find_window(VT::TerminalWidget window->set_resizable(false); window->resize(300, 90); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->set_fill_with_background_color(true); main_widget->set_background_role(ColorRole::Button); (void)TRY(main_widget->try_set_layout()); @@ -291,7 +291,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Terminal"); window->set_obey_widget_min_size(false); - auto terminal = TRY(window->try_set_main_widget(ptm_fd, true)); + auto terminal = TRY(window->set_main_widget(ptm_fd, true)); terminal->on_command_exit = [&] { app->quit(0); }; diff --git a/Userland/Applications/TextEditor/main.cpp b/Userland/Applications/TextEditor/main.cpp index 7cf97050e1..00a13ed820 100644 --- a/Userland/Applications/TextEditor/main.cpp +++ b/Userland/Applications/TextEditor/main.cpp @@ -43,7 +43,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(GUI::Window::try_create()); window->resize(640, 400); - auto text_widget = TRY(window->try_set_main_widget()); + auto text_widget = TRY(window->set_main_widget()); text_widget->editor().set_focus(true); diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 200e86cdfc..f3273075ff 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -47,7 +47,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app_icon = GUI::Icon::default_icon("app-theme-editor"sv); auto window = GUI::Window::construct(); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); if (path.has_value()) { // Note: This is deferred to ensure that the window has already popped and thus proper window stealing can be performed. diff --git a/Userland/Applications/VideoPlayer/main.cpp b/Userland/Applications/VideoPlayer/main.cpp index 97130750ae..036d64c757 100644 --- a/Userland/Applications/VideoPlayer/main.cpp +++ b/Userland/Applications/VideoPlayer/main.cpp @@ -24,7 +24,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(640, 480); window->set_resizable(true); - auto main_widget = TRY(window->try_set_main_widget(window)); + auto main_widget = TRY(window->set_main_widget(window)); main_widget->update_title(); main_widget->initialize_menubar(window); diff --git a/Userland/Applications/Welcome/main.cpp b/Userland/Applications/Welcome/main.cpp index 529a0a1d84..688c4a10c5 100644 --- a/Userland/Applications/Welcome/main.cpp +++ b/Userland/Applications/Welcome/main.cpp @@ -33,7 +33,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->center_on_screen(); window->set_title("Welcome"); window->set_icon(app_icon.bitmap_for_size(16)); - auto welcome_widget = TRY(window->try_set_main_widget()); + auto welcome_widget = TRY(window->set_main_widget()); window->show(); diff --git a/Userland/Demos/CatDog/main.cpp b/Userland/Demos/CatDog/main.cpp index 2a8ca4ea80..b57dcbd5a6 100644 --- a/Userland/Demos/CatDog/main.cpp +++ b/Userland/Demos/CatDog/main.cpp @@ -62,7 +62,7 @@ ErrorOr 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->try_set_main_widget(catdog_widget)); + auto advice_widget = TRY(advice_window->set_main_widget(catdog_widget)); (void)TRY(advice_widget->try_set_layout()); advice_widget->layout()->set_spacing(0); diff --git a/Userland/Demos/Eyes/main.cpp b/Userland/Demos/Eyes/main.cpp index 7590c70781..06e78bedf1 100644 --- a/Userland/Demos/Eyes/main.cpp +++ b/Userland/Demos/Eyes/main.cpp @@ -97,7 +97,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Eyes Demo", app_icon, window))); - auto eyes_widget = TRY(window->try_set_main_widget(num_eyes, full_rows, extra_columns)); + auto eyes_widget = TRY(window->set_main_widget(num_eyes, full_rows, extra_columns)); eyes_widget->on_context_menu_request = [&](auto& event) { file_menu->popup(event.screen_position()); }; diff --git a/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp b/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp index 09fe6528ad..bfd8d38f1d 100644 --- a/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp +++ b/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp @@ -97,7 +97,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(Desktop::Screensaver::create_window("Screensaver"sv, "app-screensaver"sv)); - auto screensaver_window = TRY(window->try_set_main_widget(64, 48, 10000)); + auto screensaver_window = TRY(window->set_main_widget(64, 48, 10000)); screensaver_window->set_fill_with_background_color(false); screensaver_window->set_override_cursor(Gfx::StandardCursor::Hidden); screensaver_window->update(); diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp index b6b0cfa3fa..36150d8af2 100644 --- a/Userland/Demos/LibGfxDemo/main.cpp +++ b/Userland/Demos/LibGfxDemo/main.cpp @@ -200,7 +200,7 @@ ErrorOr 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->try_set_main_widget()); + (void)TRY(window->set_main_widget()); window->show(); return app->exec(); diff --git a/Userland/Demos/LibGfxScaleDemo/main.cpp b/Userland/Demos/LibGfxScaleDemo/main.cpp index 5658739e52..0c9b6a5b7d 100644 --- a/Userland/Demos/LibGfxScaleDemo/main.cpp +++ b/Userland/Demos/LibGfxScaleDemo/main.cpp @@ -121,7 +121,7 @@ ErrorOr 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->try_set_main_widget()); + (void)TRY(window->set_main_widget()); window->show(); return app->exec(); diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 41a7a2cef7..c7538d2925 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -413,7 +413,7 @@ ErrorOr 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->try_set_main_widget()); + auto mandelbrot = TRY(window->set_main_widget()); auto file_menu = TRY(window->try_add_menu("&File")); diff --git a/Userland/Demos/ModelGallery/main.cpp b/Userland/Demos/ModelGallery/main.cpp index 42f3e98dc8..8c78ab6c2b 100644 --- a/Userland/Demos/ModelGallery/main.cpp +++ b/Userland/Demos/ModelGallery/main.cpp @@ -28,7 +28,7 @@ ErrorOr 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->try_set_main_widget()); + (void)TRY(window->set_main_widget()); window->show(); return app->exec(); diff --git a/Userland/Demos/Screensaver/main.cpp b/Userland/Demos/Screensaver/main.cpp index 53eca2a247..5a549976de 100644 --- a/Userland/Demos/Screensaver/main.cpp +++ b/Userland/Demos/Screensaver/main.cpp @@ -86,7 +86,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Screensaver", app_icon, window))); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->set_fill_with_background_color(true); main_widget->set_layout(); diff --git a/Userland/Demos/Starfield/Starfield.cpp b/Userland/Demos/Starfield/Starfield.cpp index ab96f3d82e..90eda0ba7e 100644 --- a/Userland/Demos/Starfield/Starfield.cpp +++ b/Userland/Demos/Starfield/Starfield.cpp @@ -167,7 +167,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(Desktop::Screensaver::create_window("Starfield"sv, "app-starfield"sv)); - auto starfield_window = TRY(window->try_set_main_widget(refresh_rate)); + auto starfield_window = TRY(window->set_main_widget(refresh_rate)); starfield_window->set_fill_with_background_color(false); starfield_window->set_override_cursor(Gfx::StandardCursor::Hidden); starfield_window->update(); diff --git a/Userland/Demos/Tubes/main.cpp b/Userland/Demos/Tubes/main.cpp index 66d1fc7393..b77862305f 100644 --- a/Userland/Demos/Tubes/main.cpp +++ b/Userland/Demos/Tubes/main.cpp @@ -30,7 +30,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(Desktop::Screensaver::create_window("Tubes"sv, "app-tubes"sv)); window->update(); - auto tubes_widget = TRY(window->try_set_main_widget(refresh_rate)); + auto tubes_widget = TRY(window->set_main_widget(refresh_rate)); tubes_widget->set_fill_with_background_color(false); tubes_widget->set_override_cursor(Gfx::StandardCursor::Hidden); window->show(); diff --git a/Userland/Demos/WidgetGallery/main.cpp b/Userland/Demos/WidgetGallery/main.cpp index ff6ef1d325..59e7d5ddcb 100644 --- a/Userland/Demos/WidgetGallery/main.cpp +++ b/Userland/Demos/WidgetGallery/main.cpp @@ -28,7 +28,7 @@ ErrorOr 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->try_set_main_widget()); + (void)TRY(window->set_main_widget()); window->show(); return app->exec(); diff --git a/Userland/DevTools/GMLPlayground/main.cpp b/Userland/DevTools/GMLPlayground/main.cpp index 34927eb0a8..c7d0f18263 100644 --- a/Userland/DevTools/GMLPlayground/main.cpp +++ b/Userland/DevTools/GMLPlayground/main.cpp @@ -84,14 +84,14 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(800, 600); - auto splitter = TRY(window->try_set_main_widget()); + auto splitter = TRY(window->set_main_widget()); auto editor = TRY(splitter->try_add()); auto preview_frame_widget = TRY(splitter->try_add()); auto preview_window = TRY(GUI::Window::try_create()); preview_window->set_title("Preview - GML Playground"); preview_window->set_icon(app_icon.bitmap_for_size(16)); - auto preview_window_widget = TRY(preview_window->try_set_main_widget()); + auto preview_window_widget = TRY(preview_window->set_main_widget()); preview_window_widget->set_fill_with_background_color(true); GUI::Widget* preview = preview_frame_widget; diff --git a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp index 5e41b3a7c1..f997b53cd2 100644 --- a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp @@ -17,13 +17,13 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent) set_title("Commit"); set_icon(parent->icon()); - auto& widget = set_main_widget(); - widget.load_from_gml(git_commit_dialog_gml); + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->load_from_gml(git_commit_dialog_gml); - m_message_editor = widget.find_descendant_of_type_named("message_editor"); - m_cancel_button = widget.find_descendant_of_type_named("cancel_button"); - m_commit_button = widget.find_descendant_of_type_named("commit_button"); - m_line_and_col_label = widget.find_descendant_of_type_named("line_and_col_label"); + m_message_editor = widget->find_descendant_of_type_named("message_editor"); + m_cancel_button = widget->find_descendant_of_type_named("cancel_button"); + m_commit_button = widget->find_descendant_of_type_named("commit_button"); + m_line_and_col_label = widget->find_descendant_of_type_named("line_and_col_label"); m_message_editor->on_change = [this]() { m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit); diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index c6daa392df..f80e80d71b 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -49,10 +49,10 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent) set_resizable(false); set_title("New project"); - auto& main_widget = set_main_widget(); - main_widget.load_from_gml(new_project_dialog_gml); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->load_from_gml(new_project_dialog_gml); - m_icon_view_container = *main_widget.find_descendant_of_type_named("icon_view_container"); + m_icon_view_container = *main_widget->find_descendant_of_type_named("icon_view_container"); m_icon_view = m_icon_view_container->add(); m_icon_view->set_always_wrap_item_labels(true); m_icon_view->set_model(m_model); @@ -65,24 +65,24 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent) do_create_project(); }; - m_description_label = *main_widget.find_descendant_of_type_named("description_label"); - m_name_input = *main_widget.find_descendant_of_type_named("name_input"); + m_description_label = *main_widget->find_descendant_of_type_named("description_label"); + m_name_input = *main_widget->find_descendant_of_type_named("name_input"); m_name_input->on_change = [&]() { update_dialog(); }; - m_create_in_input = *main_widget.find_descendant_of_type_named("create_in_input"); + m_create_in_input = *main_widget->find_descendant_of_type_named("create_in_input"); m_create_in_input->on_change = [&]() { update_dialog(); }; - m_full_path_label = *main_widget.find_descendant_of_type_named("full_path_label"); + m_full_path_label = *main_widget->find_descendant_of_type_named("full_path_label"); - m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); + m_ok_button = *main_widget->find_descendant_of_type_named("ok_button"); m_ok_button->set_default(true); m_ok_button->on_click = [this](auto) { do_create_project(); }; - m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); + m_cancel_button = *main_widget->find_descendant_of_type_named("cancel_button"); m_cancel_button->on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 1a8b8eb41b..6d214a6191 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -94,7 +94,7 @@ ErrorOr 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->try_set_main_widget()); + s_tooltip_page_view = TRY(s_tooltip_window->set_main_widget()); } return {}; } diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index b43e31eedd..124d12abb0 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -149,7 +149,7 @@ Locator::Locator(Core::Object* 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(); + m_suggestion_view = m_popup_window->set_main_widget().release_value_but_fixme_should_propagate_errors(); m_suggestion_view->set_column_headers_visible(false); m_suggestion_view->on_activation = [this](auto& index) { diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index 69979d4bd4..086835ea8c 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -99,7 +99,7 @@ ErrorOr serenity_main(Main::Arguments arguments) })); help_menu.add_action(GUI::CommonActions::make_about_action("Inspector", app_icon, window)); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->set_fill_with_background_color(true); widget->set_layout(); diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index fe3bad2b65..2026ce46ef 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -86,7 +86,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(800, 600); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->set_fill_with_background_color(true); main_widget->set_layout(); @@ -318,19 +318,19 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_ window->set_icon(Gfx::Bitmap::try_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(); - widget.set_fill_with_background_color(true); - auto& layout = widget.set_layout(); + auto widget = window->set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->set_fill_with_background_color(true); + auto& layout = widget->set_layout(); layout.set_margins({ 0, 0, 16 }); - auto& timer_label = widget.add("..."); + auto& timer_label = widget->add("..."); Core::ElapsedTimer clock; clock.start(); auto update_timer = Core::Timer::construct(100, [&] { timer_label.set_text(DeprecatedString::formatted("{:.1} seconds", clock.elapsed() / 1000.0f)); }); - auto& stop_button = widget.add("Stop"); + auto& stop_button = widget->add("Stop"); stop_button.set_fixed_size(140, 22); stop_button.on_click = [&](auto) { GUI::Application::the()->quit(); diff --git a/Userland/DevTools/SQLStudio/main.cpp b/Userland/DevTools/SQLStudio/main.cpp index ea93c93c0e..0e6509062e 100644 --- a/Userland/DevTools/SQLStudio/main.cpp +++ b/Userland/DevTools/SQLStudio/main.cpp @@ -30,7 +30,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->set_title("SQL Studio"); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->initialize_menu(window); window->on_close_request = [&] { diff --git a/Userland/Games/2048/GameSizeDialog.cpp b/Userland/Games/2048/GameSizeDialog.cpp index 20c21b4cef..a2ef18d80b 100644 --- a/Userland/Games/2048/GameSizeDialog.cpp +++ b/Userland/Games/2048/GameSizeDialog.cpp @@ -25,16 +25,16 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta set_icon(parent->icon()); set_resizable(false); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(game_size_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(game_size_dialog_gml)) VERIFY_NOT_REACHED(); - auto board_size_spinbox = main_widget.find_descendant_of_type_named("board_size_spinbox"); + auto board_size_spinbox = main_widget->find_descendant_of_type_named("board_size_spinbox"); board_size_spinbox->set_value(m_board_size); - auto tile_value_label = main_widget.find_descendant_of_type_named("tile_value_label"); + auto tile_value_label = main_widget->find_descendant_of_type_named("tile_value_label"); tile_value_label->set_text(DeprecatedString::number(target_tile())); - auto target_spinbox = main_widget.find_descendant_of_type_named("target_spinbox"); + auto target_spinbox = main_widget->find_descendant_of_type_named("target_spinbox"); target_spinbox->set_max(Game::max_power_for_board(m_board_size)); target_spinbox->set_value(m_target_tile_power); @@ -48,20 +48,20 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta tile_value_label->set_text(DeprecatedString::number(target_tile())); }; - auto evil_ai_checkbox = main_widget.find_descendant_of_type_named("evil_ai_checkbox"); + auto evil_ai_checkbox = main_widget->find_descendant_of_type_named("evil_ai_checkbox"); evil_ai_checkbox->set_checked(m_evil_ai); evil_ai_checkbox->on_checked = [this](auto checked) { m_evil_ai = checked; }; - auto temporary_checkbox = main_widget.find_descendant_of_type_named("temporary_checkbox"); + auto temporary_checkbox = main_widget->find_descendant_of_type_named("temporary_checkbox"); temporary_checkbox->set_checked(m_temporary); temporary_checkbox->on_checked = [this](auto checked) { m_temporary = checked; }; - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); cancel_button->on_click = [this](auto) { done(ExecResult::Cancel); }; - auto ok_button = main_widget.find_descendant_of_type_named("ok_button"); + auto ok_button = main_widget->find_descendant_of_type_named("ok_button"); ok_button->on_click = [this](auto) { done(ExecResult::OK); }; diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index d92cb70f83..935190bb8c 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -66,15 +66,15 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("2048"); window->resize(315, 336); - auto& main_widget = window->set_main_widget(); - if (!main_widget.load_from_gml(game_window_gml)) + auto main_widget = TRY(window->set_main_widget()); + if (!main_widget->load_from_gml(game_window_gml)) VERIFY_NOT_REACHED(); Game game { board_size, target_tile, evil_ai }; - auto board_view = TRY(main_widget.find_descendant_of_type_named("board_view_container")->try_add(&game.board())); + auto board_view = TRY(main_widget->find_descendant_of_type_named("board_view_container")->try_add(&game.board())); board_view->set_focus(true); - auto statusbar = main_widget.find_descendant_of_type_named("statusbar"); + auto statusbar = main_widget->find_descendant_of_type_named("statusbar"); app->on_action_enter = [&](GUI::Action& action) { auto text = action.status_tip(); diff --git a/Userland/Games/BrickGame/main.cpp b/Userland/Games/BrickGame/main.cpp index 28576493f6..4ca23c4c1e 100644 --- a/Userland/Games/BrickGame/main.cpp +++ b/Userland/Games/BrickGame/main.cpp @@ -49,7 +49,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(360, 462); window->set_resizable(false); - auto game = TRY(window->try_set_main_widget(app_name)); + auto game = TRY(window->set_main_widget(app_name)); auto game_menu = TRY(window->try_add_menu("&Game")); diff --git a/Userland/Games/Chess/PromotionDialog.cpp b/Userland/Games/Chess/PromotionDialog.cpp index f20ab09148..06e742ae24 100644 --- a/Userland/Games/Chess/PromotionDialog.cpp +++ b/Userland/Games/Chess/PromotionDialog.cpp @@ -17,13 +17,13 @@ PromotionDialog::PromotionDialog(ChessWidget& chess_widget) set_icon(chess_widget.window()->icon()); resize(70 * 4, 70); - auto& main_widget = set_main_widget(); - main_widget.set_frame_shape(Gfx::FrameShape::Container); - main_widget.set_fill_with_background_color(true); - main_widget.set_layout(); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_frame_shape(Gfx::FrameShape::Container); + main_widget->set_fill_with_background_color(true); + main_widget->set_layout(); for (auto const& type : { Chess::Type::Queen, Chess::Type::Knight, Chess::Type::Rook, Chess::Type::Bishop }) { - auto& button = main_widget.add(""); + auto& button = main_widget->add(""); button.set_fixed_height(70); button.set_icon(chess_widget.get_piece_graphic({ chess_widget.board().turn(), type })); button.on_click = [this, type](auto) { diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index 5dfa1145fd..8e40931ec3 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-chess"sv)); auto window = TRY(GUI::Window::try_create()); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); TRY(Core::System::unveil("/sys/kernel/processes", "r")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Games/ColorLines/main.cpp b/Userland/Games/ColorLines/main.cpp index 163a39ea21..d73a033065 100644 --- a/Userland/Games/ColorLines/main.cpp +++ b/Userland/Games/ColorLines/main.cpp @@ -48,7 +48,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->resize(436, 481); window->set_resizable(false); - auto game = TRY(window->try_set_main_widget(app_name)); + auto game = TRY(window->set_main_widget(app_name)); auto game_menu = TRY(window->try_add_menu("&Game")); diff --git a/Userland/Games/FlappyBug/main.cpp b/Userland/Games/FlappyBug/main.cpp index 9a1a0c0c84..9f7e720543 100644 --- a/Userland/Games/FlappyBug/main.cpp +++ b/Userland/Games/FlappyBug/main.cpp @@ -43,7 +43,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Flappy Bug"); window->set_double_buffering_enabled(false); window->set_resizable(false); - auto widget = TRY(window->try_set_main_widget(TRY(FlappyBug::Game::Bug::construct()), TRY(FlappyBug::Game::Cloud::construct()))); + auto widget = TRY(window->set_main_widget(TRY(FlappyBug::Game::Bug::construct()), TRY(FlappyBug::Game::Cloud::construct()))); widget->on_game_end = [&](u32 score) { if (score <= high_score) diff --git a/Userland/Games/Flood/SettingsDialog.cpp b/Userland/Games/Flood/SettingsDialog.cpp index 2dcad063c8..873cab5ede 100644 --- a/Userland/Games/Flood/SettingsDialog.cpp +++ b/Userland/Games/Flood/SettingsDialog.cpp @@ -27,30 +27,30 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, size_t board_rows, size_t bo set_icon(parent->icon()); set_resizable(false); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(settings_dialog_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(settings_dialog_gml)) VERIFY_NOT_REACHED(); - auto board_rows_spinbox = main_widget.find_descendant_of_type_named("board_rows_spinbox"); + auto board_rows_spinbox = main_widget->find_descendant_of_type_named("board_rows_spinbox"); board_rows_spinbox->set_value(m_board_rows); board_rows_spinbox->on_change = [&](auto value) { m_board_rows = value; }; - auto board_columns_spinbox = main_widget.find_descendant_of_type_named("board_columns_spinbox"); + auto board_columns_spinbox = main_widget->find_descendant_of_type_named("board_columns_spinbox"); board_columns_spinbox->set_value(m_board_columns); board_columns_spinbox->on_change = [&](auto value) { m_board_columns = value; }; - auto cancel_button = main_widget.find_descendant_of_type_named("cancel_button"); + auto cancel_button = main_widget->find_descendant_of_type_named("cancel_button"); cancel_button->on_click = [this](auto) { done(ExecResult::Cancel); }; - auto ok_button = main_widget.find_descendant_of_type_named("ok_button"); + auto ok_button = main_widget->find_descendant_of_type_named("ok_button"); ok_button->on_click = [this](auto) { done(ExecResult::OK); }; diff --git a/Userland/Games/Flood/main.cpp b/Userland/Games/Flood/main.cpp index f6a208201b..de902a1414 100644 --- a/Userland/Games/Flood/main.cpp +++ b/Userland/Games/Flood/main.cpp @@ -82,16 +82,16 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Flood"); window->resize(304, 325); - auto& main_widget = window->set_main_widget(); - if (!main_widget.load_from_gml(flood_window_gml)) + auto main_widget = TRY(window->set_main_widget()); + if (!main_widget->load_from_gml(flood_window_gml)) VERIFY_NOT_REACHED(); - auto board_widget = TRY(main_widget.find_descendant_of_type_named("board_widget_container")->try_add(board_rows, board_columns)); + auto board_widget = TRY(main_widget->find_descendant_of_type_named("board_widget_container")->try_add(board_rows, board_columns)); board_widget->board()->randomize(); int ai_moves = get_number_of_moves_from_ai(*board_widget->board()); int moves_made = 0; - auto statusbar = main_widget.find_descendant_of_type_named("statusbar"); + auto statusbar = main_widget->find_descendant_of_type_named("statusbar"); app->on_action_enter = [&](GUI::Action& action) { auto text = action.status_tip(); diff --git a/Userland/Games/GameOfLife/main.cpp b/Userland/Games/GameOfLife/main.cpp index 5b2428e5c2..2ab0f5c143 100644 --- a/Userland/Games/GameOfLife/main.cpp +++ b/Userland/Games/GameOfLife/main.cpp @@ -52,7 +52,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_double_buffering_enabled(false); window->set_title("Game Of Life"); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(game_of_life_gml); main_widget->set_fill_with_background_color(true); diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index c62dc48858..4afcdb770f 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -122,16 +122,16 @@ void Game::show_score_card(bool game_over) score_dialog->set_resizable(false); score_dialog->set_icon(window()->icon()); - auto& score_widget = score_dialog->set_main_widget(); - score_widget.set_fill_with_background_color(true); - auto& layout = score_widget.set_layout(); + auto score_widget = score_dialog->set_main_widget().release_value_but_fixme_should_propagate_errors(); + score_widget->set_fill_with_background_color(true); + auto& layout = score_widget->set_layout(); layout.set_margins(10); layout.set_spacing(15); - auto& card_container = score_widget.add(); + auto& card_container = score_widget->add(); auto& score_card = card_container.add(m_players, game_over); - auto& button_container = score_widget.add(); + auto& button_container = score_widget->add(); button_container.set_shrink_to_fit(true); button_container.set_layout(); diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp index f218d9b337..f96482f0cd 100644 --- a/Userland/Games/Hearts/SettingsDialog.cpp +++ b/Userland/Games/Hearts/SettingsDialog.cpp @@ -19,13 +19,13 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name set_icon(parent->icon()); set_resizable(false); - auto& main_widget = set_main_widget(); - main_widget.set_fill_with_background_color(true); + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + main_widget->set_fill_with_background_color(true); - auto& layout = main_widget.set_layout(); + auto& layout = main_widget->set_layout(); layout.set_margins(4); - auto& name_box = main_widget.add(); + auto& name_box = main_widget->add(); auto& input_layout = name_box.set_layout(); input_layout.set_spacing(4); @@ -38,7 +38,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name m_player_name = textbox.text(); }; - auto& button_box = main_widget.add(); + auto& button_box = main_widget->add(); auto& button_layout = button_box.set_layout(); button_layout.set_spacing(10); diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp index d954994caa..30617193fe 100644 --- a/Userland/Games/Hearts/main.cpp +++ b/Userland/Games/Hearts/main.cpp @@ -50,7 +50,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto window = TRY(GUI::Window::try_create()); window->set_title("Hearts"); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->load_from_gml(hearts_gml); auto& game = *widget->find_descendant_of_type_named("game"); diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index e377fd437f..4801e06ec6 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -46,7 +46,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("MasterWord"); window->set_resizable(false); - auto main_widget = TRY(window->try_set_main_widget()); + auto main_widget = TRY(window->set_main_widget()); main_widget->load_from_gml(master_word_gml); auto& game = *main_widget->find_descendant_of_type_named("word_game"); auto& statusbar = *main_widget->find_descendant_of_type_named("statusbar"); diff --git a/Userland/Games/Minesweeper/CustomGameDialog.cpp b/Userland/Games/Minesweeper/CustomGameDialog.cpp index 6020499248..081b7eb3ce 100644 --- a/Userland/Games/Minesweeper/CustomGameDialog.cpp +++ b/Userland/Games/Minesweeper/CustomGameDialog.cpp @@ -45,15 +45,15 @@ CustomGameDialog::CustomGameDialog(Window* parent_window) set_resizable(false); set_title("Custom game"); - auto& main_widget = set_main_widget(); - if (!main_widget.load_from_gml(minesweeper_custom_game_window_gml)) + auto main_widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + if (!main_widget->load_from_gml(minesweeper_custom_game_window_gml)) VERIFY_NOT_REACHED(); - m_columns_spinbox = *main_widget.find_descendant_of_type_named("columns_spinbox"); - m_rows_spinbox = *main_widget.find_descendant_of_type_named("rows_spinbox"); - m_mines_spinbox = *main_widget.find_descendant_of_type_named("mines_spinbox"); - m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); - m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); + m_columns_spinbox = *main_widget->find_descendant_of_type_named("columns_spinbox"); + m_rows_spinbox = *main_widget->find_descendant_of_type_named("rows_spinbox"); + m_mines_spinbox = *main_widget->find_descendant_of_type_named("mines_spinbox"); + m_ok_button = *main_widget->find_descendant_of_type_named("ok_button"); + m_cancel_button = *main_widget->find_descendant_of_type_named("cancel_button"); m_columns_spinbox->on_change = [this](auto) { set_max_mines(); diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 2215d90882..49e1062f77 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -49,7 +49,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Minesweeper"); window->resize(139, 177); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); widget->load_from_gml(minesweeper_window_gml); auto& separator = *widget->find_descendant_of_type_named("separator"); diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp index ecbdaa08c1..6efd749f8c 100644 --- a/Userland/Games/Snake/main.cpp +++ b/Userland/Games/Snake/main.cpp @@ -48,7 +48,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_title("Snake"); window->resize(324, 345); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); TRY(widget->try_load_from_gml(snake_gml)); auto& game = *widget->find_descendant_of_type_named("game"); diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index f2f5e8b0dd..a2800e7809 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -83,7 +83,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (mode >= Solitaire::Mode::__Count) update_mode(Solitaire::Mode::SingleCardDraw); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); TRY(widget->try_load_from_gml(solitaire_gml)); auto& game = *widget->find_descendant_of_type_named("game"); diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp index 6bd101e05c..afbfcc20c2 100644 --- a/Userland/Games/Spider/main.cpp +++ b/Userland/Games/Spider/main.cpp @@ -117,7 +117,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (statistic_display >= StatisticDisplay::__Count) update_statistic_display(StatisticDisplay::HighScore); - auto widget = TRY(window->try_set_main_widget()); + auto widget = TRY(window->set_main_widget()); TRY(widget->try_load_from_gml(spider_gml)); auto& game = *widget->find_descendant_of_type_named("game"); diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index d75d3e0cec..692736e7ae 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -30,15 +30,15 @@ AboutDialog::AboutDialog(StringView name, StringView version, Gfx::Bitmap const* if (parent_window) set_icon(parent_window->icon()); - auto& widget = set_main_widget(); - widget.set_fill_with_background_color(true); - widget.set_layout(); - widget.layout()->set_spacing(0); + auto widget = set_main_widget().release_value_but_fixme_should_propagate_errors(); + widget->set_fill_with_background_color(true); + widget->set_layout(); + widget->layout()->set_spacing(0); - auto& banner_image = widget.add(); + auto& banner_image = widget->add(); banner_image.load_from_file("/res/graphics/brand-banner.png"sv); - auto& content_container = widget.add(); + auto& content_container = widget->add(); content_container.set_layout(); auto& left_container = content_container.add(); diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 1d78929107..9b38932d66 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -44,7 +44,7 @@ private: { set_window_type(WindowType::Tooltip); set_obey_widget_min_size(false); - m_label = set_main_widget