diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 17:32:29 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | 3f3f45580ab7266258e97cb3cecf1e24716d61c5 (patch) | |
tree | 152c7a187c98184d58bf91a326357e0af435edcf /Userland/Applications/ImageViewer | |
parent | e5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13 (diff) | |
download | serenity-3f3f45580ab7266258e97cb3cecf1e24716d61c5.zip |
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).
No functional changes.
Diffstat (limited to 'Userland/Applications/ImageViewer')
-rw-r--r-- | Userland/Applications/ImageViewer/ViewWidget.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/ImageViewer/main.cpp | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 0a1dfc7c4e..0ca9b8d9a8 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -154,7 +154,7 @@ void ViewWidget::mouseup_event(GUI::MouseEvent& event) void ViewWidget::load_from_file(String const& path) { auto show_error = [&] { - GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image"sv, GUI::MessageBox::Type::Error); }; auto file_or_error = Core::MappedFile::map(path); diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 555b96c4a8..0fa847cd45 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/ImageViewer.md") })); TRY(Desktop::Launcher::seal_allowlist()); - auto app_icon = GUI::Icon::default_icon("filetype-image"); + auto app_icon = GUI::Icon::default_icon("filetype-image"sv); char const* path = nullptr; Core::ArgsParser args_parser; @@ -124,7 +124,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto msgbox_result = GUI::MessageBox::show(window, String::formatted("Are you sure you want to delete {}?", path), - "Confirm deletion", + "Confirm deletion"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); @@ -135,7 +135,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (unlinked_or_error.is_error()) { GUI::MessageBox::show(window, String::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()), - "Delete failed", + "Delete failed"sv, GUI::MessageBox::Type::Error); return; @@ -157,42 +157,42 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) widget->rotate(Gfx::RotationDirection::Clockwise); }); - auto vertical_flip_action = GUI::Action::create("Flip &Vertically", { Mod_None, Key_V }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png")), + auto vertical_flip_action = GUI::Action::create("Flip &Vertically", { Mod_None, Key_V }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)), [&](auto&) { widget->flip(Gfx::Orientation::Vertical); }); - auto horizontal_flip_action = GUI::Action::create("Flip &Horizontally", { Mod_None, Key_H }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png")), + auto horizontal_flip_action = GUI::Action::create("Flip &Horizontally", { Mod_None, Key_H }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)), [&](auto&) { widget->flip(Gfx::Orientation::Horizontal); }); - auto desktop_wallpaper_action = GUI::Action::create("Set as Desktop &Wallpaper", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png")), + auto desktop_wallpaper_action = GUI::Action::create("Set as Desktop &Wallpaper", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)), [&](auto&) { if (!GUI::Desktop::the().set_wallpaper(widget->bitmap(), widget->path())) { GUI::MessageBox::show(window, String::formatted("set_wallpaper({}) failed", widget->path()), - "Could not set wallpaper", + "Could not set wallpaper"sv, GUI::MessageBox::Type::Error); } }); - auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-first.png")), + auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-first.png"sv)), [&](auto&) { widget->navigate(ViewWidget::Directions::First); }); - auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png")), + auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) { widget->navigate(ViewWidget::Directions::Back); }); - auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png")), + auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) { widget->navigate(ViewWidget::Directions::Forward); }); - auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png")), + auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv)), [&](auto&) { widget->navigate(ViewWidget::Directions::Last); }); |