diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-01-06 16:48:37 +0000 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-01-06 13:36:02 -0700 |
commit | 0c24522635ec7f07e1fb69d9e1cd350d81e2248f (patch) | |
tree | 391782374bada7ee7a986674229551c2ec21f75a /Userland/Services/LoginServer | |
parent | d223477bc650e271008ccc339fc1e2c0fcc079e7 (diff) | |
download | serenity-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/Services/LoginServer')
-rw-r--r-- | Userland/Services/LoginServer/LoginWindow.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Services/LoginServer/LoginWindow.cpp b/Userland/Services/LoginServer/LoginWindow.cpp index 3001f0b80a..28d438c481 100644 --- a/Userland/Services/LoginServer/LoginWindow.cpp +++ b/Userland/Services/LoginServer/LoginWindow.cpp @@ -20,24 +20,24 @@ LoginWindow::LoginWindow(GUI::Window* parent) set_closeable(false); set_icon(GUI::Icon::default_icon("ladyball"sv).bitmap_for_size(16)); - auto& widget = set_main_widget<GUI::Widget>(); - widget.load_from_gml(login_window_gml); - m_banner = *widget.find_descendant_of_type_named<GUI::ImageWidget>("banner"); + auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); + widget->load_from_gml(login_window_gml); + m_banner = *widget->find_descendant_of_type_named<GUI::ImageWidget>("banner"); m_banner->load_from_file("/res/graphics/brand-banner.png"sv); m_banner->set_auto_resize(true); - m_username = *widget.find_descendant_of_type_named<GUI::TextBox>("username"); + m_username = *widget->find_descendant_of_type_named<GUI::TextBox>("username"); m_username->set_focus(true); - m_password = *widget.find_descendant_of_type_named<GUI::PasswordBox>("password"); + m_password = *widget->find_descendant_of_type_named<GUI::PasswordBox>("password"); - m_log_in_button = *widget.find_descendant_of_type_named<GUI::Button>("log_in"); + m_log_in_button = *widget->find_descendant_of_type_named<GUI::Button>("log_in"); m_log_in_button->on_click = [&](auto) { if (on_submit) on_submit(); }; m_log_in_button->set_default(true); - m_fail_message = *widget.find_descendant_of_type_named<GUI::Label>("fail_message"); + m_fail_message = *widget->find_descendant_of_type_named<GUI::Label>("fail_message"); m_username->on_change = [&] { m_fail_message->set_text(""); }; |