1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()

This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
This commit is contained in:
Andreas Kling 2021-11-06 16:25:29 +01:00
parent 16f064d9be
commit 235f39e449
104 changed files with 412 additions and 397 deletions

View file

@ -92,7 +92,7 @@ MainWidget::MainWidget()
};
m_wrap_around_checkbox->set_checked(true);
m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"), [&](auto&) {
m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
auto needle = m_find_textbox->text();
if (needle.is_empty())
return;
@ -111,7 +111,7 @@ MainWidget::MainWidget()
}
});
m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"), [&](auto&) {
m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
auto needle = m_find_textbox->text();
if (needle.is_empty())
return;
@ -174,11 +174,11 @@ MainWidget::MainWidget()
m_find_previous_button = *find_descendant_of_type_named<GUI::Button>("find_previous_button");
m_find_previous_button->set_action(*m_find_previous_action);
m_find_previous_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"));
m_find_previous_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png").release_value_but_fixme_should_propagate_errors());
m_find_next_button = *find_descendant_of_type_named<GUI::Button>("find_next_button");
m_find_next_button->set_action(*m_find_next_action);
m_find_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"));
m_find_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png").release_value_but_fixme_should_propagate_errors());
m_find_textbox->on_return_pressed = [this] {
m_find_next_button->click();
@ -212,7 +212,7 @@ MainWidget::MainWidget()
});
m_vim_emulation_setting_action->set_checked(false);
m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [this](auto&) {
m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
m_find_replace_widget->set_visible(true);
m_find_widget->set_visible(true);
m_replace_widget->set_visible(true);
@ -245,7 +245,7 @@ MainWidget::MainWidget()
m_editor->on_cursor_change = [this] { update_statusbar(); };
m_editor->on_selection_change = [this] { update_statusbar(); };
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [this](GUI::Action const&) {
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
if (editor().document().is_modified()) {
auto save_document_first_result = GUI::MessageBox::show(window(), "Save changes to current document first?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
@ -448,7 +448,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
view_menu.add_separator();
view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"),
view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(),
[&](auto&) {
auto picker = GUI::FontPicker::construct(&window, &m_editor->font(), false);
if (picker->exec() == GUI::Dialog::ExecOK) {