summaryrefslogtreecommitdiff
path: root/Userland/Applications/Browser
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-06 16:25:29 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 00:35:27 +0100
commit235f39e449ebffed26114c7166b0b632a3f2232e (patch)
tree3f61715fe8ba3e801803bde270ca4aeca74fd9f5 /Userland/Applications/Browser
parent16f064d9bea97b499843e1a90a545a738d9c35fd (diff)
downloadserenity-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')
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp4
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp4
-rw-r--r--Userland/Applications/Browser/ConsoleWidget.cpp2
-rw-r--r--Userland/Applications/Browser/Tab.cpp16
-rw-r--r--Userland/Applications/Browser/WindowActions.cpp2
5 files changed, 14 insertions, 14 deletions
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();
},