1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +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

@ -48,8 +48,7 @@ private:
: Dialog(parent_window) : Dialog(parent_window)
{ {
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!widget->load_from_gml(edit_bookmark_gml)) widget->try_load_from_gml(edit_bookmark_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
set_resizable(false); set_resizable(false);
resize(260, 85); resize(260, 85);

View file

@ -74,7 +74,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
set_title("Browser"); set_title("Browser");
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(browser_window_gml); widget->try_load_from_gml(browser_window_gml).release_value_but_fixme_should_propagate_errors();
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");

View file

@ -11,7 +11,7 @@
namespace Browser { namespace Browser {
HistoryWidget::HistoryWidget() HistoryWidget::HistoryWidget()
{ {
load_from_gml(history_widget_gml); try_load_from_gml(history_widget_gml).release_value_but_fixme_should_propagate_errors();
m_table_view = find_descendant_of_type_named<GUI::TableView>("history_tableview"); m_table_view = find_descendant_of_type_named<GUI::TableView>("history_tableview");
m_textbox = find_descendant_of_type_named<GUI::TextBox>("history_filter_textbox"); m_textbox = find_descendant_of_type_named<GUI::TextBox>("history_filter_textbox");

View file

@ -18,7 +18,7 @@ namespace Browser {
StorageWidget::StorageWidget() StorageWidget::StorageWidget()
{ {
load_from_gml(storage_widget_gml); try_load_from_gml(storage_widget_gml).release_value_but_fixme_should_propagate_errors();
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
m_cookies_table_view = tab_widget.find_descendant_of_type_named<GUI::TableView>("cookies_tableview"); m_cookies_table_view = tab_widget.find_descendant_of_type_named<GUI::TableView>("cookies_tableview");

View file

@ -114,7 +114,7 @@ void Tab::update_status(Optional<DeprecatedString> text_override, i32 count_wait
Tab::Tab(BrowserWindow& window) Tab::Tab(BrowserWindow& window)
{ {
load_from_gml(tab_gml); try_load_from_gml(tab_gml).release_value_but_fixme_should_propagate_errors();
m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container"); m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");
auto& toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar"); auto& toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar");

View file

@ -59,7 +59,7 @@ private:
BrowserSettingsWidget::BrowserSettingsWidget() BrowserSettingsWidget::BrowserSettingsWidget()
{ {
load_from_gml(browser_settings_widget_gml); try_load_from_gml(browser_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
m_homepage_url_textbox = find_descendant_of_type_named<GUI::TextBox>("homepage_url_textbox"); m_homepage_url_textbox = find_descendant_of_type_named<GUI::TextBox>("homepage_url_textbox");
m_homepage_url_textbox->set_text(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, default_homepage_url), GUI::AllowCallback::No); m_homepage_url_textbox->set_text(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, default_homepage_url), GUI::AllowCallback::No);

View file

@ -108,7 +108,7 @@ void DomainListModel::reset_default_values()
ContentFilterSettingsWidget::ContentFilterSettingsWidget() ContentFilterSettingsWidget::ContentFilterSettingsWidget()
{ {
load_from_gml(content_filter_settings_widget_gml); try_load_from_gml(content_filter_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
m_enable_content_filtering_checkbox = find_descendant_of_type_named<GUI::CheckBox>("enable_content_filtering_checkbox"); m_enable_content_filtering_checkbox = find_descendant_of_type_named<GUI::CheckBox>("enable_content_filtering_checkbox");
m_domain_list_view = find_descendant_of_type_named<GUI::ListView>("domain_list_view"); m_domain_list_view = find_descendant_of_type_named<GUI::ListView>("domain_list_view");
m_add_new_domain_button = find_descendant_of_type_named<GUI::Button>("add_new_domain_button"); m_add_new_domain_button = find_descendant_of_type_named<GUI::Button>("add_new_domain_button");

View file

@ -18,7 +18,7 @@
CalculatorWidget::CalculatorWidget() CalculatorWidget::CalculatorWidget()
{ {
load_from_gml(calculator_gml); try_load_from_gml(calculator_gml).release_value_but_fixme_should_propagate_errors();
m_entry = *find_descendant_of_type_named<GUI::TextBox>("entry_textbox"); m_entry = *find_descendant_of_type_named<GUI::TextBox>("entry_textbox");
m_entry->set_relative_rect(5, 5, 244, 26); m_entry->set_relative_rect(5, 5, 244, 26);

View file

@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16)); window->set_icon(app_icon.bitmap_for_size(16));
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(calendar_window_gml); TRY(main_widget->try_load_from_gml(calendar_window_gml));
auto toolbar = main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar"); auto toolbar = main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar");
auto calendar = main_widget->find_descendant_of_type_named<GUI::Calendar>("calendar"); auto calendar = main_widget->find_descendant_of_type_named<GUI::Calendar>("calendar");

View file

@ -31,7 +31,7 @@ void CalendarSettingsWidget::reset_default_values()
CalendarSettingsWidget::CalendarSettingsWidget() CalendarSettingsWidget::CalendarSettingsWidget()
{ {
load_from_gml(calendar_settings_widget_gml); try_load_from_gml(calendar_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
m_first_day_of_week_combobox = *find_descendant_of_type_named<GUI::ComboBox>("first_day_of_week"); m_first_day_of_week_combobox = *find_descendant_of_type_named<GUI::ComboBox>("first_day_of_week");
m_first_day_of_week_combobox->set_text(Config::read_string("Calendar"sv, "View"sv, "FirstDayOfWeek"sv, "Sunday"sv)); m_first_day_of_week_combobox->set_text(Config::read_string("Calendar"sv, "View"sv, "FirstDayOfWeek"sv, "Sunday"sv));

View file

@ -27,7 +27,7 @@
CharacterMapWidget::CharacterMapWidget() CharacterMapWidget::CharacterMapWidget()
{ {
load_from_gml(character_map_window_gml); try_load_from_gml(character_map_window_gml).release_value_but_fixme_should_propagate_errors();
m_toolbar = find_descendant_of_type_named<GUI::Toolbar>("toolbar"); m_toolbar = find_descendant_of_type_named<GUI::Toolbar>("toolbar");
m_font_name_label = find_descendant_of_type_named<GUI::Label>("font_name"); m_font_name_label = find_descendant_of_type_named<GUI::Label>("font_name");

View file

@ -53,7 +53,7 @@ private:
CharacterSearchWidget::CharacterSearchWidget() CharacterSearchWidget::CharacterSearchWidget()
{ {
load_from_gml(character_search_window_gml); try_load_from_gml(character_search_window_gml).release_value_but_fixme_should_propagate_errors();
m_search_input = find_descendant_of_type_named<GUI::TextBox>("search_input"); m_search_input = find_descendant_of_type_named<GUI::TextBox>("search_input");
m_search_button = find_descendant_of_type_named<GUI::Button>("search_button"); m_search_button = find_descendant_of_type_named<GUI::Button>("search_button");

View file

@ -21,7 +21,7 @@ constexpr auto time_format_24h_seconds = "%T"sv;
ClockSettingsWidget::ClockSettingsWidget() ClockSettingsWidget::ClockSettingsWidget()
{ {
load_from_gml(clock_settings_widget_gml); try_load_from_gml(clock_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
m_24_hour_radio = *find_descendant_of_type_named<GUI::RadioButton>("24hour_radio"); m_24_hour_radio = *find_descendant_of_type_named<GUI::RadioButton>("24hour_radio");
auto& twelve_hour_radio = *find_descendant_of_type_named<GUI::RadioButton>("12hour_radio"); auto& twelve_hour_radio = *find_descendant_of_type_named<GUI::RadioButton>("12hour_radio");

View file

@ -61,7 +61,7 @@ ErrorOr<NonnullRefPtr<TimeZoneSettingsWidget>> TimeZoneSettingsWidget::create()
TimeZoneSettingsWidget::TimeZoneSettingsWidget() TimeZoneSettingsWidget::TimeZoneSettingsWidget()
{ {
load_from_gml(time_zone_settings_widget_gml); try_load_from_gml(time_zone_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
static auto time_zones = TimeZone::all_time_zones(); static auto time_zones = TimeZone::all_time_zones();
m_time_zone = TimeZone::system_time_zone(); m_time_zone = TimeZone::system_time_zone();

View file

@ -182,7 +182,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}; };
auto widget = TRY(window->set_main_widget<GUI::Widget>()); auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(crash_reporter_window_gml); TRY(widget->try_load_from_gml(crash_reporter_window_gml));
auto& icon_image_widget = *widget->find_descendant_of_type_named<GUI::ImageWidget>("icon"); auto& icon_image_widget = *widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
icon_image_widget.set_bitmap(GUI::FileIconProvider::icon_for_executable(executable_path).bitmap_for_size(32)); icon_image_widget.set_bitmap(GUI::FileIconProvider::icon_for_executable(executable_path).bitmap_for_size(32));

View file

@ -42,7 +42,7 @@ BackgroundSettingsWidget::BackgroundSettingsWidget(bool& background_settings_cha
void BackgroundSettingsWidget::create_frame() void BackgroundSettingsWidget::create_frame()
{ {
load_from_gml(background_settings_gml); try_load_from_gml(background_settings_gml).release_value_but_fixme_should_propagate_errors();
m_monitor_widget = *find_descendant_of_type_named<DisplaySettings::MonitorWidget>("monitor_widget"); m_monitor_widget = *find_descendant_of_type_named<DisplaySettings::MonitorWidget>("monitor_widget");

View file

@ -23,7 +23,7 @@ DesktopSettingsWidget::DesktopSettingsWidget()
void DesktopSettingsWidget::create_frame() void DesktopSettingsWidget::create_frame()
{ {
load_from_gml(desktop_settings_gml); try_load_from_gml(desktop_settings_gml).release_value_but_fixme_should_propagate_errors();
m_workspace_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_rows_spinbox"); m_workspace_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_rows_spinbox");
m_workspace_rows_spinbox->on_change = [&](auto) { m_workspace_rows_spinbox->on_change = [&](auto) {

View file

@ -18,7 +18,7 @@ namespace DisplaySettings {
EffectsSettingsWidget::EffectsSettingsWidget() EffectsSettingsWidget::EffectsSettingsWidget()
{ {
load_from_gml(effects_settings_gml); try_load_from_gml(effects_settings_gml).release_value_but_fixme_should_propagate_errors();
m_geometry_combobox = find_descendant_of_type_named<ComboBox>("geometry_combobox"); m_geometry_combobox = find_descendant_of_type_named<ComboBox>("geometry_combobox");
m_geometry_combobox->set_only_allow_values_from_model(true); m_geometry_combobox->set_only_allow_values_from_model(true);

View file

@ -19,7 +19,7 @@ static void update_label_with_font(GUI::Label&, Gfx::Font const&);
FontSettingsWidget::FontSettingsWidget() FontSettingsWidget::FontSettingsWidget()
{ {
load_from_gml(font_settings_gml); try_load_from_gml(font_settings_gml).release_value_but_fixme_should_propagate_errors();
auto& default_font = Gfx::FontDatabase::default_font(); auto& default_font = Gfx::FontDatabase::default_font();
m_default_font_label = *find_descendant_of_type_named<GUI::Label>("default_font_label"); m_default_font_label = *find_descendant_of_type_named<GUI::Label>("default_font_label");

View file

@ -71,7 +71,7 @@ void MonitorSettingsWidget::create_resolution_list()
void MonitorSettingsWidget::create_frame() void MonitorSettingsWidget::create_frame()
{ {
load_from_gml(monitor_settings_window_gml); try_load_from_gml(monitor_settings_window_gml).release_value_but_fixme_should_propagate_errors();
m_monitor_widget = *find_descendant_of_type_named<DisplaySettings::MonitorWidget>("monitor_widget"); m_monitor_widget = *find_descendant_of_type_named<DisplaySettings::MonitorWidget>("monitor_widget");

View file

@ -21,7 +21,7 @@ namespace DisplaySettings {
ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed) ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
: m_background_settings_changed { background_settings_changed } : m_background_settings_changed { background_settings_changed }
{ {
load_from_gml(themes_settings_gml); try_load_from_gml(themes_settings_gml).release_value_but_fixme_should_propagate_errors();
m_themes = MUST(Gfx::list_installed_system_themes()); m_themes = MUST(Gfx::list_installed_system_themes());
size_t current_theme_index; size_t current_theme_index;

View file

@ -32,7 +32,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
set_minimizable(false); set_minimizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->load_from_gml(escalator_gml); main_widget->try_load_from_gml(escalator_gml).release_value_but_fixme_should_propagate_errors();
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");

View file

@ -23,7 +23,7 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
: m_operation(operation) : m_operation(operation)
, m_helper_pipe(move(helper_pipe)) , m_helper_pipe(move(helper_pipe))
{ {
load_from_gml(file_operation_progress_gml); try_load_from_gml(file_operation_progress_gml).release_value_but_fixme_should_propagate_errors();
auto& button = *find_descendant_of_type_named<GUI::Button>("button"); auto& button = *find_descendant_of_type_named<GUI::Button>("button");

View file

@ -45,7 +45,7 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_re
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"); auto& general_tab = tab_widget.add_tab<GUI::Widget>("General");
general_tab.load_from_gml(properties_window_general_tab_gml); general_tab.try_load_from_gml(properties_window_general_tab_gml).release_value_but_fixme_should_propagate_errors();
m_name = lexical_path.basename(); m_name = lexical_path.basename();
m_path = lexical_path.string(); m_path = lexical_path.string();

View file

@ -580,8 +580,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
auto was_maximized = Config::read_bool("FileManager"sv, "Window"sv, "Maximized"sv, false); auto was_maximized = Config::read_bool("FileManager"sv, "Window"sv, "Maximized"sv, false);
auto widget = TRY(window->set_main_widget<GUI::Widget>()); auto widget = TRY(window->set_main_widget<GUI::Widget>());
TRY(widget->try_load_from_gml(file_manager_window_gml));
widget->load_from_gml(file_manager_window_gml);
auto& toolbar_container = *widget->find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container"); auto& toolbar_container = *widget->find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");
auto& main_toolbar = *widget->find_descendant_of_type_named<GUI::Toolbar>("main_toolbar"); auto& main_toolbar = *widget->find_descendant_of_type_named<GUI::Toolbar>("main_toolbar");

View file

@ -66,7 +66,7 @@ ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window()
window->center_within(*this->window()); window->center_within(*this->window());
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(font_preview_window_gml); TRY(main_widget->try_load_from_gml(font_preview_window_gml));
m_preview_label = find_descendant_of_type_named<GUI::Label>("preview_label"); m_preview_label = find_descendant_of_type_named<GUI::Label>("preview_label");
m_preview_label->set_font(edited_font()); m_preview_label->set_font(edited_font());
@ -420,7 +420,7 @@ ErrorOr<void> MainWidget::create_undo_stack()
MainWidget::MainWidget() MainWidget::MainWidget()
{ {
load_from_gml(font_editor_window_gml); try_load_from_gml(font_editor_window_gml).release_value_but_fixme_should_propagate_errors();
m_font_metadata_groupbox = find_descendant_of_type_named<GUI::GroupBox>("font_metadata_groupbox"); m_font_metadata_groupbox = find_descendant_of_type_named<GUI::GroupBox>("font_metadata_groupbox");
m_unicode_block_container = find_descendant_of_type_named<GUI::Widget>("unicode_block_container"); m_unicode_block_container = find_descendant_of_type_named<GUI::Widget>("unicode_block_container");

View file

@ -128,7 +128,7 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window)
set_title("New Font"); set_title("New Font");
m_font_properties_page = GUI::WizardPage::construct("Typeface properties", "Edit details about this font."); m_font_properties_page = GUI::WizardPage::construct("Typeface properties", "Edit details about this font.");
m_font_properties_page->body_widget().load_from_gml(new_font_dialog_page_1_gml); m_font_properties_page->body_widget().try_load_from_gml(new_font_dialog_page_1_gml).release_value_but_fixme_should_propagate_errors();
m_name_textbox = m_font_properties_page->body_widget().find_descendant_of_type_named<GUI::TextBox>("name_textbox"); m_name_textbox = m_font_properties_page->body_widget().find_descendant_of_type_named<GUI::TextBox>("name_textbox");
m_family_textbox = m_font_properties_page->body_widget().find_descendant_of_type_named<GUI::TextBox>("family_textbox"); m_family_textbox = m_font_properties_page->body_widget().find_descendant_of_type_named<GUI::TextBox>("family_textbox");
@ -156,7 +156,7 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window)
}; };
m_glyph_properties_page = GUI::WizardPage::construct("Glyph properties", "Edit details about this font."); m_glyph_properties_page = GUI::WizardPage::construct("Glyph properties", "Edit details about this font.");
m_glyph_properties_page->body_widget().load_from_gml(new_font_dialog_page_2_gml); m_glyph_properties_page->body_widget().try_load_from_gml(new_font_dialog_page_2_gml).release_value_but_fixme_should_propagate_errors();
m_glyph_properties_page->set_is_final_page(true); m_glyph_properties_page->set_is_final_page(true);
m_glyph_height_spinbox = m_glyph_properties_page->body_widget().find_descendant_of_type_named<GUI::SpinBox>("height_spinbox"); m_glyph_height_spinbox = m_glyph_properties_page->body_widget().find_descendant_of_type_named<GUI::SpinBox>("height_spinbox");

View file

@ -15,7 +15,7 @@ static constexpr StringView default_card_back_image_path = "/res/icons/cards/bug
CardSettingsWidget::CardSettingsWidget() CardSettingsWidget::CardSettingsWidget()
{ {
load_from_gml(card_settings_widget_gml); try_load_from_gml(card_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
auto background_color = Gfx::Color::from_string(Config::read_string("Games"sv, "Cards"sv, "BackgroundColor"sv)).value_or(Gfx::Color::from_rgb(0x008000)); auto background_color = Gfx::Color::from_string(Config::read_string("Games"sv, "Cards"sv, "BackgroundColor"sv)).value_or(Gfx::Color::from_rgb(0x008000));

View file

@ -42,7 +42,7 @@ namespace Help {
MainWidget::MainWidget() MainWidget::MainWidget()
{ {
load_from_gml(help_window_gml); try_load_from_gml(help_window_gml).release_value_but_fixme_should_propagate_errors();
m_toolbar = find_descendant_of_type_named<GUI::Toolbar>("toolbar"); m_toolbar = find_descendant_of_type_named<GUI::Toolbar>("toolbar");
m_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); m_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
m_search_container = find_descendant_of_type_named<GUI::Widget>("search_container"); m_search_container = find_descendant_of_type_named<GUI::Widget>("search_container");

View file

@ -100,8 +100,7 @@ FindDialog::FindDialog()
set_title("Find"); set_title("Find");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(find_dialog_gml)) main_widget->try_load_from_gml(find_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_text_editor = *main_widget->find_descendant_of_type_named<GUI::TextBox>("text_editor"); 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_button = *main_widget->find_descendant_of_type_named<GUI::Button>("find_button");

View file

@ -97,8 +97,7 @@ GoToOffsetDialog::GoToOffsetDialog()
set_title("Go to Offset"); set_title("Go to Offset");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); 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)) main_widget->try_load_from_gml(go_to_offset_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_text_editor = *main_widget->find_descendant_of_type_named<GUI::TextBox>("text_editor"); 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_go_button = *main_widget->find_descendant_of_type_named<GUI::Button>("go_button");

View file

@ -40,7 +40,7 @@ REGISTER_WIDGET(HexEditor, HexEditor);
HexEditorWidget::HexEditorWidget() HexEditorWidget::HexEditorWidget()
{ {
load_from_gml(hex_editor_window_gml); try_load_from_gml(hex_editor_window_gml).release_value_but_fixme_should_propagate_errors();
m_toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar"); m_toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar");
m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container"); m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");

View file

@ -52,8 +52,7 @@ private:
: Dialog(parent_window) : Dialog(parent_window)
{ {
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!widget->load_from_gml(keymap_dialog_gml)) widget->try_load_from_gml(keymap_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
set_resizable(false); set_resizable(false);
resize(190, 54); resize(190, 54);
@ -152,7 +151,7 @@ private:
KeyboardSettingsWidget::KeyboardSettingsWidget() KeyboardSettingsWidget::KeyboardSettingsWidget()
{ {
load_from_gml(keyboard_widget_gml); try_load_from_gml(keyboard_widget_gml).release_value_but_fixme_should_propagate_errors();
auto proc_keymap = Core::File::construct("/sys/kernel/keymap"); auto proc_keymap = Core::File::construct("/sys/kernel/keymap");
if (!proc_keymap->open(Core::OpenMode::ReadOnly)) if (!proc_keymap->open(Core::OpenMode::ReadOnly))

View file

@ -24,7 +24,7 @@
MailWidget::MailWidget() MailWidget::MailWidget()
{ {
load_from_gml(mail_window_gml); try_load_from_gml(mail_window_gml).release_value_but_fixme_should_propagate_errors();
m_mailbox_list = *find_descendant_of_type_named<GUI::TreeView>("mailbox_list"); m_mailbox_list = *find_descendant_of_type_named<GUI::TreeView>("mailbox_list");
m_individual_mailbox_view = *find_descendant_of_type_named<GUI::TableView>("individual_mailbox_view"); m_individual_mailbox_view = *find_descendant_of_type_named<GUI::TableView>("individual_mailbox_view");

View file

@ -42,7 +42,7 @@ MailSettingsWidget::MailSettingsWidget()
m_common_ports.append("143"); m_common_ports.append("143");
m_common_ports.append("993"); m_common_ports.append("993");
load_from_gml(mail_settings_widget_gml); try_load_from_gml(mail_settings_widget_gml).release_value_but_fixme_should_propagate_errors();
m_server_inputbox = *find_descendant_of_type_named<GUI::TextBox>("server_input"); m_server_inputbox = *find_descendant_of_type_named<GUI::TextBox>("server_input");
m_server_inputbox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Server"sv, ""sv)); m_server_inputbox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Server"sv, ""sv));

View file

@ -11,7 +11,7 @@
HighlightWidget::HighlightWidget() HighlightWidget::HighlightWidget()
{ {
load_from_gml(highlight_widget_gml); try_load_from_gml(highlight_widget_gml).release_value_but_fixme_should_propagate_errors();
m_highlight_preview = find_descendant_of_type_named<GUI::Frame>("preview_frame")->add<MouseSettings::HighlightPreviewWidget>(palette()); m_highlight_preview = find_descendant_of_type_named<GUI::Frame>("preview_frame")->add<MouseSettings::HighlightPreviewWidget>(palette());

View file

@ -20,7 +20,7 @@ constexpr int double_click_speed_default = 250;
MouseWidget::MouseWidget() MouseWidget::MouseWidget()
{ {
load_from_gml(mouse_widget_gml); try_load_from_gml(mouse_widget_gml).release_value_but_fixme_should_propagate_errors();
m_speed_label = *find_descendant_of_type_named<GUI::Label>("speed_label"); m_speed_label = *find_descendant_of_type_named<GUI::Label>("speed_label");
m_speed_slider = *find_descendant_of_type_named<GUI::HorizontalSlider>("speed_slider"); m_speed_slider = *find_descendant_of_type_named<GUI::HorizontalSlider>("speed_slider");

View file

@ -98,7 +98,7 @@ void ThemeModel::invalidate()
ThemeWidget::ThemeWidget() ThemeWidget::ThemeWidget()
{ {
load_from_gml(theme_widget_gml); try_load_from_gml(theme_widget_gml).release_value_but_fixme_should_propagate_errors();
m_cursors_tableview = find_descendant_of_type_named<GUI::TableView>("cursors_tableview"); m_cursors_tableview = find_descendant_of_type_named<GUI::TableView>("cursors_tableview");
m_cursors_tableview->set_highlight_selected_rows(true); m_cursors_tableview->set_highlight_selected_rows(true);
m_cursors_tableview->set_alternating_row_colors(false); m_cursors_tableview->set_alternating_row_colors(false);

View file

@ -30,7 +30,7 @@ static int netmask_to_cidr(IPv4Address const& address)
NetworkSettingsWidget::NetworkSettingsWidget() NetworkSettingsWidget::NetworkSettingsWidget()
{ {
load_from_gml(network_settings_gml); try_load_from_gml(network_settings_gml).release_value_but_fixme_should_propagate_errors();
m_adapters_combobox = *find_descendant_of_type_named<GUI::ComboBox>("adapters_combobox"); m_adapters_combobox = *find_descendant_of_type_named<GUI::ComboBox>("adapters_combobox");
m_enabled_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("enabled_checkbox"); m_enabled_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("enabled_checkbox");

View file

@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
} }
auto widget = TRY(window->set_main_widget<GUI::Widget>()); auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(partition_editor_window_gml); TRY(widget->try_load_from_gml(partition_editor_window_gml));
auto device_paths = get_device_paths(); auto device_paths = get_device_paths();

View file

@ -24,8 +24,7 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, DeprecatedString co
set_resizable(false); set_resizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); 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)) main_widget->try_load_from_gml(edit_guide_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
auto horizontal_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("orientation_horizontal_radio"); 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 vertical_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("orientation_vertical_radio");

View file

@ -22,8 +22,7 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor)
set_resizable(true); set_resizable(true);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(filter_gallery_gml)) main_widget->try_load_from_gml(filter_gallery_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_filter_tree = main_widget->find_descendant_of_type_named<GUI::TreeView>("tree_view"); 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 apply_button = main_widget->find_descendant_of_type_named<GUI::Button>("apply_button");

View file

@ -46,7 +46,7 @@ RefPtr<GUI::Widget> Median::get_settings_widget()
{ {
if (!m_settings_widget) { if (!m_settings_widget) {
m_settings_widget = GUI::Widget::construct(); m_settings_widget = GUI::Widget::construct();
m_settings_widget->load_from_gml(median_settings_gml); m_settings_widget->try_load_from_gml(median_settings_gml).release_value_but_fixme_should_propagate_errors();
m_settings_widget->find_descendant_of_type_named<GUI::SpinBox>("filter_radius")->on_change = [this](auto value) { m_settings_widget->find_descendant_of_type_named<GUI::SpinBox>("filter_radius")->on_change = [this](auto value) {
m_filter_radius = value; m_filter_radius = value;
update_preview(); update_preview();

View file

@ -19,8 +19,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor)
set_icon(parent_window->icon()); set_icon(parent_window->icon());
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(levels_dialog_gml)) main_widget->try_load_from_gml(levels_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
resize(305, 202); resize(305, 202);
set_resizable(false); set_resizable(false);

View file

@ -37,7 +37,7 @@ IconBag g_icon_bag;
MainWidget::MainWidget() MainWidget::MainWidget()
: Widget() : Widget()
{ {
load_from_gml(pixel_paint_window_gml); try_load_from_gml(pixel_paint_window_gml).release_value_but_fixme_should_propagate_errors();
m_toolbox = find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox"); m_toolbox = find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox");
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar"); m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");

View file

@ -28,8 +28,7 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p
set_icon(parent_window->icon()); set_icon(parent_window->icon());
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); 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)) main_widget->try_load_from_gml(resize_image_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
auto width_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("width_spinbox"); 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 height_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("height_spinbox");

View file

@ -42,7 +42,7 @@ RunWindow::RunWindow()
set_minimizable(false); set_minimizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->load_from_gml(run_gml); main_widget->try_load_from_gml(run_gml).release_value_but_fixme_should_propagate_errors();
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_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));

View file

@ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Load widgets. // Load widgets.
auto mainwidget = TRY(window->set_main_widget<GUI::Widget>()); auto mainwidget = TRY(window->set_main_widget<GUI::Widget>());
mainwidget->load_from_gml(space_analyzer_gml); TRY(mainwidget->try_load_from_gml(space_analyzer_gml));
auto& breadcrumbbar = *mainwidget->find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar"); auto& breadcrumbbar = *mainwidget->find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
auto& treemapwidget = *mainwidget->find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map"); auto& treemapwidget = *mainwidget->find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map");
auto& statusbar = *mainwidget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"); auto& statusbar = *mainwidget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");

View file

@ -318,7 +318,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
} }
auto& conditional_fmt_tab = tabs.add_tab<GUI::Widget>("Conditional format"); auto& conditional_fmt_tab = tabs.add_tab<GUI::Widget>("Conditional format");
conditional_fmt_tab.load_from_gml(cond_fmt_gml); conditional_fmt_tab.try_load_from_gml(cond_fmt_gml).release_value_but_fixme_should_propagate_errors();
{ {
auto& view = *conditional_fmt_tab.find_descendant_of_type_named<Spreadsheet::ConditionsView>("conditions_view"); auto& view = *conditional_fmt_tab.find_descendant_of_type_named<Spreadsheet::ConditionsView>("conditions_view");
view.set_formats(&m_conditional_formats); view.set_formats(&m_conditional_formats);
@ -391,7 +391,7 @@ CellTypeMetadata CellTypeDialog::metadata() const
ConditionView::ConditionView(ConditionalFormat& fmt) ConditionView::ConditionView(ConditionalFormat& fmt)
: m_format(fmt) : m_format(fmt)
{ {
load_from_gml(cond_fmt_view_gml); try_load_from_gml(cond_fmt_view_gml).release_value_but_fixme_should_propagate_errors();
auto& fg_input = *find_descendant_of_type_named<GUI::ColorInput>("foreground_input"); auto& fg_input = *find_descendant_of_type_named<GUI::ColorInput>("foreground_input");
auto& bg_input = *find_descendant_of_type_named<GUI::ColorInput>("background_input"); auto& bg_input = *find_descendant_of_type_named<GUI::ColorInput>("background_input");

View file

@ -38,7 +38,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet)
"CSV Export Options", "CSV Export Options",
"Please select the options for the csv file you wish to export to"); "Please select the options for the csv file you wish to export to");
m_page->body_widget().load_from_gml(csv_export_gml); m_page->body_widget().try_load_from_gml(csv_export_gml).release_value_but_fixme_should_propagate_errors();
m_page->set_is_final_page(true); m_page->set_is_final_page(true);
m_delimiter_comma_radio = m_page->body_widget().find_descendant_of_type_named<GUI::RadioButton>("delimiter_comma_radio"); m_delimiter_comma_radio = m_page->body_widget().find_descendant_of_type_named<GUI::RadioButton>("delimiter_comma_radio");
@ -209,7 +209,7 @@ ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, NonnullOwnPtr<Core
page->on_next_page = [] { return nullptr; }; page->on_next_page = [] { return nullptr; };
page->body_widget().load_from_gml(select_format_page_gml); TRY(page->body_widget().try_load_from_gml(select_format_page_gml));
auto format_combo_box = page->body_widget().find_descendant_of_type_named<GUI::ComboBox>("select_format_page_format_combo_box"); auto format_combo_box = page->body_widget().find_descendant_of_type_named<GUI::ComboBox>("select_format_page_format_combo_box");
Vector<DeprecatedString> supported_formats { Vector<DeprecatedString> supported_formats {

View file

@ -32,7 +32,7 @@ CSVImportDialogPage::CSVImportDialogPage(StringView csv)
"CSV Import Options", "CSV Import Options",
"Please select the options for the csv file you wish to import"); "Please select the options for the csv file you wish to import");
m_page->body_widget().load_from_gml(csv_import_gml); m_page->body_widget().try_load_from_gml(csv_import_gml).release_value_but_fixme_should_propagate_errors();
m_page->set_is_final_page(true); m_page->set_is_final_page(true);
m_delimiter_comma_radio = m_page->body_widget().find_descendant_of_type_named<GUI::RadioButton>("delimiter_comma_radio"); m_delimiter_comma_radio = m_page->body_widget().find_descendant_of_type_named<GUI::RadioButton>("delimiter_comma_radio");
@ -254,7 +254,7 @@ Result<NonnullRefPtrVector<Sheet>, DeprecatedString> ImportDialog::make_and_run_
page->on_next_page = [] { return nullptr; }; page->on_next_page = [] { return nullptr; };
page->body_widget().load_from_gml(select_format_page_gml); page->body_widget().try_load_from_gml(select_format_page_gml).release_value_but_fixme_should_propagate_errors();
auto format_combo_box = page->body_widget().find_descendant_of_type_named<GUI::ComboBox>("select_format_page_format_combo_box"); auto format_combo_box = page->body_widget().find_descendant_of_type_named<GUI::ComboBox>("select_format_page_format_combo_box");
Vector<DeprecatedString> supported_formats { Vector<DeprecatedString> supported_formats {

View file

@ -279,7 +279,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(560, 430); window->resize(560, 430);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(system_monitor_gml); TRY(main_widget->try_load_from_gml(system_monitor_gml));
auto& tabwidget = *main_widget->find_descendant_of_type_named<GUI::TabWidget>("main_tabs"); auto& tabwidget = *main_widget->find_descendant_of_type_named<GUI::TabWidget>("main_tabs");
statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"); statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
@ -513,7 +513,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
window->set_icon(app_icon.bitmap_for_size(16)); window->set_icon(app_icon.bitmap_for_size(16));
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(process_window_gml); TRY(main_widget->try_load_from_gml(process_window_gml));
GUI::ModelIndex process_index; GUI::ModelIndex process_index;
for (int row = 0; row < ProcessModel::the().row_count({}); ++row) { for (int row = 0; row < ProcessModel::the().row_count({}); ++row) {

View file

@ -32,7 +32,7 @@
TerminalSettingsMainWidget::TerminalSettingsMainWidget() TerminalSettingsMainWidget::TerminalSettingsMainWidget()
{ {
load_from_gml(terminal_settings_main_gml); try_load_from_gml(terminal_settings_main_gml).release_value_but_fixme_should_propagate_errors();
auto& beep_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("beep_bell_radio"); auto& beep_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("beep_bell_radio");
auto& visual_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("visual_bell_radio"); auto& visual_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("visual_bell_radio");
@ -102,7 +102,7 @@ TerminalSettingsMainWidget::TerminalSettingsMainWidget()
TerminalSettingsViewWidget::TerminalSettingsViewWidget() TerminalSettingsViewWidget::TerminalSettingsViewWidget()
{ {
load_from_gml(terminal_settings_view_gml); try_load_from_gml(terminal_settings_view_gml).release_value_but_fixme_should_propagate_errors();
auto& slider = *find_descendant_of_type_named<GUI::HorizontalOpacitySlider>("background_opacity_slider"); auto& slider = *find_descendant_of_type_named<GUI::HorizontalOpacitySlider>("background_opacity_slider");
m_opacity = Config::read_i32("Terminal"sv, "Window"sv, "Opacity"sv); m_opacity = Config::read_i32("Terminal"sv, "Window"sv, "Opacity"sv);

View file

@ -49,7 +49,7 @@ namespace TextEditor {
MainWidget::MainWidget() MainWidget::MainWidget()
{ {
load_from_gml(text_editor_window_gml); try_load_from_gml(text_editor_window_gml).release_value_but_fixme_should_propagate_errors();
m_toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar"); m_toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar");
m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container"); m_toolbar_container = *find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");

View file

@ -22,7 +22,7 @@
WelcomeWidget::WelcomeWidget() WelcomeWidget::WelcomeWidget()
{ {
load_from_gml(welcome_window_gml); try_load_from_gml(welcome_window_gml).release_value_but_fixme_should_propagate_errors();
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view"); m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_web_view->load(URL::create_with_file_scheme(DeprecatedString::formatted("{}/README.md", Core::StandardPaths::home_directory()))); m_web_view->load(URL::create_with_file_scheme(DeprecatedString::formatted("{}/README.md", Core::StandardPaths::home_directory())));

View file

@ -26,7 +26,7 @@ GalleryWidget::GalleryWidget()
ErrorOr<void> GalleryWidget::load_basic_model_tab() ErrorOr<void> GalleryWidget::load_basic_model_tab()
{ {
auto tab = TRY(m_tab_widget->try_add_tab<GUI::Widget>("Basic Model")); auto tab = TRY(m_tab_widget->try_add_tab<GUI::Widget>("Basic Model"));
tab->load_from_gml(basic_model_tab_gml); TRY(tab->try_load_from_gml(basic_model_tab_gml));
m_basic_model = BasicModel::create(); m_basic_model = BasicModel::create();
m_basic_model_table = *tab->find_descendant_of_type_named<GUI::TableView>("model_table"); m_basic_model_table = *tab->find_descendant_of_type_named<GUI::TableView>("model_table");

View file

@ -28,7 +28,7 @@ DemoWizardDialog::DemoWizardDialog(GUI::Window* parent_window)
"Installation location", "Installation location",
"Choose where Demo Application is installed on your computer.") "Choose where Demo Application is installed on your computer.")
.release_value_but_fixme_should_propagate_errors(); .release_value_but_fixme_should_propagate_errors();
m_page_1->body_widget().load_from_gml(demo_wizard_page_1_gml); m_page_1->body_widget().try_load_from_gml(demo_wizard_page_1_gml).release_value_but_fixme_should_propagate_errors();
m_page_1_location_text_box = m_page_1->body_widget().find_descendant_of_type_named<GUI::TextBox>("page_1_location_text_box"); m_page_1_location_text_box = m_page_1->body_widget().find_descendant_of_type_named<GUI::TextBox>("page_1_location_text_box");
m_page_1->on_next_page = [&]() { m_page_1->on_next_page = [&]() {
return m_page_2; return m_page_2;
@ -39,7 +39,7 @@ DemoWizardDialog::DemoWizardDialog(GUI::Window* parent_window)
"Installation in progress...", "Installation in progress...",
"Please wait. Do not turn off your computer.") "Please wait. Do not turn off your computer.")
.release_value_but_fixme_should_propagate_errors(); .release_value_but_fixme_should_propagate_errors();
m_page_2->body_widget().load_from_gml(demo_wizard_page_2_gml); m_page_2->body_widget().try_load_from_gml(demo_wizard_page_2_gml).release_value_but_fixme_should_propagate_errors();
m_page_2_progressbar = m_page_2->body_widget().find_descendant_of_type_named<GUI::Progressbar>("page_2_progressbar"); m_page_2_progressbar = m_page_2->body_widget().find_descendant_of_type_named<GUI::Progressbar>("page_2_progressbar");
m_page_2_timer = Core::Timer::try_create(this).release_value_but_fixme_should_propagate_errors(); m_page_2_timer = Core::Timer::try_create(this).release_value_but_fixme_should_propagate_errors();
m_page_2->on_page_enter = [&]() { m_page_2->on_page_enter = [&]() {

View file

@ -32,12 +32,12 @@
GalleryWidget::GalleryWidget() GalleryWidget::GalleryWidget()
{ {
load_from_gml(window_gml); try_load_from_gml(window_gml).release_value_but_fixme_should_propagate_errors();
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics").release_value_but_fixme_should_propagate_errors(); auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics").release_value_but_fixme_should_propagate_errors();
basics_tab->load_from_gml(basics_tab_gml); basics_tab->try_load_from_gml(basics_tab_gml).release_value_but_fixme_should_propagate_errors();
m_enabled_label = basics_tab->find_descendant_of_type_named<GUI::Label>("enabled_label"); m_enabled_label = basics_tab->find_descendant_of_type_named<GUI::Label>("enabled_label");
m_label_frame = basics_tab->find_descendant_of_type_named<GUI::Frame>("label_frame"); m_label_frame = basics_tab->find_descendant_of_type_named<GUI::Frame>("label_frame");
@ -170,7 +170,7 @@ GalleryWidget::GalleryWidget()
}; };
auto sliders_tab = tab_widget.try_add_tab<GUI::Widget>("Sliders").release_value_but_fixme_should_propagate_errors(); auto sliders_tab = tab_widget.try_add_tab<GUI::Widget>("Sliders").release_value_but_fixme_should_propagate_errors();
sliders_tab->load_from_gml(sliders_tab_gml); sliders_tab->try_load_from_gml(sliders_tab_gml).release_value_but_fixme_should_propagate_errors();
m_vertical_progressbar_left = sliders_tab->find_descendant_of_type_named<GUI::VerticalProgressbar>("vertical_progressbar_left"); m_vertical_progressbar_left = sliders_tab->find_descendant_of_type_named<GUI::VerticalProgressbar>("vertical_progressbar_left");
m_vertical_progressbar_left->set_value(0); m_vertical_progressbar_left->set_value(0);
@ -231,7 +231,7 @@ GalleryWidget::GalleryWidget()
}; };
auto wizards_tab = tab_widget.try_add_tab<GUI::Widget>("Wizards").release_value_but_fixme_should_propagate_errors(); auto wizards_tab = tab_widget.try_add_tab<GUI::Widget>("Wizards").release_value_but_fixme_should_propagate_errors();
wizards_tab->load_from_gml(wizards_tab_gml); wizards_tab->try_load_from_gml(wizards_tab_gml).release_value_but_fixme_should_propagate_errors();
m_wizard_button = wizards_tab->find_descendant_of_type_named<GUI::Button>("wizard_button"); m_wizard_button = wizards_tab->find_descendant_of_type_named<GUI::Button>("wizard_button");
m_wizard_output = wizards_tab->find_descendant_of_type_named<GUI::TextEditor>("wizard_output"); m_wizard_output = wizards_tab->find_descendant_of_type_named<GUI::TextEditor>("wizard_output");
@ -287,7 +287,7 @@ GalleryWidget::GalleryWidget()
}; };
auto cursors_tab = tab_widget.try_add_tab<GUI::Widget>("Cursors").release_value_but_fixme_should_propagate_errors(); auto cursors_tab = tab_widget.try_add_tab<GUI::Widget>("Cursors").release_value_but_fixme_should_propagate_errors();
cursors_tab->load_from_gml(cursors_tab_gml); cursors_tab->try_load_from_gml(cursors_tab_gml).release_value_but_fixme_should_propagate_errors();
m_cursors_tableview = cursors_tab->find_descendant_of_type_named<GUI::TableView>("cursors_tableview"); m_cursors_tableview = cursors_tab->find_descendant_of_type_named<GUI::TableView>("cursors_tableview");
m_cursors_tableview->set_highlight_selected_rows(true); m_cursors_tableview->set_highlight_selected_rows(true);
@ -310,7 +310,7 @@ GalleryWidget::GalleryWidget()
}; };
auto icons_tab = tab_widget.try_add_tab<GUI::Widget>("Icons").release_value_but_fixme_should_propagate_errors(); auto icons_tab = tab_widget.try_add_tab<GUI::Widget>("Icons").release_value_but_fixme_should_propagate_errors();
icons_tab->load_from_gml(icons_tab_gml); icons_tab->try_load_from_gml(icons_tab_gml).release_value_but_fixme_should_propagate_errors();
m_icons_tableview = icons_tab->find_descendant_of_type_named<GUI::TableView>("icons_tableview"); m_icons_tableview = icons_tab->find_descendant_of_type_named<GUI::TableView>("icons_tableview");
m_icons_tableview->set_highlight_selected_rows(true); m_icons_tableview->set_highlight_selected_rows(true);

View file

@ -119,7 +119,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
editor->on_change = [&] { editor->on_change = [&] {
preview->remove_all_children(); preview->remove_all_children();
preview->load_from_gml(editor->text(), [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::Object>> { // FIXME: Parsing errors happen while the user is typing. What should we do about them?
(void)preview->try_load_from_gml(editor->text(), [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return UnregisteredWidget::try_create(class_name); return UnregisteredWidget::try_create(class_name);
}); });
}; };

View file

@ -18,7 +18,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
set_icon(parent->icon()); set_icon(parent->icon());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(git_commit_dialog_gml); widget->try_load_from_gml(git_commit_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_message_editor = widget->find_descendant_of_type_named<GUI::TextEditor>("message_editor"); 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_cancel_button = widget->find_descendant_of_type_named<GUI::Button>("cancel_button");

View file

@ -50,7 +50,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
set_title("New project"); set_title("New project");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->load_from_gml(new_project_dialog_gml); main_widget->try_load_from_gml(new_project_dialog_gml).release_value_but_fixme_should_propagate_errors();
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 = m_icon_view_container->add<GUI::IconView>();

View file

@ -27,7 +27,8 @@ void GMLPreviewWidget::load_gml(DeprecatedString const& gml)
return; return;
} }
load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> { // FIXME: Parsing errors happen while the user is typing. What should we do about them?
(void)try_load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return GUI::Label::try_create(DeprecatedString::formatted("{} is not registered as a GML element!", name)); return GUI::Label::try_create(DeprecatedString::formatted("{} is not registered as a GML element!", name));
}); });

View file

@ -61,8 +61,7 @@ static Vector<DeprecatedString> lookup_database_names()
MainWidget::MainWidget() MainWidget::MainWidget()
{ {
if (!load_from_gml(sql_studio_gml)) try_load_from_gml(sql_studio_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
open_new_script(); open_new_script();

View file

@ -26,8 +26,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
set_resizable(false); set_resizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); 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)) main_widget->try_load_from_gml(game_size_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
auto board_size_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_size_spinbox"); auto board_size_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_size_spinbox");
board_size_spinbox->set_value(m_board_size); 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); window->resize(315, 336);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
if (!main_widget->load_from_gml(game_window_gml)) TRY(main_widget->try_load_from_gml(game_window_gml));
VERIFY_NOT_REACHED();
Game game { board_size, target_tile, evil_ai }; 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); set_resizable(false);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(settings_dialog_gml)) main_widget->try_load_from_gml(settings_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
auto board_rows_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_rows_spinbox"); auto board_rows_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_rows_spinbox");
board_rows_spinbox->set_value(m_board_rows); 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); window->resize(304, 325);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
if (!main_widget->load_from_gml(flood_window_gml)) TRY(main_widget->try_load_from_gml(flood_window_gml));
VERIFY_NOT_REACHED();
auto board_widget = TRY(main_widget->find_descendant_of_type_named<GUI::Widget>("board_widget_container")->try_add<BoardWidget>(board_rows, board_columns)); 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(); board_widget->board()->randomize();

View file

@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Game Of Life"); window->set_title("Game Of Life");
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); 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); main_widget->set_fill_with_background_color(true);
auto& main_toolbar = *main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar"); 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"); window->set_title("Hearts");
auto widget = TRY(window->set_main_widget<GUI::Widget>()); 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"); auto& game = *widget->find_descendant_of_type_named<Hearts::Game>("game");
game.set_focus(true); game.set_focus(true);

View file

@ -47,7 +47,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_resizable(false); window->set_resizable(false);
auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); 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& game = *main_widget->find_descendant_of_type_named<MasterWord::WordGame>("word_game");
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"); 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"); set_title("Custom game");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); 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)) main_widget->try_load_from_gml(minesweeper_custom_game_window_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_columns_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("columns_spinbox"); 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"); 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); window->resize(139, 177);
auto widget = TRY(window->set_main_widget<GUI::Widget>()); 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& separator = *widget->find_descendant_of_type_named<GUI::HorizontalSeparator>("separator");
auto& container = *widget->find_descendant_of_type_named<GUI::Widget>("container"); auto& container = *widget->find_descendant_of_type_named<GUI::Widget>("container");

View file

@ -93,8 +93,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
, m_category_action_group(make<ActionGroup>()) , m_category_action_group(make<ActionGroup>())
{ {
auto main_widget = set_main_widget<Frame>().release_value_but_fixme_should_propagate_errors(); auto main_widget = set_main_widget<Frame>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(emoji_input_dialog_gml)) main_widget->try_load_from_gml(emoji_input_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
set_window_type(GUI::WindowType::Popup); set_window_type(GUI::WindowType::Popup);
set_window_mode(GUI::WindowMode::Modeless); set_window_mode(GUI::WindowMode::Modeless);

View file

@ -85,8 +85,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
resize(560, 320); resize(560, 320);
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!widget->load_from_gml(file_picker_dialog_gml)) widget->try_load_from_gml(file_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
auto& toolbar = *widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar"); auto& toolbar = *widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar");

View file

@ -27,8 +27,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors()); set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
if (!widget->load_from_gml(font_picker_dialog_gml)) widget->try_load_from_gml(font_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED();
m_family_list_view = *widget->find_descendant_of_type_named<ListView>("family_list_view"); m_family_list_view = *widget->find_descendant_of_type_named<ListView>("family_list_view");
m_family_list_view->set_model(ItemListModel<DeprecatedString>::create(m_families)); m_family_list_view->set_model(ItemListModel<DeprecatedString>::create(m_families));

View file

@ -19,7 +19,7 @@ namespace GUI {
IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor) IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor)
: m_editor(editor) : m_editor(editor)
{ {
load_from_gml(incremental_search_banner_gml); try_load_from_gml(incremental_search_banner_gml).release_value_but_fixme_should_propagate_errors();
m_index_label = find_descendant_of_type_named<Label>("incremental_search_banner_index_label"); m_index_label = find_descendant_of_type_named<Label>("incremental_search_banner_index_label");
m_wrap_search_button = find_descendant_of_type_named<Button>("incremental_search_banner_wrap_search_button"); m_wrap_search_button = find_descendant_of_type_named<Button>("incremental_search_banner_wrap_search_button");

View file

@ -23,8 +23,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
set_title(move(title)); set_title(move(title));
auto widget = set_main_widget<Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<Widget>().release_value_but_fixme_should_propagate_errors();
widget->try_load_from_gml(password_input_dialog_gml).release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(password_input_dialog_gml);
auto& key_icon_label = *widget->find_descendant_of_type_named<GUI::Label>("key_icon_label"); auto& key_icon_label = *widget->find_descendant_of_type_named<GUI::Label>("key_icon_label");

View file

@ -21,7 +21,7 @@ LoginWindow::LoginWindow(GUI::Window* parent)
set_icon(GUI::Icon::default_icon("ladyball"sv).bitmap_for_size(16)); set_icon(GUI::Icon::default_icon("ladyball"sv).bitmap_for_size(16));
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors(); auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(login_window_gml); widget->try_load_from_gml(login_window_gml).release_value_but_fixme_should_propagate_errors();
m_banner = *widget->find_descendant_of_type_named<GUI::ImageWidget>("banner"); m_banner = *widget->find_descendant_of_type_named<GUI::ImageWidget>("banner");
m_banner->load_from_file("/res/graphics/brand-banner.png"sv); m_banner->load_from_file("/res/graphics/brand-banner.png"sv);
m_banner->set_auto_resize(true); m_banner->set_auto_resize(true);