summaryrefslogtreecommitdiff
path: root/Userland/Applications/Browser/Tab.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-21 18:02:15 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-21 18:02:15 +0200
commitc7d891765cc87ec04f8d332b93fc7c3f82521d7f (patch)
tree9d414d3ad62e0193b1b6fb0d12079e11e96e69b1 /Userland/Applications/Browser/Tab.cpp
parentf0409081f562b635de3a23d7babbc7348cbb970c (diff)
downloadserenity-c7d891765cc87ec04f8d332b93fc7c3f82521d7f.zip
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
Diffstat (limited to 'Userland/Applications/Browser/Tab.cpp')
-rw-r--r--Userland/Applications/Browser/Tab.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index 9a67166838..aea0f68700 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -75,7 +75,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::load_from_file("/res/icons/16x16/filetype-text.png"));
+ window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"));
window->show();
}
@@ -84,7 +84,7 @@ void Tab::view_dom_tree(const String& dom_tree)
auto window = GUI::Window::construct(&this->window());
window->resize(300, 500);
window->set_title("DOM inspector");
- window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
+ window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
window->set_main_widget<InspectorWidget>();
auto* inspector_widget = static_cast<InspectorWidget*>(window->main_widget());
@@ -117,7 +117,7 @@ Tab::Tab(BrowserWindow& window, Type type)
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::load_from_file("/res/icons/16x16/filetype-html.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"),
[this, i](auto&) { go_back(i); }));
}
m_go_back_context_menu->popup(context_menu_event.screen_position());
@@ -132,7 +132,7 @@ Tab::Tab(BrowserWindow& window, Type type)
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::load_from_file("/res/icons/16x16/filetype-html.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"),
[this, i](auto&) { go_forward(i); }));
}
m_go_forward_context_menu->popup(context_menu_event.screen_position());
@@ -158,7 +158,7 @@ Tab::Tab(BrowserWindow& window, Type type)
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::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"));
m_bookmark_button->set_fixed_size(22, 22);
m_bookmark_button->on_click = [this](auto) {
@@ -394,10 +394,10 @@ void Tab::update_actions()
void Tab::update_bookmark_button(const String& url)
{
if (BookmarksBarWidget::the().contains_bookmark(url)) {
- m_bookmark_button->set_icon(Gfx::Bitmap::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"));
m_bookmark_button->set_tooltip("Remove Bookmark");
} else {
- m_bookmark_button->set_icon(Gfx::Bitmap::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"));
m_bookmark_button->set_tooltip("Add Bookmark");
}
}