mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibGfx: Remove try_
prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit it.
This commit is contained in:
parent
1971bff314
commit
82a152b696
186 changed files with 598 additions and 598 deletions
|
@ -252,7 +252,7 @@ void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window)
|
|||
GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(file_path);
|
||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(file_path);
|
||||
if (bitmap_or_error.is_error()) {
|
||||
show_error();
|
||||
return;
|
||||
|
@ -379,7 +379,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
auto create_archive_action
|
||||
= GUI::Action::create(
|
||||
"Create &Archive",
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
|
||||
[&](GUI::Action const&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty())
|
||||
|
@ -404,7 +404,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
auto set_wallpaper_action
|
||||
= GUI::Action::create(
|
||||
"Set as Desktop &Wallpaper",
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
|
||||
[&](GUI::Action const&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty())
|
||||
|
@ -441,7 +441,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
|
||||
auto desktop_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
|
||||
|
||||
auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [&](auto&) {
|
||||
auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [&](auto&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty()) {
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(directory_view->path()));
|
||||
|
@ -454,7 +454,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
}
|
||||
});
|
||||
|
||||
auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
|
||||
auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty()) {
|
||||
spawn_terminal(directory_view->path());
|
||||
|
@ -468,7 +468,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
}
|
||||
});
|
||||
|
||||
auto display_properties_action = GUI::Action::create("&Display Settings", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)), [&](GUI::Action const&) {
|
||||
auto display_properties_action = GUI::Action::create("&Display Settings", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)), [&](GUI::Action const&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/bin/DisplaySettings"));
|
||||
});
|
||||
|
||||
|
@ -544,7 +544,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
GUI::Desktop::the().set_wallpaper(nullptr, {});
|
||||
return;
|
||||
}
|
||||
auto wallpaper_bitmap_or_error = Gfx::Bitmap::try_load_from_file(value);
|
||||
auto wallpaper_bitmap_or_error = Gfx::Bitmap::load_from_file(value);
|
||||
if (wallpaper_bitmap_or_error.is_error())
|
||||
dbgln("Failed to load wallpaper bitmap from path: {}", wallpaper_bitmap_or_error.error());
|
||||
else
|
||||
|
@ -556,7 +556,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
auto selected_wallpaper = Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv);
|
||||
RefPtr<Gfx::Bitmap> wallpaper_bitmap {};
|
||||
if (!selected_wallpaper.is_empty()) {
|
||||
wallpaper_bitmap = TRY(Gfx::Bitmap::try_load_from_file(selected_wallpaper));
|
||||
wallpaper_bitmap = TRY(Gfx::Bitmap::load_from_file(selected_wallpaper));
|
||||
}
|
||||
// This sets the wallpaper at startup, even if there is no wallpaper, the
|
||||
// desktop should still show the background color. It's fine to pass a
|
||||
|
@ -670,7 +670,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
auto directory_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
|
||||
auto tree_view_directory_context_menu = TRY(GUI::Menu::try_create("Tree View Directory"));
|
||||
|
||||
auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"sv)), [&](GUI::Action const&) {
|
||||
auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv)), [&](GUI::Action const&) {
|
||||
directory_view->open_parent_directory();
|
||||
});
|
||||
|
||||
|
@ -798,7 +798,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
= GUI::Action::create(
|
||||
"Open in New &Window",
|
||||
{},
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<DeprecatedString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
|
@ -817,7 +817,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
= GUI::Action::create(
|
||||
"Open in &Terminal",
|
||||
{},
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<DeprecatedString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
|
@ -837,7 +837,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
= GUI::Action::create(
|
||||
"Create Desktop &Shortcut",
|
||||
{},
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-symlink.png"sv)),
|
||||
[&](GUI::Action const&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty()) {
|
||||
|
@ -850,7 +850,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
auto create_archive_action
|
||||
= GUI::Action::create(
|
||||
"Create &Archive",
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
|
||||
[&](GUI::Action const&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty())
|
||||
|
@ -877,7 +877,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
auto set_wallpaper_action
|
||||
= GUI::Action::create(
|
||||
"Set as Desktop &Wallpaper",
|
||||
TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
|
||||
[&](GUI::Action const&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty())
|
||||
|
@ -971,12 +971,12 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
});
|
||||
focus_dependent_delete_action->set_enabled(false);
|
||||
|
||||
auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv)), [&](GUI::Action const&) {
|
||||
auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv)), [&](GUI::Action const&) {
|
||||
directory_view->mkdir_action().activate();
|
||||
refresh_tree_view();
|
||||
});
|
||||
|
||||
auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv)), [&](GUI::Action const&) {
|
||||
auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv)), [&](GUI::Action const&) {
|
||||
directory_view->touch_action().activate();
|
||||
refresh_tree_view();
|
||||
});
|
||||
|
@ -1031,7 +1031,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
TRY(view_menu->try_add_separator());
|
||||
TRY(view_menu->try_add_action(show_dotfiles_action));
|
||||
|
||||
auto go_to_location_action = GUI::Action::create("Go to &Location...", { Mod_Ctrl, Key_L }, Key_F6, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
|
||||
auto go_to_location_action = GUI::Action::create("Go to &Location...", { Mod_Ctrl, Key_L }, Key_F6, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
|
||||
toolbar_container.set_visible(true);
|
||||
location_toolbar.set_visible(true);
|
||||
breadcrumb_toolbar.set_visible(false);
|
||||
|
@ -1181,7 +1181,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|| (!directory_view->current_view().selection().is_empty() && access(directory_view->path().characters(), W_OK) == 0));
|
||||
};
|
||||
|
||||
auto directory_open_action = GUI::Action::create("Open", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv)), [&](auto&) {
|
||||
auto directory_open_action = GUI::Action::create("Open", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv)), [&](auto&) {
|
||||
directory_view->open(directory_view->selected_file_paths().first());
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue