diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-06 16:25:29 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:35:27 +0100 |
commit | 235f39e449ebffed26114c7166b0b632a3f2232e (patch) | |
tree | 3f61715fe8ba3e801803bde270ca4aeca74fd9f5 /Userland/Applications | |
parent | 16f064d9bea97b499843e1a90a545a738d9c35fd (diff) | |
download | serenity-235f39e449ebffed26114c7166b0b632a3f2232e.zip |
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().
Diffstat (limited to 'Userland/Applications')
41 files changed, 144 insertions, 142 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 2731d16ee3..0785a1b240 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -250,7 +250,9 @@ bool GLContextWidget::load_file(Core::File& file, String const& filename) // Attempt to open the texture file from disk RefPtr<Gfx::Bitmap> texture_image; if (Core::File::exists(texture_path)) { - texture_image = Gfx::Bitmap::try_load_from_file(texture_path); + auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(texture_path); + if (!bitmap_or_error.is_error()) + texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors(); } else { auto result = FileSystemAccessClient::Client::the().request_file(window()->window_id(), builder.string_view(), Core::OpenMode::ReadOnly); @@ -258,7 +260,9 @@ bool GLContextWidget::load_file(Core::File& file, String const& filename) return false; } - texture_image = Gfx::Bitmap::try_load_from_fd_and_close(*result.fd, *result.chosen_file); + auto bitmap_or_error = Gfx::Bitmap::try_load_from_fd_and_close(*result.fd, *result.chosen_file); + if (!bitmap_or_error.is_error()) + texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors(); } GLuint tex; diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 60552fff6e..cb26df6293 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -190,7 +190,7 @@ void BookmarksBarWidget::model_did_update(unsigned) button.set_button_style(Gfx::ButtonStyle::Coolbar); button.set_text(title); - button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png")); + button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png").release_value_but_fixme_should_propagate_errors()); button.set_fixed_size(font().width(title) + 32, 20); button.set_relative_rect(rect); button.set_focus_policy(GUI::FocusPolicy::TabFocus); @@ -242,7 +242,7 @@ void BookmarksBarWidget::update_content_size() auto& bookmark = m_bookmarks.at(i); bookmark.set_visible(false); m_additional_menu->add_action(GUI::Action::create(bookmark.text(), - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { bookmark.on_click(0); })); diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 32f8ea12ea..28950e72ce 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -238,7 +238,7 @@ void BrowserWindow::build_menus() m_search_engine_actions.set_exclusive(true); auto& search_engine_menu = settings_menu.add_submenu("&Search Engine"); - search_engine_menu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png")); + search_engine_menu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors()); bool search_engine_set = false; auto add_search_engine = [&](auto& name, auto& url_format) { auto action = GUI::Action::create_checkable( @@ -301,7 +301,7 @@ void BrowserWindow::build_menus() } auto& color_scheme_menu = settings_menu.add_submenu("&Color Scheme"); - color_scheme_menu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png")); + color_scheme_menu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png").release_value_but_fixme_should_propagate_errors()); { auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser", "Preferences", "ColorScheme", "auto")); m_color_scheme_actions.set_exclusive(true); diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 5c0f961ef7..171c0750a7 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -60,7 +60,7 @@ ConsoleWidget::ConsoleWidget() auto& clear_button = bottom_container.add<GUI::Button>(); clear_button.set_fixed_size(22, 22); - clear_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png")); + clear_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors()); clear_button.set_tooltip("Clear the console output"); clear_button.on_click = [this](auto) { clear_output(); diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 098e3eadb4..91373c4d0b 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -73,7 +73,7 @@ void Tab::view_source(const URL& url, const String& source) editor.set_ruler_visible(true); window->resize(640, 480); window->set_title(url.to_string()); - window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png")); + window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png").release_value_but_fixme_should_propagate_errors()); window->show(); } @@ -98,7 +98,7 @@ Tab::Tab(BrowserWindow& window) for (auto& url : m_history.get_back_title_history()) { i++; m_go_back_context_menu->add_action(GUI::Action::create(url.to_string(), - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png").release_value_but_fixme_should_propagate_errors(), [this, i](auto&) { go_back(i); })); } m_go_back_context_menu->popup(context_menu_event.screen_position()); @@ -113,7 +113,7 @@ Tab::Tab(BrowserWindow& window) for (auto& url : m_history.get_forward_title_history()) { i++; m_go_forward_context_menu->add_action(GUI::Action::create(url.to_string(), - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png").release_value_but_fixme_should_propagate_errors(), [this, i](auto&) { go_forward(i); })); } m_go_forward_context_menu->popup(context_menu_event.screen_position()); @@ -148,7 +148,7 @@ Tab::Tab(BrowserWindow& window) m_bookmark_button = toolbar.add<GUI::Button>(); m_bookmark_button->set_button_style(Gfx::ButtonStyle::Coolbar); m_bookmark_button->set_focus_policy(GUI::FocusPolicy::TabFocus); - m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png")); + m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png").release_value_but_fixme_should_propagate_errors()); m_bookmark_button->set_fixed_size(22, 22); m_bookmark_button->on_click = [this](auto) { @@ -411,10 +411,10 @@ void Tab::bookmark_current_url() void Tab::update_bookmark_button(const String& url) { if (BookmarksBarWidget::the().contains_bookmark(url)) { - m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png")); + m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png").release_value_but_fixme_should_propagate_errors()); m_bookmark_button->set_tooltip("Remove Bookmark"); } else { - m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png")); + m_bookmark_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png").release_value_but_fixme_should_propagate_errors()); m_bookmark_button->set_tooltip("Add Bookmark"); } } @@ -483,7 +483,7 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target) auto window = GUI::Window::construct(&this->window()); window->resize(300, 500); window->set_title("Inspector"); - window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png")); + window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors()); window->on_close = [&]() { m_web_content_view->clear_inspected_dom_node(); }; @@ -512,7 +512,7 @@ void Tab::show_console_window() auto console_window = GUI::Window::construct(&window()); console_window->resize(500, 300); console_window->set_title("JS Console"); - console_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png")); + console_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png").release_value_but_fixme_should_propagate_errors()); m_console_widget = console_window->set_main_widget<ConsoleWidget>(); m_console_widget->on_js_input = [this](String const& js_source) { m_web_content_view->js_console_input(js_source); diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index 294f0c6950..d91f7cfb16 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -24,7 +24,7 @@ WindowActions::WindowActions(GUI::Window& window) VERIFY(!s_the); s_the = this; m_create_new_tab_action = GUI::Action::create( - "&New Tab", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"), [this](auto&) { + "&New Tab", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (on_create_new_tab) on_create_new_tab(); }, diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp index ec48c5e48a..7e74b373b5 100644 --- a/Userland/Applications/Calendar/main.cpp +++ b/Userland/Applications/Calendar/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char** argv) 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 prev_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"), [&](const GUI::Action&) { + auto prev_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { unsigned view_month = calendar->view_month(); unsigned view_year = calendar->view_year(); if (calendar->mode() == GUI::Calendar::Month) { @@ -68,7 +68,7 @@ int main(int argc, char** argv) calendar->update_tiles(view_year, view_month); }); - auto next_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"), [&](const GUI::Action&) { + auto next_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { unsigned view_month = calendar->view_month(); unsigned view_year = calendar->view_year(); if (calendar->mode() == GUI::Calendar::Month) { @@ -83,22 +83,22 @@ int main(int argc, char** argv) calendar->update_tiles(view_year, view_month); }); - auto add_event_action = GUI::Action::create("&Add Event", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"), [&](const GUI::Action&) { + auto add_event_action = GUI::Action::create("&Add Event", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { AddEventDialog::show(calendar->selected_date(), window); }); - auto jump_to_action = GUI::Action::create("Jump to &Today", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"), [&](const GUI::Action&) { + auto jump_to_action = GUI::Action::create("Jump to &Today", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { calendar->set_selected_date(Core::DateTime::now()); calendar->update_tiles(Core::DateTime::now().year(), Core::DateTime::now().month()); }); - auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-month-view.png"), [&](const GUI::Action&) { + auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-month-view.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { if (calendar->mode() == GUI::Calendar::Year) calendar->toggle_mode(); }); view_month_action->set_checked(true); - auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) { + auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { if (calendar->mode() == GUI::Calendar::Month) calendar->toggle_mode(); }); @@ -126,7 +126,7 @@ int main(int argc, char** argv) }; auto& file_menu = window->add_menu("&File"); - file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"), + file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { AddEventDialog::show(calendar->selected_date(), window); })); diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp index d60d925690..032808f5f9 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp @@ -65,7 +65,7 @@ void BackgroundSettingsWidget::create_frame() }; m_context_menu = GUI::Menu::construct(); - m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"), [this](GUI::Action const&) { + m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) { LexicalPath path { m_monitor_widget->wallpaper() }; Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename())); }); diff --git a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp index 3ac98d014a..920f23a0fc 100644 --- a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp @@ -30,7 +30,7 @@ void DesktopSettingsWidget::create_frame() load_from_gml(desktop_settings_gml); auto& light_bulb_label = *find_descendant_of_type_named<GUI::Label>("light_bulb_label"); - light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png")); + light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png").release_value_but_fixme_should_propagate_errors()); m_virtual_desktop_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("virtual_desktop_rows_spinbox"); m_virtual_desktop_columns_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("virtual_desktop_columns_spinbox"); diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index efdbccc5f9..dc958bee1d 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -19,7 +19,7 @@ namespace DisplaySettings { MonitorWidget::MonitorWidget() { m_desktop_resolution = GUI::Desktop::the().rect().size(); - m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png"); + m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png").release_value_but_fixme_should_propagate_errors(); m_desktop_bitmap = Gfx::Bitmap::try_create(m_monitor_bitmap->format(), { 280, 158 }); m_monitor_rect = { { 12, 13 }, m_desktop_bitmap->size() }; set_fixed_size(304, 201); @@ -34,7 +34,7 @@ bool MonitorWidget::set_wallpaper(String path) [path](auto&) { RefPtr<Gfx::Bitmap> bmp; if (!path.is_empty()) - bmp = Gfx::Bitmap::try_load_from_file(path); + bmp = Gfx::Bitmap::try_load_from_file(path).release_value_but_fixme_should_propagate_errors(); return bmp; }, diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 607144cfa8..b076fb7393 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -534,7 +534,7 @@ void DirectoryView::handle_selection_change() void DirectoryView::setup_actions() { - m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [&](GUI::Action const&) { + m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecOK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); @@ -546,7 +546,7 @@ void DirectoryView::setup_actions() } }); - m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [&](GUI::Action const&) { + m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecOK && !value.is_empty()) { auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); @@ -572,7 +572,7 @@ void DirectoryView::setup_actions() } }); - m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) { + m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { spawn_terminal(path()); }); @@ -588,21 +588,21 @@ void DirectoryView::setup_actions() window()); m_view_as_icons_action = GUI::Action::create_checkable( - "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"), [&](GUI::Action const&) { + "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Icon); Config::write_string("FileManager", "DirectoryView", "ViewMode", "Icon"); }, window()); m_view_as_table_action = GUI::Action::create_checkable( - "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"), [&](GUI::Action const&) { + "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Table); Config::write_string("FileManager", "DirectoryView", "ViewMode", "Table"); }, window()); m_view_as_columns_action = GUI::Action::create_checkable( - "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"), [&](GUI::Action const&) { + "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Columns); Config::write_string("FileManager", "DirectoryView", "ViewMode", "Columns"); }, diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 4daf9d2830..dbff9c91f6 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -39,7 +39,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind set_rect({ 0, 0, 360, 420 }); set_resizable(false); - set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png")); + set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png").release_value_but_fixme_should_propagate_errors()); auto& tab_widget = main_widget.add<GUI::TabWidget>(); diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index b2ae3dae75..7f3a91628a 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -353,7 +353,7 @@ int run_in_desktop_mode() auto desktop_view_context_menu = GUI::Menu::construct("Directory View"); - auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"), [&](auto&) { + auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto paths = directory_view.selected_file_paths(); if (paths.is_empty()) { Desktop::Launcher::open(URL::create_with_file_protocol(directory_view.path())); @@ -366,7 +366,7 @@ int run_in_desktop_mode() } }); - auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) { + auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto paths = directory_view.selected_file_paths(); if (paths.is_empty()) { spawn_terminal(directory_view.path()); @@ -380,7 +380,7 @@ int run_in_desktop_mode() } }); - auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"), [&](GUI::Action const&) { + auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { Desktop::Launcher::open(URL::create_with_file_protocol("/bin/DisplaySettings")); }); @@ -563,7 +563,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) auto directory_view_context_menu = GUI::Menu::construct("Directory View"); auto tree_view_directory_context_menu = GUI::Menu::construct("Tree View Directory"); - auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](GUI::Action const&) { + auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { directory_view.open_parent_directory(); }); @@ -690,7 +690,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) = GUI::Action::create( "Open in New &Window", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { Vector<String> paths; if (action.activator() == tree_view_directory_context_menu) @@ -709,7 +709,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) = GUI::Action::create( "Open in &Terminal", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { Vector<String> paths; if (action.activator() == tree_view_directory_context_menu) @@ -729,7 +729,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) = GUI::Action::create( "Create Desktop &Shortcut", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png"), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { auto paths = directory_view.selected_file_paths(); if (paths.is_empty()) { @@ -836,12 +836,12 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) }); focus_dependent_delete_action->set_enabled(false); - auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [&](GUI::Action const&) { + auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { directory_view.mkdir_action().activate(); refresh_tree_view(); }); - auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [&](GUI::Action const&) { + auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { directory_view.touch_action().activate(); refresh_tree_view(); }); @@ -1042,7 +1042,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) || !directory_view.current_view().selection().is_empty()); }; - auto directory_open_action = GUI::Action::create("Open", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"), [&](auto&) { + auto directory_open_action = GUI::Action::create("Open", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { directory_view.open(directory_view.selected_file_paths().first()); }); diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index c0a40b32e4..9f159ba152 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -92,7 +92,7 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor) }; auto& reload_button = textbox_button_container.add<GUI::Button>(); - reload_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png")); + reload_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png").release_value_but_fixme_should_propagate_errors()); reload_button.set_fixed_width(22); reload_button.on_click = [&](auto) { static int i = 1; @@ -131,7 +131,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& m_glyph_editor_widget = m_glyph_editor_container->add<GlyphEditorWidget>(); m_glyph_map_widget = glyph_map_container.add<GlyphMapWidget>(); - m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png"), [&](auto&) { + m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { if (window()->is_modified()) { auto result = GUI::MessageBox::show(window(), "Save changes to the current font?", "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel); if (result == GUI::Dialog::ExecResult::ExecYes) { @@ -214,7 +214,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& m_redo_action = GUI::CommonActions::make_redo_action([&](auto&) { redo(); }); - m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [&](auto&) { + m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { if (!m_font_preview_window) m_font_preview_window = create_font_preview_window(*this); m_font_preview_window->show(); @@ -227,7 +227,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& }); m_show_metadata_action->set_checked(true); m_show_metadata_action->set_status_tip("Show or hide metadata about the current font"); - m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"), [&](auto&) { + m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { String input; if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to Glyph") == GUI::InputBox::ExecOK && !input.is_empty()) { int code_point = strtoul(&input[0], nullptr, 16); @@ -238,7 +238,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& } }); m_go_to_glyph_action->set_status_tip("Go to the specified code point"); - m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"), [&](auto&) { + m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { bool search_wrapped = false; for (int i = m_glyph_map_widget->selected_glyph() - 1;; --i) { if (i < 0 && !search_wrapped) { @@ -256,7 +256,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& } }); m_previous_glyph_action->set_status_tip("Seek the previous visible glyph"); - m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"), [&](auto&) { + m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { bool search_wrapped = false; for (int i = m_glyph_map_widget->selected_glyph() + 1;; ++i) { if (i > 0x10FFFF && !search_wrapped) { @@ -327,7 +327,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& m_glyph_editor_widget->set_mode(GlyphEditorWidget::Paint); }; move_glyph_button.set_checkable(true); - move_glyph_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png")); + move_glyph_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png").release_value_but_fixme_should_propagate_errors()); GUI::Clipboard::the().on_change = [&](const String& data_type) { m_paste_action->set_enabled(data_type == "glyph/x-fonteditor"); diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 3d6eb29a7e..353502cd49 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -25,9 +25,9 @@ static ManualSectionNode s_sections[] = { ManualModel::ManualModel() { - m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png")); - m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png")); - m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png")); + m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); + m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png").release_value_but_fixme_should_propagate_errors()); + m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors()); } Optional<GUI::ModelIndex> ManualModel::index_from_path(const StringView& path) const diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index a307b8a481..60f521fd34 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -69,7 +69,7 @@ HexEditorWidget::HexEditorWidget() m_editor->update(); }; - m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { + 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](const GUI::Action&) { String value; if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecOK && !value.is_empty()) { auto file_size = value.to_int(); @@ -149,7 +149,7 @@ HexEditorWidget::HexEditorWidget() dbgln("Wrote document to {}", *response.chosen_file); }); - m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [&](const GUI::Action&) { + m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { auto old_buffer = m_search_buffer; bool find_all = false; if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecOK) { @@ -186,7 +186,7 @@ HexEditorWidget::HexEditorWidget() } }); - m_goto_offset_action = GUI::Action::create("&Go to Offset ...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"), [this](const GUI::Action&) { + m_goto_offset_action = GUI::Action::create("&Go to Offset ...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { int new_offset; auto result = GoToOffsetDialog::show( window(), @@ -253,7 +253,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) edit_menu.add_action(GUI::Action::create("Copy &Hex", { Mod_Ctrl, Key_C }, [&](const GUI::Action&) { m_editor->copy_selected_hex_to_clipboard(); })); - edit_menu.add_action(GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"), [&](const GUI::Action&) { + edit_menu.add_action(GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { m_editor->copy_selected_text_to_clipboard(); })); edit_menu.add_action(GUI::Action::create("Copy as &C Code", { Mod_Alt | Mod_Shift, Key_C }, [&](const GUI::Action&) { @@ -261,7 +261,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) })); edit_menu.add_separator(); edit_menu.add_action(*m_find_action); - edit_menu.add_action(GUI::Action::create("Find &Next", { Mod_None, Key_F3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"), [&](const GUI::Action&) { + edit_menu.add_action(GUI::Action::create("Find &Next", { Mod_None, Key_F3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { if (m_search_text.is_empty() || m_search_buffer.is_empty()) { GUI::MessageBox::show(&window, "Nothing to search for", "Not found", GUI::MessageBox::Type::Warning); return; @@ -276,7 +276,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) m_last_found_index = result.value(); })); - edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [&](const GUI::Action&) { + edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { int min_length = 4; auto matches = m_editor->find_all_strings(min_length); m_search_results->set_model(*new SearchResultsModel(move(matches))); diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index c755d45c3e..95a3167f63 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -187,22 +187,22 @@ int main(int argc, char** argv) GUI::Desktop::the().set_wallpaper(widget.path()); }); - auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-first.png"), + auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-first.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { widget.navigate(ViewWidget::Directions::First); }); - auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"), + auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { widget.navigate(ViewWidget::Directions::Back); }); - auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"), + auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { widget.navigate(ViewWidget::Directions::Forward); }); - auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"), + auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { widget.navigate(ViewWidget::Directions::Last); }); diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp index 737a9fb927..eb80315f8c 100644 --- a/Userland/Applications/Mail/MailboxTreeModel.cpp +++ b/Userland/Applications/Mail/MailboxTreeModel.cpp @@ -10,9 +10,9 @@ MailboxTreeModel::MailboxTreeModel(AccountHolder const& account_holder) : m_account_holder(account_holder) { - m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mail.png")); - m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-folder.png")); - m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/home-directory.png")); + m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mail.png").release_value_but_fixme_should_propagate_errors()); + m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-folder.png").release_value_but_fixme_should_propagate_errors()); + m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/home-directory.png").release_value_but_fixme_should_propagate_errors()); } MailboxTreeModel::~MailboxTreeModel() diff --git a/Userland/Applications/MailSettings/MailSettingsWindow.cpp b/Userland/Applications/MailSettings/MailSettingsWindow.cpp index 8f5444b809..29f7405840 100644 --- a/Userland/Applications/MailSettings/MailSettingsWindow.cpp +++ b/Userland/Applications/MailSettings/MailSettingsWindow.cpp @@ -57,10 +57,10 @@ MailSettingsWindow::MailSettingsWindow() mail_widget.load_from_gml(mail_settings_window_gml); auto& server_settings_image_label = *main_widget.find_descendant_of_type_named<GUI::Label>("server_settings_image_label"); - server_settings_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mail-server-settings.png")); + server_settings_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mail-server-settings.png").release_value_but_fixme_should_propagate_errors()); auto& user_settings_image_label = *main_widget.find_descendant_of_type_named<GUI::Label>("user_settings_image_label"); - user_settings_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mail-user-settings.png")); + user_settings_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mail-user-settings.png").release_value_but_fixme_should_propagate_errors()); m_server_inputbox = *main_widget.find_descendant_of_type_named<GUI::TextBox>("server_input"); m_server_inputbox->set_text(Config::read_string("Mail", "Connection", "Server", "")); diff --git a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp index 8047bb19b3..a72ad35010 100644 --- a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp +++ b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp @@ -27,7 +27,7 @@ void DoubleClickArrowWidget::set_double_click_speed(int speed) DoubleClickArrowWidget::DoubleClickArrowWidget() { - m_arrow_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/double-click-down-arrow.png"); + m_arrow_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/double-click-down-arrow.png").release_value_but_fixme_should_propagate_errors(); } void DoubleClickArrowWidget::paint_event(GUI::PaintEvent& event) diff --git a/Userland/Applications/MouseSettings/MouseWidget.cpp b/Userland/Applications/MouseSettings/MouseWidget.cpp index afae4b45d8..0816f0bb33 100644 --- a/Userland/Applications/MouseSettings/MouseWidget.cpp +++ b/Userland/Applications/MouseSettings/MouseWidget.cpp @@ -32,10 +32,10 @@ MouseWidget::MouseWidget() m_speed_slider->set_value(slider_value); auto& cursor_speed_image_label = *find_descendant_of_type_named<GUI::Label>("cursor_speed_image_label"); - cursor_speed_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mouse-cursor-speed.png")); + cursor_speed_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/mouse-cursor-speed.png").release_value_but_fixme_should_propagate_errors()); auto& scroll_step_size_image_label = *find_descendant_of_type_named<GUI::Label>("scroll_step_size_image_label"); - scroll_step_size_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/scroll-wheel-step-size.png")); + scroll_step_size_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/scroll-wheel-step-size.png").release_value_but_fixme_should_propagate_errors()); m_scroll_length_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox"); m_scroll_length_spinbox->set_min(WindowServer::scroll_step_size_min); @@ -54,7 +54,7 @@ MouseWidget::MouseWidget() m_switch_buttons_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("switch_buttons_input"); m_switch_buttons_checkbox->set_checked(GUI::WindowServerConnection::the().get_buttons_switched()); auto& switch_buttons_image_label = *find_descendant_of_type_named<GUI::Label>("switch_buttons_image_label"); - switch_buttons_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/switch-mouse-buttons.png")); + switch_buttons_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/graphics/switch-mouse-buttons.png").release_value_but_fixme_should_propagate_errors()); } void MouseWidget::update_window_server() diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index cab8736420..cb7b498881 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -63,7 +63,7 @@ void MouseCursorModel::invalidate() cursor.name = LexicalPath::basename(cursor.path); // FIXME: Animated cursor bitmaps - auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); + auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path).release_value_but_fixme_should_propagate_errors(); auto cursor_bitmap_rect = cursor_bitmap->rect(); cursor.params = Gfx::CursorParams::parse_from_filename(cursor.name, cursor_bitmap_rect.center()).constrained(*cursor_bitmap); cursor.bitmap = cursor_bitmap->cropped(Gfx::IntRect(Gfx::FloatRect(cursor_bitmap_rect).scaled(1.0 / cursor.params.frames(), 1.0))).release_value_but_fixme_should_propagate_errors(); diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp index be56f63140..ad4d770416 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.cpp +++ b/Userland/Applications/PDFViewer/OutlineModel.cpp @@ -15,8 +15,8 @@ NonnullRefPtr<OutlineModel> OutlineModel::create(const NonnullRefPtr<PDF::Outlin OutlineModel::OutlineModel(const NonnullRefPtr<PDF::OutlineDict>& outline) : m_outline(outline) { - m_closed_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png")); - m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png")); + m_closed_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png").release_value_but_fixme_should_propagate_errors()); + m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); } void OutlineModel::set_index_open_state(const GUI::ModelIndex& index, bool is_open) diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index b32dddb975..7e6b13c78f 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -66,7 +66,7 @@ void PDFViewerWidget::create_toolbar() auto& toolbar = toolbar_container.add<GUI::Toolbar>(); auto open_outline_action = GUI::Action::create( - "Open &Sidebar", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"), [&](auto& action) { + "Open &Sidebar", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png").release_value_but_fixme_should_propagate_errors(), [&](auto& action) { m_sidebar_open = !m_sidebar_open; m_sidebar->set_fixed_width(m_sidebar_open ? 0 : 200); action.set_text(m_sidebar_open ? "Open &Sidebar" : "Close &Sidebar"); @@ -78,13 +78,13 @@ void PDFViewerWidget::create_toolbar() toolbar.add_action(*open_outline_action); toolbar.add_separator(); - m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-up.png"), [&](auto&) { + m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-up.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { VERIFY(m_viewer->current_page() > 0); m_page_text_box->set_current_number(m_viewer->current_page()); }); m_go_to_prev_page_action->set_enabled(false); - m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-down.png"), [&](auto&) { + m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-down.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { VERIFY(m_viewer->current_page() < m_viewer->document()->get_page_count() - 1); m_page_text_box->set_current_number(m_viewer->current_page() + 2); }); diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp index 4a52bee5b5..e8f931bd14 100644 --- a/Userland/Applications/Piano/PlayerWidget.cpp +++ b/Userland/Applications/Piano/PlayerWidget.cpp @@ -19,10 +19,10 @@ PlayerWidget::PlayerWidget(TrackManager& manager, AudioPlayerLoop& loop) set_layout<GUI::HorizontalBoxLayout>(); set_fill_with_background_color(true); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"); // Go back a note - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"); // Advance a note + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); // Go back a note + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); // Advance a note m_play_button = add<GUI::Button>(); m_play_button->set_icon(*m_pause_icon); diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp index 87b8cdf327..14051a4538 100644 --- a/Userland/Applications/Piano/SamplerWidget.cpp +++ b/Userland/Applications/Piano/SamplerWidget.cpp @@ -84,7 +84,7 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager) m_open_button = m_open_button_and_recorded_sample_name_container->add<GUI::Button>(); m_open_button->set_fixed_size(24, 24); m_open_button->set_focus_policy(GUI::FocusPolicy::TabFocus); - m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png")); + m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors()); m_open_button->on_click = [this](auto) { Optional<String> open_path = GUI::FilePicker::get_open_filepath(window()); if (!open_path.has_value()) diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index b58d88b164..00faeccca1 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -91,7 +91,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto& file_menu = window.add_menu("&File"); m_new_image_action = GUI::Action::create( - "&New Image...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [&](auto&) { + "&New Image...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto dialog = PixelPaint::CreateNewImageDialog::construct(&window); if (dialog->exec() == GUI::Dialog::ExecOK) { auto image = PixelPaint::Image::try_create_with_size(dialog->image_size()); @@ -198,7 +198,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) }); m_copy_merged_action = GUI::Action::create( - "Copy &Merged", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"), + "Copy &Merged", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto* editor = current_image_editor(); if (!editor) @@ -434,7 +434,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto& layer_menu = window.add_menu("&Layer"); layer_menu.add_action(GUI::Action::create( - "New &Layer...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-layer.png"), [&](auto&) { + "New &Layer...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-layer.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto* editor = current_image_editor(); if (!editor) return; @@ -461,11 +461,11 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_layer_list_widget->cycle_through_selection(-1); })); layer_menu.add_action(GUI::Action::create( - "Select &Top Layer", { 0, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/top-layer.png"), [&](auto&) { + "Select &Top Layer", { 0, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/top-layer.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_layer_list_widget->select_top_layer(); })); layer_menu.add_action(GUI::Action::create( - "Select B&ottom Layer", { 0, Key_End }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bottom-layer.png"), [&](auto&) { + "Select B&ottom Layer", { 0, Key_End }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bottom-layer.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_layer_list_widget->select_bottom_layer(); })); layer_menu.add_separator(); @@ -514,7 +514,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) })); layer_menu.add_separator(); layer_menu.add_action(GUI::Action::create( - "&Remove Active Layer", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"), [&](auto&) { + "&Remove Active Layer", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto* editor = current_image_editor(); if (!editor) return; diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index 4f5ffc042c..25f1e060ae 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -52,7 +52,7 @@ ToolboxWidget::~ToolboxWidget() void ToolboxWidget::setup_tools() { auto add_tool = [&](String name, StringView const& icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool) { - auto action = GUI::Action::create_checkable(move(name), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)), + auto action = GUI::Action::create_checkable(move(name), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(), [this, tool = tool.ptr()](auto& action) { if (action.is_checked()) { on_tool_selection(tool); diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp index 162db6df2c..8b417cfa35 100644 --- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp @@ -20,9 +20,7 @@ namespace PixelPaint { BucketTool::BucketTool() { - auto bucket_icon = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"); - if (!bucket_icon.is_null()) - m_cursor = bucket_icon.release_nonnull(); + m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png").release_value_but_fixme_should_propagate_errors(); } BucketTool::~BucketTool() diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index 3f8a9fbed7..edb09bfef5 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -142,7 +142,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) if (!m_context_menu) { m_context_menu = GUI::Menu::construct(); m_context_menu->add_action(GUI::Action::create( - "Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png"), [this](auto&) { + "Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (!m_context_menu_guide) return; auto dialog = EditGuideDialog::construct( @@ -160,7 +160,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) }, editor())); m_context_menu->add_action(GUI::Action::create( - "&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"), [this](auto&) { + "&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (!m_context_menu_guide) return; editor()->remove_guide(*m_context_menu_guide); diff --git a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp index 04326d0e73..e7a5510ccd 100644 --- a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp @@ -20,11 +20,9 @@ void NoVisualizationWidget::paint_event(GUI::PaintEvent& event) Frame::paint_event(event); GUI::Painter painter(*this); - if (m_serenity_bg.is_null()) { - m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png"); - } + if (!m_serenity_bg) + m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png").release_value_but_fixme_should_propagate_errors(); painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f); - return; } void NoVisualizationWidget::set_buffer(RefPtr<Audio::Buffer>) diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 5ac1c80ab2..a66654b364 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -43,11 +43,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window m_player_view->set_layout<GUI::VerticalBoxLayout>(); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"); - m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png"); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"); - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"); + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); + m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png").release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); m_visualization = m_player_view->add<BarsVisualizationWidget>(); diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 2f1f5a8207..43bc47ff7c 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -332,14 +332,14 @@ int main(int argc, char* argv[]) help_menu.add_action(GUI::CommonActions::make_about_action(APP_NAME, app_icon, window)); // Configure the nodes context menu. - auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"), [&](auto&) { + auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { Desktop::Launcher::open(URL::create_with_file_protocol(get_absolute_path_to_selected_node(treemapwidget))); }); - auto open_containing_folder_action = GUI::Action::create("Open Containing Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"), [&](auto&) { + auto open_containing_folder_action = GUI::Action::create("Open Containing Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { LexicalPath path { get_absolute_path_to_selected_node(treemapwidget) }; Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename())); }); - auto copy_path_action = GUI::Action::create("Copy Path to Clipboard", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"), [&](auto&) { + auto copy_path_action = GUI::Action::create("Copy Path to Clipboard", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { GUI::Clipboard::the().set_plain_text(get_absolute_path_to_selected_node(treemapwidget)); }); auto delete_action = GUI::CommonActions::make_delete_action([&](auto&) { diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index e38fdb2d75..86772bd462 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -63,7 +63,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) { resize(530, 365); set_title("Spreadsheet Functions Help"); - set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png")); + set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png").release_value_but_fixme_should_propagate_errors()); set_accessory(true); auto& widget = set_main_widget<GUI::Widget>(); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 5556c386b2..e35cff4e25 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -114,7 +114,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s setup_tabs(m_workbook->sheets()); - m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"), [&](auto&) { + m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { add_sheet(); }); diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index 604e16b18d..79f7ae7315 100644 --- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -19,8 +19,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() layout()->set_margins(4); set_fill_with_background_color(true); - m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png"); - m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png"); + m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png").release_value_but_fixme_should_propagate_errors(); + m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png").release_value_but_fixme_should_propagate_errors(); m_network_link_down_bitmap = Gfx::Bitmap::try_create(m_network_connected_bitmap->format(), m_network_connected_bitmap->size()); { diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index bef42e2869..ab08d33e37 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -255,7 +255,7 @@ int main(int argc, char** argv) }; auto kill_action = GUI::Action::create( - "&Kill Process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) { + "&Kill Process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid != -1) kill(pid, SIGKILL); @@ -263,7 +263,7 @@ int main(int argc, char** argv) &process_table_view); auto stop_action = GUI::Action::create( - "&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) { + "&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid != -1) kill(pid, SIGSTOP); @@ -271,7 +271,7 @@ int main(int argc, char** argv) &process_table_view); auto continue_action = GUI::Action::create( - "&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) { + "&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid != -1) kill(pid, SIGCONT); @@ -280,7 +280,7 @@ int main(int argc, char** argv) auto profile_action = GUI::Action::create( "&Profile Process", { Mod_Ctrl, Key_P }, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) { + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid != -1) { auto pid_string = String::number(pid); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 711c2c7999..c9975d3868 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -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); diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index aa506060a3..53209f915e 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -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) { diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp index eb2ab93e72..ea64fb31b7 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp +++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp @@ -79,12 +79,12 @@ private: PreviewWidget::PreviewWidget(const Gfx::Palette& preview_palette) : m_preview_palette(preview_palette) { - m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"); - m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"); + m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors(); + m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors(); - m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png"); - m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"); - m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"); + m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png").release_value_but_fixme_should_propagate_errors(); + m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors(); + m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors(); VERIFY(m_active_window_icon); VERIFY(m_inactive_window_icon); @@ -105,15 +105,17 @@ PreviewWidget::~PreviewWidget() void PreviewWidget::load_theme_bitmaps() { auto load_bitmap = [](String const& path, String& last_path, RefPtr<Gfx::Bitmap>& bitmap) { + bitmap = nullptr; if (path.is_empty()) { last_path = String::empty(); - bitmap = nullptr; } else if (last_path != path) { - bitmap = Gfx::Bitmap::try_load_from_file(path); - if (bitmap) - last_path = path; - else + auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path); + if (bitmap_or_error.is_error()) { last_path = String::empty(); + } else { + last_path = path; + bitmap = bitmap_or_error.release_value(); + } } }; diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index 439cfc0543..259a73bd07 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -30,14 +30,14 @@ WelcomeWidget::WelcomeWidget() tip_frame.set_fill_with_background_color(true); auto& light_bulb_label = *find_descendant_of_type_named<GUI::Label>("light_bulb_label"); - light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png")); + light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png").release_value_but_fixme_should_propagate_errors()); m_web_view = *find_descendant_of_type_named<Web::OutOfProcessWebView>("web_view"); m_tip_label = *find_descendant_of_type_named<GUI::Label>("tip_label"); m_next_button = *find_descendant_of_type_named<GUI::Button>("next_button"); - m_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png")); + m_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors()); m_next_button->on_click = [&](auto) { if (!tip_frame.is_visible()) { m_web_view->set_visible(false); @@ -52,7 +52,7 @@ WelcomeWidget::WelcomeWidget() }; m_help_button = *find_descendant_of_type_named<GUI::Button>("help_button"); - m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png")); + m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); m_help_button->on_click = [](auto) { Core::Process::spawn("/bin/Help"sv); }; |