summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-01-06 16:48:37 +0000
committerAndrew Kaster <andrewdkaster@gmail.com>2023-01-06 13:36:02 -0700
commit0c24522635ec7f07e1fb69d9e1cd350d81e2248f (patch)
tree391782374bada7ee7a986674229551c2ec21f75a /Userland/Applications
parentd223477bc650e271008ccc339fc1e2c0fcc079e7 (diff)
downloadserenity-0c24522635ec7f07e1fb69d9e1cd350d81e2248f.zip
LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp2
-rw-r--r--Userland/Applications/AnalogClock/main.cpp2
-rw-r--r--Userland/Applications/Assistant/main.cpp12
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp12
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp8
-rw-r--r--Userland/Applications/Browser/Tab.cpp20
-rw-r--r--Userland/Applications/Calculator/RoundingDialog.cpp10
-rw-r--r--Userland/Applications/Calculator/main.cpp2
-rw-r--r--Userland/Applications/Calendar/AddEventDialog.cpp16
-rw-r--r--Userland/Applications/Calendar/main.cpp2
-rw-r--r--Userland/Applications/CharacterMap/CharacterMapWidget.cpp4
-rw-r--r--Userland/Applications/CharacterMap/main.cpp2
-rw-r--r--Userland/Applications/CrashReporter/main.cpp2
-rw-r--r--Userland/Applications/Escalator/EscalatorWindow.cpp14
-rw-r--r--Userland/Applications/FileManager/FileUtils.cpp2
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.cpp14
-rw-r--r--Userland/Applications/FileManager/main.cpp4
-rw-r--r--Userland/Applications/FontEditor/MainWidget.cpp2
-rw-r--r--Userland/Applications/FontEditor/main.cpp2
-rw-r--r--Userland/Applications/Help/main.cpp2
-rw-r--r--Userland/Applications/HexEditor/FindDialog.cpp14
-rw-r--r--Userland/Applications/HexEditor/GoToOffsetDialog.cpp14
-rw-r--r--Userland/Applications/HexEditor/main.cpp2
-rw-r--r--Userland/Applications/ImageViewer/main.cpp2
-rw-r--r--Userland/Applications/KeyboardMapper/main.cpp2
-rw-r--r--Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp10
-rw-r--r--Userland/Applications/Magnifier/main.cpp2
-rw-r--r--Userland/Applications/Mail/main.cpp2
-rw-r--r--Userland/Applications/PDFViewer/main.cpp2
-rw-r--r--Userland/Applications/PartitionEditor/main.cpp2
-rw-r--r--Userland/Applications/Piano/main.cpp2
-rw-r--r--Userland/Applications/PixelPaint/CreateNewImageDialog.cpp28
-rw-r--r--Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp20
-rw-r--r--Userland/Applications/PixelPaint/EditGuideDialog.cpp14
-rw-r--r--Userland/Applications/PixelPaint/FilterGallery.cpp14
-rw-r--r--Userland/Applications/PixelPaint/FilterParams.h18
-rw-r--r--Userland/Applications/PixelPaint/LevelsDialog.cpp16
-rw-r--r--Userland/Applications/PixelPaint/ResizeImageDialog.cpp22
-rw-r--r--Userland/Applications/PixelPaint/main.cpp2
-rw-r--r--Userland/Applications/Presenter/main.cpp2
-rw-r--r--Userland/Applications/Run/RunWindow.cpp12
-rw-r--r--Userland/Applications/Settings/main.cpp2
-rw-r--r--Userland/Applications/SoundPlayer/main.cpp2
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp20
-rw-r--r--Userland/Applications/Spreadsheet/CellTypeDialog.cpp10
-rw-r--r--Userland/Applications/Spreadsheet/HelpWindow.cpp14
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp10
-rw-r--r--Userland/Applications/Spreadsheet/main.cpp10
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp4
-rw-r--r--Userland/Applications/Terminal/main.cpp4
-rw-r--r--Userland/Applications/TextEditor/main.cpp2
-rw-r--r--Userland/Applications/ThemeEditor/main.cpp2
-rw-r--r--Userland/Applications/VideoPlayer/main.cpp2
-rw-r--r--Userland/Applications/Welcome/main.cpp2
54 files changed, 210 insertions, 210 deletions
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<int> 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<GLContextWidget>());
+ auto widget = TRY(window->set_main_widget<GLContextWidget>());
auto& time = widget->add<GUI::Label>();
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<int> 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<AnalogClock>());
+ auto clock = TRY(window->set_main_widget<AnalogClock>());
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<int> serenity_main(Main::Arguments arguments)
Assistant::AppState app_state;
Assistant::Database db { app_state };
- auto& container = window->set_main_widget<GUI::Frame>();
- container.set_fill_with_background_color(true);
- container.set_frame_shape(Gfx::FrameShape::Window);
- auto& layout = container.set_layout<GUI::VerticalBoxLayout>();
+ auto container = TRY(window->set_main_widget<GUI::Frame>());
+ container->set_fill_with_background_color(true);
+ container->set_frame_shape(Gfx::FrameShape::Window);
+ auto& layout = container->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 8 });
- auto& text_box = container.add<GUI::TextBox>();
- auto& results_container = container.add<GUI::Widget>();
+ auto& text_box = container->add<GUI::TextBox>();
+ auto& results_container = container->add<GUI::Widget>();
auto& results_layout = results_container.set_layout<GUI::VerticalBoxLayout>();
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<GUI::Widget>();
- if (!widget.load_from_gml(edit_bookmark_gml))
+ auto widget = set_main_widget<GUI::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<GUI::TextBox>("title_textbox");
+ m_title_textbox = *widget->find_descendant_of_type_named<GUI::TextBox>("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<GUI::TextBox>("url_textbox");
+ m_url_textbox = *widget->find_descendant_of_type_named<GUI::TextBox>("url_textbox");
m_url_textbox->set_text(url);
- auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button");
+ auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("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<GUI::Button>("cancel_button");
+ auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("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<GUI::Widget>();
- widget.load_from_gml(browser_window_gml);
+ auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ widget->load_from_gml(browser_window_gml);
- auto& top_line = *widget.find_descendant_of_type_named<GUI::HorizontalSeparator>("top_line");
+ auto& top_line = *widget->find_descendant_of_type_named<GUI::HorizontalSeparator>("top_line");
- m_tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
+ m_tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("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<DownloadWidget>(url);
+ (void)window->set_main_widget<DownloadWidget>(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<GUI::TextEditor>();
- editor.set_text(source);
- editor.set_mode(GUI::TextEditor::ReadOnly);
- editor.set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
- editor.set_ruler_visible(true);
+ auto editor = window->set_main_widget<GUI::TextEditor>().release_value_but_fixme_should_propagate_errors();
+ editor->set_text(source);
+ editor->set_mode(GUI::TextEditor::ReadOnly);
+ editor->set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
+ 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<InspectorWidget>();
+ m_dom_inspector_widget = window->set_main_widget<InspectorWidget>().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<ConsoleWidget>();
+ m_console_widget = console_window->set_main_widget<ConsoleWidget>().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<StorageWidget>();
+ m_storage_widget = storage_window->set_main_widget<StorageWidget>().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<HistoryWidget>();
+ m_history_widget = history_window->set_main_widget<HistoryWidget>().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<GUI::Widget>();
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
- main_widget.set_fill_with_background_color(true);
- main_widget.set_layout<GUI::VerticalBoxLayout>();
+ main_widget->set_fill_with_background_color(true);
+ main_widget->set_layout<GUI::VerticalBoxLayout>();
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<GUI::HorizontalBoxLayout>();
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<int> serenity_main(Main::Arguments arguments)
window->set_resizable(false);
window->resize(250, 215);
- auto widget = TRY(window->try_set_main_widget<CalculatorWidget>());
+ auto widget = TRY(window->set_main_widget<CalculatorWidget>());
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<GUI::Widget>();
- widget.set_fill_with_background_color(true);
- widget.set_layout<GUI::VerticalBoxLayout>();
+ auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ widget->set_fill_with_background_color(true);
+ widget->set_layout<GUI::VerticalBoxLayout>();
- auto& top_container = widget.add<GUI::Widget>();
+ auto& top_container = widget->add<GUI::Widget>();
top_container.set_layout<GUI::VerticalBoxLayout>();
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<GUI::TextBox>();
event_title_textbox.set_fixed_height(20);
- auto& middle_container = widget.add<GUI::Widget>();
+ auto& middle_container = widget->add<GUI::Widget>();
middle_container.set_layout<GUI::HorizontalBoxLayout>();
middle_container.set_fixed_height(25);
middle_container.layout()->set_margins(4);
- auto& time_container = widget.add<GUI::Widget>();
+ auto& time_container = widget->add<GUI::Widget>();
time_container.set_layout<GUI::HorizontalBoxLayout>();
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<GUI::Widget>();
+ auto& button_container = widget->add<GUI::Widget>();
button_container.set_fixed_height(20);
button_container.set_layout<GUI::HorizontalBoxLayout>();
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<int> 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<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(calendar_window_gml);
auto toolbar = main_widget->find_descendant_of_type_named<GUI::Toolbar>("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<CharacterSearchWidget>();
- search_widget.on_character_selected = [&](auto code_point) {
+ auto search_widget = m_find_window->set_main_widget<CharacterSearchWidget>().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<int> 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<CharacterMapWidget>());
+ auto character_map_widget = TRY(window->set_main_widget<CharacterMapWidget>());
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<int> serenity_main(Main::Arguments arguments)
unlink_coredump(coredump_path);
};
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(crash_reporter_window_gml);
auto& icon_image_widget = *widget->find_descendant_of_type_named<GUI::ImageWidget>("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<StringView> argum
set_resizable(false);
set_minimizable(false);
- auto& main_widget = set_main_widget<GUI::Widget>();
- main_widget.load_from_gml(escalator_gml);
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->load_from_gml(escalator_gml);
- RefPtr<GUI::Label> app_label = *main_widget.find_descendant_of_type_named<GUI::Label>("description");
+ RefPtr<GUI::Label> app_label = *main_widget->find_descendant_of_type_named<GUI::Label>("description");
DeprecatedString prompt;
if (options.description.is_empty())
@@ -44,10 +44,10 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
app_label->set_text(prompt);
- m_icon_image_widget = *main_widget.find_descendant_of_type_named<GUI::ImageWidget>("icon");
+ m_icon_image_widget = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));
- m_ok_button = *main_widget.find_descendant_of_type_named<GUI::DialogButton>("ok_button");
+ m_ok_button = *main_widget->find_descendant_of_type_named<GUI::DialogButton>("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<StringView> argum
};
m_ok_button->set_default(true);
- m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::DialogButton>("cancel_button");
+ m_cancel_button = *main_widget->find_descendant_of_type_named<GUI::DialogButton>("cancel_button");
m_cancel_button->on_click = [this](auto) {
close();
};
- m_password_input = *main_widget.find_descendant_of_type_named<GUI::PasswordBox>("password");
+ m_password_input = *main_widget->find_descendant_of_type_named<GUI::PasswordBox>("password");
}
ErrorOr<void> 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<void> run_file_operation(FileOperation operation, Vector<DeprecatedStrin
auto pipe_input_file = TRY(Core::Stream::File::adopt_fd(pipe_fds[0], Core::Stream::OpenMode::Read));
auto buffered_pipe = TRY(Core::Stream::BufferedFile::create(move(pipe_input_file)));
- (void)TRY(window->try_set_main_widget<FileOperationProgressWidget>(operation, move(buffered_pipe), pipe_fds[0]));
+ (void)TRY(window->set_main_widget<FileOperationProgressWidget>(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<GUI::Widget>();
- main_widget.set_layout<GUI::VerticalBoxLayout>();
- 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<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_layout<GUI::VerticalBoxLayout>();
+ 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<GUI::TabWidget>();
+ auto& tab_widget = main_widget->add<GUI::TabWidget>();
auto& general_tab = tab_widget.add_tab<GUI::Widget>("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<GUI::CheckBox>("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<GUI::Widget>();
+ auto& button_widget = main_widget->add<GUI::Widget>();
button_widget.set_layout<GUI::HorizontalBoxLayout>();
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<int> 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<FileManager::DesktopWidget>());
+ auto desktop_widget = TRY(window->set_main_widget<FileManager::DesktopWidget>());
(void)TRY(desktop_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto directory_view = TRY(desktop_widget->try_add<DirectoryView>(DirectoryView::Mode::Desktop));
@@ -579,7 +579,7 @@ ErrorOr<int> 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<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::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<RefPtr<GUI::Window>> MainWidget::create_preview_window()
window->resize(400, 150);
window->center_within(*this->window());
- auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(font_preview_window_gml);
m_preview_label = find_descendant_of_type_named<GUI::Label>("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<int> 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<FontEditor::MainWidget>());
+ auto font_editor = TRY(window->set_main_widget<FontEditor::MainWidget>());
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<int> serenity_main(Main::Arguments arguments)
window->set_title("Help");
window->resize(570, 500);
- auto main_widget = TRY(window->try_set_main_widget<MainWidget>());
+ auto main_widget = TRY(window->set_main_widget<MainWidget>());
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<GUI::Widget>();
- if (!main_widget.load_from_gml(find_dialog_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::TextBox>("text_editor");
- m_find_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_button");
- m_find_all_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_all_button");
- m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ m_text_editor = *main_widget->find_descendant_of_type_named<GUI::TextBox>("text_editor");
+ m_find_button = *main_widget->find_descendant_of_type_named<GUI::Button>("find_button");
+ m_find_all_button = *main_widget->find_descendant_of_type_named<GUI::Button>("find_all_button");
+ m_cancel_button = *main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
- auto& radio_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("radio_container");
+ auto& radio_container = *main_widget->find_descendant_of_type_named<GUI::Widget>("radio_container");
for (size_t i = 0; i < options.size(); i++) {
auto action = options[i];
auto& radio = radio_container.add<GUI::RadioButton>();
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<GUI::Widget>();
- if (!main_widget.load_from_gml(go_to_offset_dialog_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::TextBox>("text_editor");
- m_go_button = *main_widget.find_descendant_of_type_named<GUI::Button>("go_button");
- m_offset_type_box = *main_widget.find_descendant_of_type_named<GUI::ComboBox>("offset_type");
- m_offset_from_box = *main_widget.find_descendant_of_type_named<GUI::ComboBox>("offset_from");
- m_statusbar = *main_widget.find_descendant_of_type_named<GUI::Statusbar>("statusbar");
+ m_text_editor = *main_widget->find_descendant_of_type_named<GUI::TextBox>("text_editor");
+ m_go_button = *main_widget->find_descendant_of_type_named<GUI::Button>("go_button");
+ m_offset_type_box = *main_widget->find_descendant_of_type_named<GUI::ComboBox>("offset_type");
+ m_offset_from_box = *main_widget->find_descendant_of_type_named<GUI::ComboBox>("offset_from");
+ m_statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("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<int> serenity_main(Main::Arguments arguments)
window->set_title("Hex Editor");
window->resize(640, 400);
- auto hex_editor_widget = TRY(window->try_set_main_widget<HexEditorWidget>());
+ auto hex_editor_widget = TRY(window->set_main_widget<HexEditorWidget>());
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<int> 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<GUI::Widget>());
+ auto root_widget = TRY(window->set_main_widget<GUI::Widget>());
root_widget->set_fill_with_background_color(true);
root_widget->set_layout<GUI::VerticalBoxLayout>();
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<int> 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<KeyboardMapperWidget>());
+ auto keyboard_mapper_widget = TRY(window->set_main_widget<KeyboardMapperWidget>());
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<DeprecatedString> const& selected_keymaps)
: Dialog(parent_window)
{
- auto& widget = set_main_widget<GUI::Widget>();
- if (!widget.load_from_gml(keymap_dialog_gml))
+ auto widget = set_main_widget<GUI::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<GUI::ComboBox>("keymaps_combobox");
+ m_keymaps_combobox = *widget->find_descendant_of_type_named<GUI::ComboBox>("keymaps_combobox");
m_keymaps_combobox->set_only_allow_values_from_model(true);
m_keymaps_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::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<GUI::Button>("ok_button");
+ auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button");
ok_button.on_click = [this](auto) {
done(ExecResult::OK);
};
- auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("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<int> 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<MagnifierWidget>());
+ auto magnifier = TRY(window->set_main_widget<MagnifierWidget>());
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<int> 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<MailWidget>());
+ auto mail_widget = TRY(window->set_main_widget<MailWidget>());
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<int> 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<PDFViewerWidget>());
+ auto pdf_viewer_widget = TRY(window->set_main_widget<PDFViewerWidget>());
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<int> serenity_main(Main::Arguments arguments)
return Error::from_string_view(error_message);
}
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::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<int> 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<MainWidget>(track_manager, audio_loop));
+ auto main_widget = TRY(window->set_main_widget<MainWidget>(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<GUI::Widget>();
- main_widget.set_fill_with_background_color(true);
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_fill_with_background_color(true);
- auto& layout = main_widget.set_layout<GUI::VerticalBoxLayout>();
+ auto& layout = main_widget->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins(4);
- auto& name_label = main_widget.add<GUI::Label>("Name:");
+ auto& name_label = main_widget->add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- m_name_textbox = main_widget.add<GUI::TextBox>();
+ m_name_textbox = main_widget->add<GUI::TextBox>();
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<GUI::Label>("Width:");
+ auto& width_label = main_widget->add<GUI::Label>("Width:");
width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- auto& width_spinbox = main_widget.add<GUI::SpinBox>();
+ auto& width_spinbox = main_widget->add<GUI::SpinBox>();
- auto& height_label = main_widget.add<GUI::Label>("Height:");
+ auto& height_label = main_widget->add<GUI::Label>("Height:");
height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- auto& height_spinbox = main_widget.add<GUI::SpinBox>();
+ auto& height_spinbox = main_widget->add<GUI::SpinBox>();
enum class BackgroundIndex {
Transparent = 0,
@@ -81,10 +81,10 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
return BackgroundIndex::Custom;
}();
- auto& background_label = main_widget.add<GUI::Label>("Background:");
+ auto& background_label = main_widget->add<GUI::Label>("Background:");
background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- auto& background_color_combo = main_widget.add<GUI::ComboBox>();
- auto& background_color_input = main_widget.add<GUI::ColorInput>();
+ auto& background_color_combo = main_widget->add<GUI::ComboBox>();
+ auto& background_color_input = main_widget->add<GUI::ColorInput>();
background_color_input.set_visible(false);
background_color_combo.set_only_allow_values_from_model(true);
background_color_combo.set_model(*GUI::ItemListModel<StringView, decltype(suggested_backgrounds)>::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<GUI::CheckBox>();
+ auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>();
set_defaults_checkbox.set_text("Use these settings as default");
- auto& button_container = main_widget.add<GUI::Widget>();
+ auto& button_container = main_widget->add<GUI::Widget>();
button_container.set_layout<GUI::HorizontalBoxLayout>();
auto& ok_button = button_container.add<GUI::Button>("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<GUI::Widget>();
- main_widget.set_fill_with_background_color(true);
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_fill_with_background_color(true);
- auto& layout = main_widget.set_layout<GUI::VerticalBoxLayout>();
+ auto& layout = main_widget->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins(4);
- auto& name_label = main_widget.add<GUI::Label>("Name:");
+ auto& name_label = main_widget->add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- m_name_textbox = main_widget.add<GUI::TextBox>();
+ m_name_textbox = main_widget->add<GUI::TextBox>();
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<GUI::Label>("Width:");
+ auto& width_label = main_widget->add<GUI::Label>("Width:");
width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- auto& width_spinbox = main_widget.add<GUI::SpinBox>();
+ auto& width_spinbox = main_widget->add<GUI::SpinBox>();
- auto& height_label = main_widget.add<GUI::Label>("Height:");
+ auto& height_label = main_widget->add<GUI::Label>("Height:");
height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- auto& height_spinbox = main_widget.add<GUI::SpinBox>();
+ auto& height_spinbox = main_widget->add<GUI::SpinBox>();
- auto& button_container = main_widget.add<GUI::Widget>();
+ auto& button_container = main_widget->add<GUI::Widget>();
button_container.set_layout<GUI::HorizontalBoxLayout>();
auto& ok_button = button_container.add<GUI::Button>("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<GUI::Widget>();
- if (!main_widget.load_from_gml(edit_guide_dialog_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::RadioButton>("orientation_horizontal_radio");
- auto vertical_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("orientation_vertical_radio");
- auto ok_button = main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
- m_offset_text_box = main_widget.find_descendant_of_type_named<GUI::TextBox>("offset_text_box");
+ auto horizontal_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("orientation_horizontal_radio");
+ auto vertical_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("orientation_vertical_radio");
+ auto ok_button = main_widget->find_descendant_of_type_named<GUI::Button>("ok_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
+ m_offset_text_box = main_widget->find_descendant_of_type_named<GUI::TextBox>("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<GUI::Widget>();
- if (!main_widget.load_from_gml(filter_gallery_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::TreeView>("tree_view");
- auto apply_button = main_widget.find_descendant_of_type_named<GUI::Button>("apply_button");
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
- m_config_widget = main_widget.find_descendant_of_type_named<GUI::Widget>("config_widget");
- m_preview_widget = main_widget.find_descendant_of_type_named<FilterPreviewWidget>("preview_widget");
+ m_filter_tree = main_widget->find_descendant_of_type_named<GUI::TreeView>("tree_view");
+ auto apply_button = main_widget->find_descendant_of_type_named<GUI::Button>("apply_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
+ m_config_widget = main_widget->find_descendant_of_type_named<GUI::Widget>("config_widget");
+ m_preview_widget = main_widget->find_descendant_of_type_named<FilterPreviewWidget>("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<GUI::Frame>();
- 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<GUI::VerticalBoxLayout>();
+ auto main_widget = set_main_widget<GUI::Frame>().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<GUI::VerticalBoxLayout>();
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<GUI::Widget>();
+ auto& horizontal_container = main_widget->template add<GUI::Widget>();
horizontal_container.template set_layout<GUI::HorizontalBoxLayout>();
for (size_t column = 0; column < columns; ++column) {
if (index < columns * rows) {
@@ -81,13 +81,13 @@ private:
}
}
- auto& norm_checkbox = main_widget.template add<GUI::CheckBox>("Normalize");
+ auto& norm_checkbox = main_widget->template add<GUI::CheckBox>("Normalize");
norm_checkbox.set_checked(false);
- auto& wrap_checkbox = main_widget.template add<GUI::CheckBox>("Wrap");
+ auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>("Wrap");
wrap_checkbox.set_checked(m_should_wrap);
- auto& button = main_widget.template add<GUI::Button>("Done");
+ auto& button = main_widget->template add<GUI::Button>("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<GUI::Widget>();
- if (!main_widget.load_from_gml(levels_dialog_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::ValueSlider>("brightness_slider");
- m_contrast_slider = main_widget.find_descendant_of_type_named<GUI::ValueSlider>("contrast_slider");
- m_gamma_slider = main_widget.find_descendant_of_type_named<GUI::ValueSlider>("gamma_slider");
- auto context_label = main_widget.find_descendant_of_type_named<GUI::Label>("context_label");
- auto apply_button = main_widget.find_descendant_of_type_named<GUI::Button>("apply_button");
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ m_brightness_slider = main_widget->find_descendant_of_type_named<GUI::ValueSlider>("brightness_slider");
+ m_contrast_slider = main_widget->find_descendant_of_type_named<GUI::ValueSlider>("contrast_slider");
+ m_gamma_slider = main_widget->find_descendant_of_type_named<GUI::ValueSlider>("gamma_slider");
+ auto context_label = main_widget->find_descendant_of_type_named<GUI::Label>("context_label");
+ auto apply_button = main_widget->find_descendant_of_type_named<GUI::Button>("apply_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("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<GUI::Widget>();
- if (!main_widget.load_from_gml(resize_image_dialog_gml))
+ auto main_widget = set_main_widget<GUI::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<GUI::SpinBox>("width_spinbox");
- auto height_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("height_spinbox");
- auto keep_aspect_ratio_checkbox = main_widget.find_descendant_of_type_named<GUI::CheckBox>("keep_aspect_ratio_checkbox");
+ auto width_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("width_spinbox");
+ auto height_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("height_spinbox");
+ auto keep_aspect_ratio_checkbox = main_widget->find_descendant_of_type_named<GUI::CheckBox>("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<GUI::RadioButton>("nearest_neighbor_radio");
- auto smooth_pixels_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("smooth_pixels_radio");
- auto bilinear_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("bilinear_radio");
- auto resize_canvas_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("resize_canvas");
+ auto nearest_neighbor_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("nearest_neighbor_radio");
+ auto smooth_pixels_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("smooth_pixels_radio");
+ auto bilinear_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("bilinear_radio");
+ auto resize_canvas_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("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<GUI::Button>("ok_button");
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ auto ok_button = main_widget->find_descendant_of_type_named<GUI::Button>("ok_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("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<int> 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<PixelPaint::MainWidget>());
+ auto main_widget = TRY(window->set_main_widget<PixelPaint::MainWidget>());
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<int> 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<PresenterWidget>());
+ auto main_widget = TRY(window->set_main_widget<PresenterWidget>());
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<GUI::Widget>();
- main_widget.load_from_gml(run_gml);
+ auto main_widget = set_main_widget<GUI::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<GUI::ImageWidget>("icon");
+ m_icon_image_widget = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));
- m_path_combo_box = *main_widget.find_descendant_of_type_named<GUI::ComboBox>("path");
+ m_path_combo_box = *main_widget->find_descendant_of_type_named<GUI::ComboBox>("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<GUI::DialogButton>("ok_button");
+ m_ok_button = *main_widget->find_descendant_of_type_named<GUI::DialogButton>("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<GUI::DialogButton>("cancel_button");
+ m_cancel_button = *main_widget->find_descendant_of_type_named<GUI::DialogButton>("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<int> 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<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
main_widget->set_layout<GUI::VerticalBoxLayout>();
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<int> 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<SoundPlayerWidgetAdvancedView>(window, audio_client));
+ Player* player = TRY(window->set_main_widget<SoundPlayerWidgetAdvancedView>(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<GUI::Window> create_progress_window()
window->resize(240, 50);
window->center_on_screen();
- auto& main_widget = window->set_main_widget<GUI::Widget>();
- main_widget.set_fill_with_background_color(true);
- main_widget.set_layout<GUI::VerticalBoxLayout>();
+ auto main_widget = window->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_fill_with_background_color(true);
+ main_widget->set_layout<GUI::VerticalBoxLayout>();
- auto& label = main_widget.add<GUI::Label>("Analyzing storage space...");
+ auto& label = main_widget->add<GUI::Label>("Analyzing storage space...");
label.set_fixed_height(22);
- auto& progresslabel = main_widget.add<GUI::Label>();
+ auto& progresslabel = main_widget->add<GUI::Label>();
progresslabel.set_name("progresslabel");
progresslabel.set_fixed_height(22);
@@ -321,11 +321,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
// Load widgets.
- auto& mainwidget = window->set_main_widget<GUI::Widget>();
- mainwidget.load_from_gml(space_analyzer_gml);
- auto& breadcrumbbar = *mainwidget.find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
- auto& treemapwidget = *mainwidget.find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map");
- auto& statusbar = *mainwidget.find_descendant_of_type_named<GUI::Statusbar>("statusbar");
+ auto mainwidget = TRY(window->set_main_widget<GUI::Widget>());
+ mainwidget->load_from_gml(space_analyzer_gml);
+ auto& breadcrumbbar = *mainwidget->find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
+ auto& treemapwidget = *mainwidget->find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map");
+ auto& statusbar = *mainwidget->find_descendant_of_type_named<GUI::Statusbar>("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<Position> const& positions, Sheet& sheet,
set_icon(parent->icon());
resize(285, 360);
- auto& main_widget = set_main_widget<GUI::Widget>();
- main_widget.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
- main_widget.set_fill_with_background_color(true);
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ main_widget->set_fill_with_background_color(true);
- auto& tab_widget = main_widget.add<GUI::TabWidget>();
+ auto& tab_widget = main_widget->add<GUI::TabWidget>();
setup_tabs(tab_widget, positions, sheet);
- auto& buttonbox = main_widget.add<GUI::Widget>();
+ auto& buttonbox = main_widget->add<GUI::Widget>();
buttonbox.set_shrink_to_fit(true);
auto& button_layout = buttonbox.set_layout<GUI::HorizontalBoxLayout>();
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<GUI::Widget>();
- widget.set_layout<GUI::VerticalBoxLayout>();
- widget.set_fill_with_background_color(true);
+ auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ widget->set_layout<GUI::VerticalBoxLayout>();
+ widget->set_fill_with_background_color(true);
- auto& splitter = widget.add<GUI::HorizontalSplitter>();
+ auto& splitter = widget->add<GUI::HorizontalSplitter>();
auto& left_frame = splitter.add<GUI::Frame>();
left_frame.set_layout<GUI::VerticalBoxLayout>();
// 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<SpreadsheetWidget>(window, NonnullRefPtrVector<Sheet> {}, false);
- auto sheet = Sheet::from_json(value.as_object(), widget.workbook());
+ auto widget = window->set_main_widget<SpreadsheetWidget>(window, NonnullRefPtrVector<Sheet> {}, 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<GUI::Frame>();
- inline_widget.set_fill_with_background_color(true);
- inline_widget.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
- inline_widget.set_frame_shape(Gfx::FrameShape::Box);
- m_inline_documentation_label = inline_widget.add<GUI::Label>();
+ auto inline_widget = m_inline_documentation_window->set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
+ inline_widget->set_fill_with_background_color(true);
+ inline_widget->set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ inline_widget->set_frame_shape(Gfx::FrameShape::Box);
+ m_inline_documentation_label = inline_widget->add<GUI::Label>();
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<int> 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<Spreadsheet::SpreadsheetWidget>(*window, NonnullRefPtrVector<Spreadsheet::Sheet> {}, filename == nullptr);
+ auto spreadsheet_widget = TRY(window->set_main_widget<Spreadsheet::SpreadsheetWidget>(*window, NonnullRefPtrVector<Spreadsheet::Sheet> {}, 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<int> 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<int> serenity_main(Main::Arguments arguments)
window->set_title("System Monitor");
window->resize(560, 430);
- auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(system_monitor_gml);
auto& tabwidget = *main_widget->find_descendant_of_type_named<GUI::TabWidget>("main_tabs");
statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
@@ -512,7 +512,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> 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<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::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<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
window->set_resizable(false);
window->resize(300, 90);
- auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
main_widget->set_background_role(ColorRole::Button);
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
@@ -291,7 +291,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Terminal");
window->set_obey_widget_min_size(false);
- auto terminal = TRY(window->try_set_main_widget<VT::TerminalWidget>(ptm_fd, true));
+ auto terminal = TRY(window->set_main_widget<VT::TerminalWidget>(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<int> 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<MainWidget>());
+ auto text_widget = TRY(window->set_main_widget<MainWidget>());
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<int> 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<ThemeEditor::MainWidget>());
+ auto main_widget = TRY(window->set_main_widget<ThemeEditor::MainWidget>());
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<int> serenity_main(Main::Arguments arguments)
window->resize(640, 480);
window->set_resizable(true);
- auto main_widget = TRY(window->try_set_main_widget<VideoPlayer::VideoPlayerWidget>(window));
+ auto main_widget = TRY(window->set_main_widget<VideoPlayer::VideoPlayerWidget>(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<int> 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<WelcomeWidget>());
+ auto welcome_widget = TRY(window->set_main_widget<WelcomeWidget>());
window->show();