mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:47: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
|
@ -17,13 +17,13 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
|
|||
set_title("Commit");
|
||||
set_icon(parent->icon());
|
||||
|
||||
auto& widget = set_main_widget<GUI::Widget>();
|
||||
widget.load_from_gml(git_commit_dialog_gml);
|
||||
auto widget = set_main_widget<GUI::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<GUI::TextEditor>("message_editor");
|
||||
m_cancel_button = widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
m_commit_button = widget.find_descendant_of_type_named<GUI::Button>("commit_button");
|
||||
m_line_and_col_label = widget.find_descendant_of_type_named<GUI::Label>("line_and_col_label");
|
||||
m_message_editor = widget->find_descendant_of_type_named<GUI::TextEditor>("message_editor");
|
||||
m_cancel_button = widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
m_commit_button = widget->find_descendant_of_type_named<GUI::Button>("commit_button");
|
||||
m_line_and_col_label = widget->find_descendant_of_type_named<GUI::Label>("line_and_col_label");
|
||||
|
||||
m_message_editor->on_change = [this]() {
|
||||
m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit);
|
||||
|
|
|
@ -49,10 +49,10 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
|
|||
set_resizable(false);
|
||||
set_title("New project");
|
||||
|
||||
auto& main_widget = set_main_widget<GUI::Widget>();
|
||||
main_widget.load_from_gml(new_project_dialog_gml);
|
||||
auto main_widget = set_main_widget<GUI::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<GUI::Widget>("icon_view_container");
|
||||
m_icon_view_container = *main_widget->find_descendant_of_type_named<GUI::Widget>("icon_view_container");
|
||||
m_icon_view = m_icon_view_container->add<GUI::IconView>();
|
||||
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<GUI::Label>("description_label");
|
||||
m_name_input = *main_widget.find_descendant_of_type_named<GUI::TextBox>("name_input");
|
||||
m_description_label = *main_widget->find_descendant_of_type_named<GUI::Label>("description_label");
|
||||
m_name_input = *main_widget->find_descendant_of_type_named<GUI::TextBox>("name_input");
|
||||
m_name_input->on_change = [&]() {
|
||||
update_dialog();
|
||||
};
|
||||
m_create_in_input = *main_widget.find_descendant_of_type_named<GUI::TextBox>("create_in_input");
|
||||
m_create_in_input = *main_widget->find_descendant_of_type_named<GUI::TextBox>("create_in_input");
|
||||
m_create_in_input->on_change = [&]() {
|
||||
update_dialog();
|
||||
};
|
||||
m_full_path_label = *main_widget.find_descendant_of_type_named<GUI::Label>("full_path_label");
|
||||
m_full_path_label = *main_widget->find_descendant_of_type_named<GUI::Label>("full_path_label");
|
||||
|
||||
m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
m_ok_button = *main_widget->find_descendant_of_type_named<GUI::Button>("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<GUI::Button>("cancel_button");
|
||||
m_cancel_button = *main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
m_cancel_button->on_click = [this](auto) {
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ ErrorOr<void> Editor::initialize_tooltip_window()
|
|||
s_tooltip_window->set_window_type(GUI::WindowType::Tooltip);
|
||||
}
|
||||
if (s_tooltip_page_view.is_null()) {
|
||||
s_tooltip_page_view = TRY(s_tooltip_window->try_set_main_widget<WebView::OutOfProcessWebView>());
|
||||
s_tooltip_page_view = TRY(s_tooltip_window->set_main_widget<WebView::OutOfProcessWebView>());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -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<GUI::TableView>();
|
||||
m_suggestion_view = m_popup_window->set_main_widget<GUI::TableView>().release_value_but_fixme_should_propagate_errors();
|
||||
m_suggestion_view->set_column_headers_visible(false);
|
||||
|
||||
m_suggestion_view->on_activation = [this](auto& index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue