mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
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.
This commit is contained in:
parent
d223477bc6
commit
0c24522635
121 changed files with 441 additions and 449 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue