summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp4
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp4
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp10
-rw-r--r--Userland/Applications/Browser/ConsoleWidget.cpp2
-rw-r--r--Userland/Applications/Browser/Tab.cpp14
-rw-r--r--Userland/Applications/Browser/WindowActions.cpp2
-rw-r--r--Userland/Applications/Calendar/main.cpp14
-rw-r--r--Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp2
-rw-r--r--Userland/Applications/DisplaySettings/MonitorWidget.cpp8
-rw-r--r--Userland/Applications/FileManager/DirectoryView.cpp6
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.cpp2
-rw-r--r--Userland/Applications/FileManager/main.cpp22
-rw-r--r--Userland/Applications/FontEditor/FontEditor.cpp8
-rw-r--r--Userland/Applications/Help/ManualModel.cpp6
-rw-r--r--Userland/Applications/HexEditor/HexEditorWidget.cpp12
-rw-r--r--Userland/Applications/IRCClient/IRCAppWindow.cpp20
-rw-r--r--Userland/Applications/IRCClient/IRCWindow.cpp6
-rw-r--r--Userland/Applications/ImageViewer/main.cpp8
-rw-r--r--Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp2
-rw-r--r--Userland/Applications/MouseSettings/MouseSettingsWindow.cpp4
-rw-r--r--Userland/Applications/PDFViewer/OutlineModel.cpp4
-rw-r--r--Userland/Applications/PDFViewer/PDFViewer.cpp2
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp6
-rw-r--r--Userland/Applications/Piano/PlayerWidget.cpp8
-rw-r--r--Userland/Applications/Piano/RollWidget.cpp2
-rw-r--r--Userland/Applications/Piano/SamplerWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Image.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Layer.cpp4
-rw-r--r--Userland/Applications/PixelPaint/MoveTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/ToolboxWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/main.cpp2
-rw-r--r--Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp2
-rw-r--r--Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp10
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp6
-rw-r--r--Userland/Applications/Spreadsheet/HelpWindow.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/main.cpp2
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp8
-rw-r--r--Userland/Applications/Terminal/main.cpp12
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp14
-rw-r--r--Userland/Applications/ThemeEditor/PreviewWidget.cpp10
-rw-r--r--Userland/Applications/VideoPlayer/main.cpp2
-rw-r--r--Userland/Applications/Welcome/WelcomeWidget.cpp6
42 files changed, 133 insertions, 133 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp
index 95b3f1a7e0..27a1fe34bb 100644
--- a/Userland/Applications/3DFileViewer/main.cpp
+++ b/Userland/Applications/3DFileViewer/main.cpp
@@ -42,7 +42,7 @@ private:
GLContextWidget()
: m_mesh_loader(adopt_own(*new WavefrontOBJLoader()))
{
- m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { RENDER_WIDTH, RENDER_HEIGHT });
+ m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { RENDER_WIDTH, RENDER_HEIGHT });
m_context = GL::create_context(*m_bitmap);
start_timer(20);
@@ -169,7 +169,7 @@ bool GLContextWidget::load(const String& filename)
builder.append(".bmp");
// Attempt to open the texture file from disk
- auto texture_image = Gfx::Bitmap::load_from_file(builder.string_view());
+ auto texture_image = Gfx::Bitmap::try_load_from_file(builder.string_view());
GLuint tex;
glGenTextures(1, &tex);
diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp
index e8b809b8f8..d6e96595e6 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::load_from_file("/res/icons/16x16/filetype-html.png"));
+ button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"));
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::load_from_file("/res/icons/16x16/filetype-html.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"),
[&](auto&) {
bookmark.on_click(0);
}));
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index 5838fd4265..01f0594d1b 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -129,7 +129,7 @@ void BrowserWindow::build_menus()
file_menu.add_action(WindowActions::the().create_new_tab_action());
auto close_tab_action = GUI::Action::create(
- "&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"), [this](auto&) {
+ "&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"), [this](auto&) {
active_tab().on_tab_close_request(active_tab());
},
this);
@@ -221,7 +221,7 @@ void BrowserWindow::build_menus()
tab.m_dom_inspector_window = GUI::Window::construct(this);
tab.m_dom_inspector_window->resize(300, 500);
tab.m_dom_inspector_window->set_title("DOM inspector");
- tab.m_dom_inspector_window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
+ tab.m_dom_inspector_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
tab.m_dom_inspector_window->set_main_widget<InspectorWidget>();
}
auto* inspector_widget = static_cast<InspectorWidget*>(tab.m_dom_inspector_window->main_widget());
@@ -247,7 +247,7 @@ void BrowserWindow::build_menus()
tab.m_console_window = GUI::Window::construct(this);
tab.m_console_window->resize(500, 300);
tab.m_console_window->set_title("JS Console");
- tab.m_console_window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-javascript.png"));
+ tab.m_console_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"));
tab.m_console_window->set_main_widget<ConsoleWidget>();
}
auto* console_widget = static_cast<ConsoleWidget*>(tab.m_console_window->main_widget());
@@ -259,7 +259,7 @@ void BrowserWindow::build_menus()
tab.m_console_window = GUI::Window::construct(this);
tab.m_console_window->resize(500, 300);
tab.m_console_window->set_title("JS Console");
- tab.m_console_window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-javascript.png"));
+ tab.m_console_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"));
tab.m_console_window->set_main_widget<ConsoleWidget>();
}
auto* console_widget = static_cast<ConsoleWidget*>(tab.m_console_window->main_widget());
@@ -520,7 +520,7 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
m_tab_widget->set_bar_visible(!is_fullscreen() && m_tab_widget->children().size() > 1);
- auto default_favicon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png");
+ auto default_favicon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png");
VERIFY(default_favicon);
m_tab_widget->set_tab_icon(new_tab, default_favicon);
diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp
index 1b69c858f5..3e5856a6de 100644
--- a/Userland/Applications/Browser/ConsoleWidget.cpp
+++ b/Userland/Applications/Browser/ConsoleWidget.cpp
@@ -105,7 +105,7 @@ ConsoleWidget::ConsoleWidget()
auto& clear_button = bottom_container.add<GUI::Button>();
clear_button.set_fixed_size(22, 22);
- clear_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"));
+ clear_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"));
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 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");
}
}
diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp
index 84a3b952e6..294f0c6950 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::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"), [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 3d0a2885b1..f12bf47690 100644
--- a/Userland/Applications/Calendar/main.cpp
+++ b/Userland/Applications/Calendar/main.cpp
@@ -54,7 +54,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::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"), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -69,7 +69,7 @@ int main(int argc, char** argv)
calendar->update_tiles(view_year, view_month);
});
- auto next_date_action = GUI::Action::create({}, Gfx::Bitmap::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"), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -84,22 +84,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::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"), [&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
});
- auto jump_to_action = GUI::Action::create("Jump to &Today", {}, Gfx::Bitmap::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"), [&](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::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"), [&](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::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"), [&](const GUI::Action&) {
if (calendar->mode() == GUI::Calendar::Month)
calendar->toggle_mode();
});
@@ -128,7 +128,7 @@ int main(int argc, char** argv)
auto menubar = GUI::Menubar::construct();
auto& file_menu = menubar->add_menu("&File");
- file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, Gfx::Bitmap::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"),
[&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
}));
diff --git a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp
index 122852e4bb..1619268e4f 100644
--- a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp
@@ -32,7 +32,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::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"));
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 dfbfcb6e84..db25078f95 100644
--- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp
+++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp
@@ -18,8 +18,8 @@ namespace DisplaySettings {
MonitorWidget::MonitorWidget()
{
m_desktop_resolution = GUI::Desktop::the().rect().size();
- m_monitor_bitmap = Gfx::Bitmap::load_from_file("/res/graphics/monitor.png");
- m_desktop_bitmap = Gfx::Bitmap::create(m_monitor_bitmap->format(), { 280, 158 });
+ m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png");
+ 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);
}
@@ -37,7 +37,7 @@ bool MonitorWidget::set_wallpaper(String path)
return false;
}
- auto bitmap = Gfx::Bitmap::load_from_file(path);
+ auto bitmap = Gfx::Bitmap::try_load_from_file(path);
if (bitmap)
m_wallpaper_bitmap = move(bitmap);
m_desktop_wallpaper_path = move(path);
@@ -142,7 +142,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
// Render text label scaled with scale factor to hint at its effect.
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
// and that should give us the same effect with less code.
- auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
+ auto text_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
GUI::Painter text_painter(*text_bitmap);
text_painter.set_font(painter.font());
diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp
index 6b72bc7bfb..e824d7642c 100644
--- a/Userland/Applications/FileManager/DirectoryView.cpp
+++ b/Userland/Applications/FileManager/DirectoryView.cpp
@@ -553,7 +553,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::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) {
+ 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"), [&](const GUI::Action&) {
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));
@@ -565,7 +565,7 @@ void DirectoryView::setup_actions()
}
});
- m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) {
+ 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"), [&](const GUI::Action&) {
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));
@@ -591,7 +591,7 @@ void DirectoryView::setup_actions()
}
});
- m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::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"), [&](auto&) {
spawn_terminal(path());
});
diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp
index 3d2d4cf784..4a3570b10d 100644
--- a/Userland/Applications/FileManager/PropertiesWindow.cpp
+++ b/Userland/Applications/FileManager/PropertiesWindow.cpp
@@ -39,7 +39,7 @@ PropertiesWindow::PropertiesWindow(const String& path, bool disable_rename, Wind
set_rect({ 0, 0, 360, 420 });
set_resizable(false);
- set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"));
+ set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"));
auto& tab_widget = main_widget.add<GUI::TabWidget>();
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index 4b30104909..c30e66f62e 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -353,11 +353,11 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config)
auto desktop_view_context_menu = GUI::Menu::construct("Directory View");
- auto file_manager_action = GUI::Action::create("Show in File &Manager", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"), [&](const GUI::Action&) {
+ auto file_manager_action = GUI::Action::create("Show in File &Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"), [&](const GUI::Action&) {
Desktop::Launcher::open(URL::create_with_file_protocol(directory_view.path()));
});
- auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"), [&](const GUI::Action&) {
+ auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"), [&](const GUI::Action&) {
Desktop::Launcher::open(URL::create_with_file_protocol("/bin/DisplaySettings"));
});
@@ -527,7 +527,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
auto tree_view_directory_context_menu = GUI::Menu::construct("Tree View Directory");
auto tree_view_context_menu = GUI::Menu::construct("Tree View");
- auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GUI::Action&) {
+ 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"), [&](const GUI::Action&) {
directory_view.open_parent_directory();
});
@@ -608,7 +608,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
RefPtr<GUI::Action> view_as_columns_action;
view_as_icons_action = GUI::Action::create_checkable(
- "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
+ "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
directory_view.set_view_mode(DirectoryView::ViewMode::Icon);
config->write_entry("DirectoryView", "ViewMode", "Icon");
config->sync();
@@ -616,7 +616,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
window);
view_as_table_action = GUI::Action::create_checkable(
- "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
+ "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
directory_view.set_view_mode(DirectoryView::ViewMode::Table);
config->write_entry("DirectoryView", "ViewMode", "Table");
config->sync();
@@ -624,7 +624,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
window);
view_as_columns_action = GUI::Action::create_checkable(
- "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
+ "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
directory_view.set_view_mode(DirectoryView::ViewMode::Columns);
config->write_entry("DirectoryView", "ViewMode", "Columns");
config->sync();
@@ -686,7 +686,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
= GUI::Action::create(
"Open in New &Window",
{},
- Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"),
[&](GUI::Action const& action) {
Vector<String> paths;
if (action.activator() == tree_view_directory_context_menu)
@@ -705,7 +705,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
= GUI::Action::create(
"Open in &Terminal",
{},
- Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"),
[&](GUI::Action const& action) {
Vector<String> paths;
if (action.activator() == tree_view_directory_context_menu)
@@ -725,7 +725,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
= GUI::Action::create(
"Create Desktop &Shortcut",
{},
- Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-symlink.png"),
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png"),
[&](const GUI::Action&) {
auto paths = directory_view.selected_file_paths();
if (paths.is_empty()) {
@@ -832,12 +832,12 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
});
focus_dependent_delete_action->set_enabled(false);
- auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) {
+ 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"), [&](const GUI::Action&) {
directory_view.mkdir_action().activate();
refresh_tree_view();
});
- auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) {
+ 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"), [&](const GUI::Action&) {
directory_view.touch_action().activate();
refresh_tree_view();
});
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp
index f66c58c59b..0120a0c810 100644
--- a/Userland/Applications/FontEditor/FontEditor.cpp
+++ b/Userland/Applications/FontEditor/FontEditor.cpp
@@ -90,7 +90,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::load_from_file("/res/icons/16x16/reload.png"));
+ reload_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"));
reload_button.set_fixed_width(22);
reload_button.on_click = [&](auto) {
static int i = 1;
@@ -155,7 +155,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
m_font_preview_window->update();
};
- m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::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"), [&](auto&) {
if (m_font_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) {
@@ -271,7 +271,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
redo();
});
m_redo_action->set_enabled(false);
- m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, Gfx::Bitmap::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"), [&](auto&) {
if (!m_font_preview_window)
m_font_preview_window = create_font_preview_window(*this);
m_font_preview_window->show();
@@ -333,7 +333,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::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"));
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 b365dda2c5..9d2c04a2fc 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::load_from_file("/res/icons/16x16/book-open.png"));
- m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/book.png"));
- m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::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"));
+ 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"));
}
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 87b62384a5..9dcfe2fb58 100644
--- a/Userland/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp
@@ -71,7 +71,7 @@ HexEditorWidget::HexEditorWidget()
m_editor->update();
};
- m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::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"), [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();
@@ -134,7 +134,7 @@ HexEditorWidget::HexEditorWidget()
dbgln("Wrote document to {}", save_path.value());
});
- m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::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"), [&](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) {
@@ -171,7 +171,7 @@ HexEditorWidget::HexEditorWidget()
}
});
- m_goto_offset_action = GUI::Action::create("&Go to Offset ...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::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"), [this](const GUI::Action&) {
int new_offset;
auto result = GoToOffsetDialog::show(
window(),
@@ -239,7 +239,7 @@ void HexEditorWidget::initialize_menubar(GUI::Menubar& menubar)
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::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"), [&](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&) {
@@ -247,7 +247,7 @@ void HexEditorWidget::initialize_menubar(GUI::Menubar& menubar)
}));
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::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"), [&](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;
@@ -262,7 +262,7 @@ void HexEditorWidget::initialize_menubar(GUI::Menubar& menubar)
m_last_found_index = result;
}));
- edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::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"), [&](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/IRCClient/IRCAppWindow.cpp b/Userland/Applications/IRCClient/IRCAppWindow.cpp
index c769299db0..8a800d7e58 100644
--- a/Userland/Applications/IRCClient/IRCAppWindow.cpp
+++ b/Userland/Applications/IRCClient/IRCAppWindow.cpp
@@ -33,7 +33,7 @@ IRCAppWindow::IRCAppWindow(String server, int port)
VERIFY(!s_the);
s_the = this;
- set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-irc-client.png"));
+ set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-irc-client.png"));
update_title();
resize(600, 400);
@@ -85,17 +85,17 @@ void IRCAppWindow::setup_client()
void IRCAppWindow::setup_actions()
{
- m_join_action = GUI::Action::create("&Join Channel...", { Mod_Ctrl, Key_J }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) {
+ m_join_action = GUI::Action::create("&Join Channel...", { Mod_Ctrl, Key_J }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) {
String value;
if (GUI::InputBox::show(this, value, "Enter channel name:", "Join Channel") == GUI::InputBox::ExecOK && !value.is_empty())
m_client->handle_join_action(value);
});
- m_list_channels_action = GUI::Action::create("&List Channels", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-list.png"), [&](auto&) {
+ m_list_channels_action = GUI::Action::create("&List Channels", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-list.png"), [&](auto&) {
m_client->handle_list_channels_action();
});
- m_part_action = GUI::Action::create("&Part from Channel", { Mod_Ctrl, Key_P }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-part.png"), [this](auto&) {
+ m_part_action = GUI::Action::create("&Part from Channel", { Mod_Ctrl, Key_P }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-part.png"), [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
@@ -103,29 +103,29 @@ void IRCAppWindow::setup_actions()
m_client->handle_part_action(window->channel().name());
});
- m_whois_action = GUI::Action::create("&Whois User...", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&](auto&) {
+ m_whois_action = GUI::Action::create("&Whois User...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-whois.png"), [&](auto&) {
String value;
if (GUI::InputBox::show(this, value, "Enter nickname:", "Whois User") == GUI::InputBox::ExecOK && !value.is_empty())
m_client->handle_whois_action(value);
});
- m_open_query_action = GUI::Action::create("Open &Query...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&](auto&) {
+ m_open_query_action = GUI::Action::create("Open &Query...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-open-query.png"), [&](auto&) {
String value;
if (GUI::InputBox::show(this, value, "Enter nickname:", "Open Query") == GUI::InputBox::ExecOK && !value.is_empty())
m_client->handle_open_query_action(value);
});
- m_close_query_action = GUI::Action::create("&Close Query", { Mod_Ctrl, Key_D }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-close-query.png"), [](auto&) {
+ m_close_query_action = GUI::Action::create("&Close Query", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-close-query.png"), [](auto&) {
outln("FIXME: Implement close-query action");
});
- m_change_nick_action = GUI::Action::create("Change &Nickname...", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-nick.png"), [this](auto&) {
+ m_change_nick_action = GUI::Action::create("Change &Nickname...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-nick.png"), [this](auto&) {
String value;
if (GUI::InputBox::show(this, value, "Enter nickname:", "Change Nickname") == GUI::InputBox::ExecOK && !value.is_empty())
m_client->handle_change_nick_action(value);
});
- m_change_topic_action = GUI::Action::create("Change &Topic...", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-topic.png"), [this](auto&) {
+ m_change_topic_action = GUI::Action::create("Change &Topic...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-topic.png"), [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
@@ -135,7 +135,7 @@ void IRCAppWindow::setup_actions()
m_client->handle_change_topic_action(window->channel().name(), value);
});
- m_invite_user_action = GUI::Action::create("&Invite User...", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-invite.png"), [this](auto&) {
+ m_invite_user_action = GUI::Action::create("&Invite User...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-invite.png"), [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
diff --git a/Userland/Applications/IRCClient/IRCWindow.cpp b/Userland/Applications/IRCClient/IRCWindow.cpp
index 03345b53aa..de822d6f8d 100644
--- a/Userland/Applications/IRCClient/IRCWindow.cpp
+++ b/Userland/Applications/IRCClient/IRCWindow.cpp
@@ -55,14 +55,14 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
m_context_menu = GUI::Menu::construct();
- m_context_menu->add_action(GUI::Action::create("Open &Query", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&](const GUI::Action&) {
+ m_context_menu->add_action(GUI::Action::create("Open &Query", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-open-query.png"), [&](const GUI::Action&) {
auto nick = channel().member_model()->nick_at(member_view.selection().first());
if (nick.is_empty())
return;
m_client->handle_open_query_action(m_client->nick_without_prefix(nick.characters()));
}));
- m_context_menu->add_action(GUI::Action::create("Whois", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&](const GUI::Action&) {
+ m_context_menu->add_action(GUI::Action::create("Whois", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/irc-whois.png"), [&](const GUI::Action&) {
auto nick = channel().member_model()->nick_at(member_view.selection().first());
if (nick.is_empty())
return;
@@ -227,7 +227,7 @@ void IRCWindow::post_notification_if_needed(const String& name, const String& me
notification->set_title(name);
}
- notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-irc-client.png"));
+ notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-irc-client.png"));
notification->set_text(message);
notification->show();
}
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index cbd3cf5804..602628bc4c 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -179,22 +179,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::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"),
[&](auto&) {
widget.navigate(ViewWidget::Directions::First);
});
- auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, Gfx::Bitmap::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"),
[&](auto&) {
widget.navigate(ViewWidget::Directions::Back);
});
- auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, Gfx::Bitmap::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"),
[&](auto&) {
widget.navigate(ViewWidget::Directions::Forward);
});
- auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, Gfx::Bitmap::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"),
[&](auto&) {
widget.navigate(ViewWidget::Directions::Last);
});
diff --git a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp
index 5f5c508f5b..a71b774ea8 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::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");
}
void DoubleClickArrowWidget::paint_event(GUI::PaintEvent& event)
diff --git a/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp b/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp
index 63ffe80762..64feb353f8 100644
--- a/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp
+++ b/Userland/Applications/MouseSettings/MouseSettingsWindow.cpp
@@ -63,10 +63,10 @@ MouseSettingsWindow::MouseSettingsWindow()
m_speed_slider->set_value(slider_value);
auto& cursor_speed_image_label = *main_widget.find_descendant_of_type_named<GUI::Label>("cursor_speed_image_label");
- cursor_speed_image_label.set_icon(Gfx::Bitmap::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"));
auto& scroll_step_size_image_label = *main_widget.find_descendant_of_type_named<GUI::Label>("scroll_step_size_image_label");
- scroll_step_size_image_label.set_icon(Gfx::Bitmap::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"));
m_scroll_length_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox");
m_scroll_length_spinbox->set_min(WindowServer::scroll_step_size_min);
diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp
index b72c9b9c20..290b8194a7 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::load_from_file("/res/icons/16x16/book.png"));
- m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::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"));
+ m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"));
}
void OutlineModel::set_index_open_state(const GUI::ModelIndex& index, bool is_open)
diff --git a/Userland/Applications/PDFViewer/PDFViewer.cpp b/Userland/Applications/PDFViewer/PDFViewer.cpp
index de59df46aa..b41b857299 100644
--- a/Userland/Applications/PDFViewer/PDFViewer.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewer.cpp
@@ -145,7 +145,7 @@ RefPtr<Gfx::Bitmap> PDFViewer::render_page(const PDF::Page& page)
auto height = static_cast<float>(this->height() - 2 * frame_thickness() - PAGE_PADDING * 2) * zoom_scale_factor;
auto width = height / page_scale_factor;
- auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { width, height });
+ auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { width, height });
PDF::Renderer::render(*m_document, page, bitmap);
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index 0ed29cdc68..b818f97b59 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -58,7 +58,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::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"), [&](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");
@@ -70,13 +70,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::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"), [&](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::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"), [&](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 3faab0f7cd..4a52bee5b5 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::load_from_file("/res/icons/16x16/play.png");
- m_pause_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png");
- m_back_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"); // Go back a note
- m_next_icon = Gfx::Bitmap::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");
+ 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_button = add<GUI::Button>();
m_play_button->set_icon(*m_pause_icon);
diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp
index 5c4e68efa6..3886337302 100644
--- a/Userland/Applications/Piano/RollWidget.cpp
+++ b/Userland/Applications/Piano/RollWidget.cpp
@@ -72,7 +72,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
// Draw the background, if necessary.
if (viewport_changed() || paint_area != m_background->height()) {
- m_background = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(m_roll_width, paint_area));
+ m_background = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(m_roll_width, paint_area));
Gfx::Painter background_painter(*m_background);
background_painter.translate(frame_thickness(), frame_thickness());
diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp
index e6ee863a0b..c9215ec08a 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::load_from_file("/res/icons/16x16/open.png"));
+ m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"));
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/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp
index 0e01f45b3b..f1443cb4bb 100644
--- a/Userland/Applications/PixelPaint/Image.cpp
+++ b/Userland/Applications/PixelPaint/Image.cpp
@@ -194,7 +194,7 @@ Result<void, String> Image::write_to_file(const String& file_path) const
RefPtr<Gfx::Bitmap> Image::try_compose_bitmap(Gfx::BitmapFormat format) const
{
- auto bitmap = Gfx::Bitmap::create(format, m_size);
+ auto bitmap = Gfx::Bitmap::try_create(format, m_size);
if (!bitmap)
return nullptr;
GUI::Painter painter(*bitmap);
diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp
index 29f5332bce..c0be453314 100644
--- a/Userland/Applications/PixelPaint/Layer.cpp
+++ b/Userland/Applications/PixelPaint/Layer.cpp
@@ -19,7 +19,7 @@ RefPtr<Layer> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size
if (size.width() > 16384 || size.height() > 16384)
return nullptr;
- auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
+ auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size);
if (!bitmap)
return nullptr;
@@ -97,7 +97,7 @@ RefPtr<Gfx::Bitmap> Layer::try_copy_bitmap(Selection const& selection) const
}
auto selection_rect = selection.bounding_rect();
- auto result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, selection_rect.size());
+ auto result = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, selection_rect.size());
VERIFY(result->has_alpha_channel());
for (int y = selection_rect.top(); y <= selection_rect.bottom(); y++) {
diff --git a/Userland/Applications/PixelPaint/MoveTool.cpp b/Userland/Applications/PixelPaint/MoveTool.cpp
index dc6748c0f5..b93e02cfcd 100644
--- a/Userland/Applications/PixelPaint/MoveTool.cpp
+++ b/Userland/Applications/PixelPaint/MoveTool.cpp
@@ -103,7 +103,7 @@ void MoveTool::on_context_menu(Layer& layer, GUI::ContextMenuEvent& event)
m_editor));
m_context_menu->add_separator();
m_context_menu->add_action(GUI::Action::create(
- "&Delete Layer", Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"), [this](auto&) {
+ "&Delete Layer", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"), [this](auto&) {
m_editor->image().remove_layer(*m_context_menu_layer);
// FIXME: This should not be done imperatively here. Perhaps a Image::Client interface that ImageEditor can implement?
if (m_editor->active_layer() == m_context_menu_layer)
diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
index c12c1870ab..17eabaa19c 100644
--- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp
+++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
@@ -50,7 +50,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::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)),
[this, tool = tool.ptr()](auto& action) {
if (action.is_checked())
on_tool_selection(tool);
diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp
index 212e3c8c23..57f4f4ef45 100644
--- a/Userland/Applications/PixelPaint/main.cpp
+++ b/Userland/Applications/PixelPaint/main.cpp
@@ -90,7 +90,7 @@ int main(int argc, char** argv)
};
auto new_image_action = GUI::Action::create(
- "&New Image...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::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"), [&](auto&) {
auto dialog = PixelPaint::CreateNewImageDialog::construct(window);
if (dialog->exec() == GUI::Dialog::ExecOK) {
auto image = PixelPaint::Image::try_create_with_size(dialog->image_size());
diff --git a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp
index 3251953e67..04326d0e73 100644
--- a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp
+++ b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp
@@ -21,7 +21,7 @@ void NoVisualizationWidget::paint_event(GUI::PaintEvent& event)
GUI::Painter painter(*this);
if (m_serenity_bg.is_null()) {
- m_serenity_bg = Gfx::Bitmap::load_from_file("/res/wallpapers/sunset-retro.png");
+ m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png");
}
painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f);
return;
diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
index c2b8ceb2cf..63ebdda6ef 100644
--- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
+++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
@@ -39,11 +39,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window
m_player_view->set_layout<GUI::VerticalBoxLayout>();
- m_play_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png");
- m_pause_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png");
- m_stop_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png");
- m_back_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png");
- m_next_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png");
+ 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_visualization = m_player_view->add<BarsVisualizationWidget>();
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index 73e8226e6a..052502d6fb 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -288,14 +288,14 @@ int main(int argc, char* argv[])
window->set_menubar(move(menubar));
// Configure the nodes context menu.
- auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::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"), [&](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::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"), [&](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::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"), [&](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 e331054669..f3f07f222c 100644
--- a/Userland/Applications/Spreadsheet/HelpWindow.cpp
+++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp
@@ -64,7 +64,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
{
resize(530, 365);
set_title("Spreadsheet Functions Help");
- set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"));
+ set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"));
auto& widget = set_main_widget<GUI::Widget>();
widget.set_layout<GUI::VerticalBoxLayout>();
diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp
index 495c8a52f7..305d6a862a 100644
--- a/Userland/Applications/Spreadsheet/main.cpp
+++ b/Userland/Applications/Spreadsheet/main.cpp
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
auto menubar = GUI::Menubar::construct();
auto& file_menu = menubar->add_menu("&File");
- file_menu.add_action(GUI::Action::create("Add New Sheet", Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"), [&](auto&) {
+ file_menu.add_action(GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"), [&](auto&) {
spreadsheet_widget.add_sheet();
}));
file_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) {
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index a8c5dbf909..91a253ff24 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -243,7 +243,7 @@ int main(int argc, char** argv)
};
auto kill_action = GUI::Action::create(
- "&Kill Process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::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"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGKILL);
@@ -251,7 +251,7 @@ int main(int argc, char** argv)
&process_table_view);
auto stop_action = GUI::Action::create(
- "&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::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"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGSTOP);
@@ -259,7 +259,7 @@ int main(int argc, char** argv)
&process_table_view);
auto continue_action = GUI::Action::create(
- "&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::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"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGCONT);
@@ -268,7 +268,7 @@ int main(int argc, char** argv)
auto profile_action = GUI::Action::create(
"&Profile Process", { Mod_Ctrl, Key_P },
- Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
+ Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"), [&](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 abfe71bdfa..d4cd02deff 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -208,10 +208,10 @@ static RefPtr<GUI::Window> create_find_window(VT::TerminalWidget& terminal)
}
auto& find_backwards = find.add<GUI::Button>();
find_backwards.set_fixed_width(25);
- find_backwards.set_icon(Gfx::Bitmap::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"));
auto& find_forwards = find.add<GUI::Button>();
find_forwards.set_fixed_width(25);
- find_forwards.set_icon(Gfx::Bitmap::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"));
find_textbox.on_return_pressed = [&]() {
find_backwards.click();
@@ -352,7 +352,7 @@ int main(int argc, char** argv)
auto new_scrollback_size = config->read_num_entry("Terminal", "MaxHistorySize", terminal.max_history_size());
terminal.set_max_history_size(new_scrollback_size);
- auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::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"),
[&](const GUI::Action&) {
if (!settings_window)
settings_window = create_settings_window(terminal);
@@ -361,7 +361,7 @@ int main(int argc, char** argv)
});
terminal.context_menu().add_separator();
- auto pick_font_action = GUI::Action::create("&Terminal Font...", Gfx::Bitmap::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"),
[&](auto&) {
auto picker = GUI::FontPicker::construct(window, &terminal.font(), true);
if (picker->exec() == GUI::Dialog::ExecOK) {
@@ -380,7 +380,7 @@ int main(int argc, char** argv)
auto menubar = GUI::Menubar::construct();
auto& file_menu = menubar->add_menu("&File");
- file_menu.add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::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"), [&](auto&) {
pid_t child;
const char* argv[] = { "Terminal", nullptr };
if ((errno = posix_spawn(&child, "/bin/Terminal", nullptr, nullptr, const_cast<char**>(argv), environ))) {
@@ -402,7 +402,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::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"),
[&](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 bcf4a06b40..f21c1cfc66 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -93,7 +93,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::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"), [&](auto&) {
auto needle = m_find_textbox->text();
if (needle.is_empty())
return;
@@ -112,7 +112,7 @@ MainWidget::MainWidget()
}
});
- m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::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"), [&](auto&) {
auto needle = m_find_textbox->text();
if (needle.is_empty())
return;
@@ -173,11 +173,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::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"));
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::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"));
m_find_textbox->on_return_pressed = [this] {
m_find_next_button->click();
@@ -211,7 +211,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::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"), [this](auto&) {
m_find_replace_widget->set_visible(true);
m_find_widget->set_visible(true);
m_replace_widget->set_visible(true);
@@ -244,7 +244,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::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"), [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)
@@ -457,7 +457,7 @@ void MainWidget::initialize_menubar(GUI::Menubar& menubar)
view_menu.add_separator();
- view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::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"),
[&](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 d47a7e8c20..2825895848 100644
--- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp
+++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp
@@ -75,12 +75,12 @@ private:
PreviewWidget::PreviewWidget(const Gfx::Palette& preview_palette)
: m_preview_palette(preview_palette)
{
- m_active_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png");
- m_inactive_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png");
+ 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_close_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png");
- m_maximize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png");
- m_minimize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png");
+ m_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png");
+ m_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png");
+ m_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png");
m_gallery = add<MiniWidgetGallery>();
set_greedy_for_hits(true);
diff --git a/Userland/Applications/VideoPlayer/main.cpp b/Userland/Applications/VideoPlayer/main.cpp
index 7b1db1db61..c9f9eb5b99 100644
--- a/Userland/Applications/VideoPlayer/main.cpp
+++ b/Userland/Applications/VideoPlayer/main.cpp
@@ -26,7 +26,7 @@ int main(int argc, char** argv)
auto const& track = optional_track.value();
auto const video_track = track.video_track().value();
- auto image = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(video_track.pixel_height, video_track.pixel_width));
+ auto image = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(video_track.pixel_height, video_track.pixel_width));
auto& main_widget = window->set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp
index 0caf473d4d..623cdb65b1 100644
--- a/Userland/Applications/Welcome/WelcomeWidget.cpp
+++ b/Userland/Applications/Welcome/WelcomeWidget.cpp
@@ -28,14 +28,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::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"));
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::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"));
m_next_button->on_click = [&](auto) {
if (!tip_frame.is_visible()) {
m_web_view->set_visible(false);
@@ -50,7 +50,7 @@ WelcomeWidget::WelcomeWidget()
};
m_help_button = *find_descendant_of_type_named<GUI::Button>("help_button");
- m_help_button->set_icon(Gfx::Bitmap::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"));
m_help_button->on_click = [](auto) {
pid_t pid;
const char* argv[] = { "Help", nullptr };