1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +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

@ -202,10 +202,10 @@ static RefPtr<GUI::Window> create_find_window(VT::TerminalWidget& terminal)
find_textbox.set_text(terminal.selected_text().replace("\n", " ", true));
auto& find_backwards = find.add<GUI::Button>();
find_backwards.set_fixed_width(25);
find_backwards.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"));
find_backwards.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors());
auto& find_forwards = find.add<GUI::Button>();
find_forwards.set_fixed_width(25);
find_forwards.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"));
find_forwards.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors());
find_textbox.on_return_pressed = [&]() {
find_backwards.click();
@ -345,7 +345,7 @@ int main(int argc, char** argv)
auto new_scrollback_size = Config::read_i32("Terminal", "Terminal", "MaxHistorySize", terminal.max_history_size());
terminal.set_max_history_size(new_scrollback_size);
auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"),
auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(),
[&](const GUI::Action&) {
if (!settings_window)
settings_window = create_settings_window(terminal);
@ -369,7 +369,7 @@ int main(int argc, char** argv)
});
terminal.context_menu().add_separator();
auto pick_font_action = GUI::Action::create("&Terminal Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"),
auto pick_font_action = GUI::Action::create("&Terminal 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, &terminal.font(), true);
if (picker->exec() == GUI::Dialog::ExecOK) {
@ -385,7 +385,7 @@ int main(int argc, char** argv)
terminal.context_menu().add_action(open_settings_action);
auto& file_menu = window->add_menu("&File");
file_menu.add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) {
file_menu.add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
Core::Process::spawn("/bin/Terminal");
}));
@ -400,7 +400,7 @@ int main(int argc, char** argv)
edit_menu.add_action(terminal.copy_action());
edit_menu.add_action(terminal.paste_action());
edit_menu.add_separator();
edit_menu.add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"),
edit_menu.add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(),
[&](auto&) {
if (!find_window)
find_window = create_find_window(terminal);