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/Browser/Tab.cpp | |
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/Browser/Tab.cpp')
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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); |