mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:47:45 +00:00
LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
This commit is contained in:
parent
16f064d9be
commit
235f39e449
104 changed files with 412 additions and 397 deletions
|
@ -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);
|
||||
}));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue