1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 22:37:35 +00:00

Userland: Replace all uses of load_from_gml with try_load_from_gml

MOAR FIXMES! ;^)
This commit is contained in:
Sam Atkins 2023-01-07 12:33:53 +00:00 committed by Linus Groh
parent 703da34947
commit 54b1326165
78 changed files with 94 additions and 111 deletions

View file

@ -26,8 +26,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
set_resizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(game_size_dialog_gml))
VERIFY_NOT_REACHED();
main_widget->try_load_from_gml(game_size_dialog_gml).release_value_but_fixme_should_propagate_errors();
auto board_size_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_size_spinbox");
board_size_spinbox->set_value(m_board_size);

View file

@ -67,8 +67,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(315, 336);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
if (!main_widget->load_from_gml(game_window_gml))
VERIFY_NOT_REACHED();
TRY(main_widget->try_load_from_gml(game_window_gml));
Game game { board_size, target_tile, evil_ai };

View file

@ -28,8 +28,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, size_t board_rows, size_t bo
set_resizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(settings_dialog_gml))
VERIFY_NOT_REACHED();
main_widget->try_load_from_gml(settings_dialog_gml).release_value_but_fixme_should_propagate_errors();
auto board_rows_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_rows_spinbox");
board_rows_spinbox->set_value(m_board_rows);

View file

@ -83,8 +83,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(304, 325);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
if (!main_widget->load_from_gml(flood_window_gml))
VERIFY_NOT_REACHED();
TRY(main_widget->try_load_from_gml(flood_window_gml));
auto board_widget = TRY(main_widget->find_descendant_of_type_named<GUI::Widget>("board_widget_container")->try_add<BoardWidget>(board_rows, board_columns));
board_widget->board()->randomize();

View file

@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Game Of Life");
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(game_of_life_gml);
TRY(main_widget->try_load_from_gml(game_of_life_gml));
main_widget->set_fill_with_background_color(true);
auto& main_toolbar = *main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar");

View file

@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Hearts");
auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(hearts_gml);
TRY(widget->try_load_from_gml(hearts_gml));
auto& game = *widget->find_descendant_of_type_named<Hearts::Game>("game");
game.set_focus(true);

View file

@ -47,7 +47,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_resizable(false);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(master_word_gml);
TRY(main_widget->try_load_from_gml(master_word_gml));
auto& game = *main_widget->find_descendant_of_type_named<MasterWord::WordGame>("word_game");
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");

View file

@ -46,8 +46,7 @@ CustomGameDialog::CustomGameDialog(Window* parent_window)
set_title("Custom game");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(minesweeper_custom_game_window_gml))
VERIFY_NOT_REACHED();
main_widget->try_load_from_gml(minesweeper_custom_game_window_gml).release_value_but_fixme_should_propagate_errors();
m_columns_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("columns_spinbox");
m_rows_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("rows_spinbox");

View file

@ -50,7 +50,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(139, 177);
auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(minesweeper_window_gml);
TRY(widget->try_load_from_gml(minesweeper_window_gml));
auto& separator = *widget->find_descendant_of_type_named<GUI::HorizontalSeparator>("separator");
auto& container = *widget->find_descendant_of_type_named<GUI::Widget>("container");