diff options
Diffstat (limited to 'Userland/Applications')
140 files changed, 980 insertions, 982 deletions
diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index 2ccecbb575..167a899285 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -31,7 +31,7 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file) if (object_line.starts_with("#")) continue; - if (object_line.starts_with("vt")) { + if (object_line.starts_with("vt"sv)) { auto tex_coord_line = object_line.split_view(' '); if (tex_coord_line.size() != 3) { dbgln("Wavefront: Malformed TexCoord line. Aborting."); @@ -44,7 +44,7 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file) continue; } - if (object_line.starts_with("vn")) { + if (object_line.starts_with("vn"sv)) { auto normal_line = object_line.split_view(' '); if (normal_line.size() != 4) { dbgln("Wavefront: Malformed vertex normal line. Aborting."); diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index f4a2475c1e..49b0a7babb 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -284,7 +284,7 @@ bool GLContextWidget::load_path(String const& filename) auto file = Core::File::construct(filename); if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -294,31 +294,31 @@ bool GLContextWidget::load_path(String const& filename) bool GLContextWidget::load_file(Core::File& file) { auto const& filename = file.filename(); - if (!filename.ends_with(".obj")) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: invalid file type", filename), "Error", GUI::MessageBox::Type::Error); + if (!filename.ends_with(".obj"sv)) { + GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (file.is_device()) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (file.is_directory()) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } auto new_mesh = m_mesh_loader->load(file); if (new_mesh.is_null()) { - GUI::MessageBox::show(window(), String::formatted("Reading \"{}\" failed.", filename), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Reading \"{}\" failed.", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } // Determine whether or not a texture for this model resides within the same directory StringBuilder builder; builder.append(filename.split('.').at(0)); - builder.append(".bmp"); + builder.append(".bmp"sv); String texture_path = Core::File::absolute_path(builder.string_view()); @@ -368,7 +368,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) // Construct the main window auto window = GUI::Window::construct(); - auto app_icon = GUI::Icon::default_icon("app-3d-file-viewer"); + auto app_icon = GUI::Icon::default_icon("app-3d-file-viewer"sv); window->set_icon(app_icon.bitmap_for_size(16)); window->set_title("3D File Viewer"); window->resize(640 + 4, 480 + 4); diff --git a/Userland/Applications/About/main.cpp b/Userland/Applications/About/main.cpp index 3065a2143e..0cc6a5949c 100644 --- a/Userland/Applications/About/main.cpp +++ b/Userland/Applications/About/main.cpp @@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = TRY(GUI::Icon::try_create_default_icon("ladyball")); - GUI::AboutDialog::show("SerenityOS", app_icon.bitmap_for_size(32), nullptr, app_icon.bitmap_for_size(16), Core::Version::read_long_version_string()); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("ladyball"sv)); + GUI::AboutDialog::show("SerenityOS"sv, app_icon.bitmap_for_size(32), nullptr, app_icon.bitmap_for_size(16), Core::Version::read_long_version_string()); return app->exec(); } diff --git a/Userland/Applications/AnalogClock/AnalogClock.cpp b/Userland/Applications/AnalogClock/AnalogClock.cpp index 747cf20f94..b5d95fb33b 100644 --- a/Userland/Applications/AnalogClock/AnalogClock.cpp +++ b/Userland/Applications/AnalogClock/AnalogClock.cpp @@ -130,7 +130,7 @@ void AnalogClock::paint_event(GUI::PaintEvent& event) void AnalogClock::update_title_date() { - window()->set_title(Core::DateTime::now().to_string("%Y-%m-%d")); + window()->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv)); } void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event) diff --git a/Userland/Applications/AnalogClock/main.cpp b/Userland/Applications/AnalogClock/main.cpp index 719103410e..118d056d32 100644 --- a/Userland/Applications/AnalogClock/main.cpp +++ b/Userland/Applications/AnalogClock/main.cpp @@ -24,9 +24,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock")); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock"sv)); auto window = TRY(GUI::Window::try_create()); - window->set_title(Core::DateTime::now().to_string("%Y-%m-%d")); + window->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv)); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(170, 170); window->set_resizable(false); diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index 933fc0d005..adb65e86d7 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -52,7 +52,7 @@ void TerminalResult::activate() const // FIXME: This should be a GUI::Process::spawn_or_show_error(), however this is a // Assistant::Result object, which does not have access to the application's GUI::Window* pointer // (which spawn_or_show_error() needs incase it has to open a error message box). - (void)Core::Process::spawn("/bin/Terminal", Array { "-k", "-e", title().characters() }); + (void)Core::Process::spawn("/bin/Terminal"sv, Array { "-k", "-e", title().characters() }); } void URLResult::activate() const diff --git a/Userland/Applications/Assistant/Providers.h b/Userland/Applications/Assistant/Providers.h index b240e18e53..f9aed96648 100644 --- a/Userland/Applications/Assistant/Providers.h +++ b/Userland/Applications/Assistant/Providers.h @@ -72,7 +72,7 @@ class CalculatorResult final : public Result { public: explicit CalculatorResult(String title) : Result(move(title), "'Enter' will copy to clipboard"sv, 100) - , m_bitmap(GUI::Icon::default_icon("app-calculator").bitmap_for_size(16)) + , m_bitmap(GUI::Icon::default_icon("app-calculator"sv).bitmap_for_size(16)) { } ~CalculatorResult() override = default; @@ -100,7 +100,7 @@ class TerminalResult final : public Result { public: explicit TerminalResult(String command) : Result(move(command), "Run command in Terminal"sv, 100) - , m_bitmap(GUI::Icon::default_icon("app-terminal").bitmap_for_size(16)) + , m_bitmap(GUI::Icon::default_icon("app-terminal"sv).bitmap_for_size(16)) { } ~TerminalResult() override = default; @@ -116,7 +116,7 @@ class URLResult final : public Result { public: explicit URLResult(const URL& url) : Result(url.to_string(), "'Enter' will open this URL in the browser"sv, 50) - , m_bitmap(GUI::Icon::default_icon("app-browser").bitmap_for_size(16)) + , m_bitmap(GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16)) { } ~URLResult() override = default; diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index bc2b96ca28..0753f44177 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -45,7 +45,7 @@ static String bookmarks_file_path() { StringBuilder builder; builder.append(Core::StandardPaths::config_directory()); - builder.append("/bookmarks.json"); + builder.append("/bookmarks.json"sv); return builder.to_string(); } @@ -53,7 +53,7 @@ static String search_engines_file_path() { StringBuilder builder; builder.append(Core::StandardPaths::config_directory()); - builder.append("/SearchEngines.json"); + builder.append("/SearchEngines.json"sv); return builder.to_string(); } @@ -61,7 +61,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) : m_cookie_jar(cookie_jar) , m_window_actions(*this) { - auto app_icon = GUI::Icon::default_icon("app-browser"); + auto app_icon = GUI::Icon::default_icon("app-browser"sv); m_bookmarks_bar = Browser::BookmarksBarWidget::construct(Browser::bookmarks_file_path(), true); resize(730, 560); @@ -123,25 +123,25 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) }); m_window_actions.on_about = [this] { - auto app_icon = GUI::Icon::default_icon("app-browser"); - GUI::AboutDialog::show("Browser", app_icon.bitmap_for_size(32), this); + auto app_icon = GUI::Icon::default_icon("app-browser"sv); + GUI::AboutDialog::show("Browser"sv, app_icon.bitmap_for_size(32), this); }; m_window_actions.on_show_bookmarks_bar = [](auto& action) { Browser::BookmarksBarWidget::the().set_visible(action.is_checked()); - Config::write_bool("Browser", "Preferences", "ShowBookmarksBar", action.is_checked()); + Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, action.is_checked()); }; - bool show_bookmarks_bar = Config::read_bool("Browser", "Preferences", "ShowBookmarksBar", true); + bool show_bookmarks_bar = Config::read_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, true); m_window_actions.show_bookmarks_bar_action().set_checked(show_bookmarks_bar); Browser::BookmarksBarWidget::the().set_visible(show_bookmarks_bar); m_window_actions.on_vertical_tabs = [this](auto& action) { m_tab_widget->set_tab_position(action.is_checked() ? GUI::TabWidget::TabPosition::Left : GUI::TabWidget::TabPosition::Top); - Config::write_bool("Browser", "Preferences", "VerticalTabs", action.is_checked()); + Config::write_bool("Browser"sv, "Preferences"sv, "VerticalTabs"sv, action.is_checked()); }; - bool vertical_tabs = Config::read_bool("Browser", "Preferences", "VerticalTabs", false); + bool vertical_tabs = Config::read_bool("Browser"sv, "Preferences"sv, "VerticalTabs"sv, false); m_window_actions.vertical_tabs_action().set_checked(vertical_tabs); m_tab_widget->set_tab_position(vertical_tabs ? GUI::TabWidget::TabPosition::Left : GUI::TabWidget::TabPosition::Top); @@ -258,13 +258,13 @@ void BrowserWindow::build_menus() m_change_homepage_action = GUI::Action::create( "Set Homepage URL...", g_icon_bag.go_home, [this](auto&) { - auto homepage_url = Config::read_string("Browser", "Preferences", "Home", "about:blank"); - if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecResult::OK) { + auto homepage_url = Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, "about:blank"sv); + if (GUI::InputBox::show(this, homepage_url, "Enter URL"sv, "Change homepage URL"sv) == GUI::InputBox::ExecResult::OK) { if (URL(homepage_url).is_valid()) { - Config::write_string("Browser", "Preferences", "Home", homepage_url); + Config::write_string("Browser"sv, "Preferences"sv, "Home"sv, homepage_url); Browser::g_home_url = homepage_url; } else { - GUI::MessageBox::show_error(this, "The URL you have entered is not valid"); + GUI::MessageBox::show_error(this, "The URL you have entered is not valid"sv); } } }, @@ -280,13 +280,13 @@ void BrowserWindow::build_menus() auto& color_scheme_menu = settings_menu.add_submenu("&Color Scheme"); color_scheme_menu.set_icon(g_icon_bag.color_chooser); { - auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser", "Preferences", "ColorScheme", "auto")); + auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, "auto"sv)); m_color_scheme_actions.set_exclusive(true); auto add_color_scheme_action = [&](auto& name, Web::CSS::PreferredColorScheme preference_value) { auto action = GUI::Action::create_checkable( name, [=, this](auto&) { - Config::write_string("Browser", "Preferences", "ColorScheme", Web::CSS::preferred_color_scheme_to_string(preference_value)); + Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, Web::CSS::preferred_color_scheme_to_string(preference_value)); active_tab().view().set_preferred_color_scheme(preference_value); }, this); @@ -302,9 +302,9 @@ void BrowserWindow::build_menus() } settings_menu.add_separator(); - auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(), + auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { - GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings"); + GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings"sv); }); settings_menu.add_action(move(open_settings_action)); @@ -385,7 +385,7 @@ void BrowserWindow::build_menus() auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) { String user_agent; - if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) { + if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv) != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) { m_disable_user_agent_spoofing->activate(); return; } @@ -426,7 +426,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu) m_disable_search_engine_action = GUI::Action::create_checkable( "Disable", [](auto&) { g_search_engine = {}; - Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine); }, this); search_engine_menu.add_action(*m_disable_search_engine_action); @@ -444,13 +444,13 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu) if (!json_item.is_object()) continue; auto search_engine = json_item.as_object(); - auto name = search_engine.get("title").to_string(); - auto url_format = search_engine.get("url_format").to_string(); + auto name = search_engine.get("title"sv).to_string(); + auto url_format = search_engine.get("url_format"sv).to_string(); auto action = GUI::Action::create_checkable( name, [&, url_format](auto&) { g_search_engine = url_format; - Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine); }, this); search_engine_menu.add_action(action); @@ -467,20 +467,20 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu) auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) { String search_engine; - if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) { + if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) { m_disable_search_engine_action->activate(); return; } auto argument_count = search_engine.count("{}"sv); if (argument_count != 1) { - GUI::MessageBox::show(this, "Invalid format, must contain '{}' once!", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, "Invalid format, must contain '{}' once!"sv, "Error"sv, GUI::MessageBox::Type::Error); m_disable_search_engine_action->activate(); return; } g_search_engine = search_engine; - Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine); action.set_status_tip(search_engine); }); search_engine_menu.add_action(custom_search_engine_action); @@ -608,7 +608,7 @@ void BrowserWindow::config_string_did_change(String const& domain, String const& Browser::g_home_url = value; else if (key == "NewTab") Browser::g_new_tab_url = value; - } else if (group.starts_with("Proxy:")) { + } else if (group.starts_with("Proxy:"sv)) { dbgln("Proxy mapping changed: {}/{} = {}", group, key, value); auto proxy_spec = group.substring_view(6); auto existing_proxy = Browser::g_proxies.find(proxy_spec); diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 3603e856bb..392c4d6f61 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -25,7 +25,7 @@ ConsoleWidget::ConsoleWidget() set_fill_with_background_color(true); m_output_view = add<WebView::OutOfProcessWebView>(); - m_output_view->load("data:text/html,<html></html>"); + m_output_view->load("data:text/html,<html></html>"sv); // Wait until our output WebView is loaded, and then request any messages that occurred before we existed m_output_view->on_load_finish = [this](auto&) { if (on_request_messages) @@ -130,9 +130,9 @@ void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> cons void ConsoleWidget::print_source_line(StringView source) { StringBuilder html; - html.append("<span class=\"repl-indicator\">"); - html.append("> "); - html.append("</span>"); + html.append("<span class=\"repl-indicator\">"sv); + html.append("> "sv); + html.append("</span>"sv); html.append(JS::MarkupGenerator::html_from_source(source)); @@ -147,7 +147,7 @@ void ConsoleWidget::print_html(StringView line) if (parent_id == 0) { builder.append(R"~~~( var parentGroup = document.body; -)~~~"); +)~~~"sv); } else { builder.appendff(R"~~~( var parentGroup = document.getElementById("group_{}"); @@ -157,11 +157,11 @@ void ConsoleWidget::print_html(StringView line) builder.append(R"~~~( var p = document.createElement("p"); - p.innerHTML = ")~~~"); + p.innerHTML = ")~~~"sv); builder.append_escaped_for_json(line); builder.append(R"~~~(" parentGroup.appendChild(p); -)~~~"); +)~~~"sv); m_output_view->run_javascript(builder.string_view()); // FIXME: Make it scroll to the bottom, using `window.scrollTo()` in the JS above. // We used to call `m_output_view->scroll_to_bottom();` here, but that does not work because @@ -174,7 +174,7 @@ void ConsoleWidget::clear_output() m_group_stack.clear(); m_output_view->run_javascript(R"~~~( document.body.innerHTML = ""; - )~~~"); + )~~~"sv); } void ConsoleWidget::begin_group(StringView label, bool start_expanded) @@ -184,7 +184,7 @@ void ConsoleWidget::begin_group(StringView label, bool start_expanded) if (parent_id == 0) { builder.append(R"~~~( var parentGroup = document.body; -)~~~"); +)~~~"sv); } else { builder.appendff(R"~~~( var parentGroup = document.getElementById("group_{}"); @@ -206,10 +206,10 @@ void ConsoleWidget::begin_group(StringView label, bool start_expanded) builder.append(R"~~~("; group.appendChild(label); parentGroup.appendChild(group); -)~~~"); +)~~~"sv); if (start_expanded) - builder.append("group.open = true;"); + builder.append("group.open = true;"sv); m_output_view->run_javascript(builder.string_view()); // FIXME: Scroll console to bottom - see note in print_html() diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp index d8be5e30e6..fb97ad2e81 100644 --- a/Userland/Applications/Browser/CookieJar.cpp +++ b/Userland/Applications/Browser/CookieJar.cpp @@ -29,7 +29,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) for (auto const& cookie : cookie_list) { // If there is an unprocessed cookie in the cookie-list, output the characters %x3B and %x20 ("; ") if (!builder.is_empty()) - builder.append("; "); + builder.append("; "sv); // Output the cookie's name, the %x3D ("=") character, and the cookie's value. builder.appendff("{}={}", cookie.name, cookie.value); @@ -50,9 +50,9 @@ void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& pars void CookieJar::dump_cookies() const { - constexpr StringView key_color = "\033[34;1m"; - constexpr StringView attribute_color = "\033[33m"; - constexpr StringView no_color = "\033[0m"; + constexpr auto key_color = "\033[34;1m"sv; + constexpr auto attribute_color = "\033[33m"sv; + constexpr auto no_color = "\033[0m"sv; StringBuilder builder; builder.appendff("{} cookies stored\n", m_cookies.size()); diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index cfc6df68dd..50dfe3932b 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -37,7 +37,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_destination_path = builder.to_string(); } - auto close_on_finish = Config::read_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", false); + auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false); m_elapsed_timer.start(); m_download = Web::ResourceLoader::the().connector().start_request("GET", url); @@ -49,7 +49,7 @@ DownloadWidget::DownloadWidget(const URL& url) { auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write); if (file_or_error.is_error()) { - GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error); window()->close(); return; } @@ -68,7 +68,7 @@ DownloadWidget::DownloadWidget(const URL& url) auto& animation_layout = animation_container.set_layout<GUI::HorizontalBoxLayout>(); m_browser_image = animation_container.add<GUI::ImageWidget>(); - m_browser_image->load_from_file("/res/graphics/download-animation.gif"); + m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); animation_layout.add_spacer(); auto& source_label = add<GUI::Label>(String::formatted("From: {}", url)); @@ -90,7 +90,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_close_on_finish_checkbox->set_checked(close_on_finish); m_close_on_finish_checkbox->on_checked = [&](bool checked) { - Config::write_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", checked); + Config::write_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, checked); }; auto& button_container = add<GUI::Widget>(); @@ -126,7 +126,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size) { StringBuilder builder; - builder.append("Downloaded "); + builder.append("Downloaded "sv); builder.append(human_readable_size(downloaded_size)); builder.appendff(" in {} sec", m_elapsed_timer.elapsed() / 1000); m_progress_label->set_text(builder.to_string()); @@ -140,7 +140,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size) } else { builder.append(human_readable_size(downloaded_size)); } - builder.append(" of "); + builder.append(" of "sv); builder.append(m_url.basename()); window()->set_title(builder.to_string()); } @@ -150,7 +150,7 @@ void DownloadWidget::did_finish(bool success) { dbgln("did_finish, success={}", success); - m_browser_image->load_from_file("/res/graphics/download-finished.gif"); + m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv); window()->set_title("Download finished!"); m_close_button->set_enabled(true); m_cancel_button->set_text("Open in Folder"); @@ -161,7 +161,7 @@ void DownloadWidget::did_finish(bool success) m_cancel_button->update(); if (!success) { - GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error); window()->close(); return; } diff --git a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp index a60f37a472..0ee3e8aef6 100644 --- a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp +++ b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp @@ -83,7 +83,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event) draw_borders(margin_rect, Color::Black); margin_rect.shrink(1, 1, 1, 1); margin_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding); - painter.draw_text(margin_rect, "margin", font(), Gfx::TextAlignment::TopLeft, Color::Black); + painter.draw_text(margin_rect, "margin"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black); draw_size_texts(margin_rect, Color::Black, m_node_box_sizing.margin); // paint border box @@ -91,7 +91,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event) draw_borders(border_rect, Color::Black); border_rect.shrink(1, 1, 1, 1); border_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding); - painter.draw_text(border_rect, "border", font(), Gfx::TextAlignment::TopLeft, Color::Black); + painter.draw_text(border_rect, "border"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black); draw_size_texts(border_rect, Color::Black, m_node_box_sizing.border); // paint padding box @@ -99,7 +99,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event) draw_borders(padding_rect, Color::Black); padding_rect.shrink(1, 1, 1, 1); padding_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding); - painter.draw_text(padding_rect, "padding", font(), Gfx::TextAlignment::TopLeft, Color::Black); + painter.draw_text(padding_rect, "padding"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black); draw_size_texts(padding_rect, Color::Black, m_node_box_sizing.padding); // paint content box diff --git a/Userland/Applications/Browser/IconBag.cpp b/Userland/Applications/Browser/IconBag.cpp index de7abafd4e..05e738a9b6 100644 --- a/Userland/Applications/Browser/IconBag.cpp +++ b/Userland/Applications/Browser/IconBag.cpp @@ -12,30 +12,30 @@ ErrorOr<IconBag> IconBag::try_create() { IconBag icon_bag; - icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png")); - icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png")); - icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png")); - icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png")); - icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png")); - icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png")); - icon_bag.go_home = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png")); - icon_bag.find = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png")); - icon_bag.color_chooser = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png")); - icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png")); - icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png")); - icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png")); - icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png")); - icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png")); - icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png")); - icon_bag.layers = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layers.png")); - icon_bag.filetype_css = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-css.png")); - icon_bag.inspect = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspect.png")); - icon_bag.history = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/history.png")); - icon_bag.cookie = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/cookie.png")); - icon_bag.local_storage = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/local-storage.png")); - icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png")); - icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png")); - icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png")); + icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv)); + icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"sv)); + icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"sv)); + icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png"sv)); + icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png"sv)); + icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv)); + icon_bag.go_home = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv)); + icon_bag.find = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)); + icon_bag.color_chooser = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv)); + icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv)); + icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv)); + icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png"sv)); + icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png"sv)); + icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png"sv)); + icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv)); + icon_bag.layers = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layers.png"sv)); + icon_bag.filetype_css = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-css.png"sv)); + icon_bag.inspect = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspect.png"sv)); + icon_bag.history = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/history.png"sv)); + icon_bag.cookie = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/cookie.png"sv)); + icon_bag.local_storage = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/local-storage.png"sv)); + icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"sv)); + icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png"sv)); + icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png"sv)); return icon_bag; } diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index 4342160812..56f9fde607 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -50,11 +50,11 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index) VERIFY(json); Selection selection {}; - if (json->has_u32("pseudo-element")) { - selection.dom_node_id = json->get("parent-id").to_i32(); - selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get("pseudo-element").to_u32()); + if (json->has_u32("pseudo-element"sv)) { + selection.dom_node_id = json->get("parent-id"sv).to_i32(); + selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get("pseudo-element"sv).to_u32()); } else { - selection.dom_node_id = json->get("id").to_i32(); + selection.dom_node_id = json->get("id"sv).to_i32(); } if (selection == m_selection) @@ -186,21 +186,21 @@ void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_jso auto json_value = json_or_error.release_value(); auto const& json_object = json_value.as_object(); - m_node_box_sizing.margin.top = json_object.get("margin_top").to_float(); - m_node_box_sizing.margin.right = json_object.get("margin_right").to_float(); - m_node_box_sizing.margin.bottom = json_object.get("margin_bottom").to_float(); - m_node_box_sizing.margin.left = json_object.get("margin_left").to_float(); - m_node_box_sizing.padding.top = json_object.get("padding_top").to_float(); - m_node_box_sizing.padding.right = json_object.get("padding_right").to_float(); - m_node_box_sizing.padding.bottom = json_object.get("padding_bottom").to_float(); - m_node_box_sizing.padding.left = json_object.get("padding_left").to_float(); - m_node_box_sizing.border.top = json_object.get("border_top").to_float(); - m_node_box_sizing.border.right = json_object.get("border_right").to_float(); - m_node_box_sizing.border.bottom = json_object.get("border_bottom").to_float(); - m_node_box_sizing.border.left = json_object.get("border_left").to_float(); - - m_element_size_view->set_node_content_width(json_object.get("content_width").to_float()); - m_element_size_view->set_node_content_height(json_object.get("content_height").to_float()); + m_node_box_sizing.margin.top = json_object.get("margin_top"sv).to_float(); + m_node_box_sizing.margin.right = json_object.get("margin_right"sv).to_float(); + m_node_box_sizing.margin.bottom = json_object.get("margin_bottom"sv).to_float(); + m_node_box_sizing.margin.left = json_object.get("margin_left"sv).to_float(); + m_node_box_sizing.padding.top = json_object.get("padding_top"sv).to_float(); + m_node_box_sizing.padding.right = json_object.get("padding_right"sv).to_float(); + m_node_box_sizing.padding.bottom = json_object.get("padding_bottom"sv).to_float(); + m_node_box_sizing.padding.left = json_object.get("padding_left"sv).to_float(); + m_node_box_sizing.border.top = json_object.get("border_top"sv).to_float(); + m_node_box_sizing.border.right = json_object.get("border_right"sv).to_float(); + m_node_box_sizing.border.bottom = json_object.get("border_bottom"sv).to_float(); + m_node_box_sizing.border.left = json_object.get("border_left"sv).to_float(); + + m_element_size_view->set_node_content_width(json_object.get("content_width"sv).to_float()); + m_element_size_view->set_node_content_height(json_object.get("content_height"sv).to_float()); m_element_size_view->set_box_model(m_node_box_sizing); } diff --git a/Userland/Applications/Browser/StorageWidget.cpp b/Userland/Applications/Browser/StorageWidget.cpp index 56991ba06d..bc45b55b74 100644 --- a/Userland/Applications/Browser/StorageWidget.cpp +++ b/Userland/Applications/Browser/StorageWidget.cpp @@ -25,7 +25,7 @@ StorageWidget::StorageWidget() m_cookies_model = adopt_ref(*new CookiesModel()); m_cookies_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_cookies_model)); - m_cookies_filtering_model->set_filter_term(""); + m_cookies_filtering_model->set_filter_term(""sv); m_cookies_textbox->on_change = [this] { m_cookies_filtering_model->set_filter_term(m_cookies_textbox->text()); @@ -42,7 +42,7 @@ StorageWidget::StorageWidget() m_local_storage_model = adopt_ref(*new StorageModel()); m_local_storage_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_local_storage_model)); - m_local_storage_filtering_model->set_filter_term(""); + m_local_storage_filtering_model->set_filter_term(""sv); m_local_storage_textbox->on_change = [this] { m_local_storage_filtering_model->set_filter_term(m_local_storage_textbox->text()); @@ -59,7 +59,7 @@ StorageWidget::StorageWidget() m_session_storage_model = adopt_ref(*new StorageModel()); m_session_storage_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_session_storage_model)); - m_session_storage_filtering_model->set_filter_term(""); + m_session_storage_filtering_model->set_filter_term(""sv); m_session_storage_textbox->on_change = [this] { m_session_storage_filtering_model->set_filter_term(m_session_storage_textbox->text()); diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index e6eb96325b..aa04c63002 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -42,8 +42,8 @@ namespace Browser { URL url_from_user_input(String const& input) { - if (input.starts_with("?") && !g_search_engine.is_empty()) - return URL(g_search_engine.replace("{}", URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly)); + if (input.starts_with('?') && !g_search_engine.is_empty()) + return URL(g_search_engine.replace("{}"sv, URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly)); URL url_with_http_schema = URL(String::formatted("http://{}", input)); if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value()) @@ -150,7 +150,7 @@ Tab::Tab(BrowserWindow& window) toolbar.add_action(window.reload_action()); m_location_box = toolbar.add<GUI::UrlBox>(); - m_location_box->set_placeholder("Address"); + m_location_box->set_placeholder("Address"sv); m_location_box->on_return_pressed = [this] { auto url = url_from_location_bar(); @@ -166,7 +166,7 @@ Tab::Tab(BrowserWindow& window) m_location_box->add_custom_context_menu_action(GUI::Action::create("Paste && Go", [this](auto&) { auto [data, mime_type, _] = GUI::Clipboard::the().fetch_data_and_type(); - if (!mime_type.starts_with("text/")) + if (!mime_type.starts_with("text/"sv)) return; auto const& paste_text = data; if (paste_text.is_empty()) @@ -400,7 +400,7 @@ Tab::Tab(BrowserWindow& window) Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld) { if (m_location_box->text().starts_with('?') && g_search_engine.is_empty()) { - GUI::MessageBox::show(&this->window(), "Select a search engine in the Settings menu before searching.", "No search engine selected", GUI::MessageBox::Type::Information); + GUI::MessageBox::show(&this->window(), "Select a search engine in the Settings menu before searching."sv, "No search engine selected"sv, GUI::MessageBox::Type::Information); return {}; } @@ -410,8 +410,8 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld) builder.append(text); if (may_append_tld == MayAppendTLD::Yes) { // FIXME: Expand the list of top level domains. - if (!(text.ends_with(".com") || text.ends_with(".net") || text.ends_with(".org"))) { - builder.append(".com"); + if (!(text.ends_with(".com"sv) || text.ends_with(".net"sv) || text.ends_with(".org"sv))) { + builder.append(".com"sv); } } String final_text = builder.to_string(); diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index 0af7bfedee..68a22afc89 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -66,7 +66,7 @@ WindowActions::WindowActions(GUI::Window& window) m_tab_actions.last().set_status_tip("Switch to last tab"); m_about_action = GUI::Action::create( - "&About Browser", GUI::Icon::default_icon("app-browser").bitmap_for_size(16), [this](const GUI::Action&) { + "&About Browser", GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16), [this](const GUI::Action&) { if (on_about) on_about(); }, diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 1c1f22ecc0..04a7ea4613 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -93,22 +93,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create())); - auto app_icon = GUI::Icon::default_icon("app-browser"); + auto app_icon = GUI::Icon::default_icon("app-browser"sv); - Browser::g_home_url = Config::read_string("Browser", "Preferences", "Home", "file:///res/html/misc/welcome.html"); - Browser::g_new_tab_url = Config::read_string("Browser", "Preferences", "NewTab", "file:///res/html/misc/new-tab.html"); - Browser::g_search_engine = Config::read_string("Browser", "Preferences", "SearchEngine", {}); - Browser::g_content_filters_enabled = Config::read_bool("Browser", "Preferences", "EnableContentFilters", true); + Browser::g_home_url = Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, "file:///res/html/misc/welcome.html"sv); + Browser::g_new_tab_url = Config::read_string("Browser"sv, "Preferences"sv, "NewTab"sv, "file:///res/html/misc/new-tab.html"sv); + Browser::g_search_engine = Config::read_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, {}); + Browser::g_content_filters_enabled = Config::read_bool("Browser"sv, "Preferences"sv, "EnableContentFilters"sv, true); Browser::g_icon_bag = TRY(Browser::IconBag::try_create()); TRY(load_content_filters()); - for (auto& group : Config::list_groups("Browser")) { - if (!group.starts_with("Proxy:")) + for (auto& group : Config::list_groups("Browser"sv)) { + if (!group.starts_with("Proxy:"sv)) continue; - for (auto& key : Config::list_keys("Browser", group)) { + for (auto& key : Config::list_keys("Browser"sv, group)) { auto proxy_spec = group.substring_view(6); auto existing_proxy = Browser::g_proxies.find(proxy_spec); if (existing_proxy.is_end()) diff --git a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp index fc739bb803..9a5fb3417f 100644 --- a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp @@ -62,22 +62,22 @@ BrowserSettingsWidget::BrowserSettingsWidget() load_from_gml(browser_settings_widget_gml); m_homepage_url_textbox = find_descendant_of_type_named<GUI::TextBox>("homepage_url_textbox"); - m_homepage_url_textbox->set_text(Config::read_string("Browser", "Preferences", "Home", default_homepage_url), GUI::AllowCallback::No); + m_homepage_url_textbox->set_text(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, default_homepage_url), GUI::AllowCallback::No); m_homepage_url_textbox->on_change = [&]() { set_modified(true); }; m_new_tab_url_textbox = find_descendant_of_type_named<GUI::TextBox>("new_tab_url_textbox"); - m_new_tab_url_textbox->set_text(Config::read_string("Browser", "Preferences", "NewTab", default_new_tab_url), GUI::AllowCallback::No); + m_new_tab_url_textbox->set_text(Config::read_string("Browser"sv, "Preferences"sv, "NewTab"sv, default_new_tab_url), GUI::AllowCallback::No); m_new_tab_url_textbox->on_change = [&]() { set_modified(true); }; m_color_scheme_combobox = find_descendant_of_type_named<GUI::ComboBox>("color_scheme_combobox"); m_color_scheme_combobox->set_only_allow_values_from_model(true); m_color_scheme_combobox->set_model(adopt_ref(*new ColorSchemeModel())); m_color_scheme_combobox->set_selected_index(0, GUI::AllowCallback::No); - set_color_scheme(Config::read_string("Browser", "Preferences", "ColorScheme", default_color_scheme)); + set_color_scheme(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, default_color_scheme)); m_color_scheme_combobox->on_change = [&](auto, auto) { set_modified(true); }; m_show_bookmarks_bar_checkbox = find_descendant_of_type_named<GUI::CheckBox>("show_bookmarks_bar_checkbox"); - m_show_bookmarks_bar_checkbox->set_checked(Config::read_bool("Browser", "Preferences", "ShowBookmarksBar", default_show_bookmarks_bar), GUI::AllowCallback::No); + m_show_bookmarks_bar_checkbox->set_checked(Config::read_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, default_show_bookmarks_bar), GUI::AllowCallback::No); m_show_bookmarks_bar_checkbox->on_checked = [&](auto) { set_modified(true); }; m_enable_search_engine_checkbox = find_descendant_of_type_named<GUI::CheckBox>("enable_search_engine_checkbox"); @@ -111,10 +111,10 @@ BrowserSettingsWidget::BrowserSettingsWidget() m_custom_search_engine_group->set_enabled(m_is_custom_search_engine); set_modified(true); }; - set_search_engine_url(Config::read_string("Browser", "Preferences", "SearchEngine", default_search_engine)); + set_search_engine_url(Config::read_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, default_search_engine)); m_auto_close_download_windows_checkbox = find_descendant_of_type_named<GUI::CheckBox>("auto_close_download_windows_checkbox"); - m_auto_close_download_windows_checkbox->set_checked(Config::read_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", default_auto_close_download_windows), GUI::AllowCallback::No); + m_auto_close_download_windows_checkbox->set_checked(Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, default_auto_close_download_windows), GUI::AllowCallback::No); m_auto_close_download_windows_checkbox->on_checked = [&](auto) { set_modified(true); }; } @@ -170,39 +170,39 @@ void BrowserSettingsWidget::apply_settings() { auto homepage_url = m_homepage_url_textbox->text(); if (!URL(homepage_url).is_valid()) { - GUI::MessageBox::show_error(this->window(), "The homepage URL you have entered is not valid"); + GUI::MessageBox::show_error(this->window(), "The homepage URL you have entered is not valid"sv); m_homepage_url_textbox->select_all(); m_homepage_url_textbox->set_focus(true); return; } - Config::write_string("Browser", "Preferences", "Home", homepage_url); + Config::write_string("Browser"sv, "Preferences"sv, "Home"sv, homepage_url); auto new_tab_url = m_new_tab_url_textbox->text(); if (!URL(new_tab_url).is_valid()) { - GUI::MessageBox::show_error(this->window(), "The new tab URL you have entered is not valid"); + GUI::MessageBox::show_error(this->window(), "The new tab URL you have entered is not valid"sv); m_new_tab_url_textbox->select_all(); m_new_tab_url_textbox->set_focus(true); return; } - Config::write_string("Browser", "Preferences", "NewTab", new_tab_url); + Config::write_string("Browser"sv, "Preferences"sv, "NewTab"sv, new_tab_url); - Config::write_bool("Browser", "Preferences", "ShowBookmarksBar", m_show_bookmarks_bar_checkbox->is_checked()); + Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, m_show_bookmarks_bar_checkbox->is_checked()); auto color_scheme_index = m_color_scheme_combobox->selected_index(); auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_string(); - Config::write_string("Browser", "Preferences", "ColorScheme", color_scheme); + Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, color_scheme); if (!m_enable_search_engine_checkbox->is_checked()) { - Config::write_string("Browser", "Preferences", "SearchEngine", {}); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, {}); } else if (m_is_custom_search_engine) { - Config::write_string("Browser", "Preferences", "SearchEngine", m_custom_search_engine_textbox->text()); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, m_custom_search_engine_textbox->text()); } else { auto selected_index = m_search_engine_combobox->selected_index(); auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_string(); - Config::write_string("Browser", "Preferences", "SearchEngine", url); + Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, url); } - Config::write_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", m_auto_close_download_windows_checkbox->is_checked()); + Config::write_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, m_auto_close_download_windows_checkbox->is_checked()); } void BrowserSettingsWidget::reset_default_values() diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp index 7770fc083e..8d583c08f2 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp @@ -114,13 +114,13 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget() m_domain_list_view = find_descendant_of_type_named<GUI::ListView>("domain_list_view"); m_add_new_domain_button = find_descendant_of_type_named<GUI::Button>("add_new_domain_button"); - m_enable_content_filtering_checkbox->set_checked(Config::read_bool("Browser", "Preferences", "EnableContentFilters", s_default_enable_content_filtering), GUI::AllowCallback::No); + m_enable_content_filtering_checkbox->set_checked(Config::read_bool("Browser"sv, "Preferences"sv, "EnableContentFilters"sv, s_default_enable_content_filtering), GUI::AllowCallback::No); m_enable_content_filtering_checkbox->on_checked = [&](auto) { set_modified(true); }; m_add_new_domain_button->on_click = [&](unsigned) { String text; - if (GUI::InputBox::show(window(), text, "Enter domain name", "Add domain to Content Filter") == GUI::Dialog::ExecResult::OK + if (GUI::InputBox::show(window(), text, "Enter domain name"sv, "Add domain to Content Filter"sv) == GUI::Dialog::ExecResult::OK && !text.is_empty()) { m_domain_list_model->add_domain(std::move(text)); set_modified(true); @@ -151,7 +151,7 @@ void ContentFilterSettingsWidget::apply_settings() { // FIXME: Propagate errors MUST(m_domain_list_model->save()); - Config::write_bool("Browser", "Preferences", "EnableContentFilters", m_enable_content_filtering_checkbox->is_checked()); + Config::write_bool("Browser"sv, "Preferences"sv, "EnableContentFilters"sv, m_enable_content_filtering_checkbox->is_checked()); } void ContentFilterSettingsWidget::reset_default_values() diff --git a/Userland/Applications/BrowserSettings/main.cpp b/Userland/Applications/BrowserSettings/main.cpp index 4c4527b5f5..bfcbf26b54 100644 --- a/Userland/Applications/BrowserSettings/main.cpp +++ b/Userland/Applications/BrowserSettings/main.cpp @@ -30,12 +30,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/home/anon/.config/BrowserContentFilters.txt", "rwc")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-browser"); + auto app_icon = GUI::Icon::default_icon("app-browser"sv); auto window = TRY(GUI::SettingsWindow::create("Browser Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes)); window->set_icon(app_icon.bitmap_for_size(16)); - (void)TRY(window->add_tab<BrowserSettingsWidget>("Browser", "browser")); - (void)TRY(window->add_tab<ContentFilterSettingsWidget>("Content Filtering", "content-filtering")); + (void)TRY(window->add_tab<BrowserSettingsWidget>("Browser"sv, "browser"sv)); + (void)TRY(window->add_tab<ContentFilterSettingsWidget>("Content Filtering"sv, "content-filtering"sv)); window->set_active_tab(selected_tab); window->show(); diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp index 8fa27be759..91035a66f5 100644 --- a/Userland/Applications/Calculator/main.cpp +++ b/Userland/Applications/Calculator/main.cpp @@ -27,7 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-calculator"); + auto app_icon = GUI::Icon::default_icon("app-calculator"sv); auto window = TRY(GUI::Window::try_create()); window->set_title("Calculator"); @@ -57,13 +57,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) })); auto& constants_menu = window->add_menu("&Constants"); - constants_menu.add_action(GUI::Action::create("&Pi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/pi.png")), [&](auto&) { + constants_menu.add_action(GUI::Action::create("&Pi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/pi.png"sv)), [&](auto&) { widget->set_entry(KeypadValue { 31415926535, 10 }); })); - constants_menu.add_action(GUI::Action::create("&Euler's Number", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/eulers_number.png")), [&](auto&) { + constants_menu.add_action(GUI::Action::create("&Euler's Number", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/eulers_number.png"sv)), [&](auto&) { widget->set_entry(KeypadValue { 27182818284, 10 }); })); - constants_menu.add_action(GUI::Action::create("&Phi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/phi.png")), [&](auto&) { + constants_menu.add_action(GUI::Action::create("&Phi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/phi.png"sv)), [&](auto&) { widget->set_entry(KeypadValue { 16180339887, 10 }); })); diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp index 7845517f2f..3a7ba07ddd 100644 --- a/Userland/Applications/Calendar/main.cpp +++ b/Userland/Applications/Calendar/main.cpp @@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-calendar")); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-calendar"sv)); auto window = TRY(GUI::Window::try_create()); window->set_title("Calendar"); window->resize(600, 480); @@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) 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({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png")), [&](const GUI::Action&) { + auto prev_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](const GUI::Action&) { unsigned view_month = calendar->view_month(); unsigned view_year = calendar->view_year(); if (calendar->mode() == GUI::Calendar::Month) { @@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) calendar->update_tiles(view_year, view_month); }); - auto next_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png")), [&](const GUI::Action&) { + auto next_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](const GUI::Action&) { unsigned view_month = calendar->view_month(); unsigned view_year = calendar->view_year(); if (calendar->mode() == GUI::Calendar::Month) { @@ -74,22 +74,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) calendar->update_tiles(view_year, view_month); }); - auto add_event_action = GUI::Action::create("&Add Event", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png")), [&](const GUI::Action&) { + auto add_event_action = GUI::Action::create("&Add Event", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"sv)), [&](const GUI::Action&) { AddEventDialog::show(calendar->selected_date(), window); }); - auto jump_to_action = GUI::Action::create("Jump to &Today", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png")), [&](const GUI::Action&) { + auto jump_to_action = GUI::Action::create("Jump to &Today", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"sv)), [&](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 }, TRY(Gfx::Bitmap::try_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 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-month-view.png"sv)), [&](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 }, TRY(Gfx::Bitmap::try_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 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv)), [&](const GUI::Action&) { if (calendar->mode() == GUI::Calendar::Month) calendar->toggle_mode(); }); @@ -117,7 +117,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; auto& file_menu = window->add_menu("&File"); - file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png")), + file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"sv)), [&](const GUI::Action&) { AddEventDialog::show(calendar->selected_date(), window); })); diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index da03b59645..c448624352 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -37,11 +37,11 @@ CharacterMapWidget::CharacterMapWidget() m_statusbar = find_descendant_of_type_named<GUI::Statusbar>("statusbar"); m_unicode_block_listview = find_descendant_of_type_named<GUI::ListView>("unicode_block_listview"); - m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto font_picker = GUI::FontPicker::construct(window(), &font(), false); if (font_picker->exec() == GUI::Dialog::ExecResult::OK) { auto& font = *font_picker->font(); - Config::write_string("CharacterMap", "History", "Font", font.qualified_name()); + Config::write_string("CharacterMap"sv, "History"sv, "Font"sv, font.qualified_name()); set_font(font); } }); @@ -58,19 +58,19 @@ CharacterMapWidget::CharacterMapWidget() }); m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard"); - m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_glyph_map->select_previous_existing_glyph(); }); m_previous_glyph_action->set_status_tip("Seek the previous visible glyph"); - m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_glyph_map->select_next_existing_glyph(); }); m_next_glyph_action->set_status_tip("Seek the next visible glyph"); - m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { String input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecResult::OK && !input.is_empty()) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) return; @@ -83,7 +83,7 @@ CharacterMapWidget::CharacterMapWidget() }); m_go_to_glyph_action->set_status_tip("Go to the specified code point"); - m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { if (m_find_window.is_null()) { m_find_window = GUI::Window::construct(window()); auto& search_widget = m_find_window->set_main_widget<CharacterSearchWidget>(); @@ -91,7 +91,7 @@ CharacterMapWidget::CharacterMapWidget() m_glyph_map->set_active_glyph(code_point); m_glyph_map->scroll_to_glyph(code_point); }; - m_find_window->set_icon(GUI::Icon::try_create_default_icon("find").value().bitmap_for_size(16)); + m_find_window->set_icon(GUI::Icon::try_create_default_icon("find"sv).value().bitmap_for_size(16)); m_find_window->set_title("Find a character"); m_find_window->resize(300, 400); } @@ -159,7 +159,7 @@ void CharacterMapWidget::initialize_menubar(GUI::Window& window) help_menu.add_action(GUI::CommonActions::make_help_action([&](auto&) { Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/CharacterMap.md"), "/bin/Help"); })); - help_menu.add_action(GUI::CommonActions::make_about_action("Character Map", GUI::Icon::default_icon("app-character-map"), &window)); + help_menu.add_action(GUI::CommonActions::make_about_action("Character Map", GUI::Icon::default_icon("app-character-map"sv), &window)); } void CharacterMapWidget::did_change_font() diff --git a/Userland/Applications/CharacterMap/main.cpp b/Userland/Applications/CharacterMap/main.cpp index af90ec4bed..b293f06995 100644 --- a/Userland/Applications/CharacterMap/main.cpp +++ b/Userland/Applications/CharacterMap/main.cpp @@ -24,7 +24,7 @@ static void search_and_print_results(String const& query) for_each_character_containing(query, [&](auto code_point, auto display_name) { StringBuilder builder; builder.append_code_point(code_point); - builder.append(" - "); + builder.append(" - "sv); builder.append(display_name); outln(builder.string_view()); result_count++; @@ -62,7 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return 0; } - auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-character-map")); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-character-map"sv)); auto window = TRY(GUI::Window::try_create()); window->set_title("Character Map"); window->set_icon(app_icon.bitmap_for_size(16)); @@ -71,7 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto character_map_widget = TRY(window->try_set_main_widget<CharacterMapWidget>()); character_map_widget->initialize_menubar(*window); - auto font_query = Config::read_string("CharacterMap", "History", "Font", Gfx::FontDatabase::the().default_font_query()); + auto font_query = Config::read_string("CharacterMap"sv, "History"sv, "Font"sv, Gfx::FontDatabase::the().default_font_query()); character_map_widget->set_font(Gfx::FontDatabase::the().get_by_name(font_query)); window->show(); diff --git a/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp b/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp index dfb5edf156..f16c70f6bd 100644 --- a/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp +++ b/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp @@ -14,10 +14,10 @@ #include <LibGUI/RadioButton.h> #include <LibGUI/TextBox.h> -constexpr StringView time_format_12h = "%I:%M %p"; -constexpr StringView time_format_12h_seconds = "%r"; -constexpr StringView time_format_24h = "%R"; -constexpr StringView time_format_24h_seconds = "%T"; +constexpr auto time_format_12h = "%I:%M %p"sv; +constexpr auto time_format_12h_seconds = "%r"sv; +constexpr auto time_format_24h = "%R"sv; +constexpr auto time_format_24h_seconds = "%T"sv; ClockSettingsWidget::ClockSettingsWidget() { @@ -29,7 +29,7 @@ ClockSettingsWidget::ClockSettingsWidget() auto& custom_radio = *find_descendant_of_type_named<GUI::RadioButton>("custom_radio"); m_clock_preview = *find_descendant_of_type_named<GUI::Label>("clock_preview"); - m_time_format = Config::read_string("Taskbar", "Clock", "TimeFormat"); + m_time_format = Config::read_string("Taskbar"sv, "Clock"sv, "TimeFormat"sv); m_custom_format_input = *find_descendant_of_type_named<GUI::TextBox>("custom_format_input"); m_custom_format_input->set_text(m_time_format); m_custom_format_input->set_enabled(false); @@ -96,14 +96,14 @@ ClockSettingsWidget::ClockSettingsWidget() void ClockSettingsWidget::apply_settings() { - Config::write_string("Taskbar", "Clock", "TimeFormat", m_custom_format_input->text()); + Config::write_string("Taskbar"sv, "Clock"sv, "TimeFormat"sv, m_custom_format_input->text()); } void ClockSettingsWidget::reset_default_values() { m_24_hour_radio->set_checked(true); m_show_seconds_checkbox->set_checked(true); - Config::write_string("Taskbar", "Clock", "TimeFormat", time_format_24h_seconds); + Config::write_string("Taskbar"sv, "Clock"sv, "TimeFormat"sv, time_format_24h_seconds); } void ClockSettingsWidget::update_time_format_string() diff --git a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp index 75a411ca4b..7aecbc858c 100644 --- a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp +++ b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp @@ -62,7 +62,7 @@ TimeZoneSettingsWidget::TimeZoneSettingsWidget() m_time_zone_map = *find_descendant_of_type_named<GUI::ImageWidget>("time_zone_map"); m_time_zone_map->set_bitmap(time_zone_map_bitmap); - auto time_zone_marker = Gfx::Bitmap::try_load_from_file("/res/icons/32x32/ladyball.png").release_value_but_fixme_should_propagate_errors(); + auto time_zone_marker = Gfx::Bitmap::try_load_from_file("/res/icons/32x32/ladyball.png"sv).release_value_but_fixme_should_propagate_errors(); m_time_zone_marker = time_zone_marker->scaled(0.75f, 0.75f).release_value_but_fixme_should_propagate_errors(); set_time_zone_location(); @@ -159,5 +159,5 @@ Optional<Gfx::FloatPoint> TimeZoneSettingsWidget::compute_time_zone_location() c void TimeZoneSettingsWidget::set_time_zone() { - GUI::Process::spawn_or_show_error(window(), "/bin/timezone", Array { m_time_zone.characters() }); + GUI::Process::spawn_or_show_error(window(), "/bin/timezone"sv, Array { m_time_zone.characters() }); } diff --git a/Userland/Applications/ClockSettings/main.cpp b/Userland/Applications/ClockSettings/main.cpp index 8b3918ab1b..3c621654f9 100644 --- a/Userland/Applications/ClockSettings/main.cpp +++ b/Userland/Applications/ClockSettings/main.cpp @@ -33,11 +33,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-analog-clock"); // FIXME: Create a ClockSettings icon. + auto app_icon = GUI::Icon::default_icon("app-analog-clock"sv); // FIXME: Create a ClockSettings icon. auto window = TRY(GUI::SettingsWindow::create("Clock Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes)); - (void)TRY(window->add_tab<ClockSettingsWidget>("Clock", "clock")); - (void)TRY(window->add_tab<TimeZoneSettingsWidget>("Time Zone", "time-zone")); + (void)TRY(window->add_tab<ClockSettingsWidget>("Clock"sv, "clock"sv)); + (void)TRY(window->add_tab<TimeZoneSettingsWidget>("Time Zone"sv, "time-zone"sv)); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(540, 570); window->set_active_tab(selected_tab); diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index 4dde3ea01d..f275fddf9b 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -73,9 +73,9 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core: }; if (metadata.contains("assertion")) - prepend_metadata("assertion", "ASSERTION FAILED: {}"); + prepend_metadata("assertion", "ASSERTION FAILED: {}"sv); else if (metadata.contains("pledge_violation")) - prepend_metadata("pledge_violation", "Has not pledged {}"); + prepend_metadata("pledge_violation", "Has not pledged {}"sv); auto fault_address = metadata.get("fault_address"); auto fault_type = metadata.get("fault_type"); @@ -168,7 +168,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto pid = coredump->process_pid(); auto termination_signal = coredump->process_termination_signal(); - auto app_icon = GUI::Icon::default_icon("app-crash-reporter"); + auto app_icon = GUI::Icon::default_icon("app-crash-reporter"sv); auto window = TRY(GUI::Window::try_create()); window->set_title("Crash Reporter"); @@ -263,16 +263,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; auto& debug_button = *widget->find_descendant_of_type_named<GUI::Button>("debug_button"); - debug_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"))); + debug_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv))); debug_button.on_click = [&](int) { - GUI::Process::spawn_or_show_error(window, "/bin/HackStudio", Array { "-c", coredump_path.characters() }); + GUI::Process::spawn_or_show_error(window, "/bin/HackStudio"sv, Array { "-c", coredump_path.characters() }); }; auto& save_backtrace_button = *widget->find_descendant_of_type_named<GUI::Button>("save_backtrace_button"); - save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"))); + save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv))); save_backtrace_button.on_click = [&](auto) { if (full_backtrace.is_empty()) { - GUI::MessageBox::show(window, "Backtrace has not been generated yet. Please wait...", "Empty Backtrace", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, "Backtrace has not been generated yet. Please wait..."sv, "Empty Backtrace"sv, GUI::MessageBox::Type::Error); return; } @@ -283,7 +283,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto file = file_or_error.value(); if (!file->write(full_backtrace.to_string())) - GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error); }; (void)Threading::BackgroundAction<ThreadBacktracesAndCpuRegisters>::construct( diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index faba3a3260..2df83b3152 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -154,7 +154,7 @@ static bool handle_breakpoint_command(String const& command) if (argument.is_empty()) return false; - if (argument.contains(":")) { + if (argument.contains(":"sv)) { auto source_arguments = argument.split(':'); if (source_arguments.size() != 2) return false; @@ -164,7 +164,7 @@ static bool handle_breakpoint_command(String const& command) auto file = source_arguments[0]; return insert_breakpoint_at_source_position(file, line.value()); } - if ((argument.starts_with("0x"))) { + if ((argument.starts_with("0x"sv))) { return insert_breakpoint_at_address(strtoul(argument.characters() + 2, nullptr, 16)); } @@ -181,7 +181,7 @@ static bool handle_examine_command(String const& command) if (argument.is_empty()) return false; - if (!(argument.starts_with("0x"))) { + if (!(argument.starts_with("0x"sv))) { return false; } FlatPtr address = strtoul(argument.characters() + 2, nullptr, 16); @@ -309,14 +309,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) handle_print_registers(regs); success = true; - } else if (command.starts_with("dis")) { + } else if (command.starts_with("dis"sv)) { success = handle_disassemble_command(command, ip); - } else if (command.starts_with("bp")) { + } else if (command.starts_with("bp"sv)) { success = handle_breakpoint_command(command); - } else if (command.starts_with("x")) { + } else if (command.starts_with("x"sv)) { success = handle_examine_command(command); - } else if (command.starts_with("bt")) { + } else if (command.starts_with("bt"sv)) { success = handle_backtrace_command(regs); } diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp index 1a02a50ef2..d0a47a3f5b 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp @@ -65,7 +65,7 @@ void BackgroundSettingsWidget::create_frame() }; m_context_menu = GUI::Menu::construct(); - m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) { + m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) { LexicalPath path { m_monitor_widget->wallpaper() }; Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename())); }); @@ -88,7 +88,7 @@ void BackgroundSettingsWidget::create_frame() auto& button = *find_descendant_of_type_named<GUI::Button>("wallpaper_open_button"); button.on_click = [this](auto) { - auto path = GUI::FilePicker::get_open_filepath(window(), "Select wallpaper from file system", "/res/wallpapers"); + auto path = GUI::FilePicker::get_open_filepath(window(), "Select wallpaper from file system", "/res/wallpapers"sv); if (!path.has_value()) return; m_wallpaper_view->selection().clear(); @@ -124,7 +124,7 @@ void BackgroundSettingsWidget::load_current_settings() { auto ws_config = Core::ConfigFile::open("/etc/WindowServer.ini").release_value_but_fixme_should_propagate_errors(); - auto selected_wallpaper = Config::read_string("WindowManager", "Background", "Wallpaper", ""); + auto selected_wallpaper = Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv); if (!selected_wallpaper.is_empty()) { auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper, m_wallpaper_view->model_column()); m_wallpaper_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set); diff --git a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp index ba38f72e4a..2c2901ffff 100644 --- a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp @@ -50,7 +50,7 @@ void DesktopSettingsWidget::apply_settings() if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) { if (!GUI::ConnectionToWindowServer::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) { GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"), - "Workspace settings", GUI::MessageBox::Type::Error); + "Workspace settings"sv, GUI::MessageBox::Type::Error); } } } diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp index d5049e4084..5bdf07ec9e 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp @@ -239,7 +239,7 @@ void MonitorSettingsWidget::apply_settings() seconds_until_revert, seconds_until_revert == 1 ? "second" : "seconds"); }; - auto box = GUI::MessageBox::construct(window(), box_text(), "Apply new screen layout", + auto box = GUI::MessageBox::construct(window(), box_text(), "Apply new screen layout"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); box->set_icon(window()->icon()); @@ -258,20 +258,20 @@ void MonitorSettingsWidget::apply_settings() auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout(); if (!save_result.success()) { GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()), - "Unable to save setting", GUI::MessageBox::Type::Error); + "Unable to save setting"sv, GUI::MessageBox::Type::Error); } } else { auto restore_result = GUI::ConnectionToWindowServer::the().set_screen_layout(current_layout, false); if (!restore_result.success()) { GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()), - "Unable to restore setting", GUI::MessageBox::Type::Error); + "Unable to restore setting"sv, GUI::MessageBox::Type::Error); } else { load_current_settings(); } } } else { GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()), - "Unable to apply changes", GUI::MessageBox::Type::Error); + "Unable to apply changes"sv, GUI::MessageBox::Type::Error); } } } diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index cb56366ebd..0bf92e337b 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -19,7 +19,7 @@ namespace DisplaySettings { MonitorWidget::MonitorWidget() { m_desktop_resolution = GUI::Desktop::the().rect().size(); - m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png").release_value_but_fixme_should_propagate_errors(); + m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png"sv).release_value_but_fixme_should_propagate_errors(); m_desktop_bitmap = Gfx::Bitmap::try_create(m_monitor_bitmap->format(), { 280, 158 }).release_value_but_fixme_should_propagate_errors(); m_monitor_rect = { { 12, 13 }, m_desktop_bitmap->size() }; set_fixed_size(304, 201); diff --git a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp index 6e4bb77e1b..d4593abad8 100644 --- a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp +++ b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp @@ -39,9 +39,9 @@ void ThemePreviewWidget::paint_preview(GUI::PaintEvent&) }; center_window_group_within(window_group, frame_inner_rect()); - paint_window("Inactive Window", inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, inactive_window_icon()); - paint_window("Active Window", active_window_rect, Gfx::WindowTheme::WindowState::Active, active_window_icon()); - paint_window("Alert", message_box, Gfx::WindowTheme::WindowState::Highlighted, active_window_icon(), 1); + paint_window("Inactive Window"sv, inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, inactive_window_icon()); + paint_window("Active Window"sv, active_window_rect, Gfx::WindowTheme::WindowState::Active, active_window_icon()); + paint_window("Alert"sv, message_box, Gfx::WindowTheme::WindowState::Highlighted, active_window_icon(), 1); auto draw_centered_button = [&](auto window_rect, auto text, int button_width, int button_height) { Gfx::IntRect button_rect { 0, 0, button_width, button_height }; @@ -50,7 +50,7 @@ void ThemePreviewWidget::paint_preview(GUI::PaintEvent&) painter.draw_text(button_rect, text, Gfx::TextAlignment::Center, preview_palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap); }; - draw_centered_button(message_box, "Ok", 32, 16); + draw_centered_button(message_box, "Ok"sv, 32, 16); } } diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp index e2e9848dfe..36c4774242 100644 --- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp @@ -45,11 +45,11 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed) }; m_themes_combo->set_selected_index(current_theme_index, GUI::AllowCallback::No); - auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mouse.png").release_value_but_fixme_should_propagate_errors(); + auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mouse.png"sv).release_value_but_fixme_should_propagate_errors(); m_cursor_themes_button = *find_descendant_of_type_named<GUI::Button>("cursor_themes_button"); m_cursor_themes_button->set_icon(mouse_settings_icon); m_cursor_themes_button->on_click = [&](auto) { - GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings", Array { "-t", "cursor-theme" }); + GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings"sv, Array { "-t", "cursor-theme" }); }; GUI::Application::the()->on_theme_change = [&]() { diff --git a/Userland/Applications/DisplaySettings/main.cpp b/Userland/Applications/DisplaySettings/main.cpp index 2b83b5f5c5..0794fd41ea 100644 --- a/Userland/Applications/DisplaySettings/main.cpp +++ b/Userland/Applications/DisplaySettings/main.cpp @@ -31,16 +31,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(selected_tab, "Tab, one of 'background', 'fonts', 'monitor', 'themes', or 'workspaces'", "open-tab", 't', "tab"); args_parser.parse(arguments); - auto app_icon = GUI::Icon::default_icon("app-display-settings"); + auto app_icon = GUI::Icon::default_icon("app-display-settings"sv); bool background_settings_changed = false; auto window = TRY(GUI::SettingsWindow::create("Display Settings")); - (void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background", "background", background_settings_changed)); - (void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes", "themes", background_settings_changed)); - (void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts", "fonts")); - (void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor", "monitor")); - (void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces", "workspaces")); + (void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background"sv, "background"sv, background_settings_changed)); + (void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes"sv, "themes"sv, background_settings_changed)); + (void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"sv, "fonts"sv)); + (void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"sv, "monitor"sv)); + (void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces"sv, "workspaces"sv)); window->set_active_tab(selected_tab); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index c0bbbd61bd..21ca93702e 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -125,7 +125,7 @@ void DirectoryView::handle_activation(GUI::ModelIndex const& index) unsetenv("__libgui_launch_origin_rect"); } else { auto error_message = String::formatted("Could not open {}", path); - GUI::MessageBox::show(window(), error_message, "File Manager", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), error_message, "File Manager"sv, GUI::MessageBox::Type::Error); } } @@ -332,10 +332,10 @@ void DirectoryView::set_view_mode_from_string(String const& mode) if (m_mode == Mode::Desktop) return; - if (mode.contains("Table")) { + if (mode.contains("Table"sv)) { set_view_mode(DirectoryView::ViewMode::Table); m_view_as_table_action->set_checked(true); - } else if (mode.contains("Columns")) { + } else if (mode.contains("Columns"sv)) { set_view_mode(DirectoryView::ViewMode::Columns); m_view_as_columns_action->set_checked(true); } else { @@ -462,7 +462,7 @@ void DirectoryView::update_statusbar() if (selected_item_count == 1) { auto& node = this->node(current_view().selection().first()); if (!node.symlink_target.is_empty()) { - builder.append(" → "); + builder.append(" → "sv); builder.append(node.symlink_target); } } @@ -550,37 +550,37 @@ 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::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + 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"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; - if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); } } }); - 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").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + 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"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; - if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); struct stat st; int rc = stat(new_file_path.characters(), &st); if ((rc < 0 && errno != ENOENT)) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); return; } if (rc == 0) { - GUI::MessageBox::show(window(), String::formatted("{}: Already exists", new_file_path), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error); return; } int fd = creat(new_file_path.characters(), 0666); if (fd < 0) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); return; } rc = close(fd); @@ -588,7 +588,7 @@ void DirectoryView::setup_actions() } }); - m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { spawn_terminal(path()); }); @@ -605,23 +605,23 @@ void DirectoryView::setup_actions() window()); m_view_as_icons_action = GUI::Action::create_checkable( - "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Icon); - Config::write_string("FileManager", "DirectoryView", "ViewMode", "Icon"); + Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Icon"sv); }, window()); m_view_as_table_action = GUI::Action::create_checkable( - "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Table); - Config::write_string("FileManager", "DirectoryView", "ViewMode", "Table"); + Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Table"sv); }, window()); m_view_as_columns_action = GUI::Action::create_checkable( - "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { set_view_mode(DirectoryView::ViewMode::Columns); - Config::write_string("FileManager", "DirectoryView", "ViewMode", "Columns"); + Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Columns"sv); }, window()); diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 51532cad11..2ecbe80445 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -27,20 +27,20 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation auto& button = *find_descendant_of_type_named<GUI::Button>("button"); auto& file_copy_animation = *find_descendant_of_type_named<GUI::ImageWidget>("file_copy_animation"); - file_copy_animation.load_from_file("/res/graphics/file-flying-animation.gif"); + file_copy_animation.load_from_file("/res/graphics/file-flying-animation.gif"sv); file_copy_animation.animate(); auto& source_folder_icon = *find_descendant_of_type_named<GUI::ImageWidget>("source_folder_icon"); - source_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"); + source_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"sv); auto& destination_folder_icon = *find_descendant_of_type_named<GUI::ImageWidget>("destination_folder_icon"); switch (m_operation) { case FileOperation::Delete: - destination_folder_icon.load_from_file("/res/icons/32x32/recycle-bin.png"); + destination_folder_icon.load_from_file("/res/icons/32x32/recycle-bin.png"sv); break; default: - destination_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"); + destination_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"sv); break; } @@ -129,7 +129,7 @@ void FileOperationProgressWidget::did_error(StringView message) { // FIXME: Communicate more with the user about errors. close_pipe(); - GUI::MessageBox::show(window(), String::formatted("An error occurred: {}", message), "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); + GUI::MessageBox::show(window(), String::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); window()->close(); } diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp index fdcc66b7dc..f74fc80a0e 100644 --- a/Userland/Applications/FileManager/FileUtils.cpp +++ b/Userland/Applications/FileManager/FileUtils.cpp @@ -29,7 +29,7 @@ void delete_paths(Vector<String> const& paths, bool should_confirm, GUI::Window* if (should_confirm) { auto result = GUI::MessageBox::show(parent_window, message, - "Confirm deletion", + "Confirm deletion"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); if (result == GUI::MessageBox::ExecResult::Cancel) @@ -51,17 +51,17 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<String> const& TRY(Core::System::dup2(pipe_fds[1], STDOUT_FILENO)); Vector<StringView> file_operation_args; - file_operation_args.append("/bin/FileOperation"); + file_operation_args.append("/bin/FileOperation"sv); switch (operation) { case FileOperation::Copy: - file_operation_args.append("Copy"); + file_operation_args.append("Copy"sv); break; case FileOperation::Move: - file_operation_args.append("Move"); + file_operation_args.append("Move"sv); break; case FileOperation::Delete: - file_operation_args.append("Delete"); + file_operation_args.append("Delete"sv); break; default: VERIFY_NOT_REACHED(); diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 45a6012f10..2e6e874d76 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -40,7 +40,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind set_rect({ 0, 0, 360, 420 }); set_resizable(false); - set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png").release_value_but_fixme_should_propagate_errors()); + set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors()); auto& tab_widget = main_widget.add<GUI::TabWidget>(); @@ -194,12 +194,12 @@ bool PropertiesWindow::apply_changes() String new_file = make_full_path(new_name).characters(); if (Core::File::exists(new_file)) { - GUI::MessageBox::show(this, String::formatted("A file \"{}\" already exists!", new_name), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, String::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (rename(make_full_path(m_name).characters(), new_file.characters())) { - GUI::MessageBox::show(this, String::formatted("Could not rename file: {}!", strerror(errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, String::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -210,7 +210,7 @@ bool PropertiesWindow::apply_changes() if (m_permissions_dirty) { if (chmod(make_full_path(m_name).characters(), m_mode)) { - GUI::MessageBox::show(this, String::formatted("Could not update permissions: {}!", strerror(errno)), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, String::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index ff1d45c46d..5b926e8859 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -135,7 +135,7 @@ void do_copy(Vector<String> const& selected_file_paths, FileOperation file_opera StringBuilder copy_text; if (file_operation == FileOperation::Move) { - copy_text.append("#cut\n"); // This exploits the comment lines in the text/uri-list specification, which might be a bit hackish + copy_text.append("#cut\n"sv); // This exploits the comment lines in the text/uri-list specification, which might be a bit hackish } for (auto& path : selected_file_paths) { auto url = URL::create_with_file_protocol(path); @@ -186,7 +186,7 @@ void do_create_link(Vector<String> const& selected_file_paths, GUI::Window* wind auto path = selected_file_paths.first(); auto destination = String::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path)); if (auto result = Core::File::link_file(destination, path); result.is_error()) { - GUI::MessageBox::show(window, String::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager", + GUI::MessageBox::show(window, String::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv, GUI::MessageBox::Type::Error); } } @@ -194,7 +194,7 @@ void do_create_link(Vector<String> const& selected_file_paths, GUI::Window* wind void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* window) { String archive_name; - if (GUI::InputBox::show(window, archive_name, "Enter name:", "Create Archive") != GUI::InputBox::ExecResult::OK) + if (GUI::InputBox::show(window, archive_name, "Enter name:"sv, "Create Archive"sv) != GUI::InputBox::ExecResult::OK) return; auto output_directory_path = LexicalPath(selected_file_paths.first()); @@ -204,11 +204,11 @@ void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* w path_builder.append("/"); if (archive_name.is_empty()) { path_builder.append(output_directory_path.parent().basename()); - path_builder.append(".zip"); + path_builder.append(".zip"sv); } else { path_builder.append(archive_name); - if (!archive_name.ends_with(".zip")) - path_builder.append(".zip"); + if (!archive_name.ends_with(".zip"sv)) + path_builder.append(".zip"sv); } auto output_path = path_builder.build(); @@ -239,7 +239,7 @@ void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* w int status; int rc = waitpid(zip_pid, &status, 0); if (rc < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) - GUI::MessageBox::show(window, "Could not create archive", "Archive Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, "Could not create archive"sv, "Archive Error"sv, GUI::MessageBox::Type::Error); } } @@ -265,7 +265,7 @@ void do_unzip_archive(Vector<String> const& selected_file_paths, GUI::Window* wi int status; int rc = waitpid(unzip_pid, &status, 0); if (rc < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) - GUI::MessageBox::show(window, "Could not extract archive", "Extract Archive Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, "Could not extract archive"sv, "Extract Archive Error"sv, GUI::MessageBox::Type::Error); } } @@ -362,7 +362,7 @@ ErrorOr<int> run_in_desktop_mode() auto create_archive_action = GUI::Action::create( "Create &Archive", - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png").release_value_but_fixme_should_propagate_errors(), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { auto paths = directory_view->selected_file_paths(); if (paths.is_empty()) @@ -411,7 +411,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", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto paths = directory_view->selected_file_paths(); if (paths.is_empty()) { Desktop::Launcher::open(URL::create_with_file_protocol(directory_view->path())); @@ -424,7 +424,7 @@ ErrorOr<int> run_in_desktop_mode() } }); - auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto paths = directory_view->selected_file_paths(); if (paths.is_empty()) { spawn_terminal(directory_view->path()); @@ -438,7 +438,7 @@ ErrorOr<int> run_in_desktop_mode() } }); - auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { Desktop::Launcher::open(URL::create_with_file_protocol("/bin/DisplaySettings")); }); @@ -488,7 +488,7 @@ ErrorOr<int> run_in_desktop_mode() file_context_menu->add_action(create_archive_action); file_context_menu->add_separator(); - if (node.full_path().ends_with(".zip", AK::CaseSensitivity::CaseInsensitive)) { + if (node.full_path().ends_with(".zip"sv, AK::CaseSensitivity::CaseInsensitive)) { file_context_menu->add_action(unzip_archive_action); file_context_menu->add_separator(); } @@ -514,7 +514,7 @@ ErrorOr<int> run_in_desktop_mode() } } wallpaper_listener; - auto selected_wallpaper = Config::read_string("WindowManager", "Background", "Wallpaper", ""); + auto selected_wallpaper = Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv); if (!selected_wallpaper.is_empty()) { auto wallpaper_bitmap = TRY(Gfx::Bitmap::try_load_from_file(selected_wallpaper)); GUI::Desktop::the().set_wallpaper(wallpaper_bitmap, {}); @@ -529,11 +529,11 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& auto window = TRY(GUI::Window::try_create()); window->set_title("File Manager"); - auto left = Config::read_i32("FileManager", "Window", "Left", 150); - auto top = Config::read_i32("FileManager", "Window", "Top", 75); - auto width = Config::read_i32("FileManager", "Window", "Width", 640); - auto height = Config::read_i32("FileManager", "Window", "Height", 480); - auto was_maximized = Config::read_bool("FileManager", "Window", "Maximized", false); + auto left = Config::read_i32("FileManager"sv, "Window"sv, "Left"sv, 150); + auto top = Config::read_i32("FileManager"sv, "Window"sv, "Top"sv, 75); + auto width = Config::read_i32("FileManager"sv, "Window"sv, "Width"sv, 640); + auto height = Config::read_i32("FileManager"sv, "Window"sv, "Height"sv, 480); + auto was_maximized = Config::read_bool("FileManager"sv, "Window"sv, "Maximized"sv, false); auto widget = TRY(window->try_set_main_widget<GUI::Widget>()); @@ -628,7 +628,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& 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 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + 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"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { directory_view->open_parent_directory(); }); @@ -637,7 +637,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& RefPtr<GUI::Action> layout_statusbar_action; RefPtr<GUI::Action> layout_folderpane_action; - auto show_toolbar = Config::read_bool("FileManager", "Layout", "ShowToolbar", true); + auto show_toolbar = Config::read_bool("FileManager"sv, "Layout"sv, "ShowToolbar"sv, true); layout_toolbar_action = GUI::Action::create_checkable("&Toolbar", [&](auto& action) { if (action.is_checked()) { main_toolbar.set_visible(true); @@ -648,12 +648,12 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& toolbar_container.set_visible(false); } show_toolbar = action.is_checked(); - Config::write_bool("FileManager", "Layout", "ShowToolbar", action.is_checked()); + Config::write_bool("FileManager"sv, "Layout"sv, "ShowToolbar"sv, action.is_checked()); }); layout_toolbar_action->set_checked(show_toolbar); main_toolbar.set_visible(show_toolbar); - auto show_location = Config::read_bool("FileManager", "Layout", "ShowLocationBar", true); + auto show_location = Config::read_bool("FileManager"sv, "Layout"sv, "ShowLocationBar"sv, true); layout_location_action = GUI::Action::create_checkable("&Location Bar", [&](auto& action) { if (action.is_checked()) { breadcrumb_toolbar.set_visible(true); @@ -666,7 +666,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& toolbar_container.set_visible(false); } show_location = action.is_checked(); - Config::write_bool("FileManager", "Layout", "ShowLocationBar", action.is_checked()); + Config::write_bool("FileManager"sv, "Layout"sv, "ShowLocationBar"sv, action.is_checked()); }); layout_location_action->set_checked(show_location); breadcrumb_toolbar.set_visible(show_location); @@ -675,19 +675,19 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& layout_statusbar_action = GUI::Action::create_checkable("&Status Bar", [&](auto& action) { action.is_checked() ? statusbar.set_visible(true) : statusbar.set_visible(false); - Config::write_bool("FileManager", "Layout", "ShowStatusbar", action.is_checked()); + Config::write_bool("FileManager"sv, "Layout"sv, "ShowStatusbar"sv, action.is_checked()); }); - auto show_statusbar = Config::read_bool("FileManager", "Layout", "ShowStatusbar", true); + auto show_statusbar = Config::read_bool("FileManager"sv, "Layout"sv, "ShowStatusbar"sv, true); layout_statusbar_action->set_checked(show_statusbar); statusbar.set_visible(show_statusbar); layout_folderpane_action = GUI::Action::create_checkable("&Folder Pane", { Mod_Ctrl, Key_P }, [&](auto& action) { action.is_checked() ? tree_view.set_visible(true) : tree_view.set_visible(false); - Config::write_bool("FileManager", "Layout", "ShowFolderPane", action.is_checked()); + Config::write_bool("FileManager"sv, "Layout"sv, "ShowFolderPane"sv, action.is_checked()); }); - auto show_folderpane = Config::read_bool("FileManager", "Layout", "ShowFolderPane", true); + auto show_folderpane = Config::read_bool("FileManager"sv, "Layout"sv, "ShowFolderPane"sv, true); layout_folderpane_action->set_checked(show_folderpane); tree_view.set_visible(show_folderpane); @@ -749,7 +749,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& = GUI::Action::create( "Open in New &Window", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { Vector<String> paths; if (action.activator() == tree_view_directory_context_menu) @@ -768,7 +768,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& = GUI::Action::create( "Open in &Terminal", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { Vector<String> paths; if (action.activator() == tree_view_directory_context_menu) @@ -788,7 +788,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& = GUI::Action::create( "Create Desktop &Shortcut", {}, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png").release_value_but_fixme_should_propagate_errors(), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { auto paths = directory_view->selected_file_paths(); if (paths.is_empty()) { @@ -801,7 +801,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& auto create_archive_action = GUI::Action::create( "Create &Archive", - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png").release_value_but_fixme_should_propagate_errors(), + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { auto paths = directory_view->selected_file_paths(); if (paths.is_empty()) @@ -909,12 +909,12 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& }); focus_dependent_delete_action->set_enabled(false); - 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").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + 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"sv).release_value_but_fixme_should_propagate_errors(), [&](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 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { + 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"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { directory_view->touch_action().activate(); refresh_tree_view(); }); @@ -942,10 +942,10 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& directory_view->set_should_show_dotfiles(action.is_checked()); directories_model->set_should_show_dotfiles(action.is_checked()); refresh_tree_view(); - Config::write_bool("FileManager", "DirectoryView", "ShowDotFiles", action.is_checked()); + Config::write_bool("FileManager"sv, "DirectoryView"sv, "ShowDotFiles"sv, action.is_checked()); }); - auto show_dotfiles = Config::read_bool("FileManager", "DirectoryView", "ShowDotFiles", false); + auto show_dotfiles = Config::read_bool("FileManager"sv, "DirectoryView"sv, "ShowDotFiles"sv, false); directory_view->set_should_show_dotfiles(show_dotfiles); show_dotfiles_action->set_checked(show_dotfiles); @@ -968,7 +968,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& 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, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + auto go_to_location_action = GUI::Action::create("Go to &Location...", { Mod_Ctrl, Key_L }, Key_F6, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { toolbar_container.set_visible(true); location_toolbar.set_visible(true); breadcrumb_toolbar.set_visible(false); @@ -986,7 +986,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& TRY(go_menu->try_add_action(directory_view->open_terminal_action())); auto help_menu = TRY(window->try_add_menu("&Help")); - TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("File Manager", GUI::Icon::default_icon("app-file-manager"), window))); + TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("File Manager"sv, GUI::Icon::default_icon("app-file-manager"sv), window))); (void)TRY(main_toolbar.try_add_action(go_back_action)); (void)TRY(main_toolbar.try_add_action(go_forward_action)); @@ -1113,7 +1113,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& || (!directory_view->current_view().selection().is_empty() && access(directory_view->path().characters(), W_OK) == 0)); }; - auto directory_open_action = GUI::Action::create("Open", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + auto directory_open_action = GUI::Action::create("Open", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { directory_view->open(directory_view->selected_file_paths().first()); }); @@ -1180,7 +1180,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& file_context_menu->add_action(create_archive_action); file_context_menu->add_separator(); - if (node.full_path().ends_with(".zip", AK::CaseSensitivity::CaseInsensitive)) { + if (node.full_path().ends_with(".zip"sv, AK::CaseSensitivity::CaseInsensitive)) { file_context_menu->add_action(unzip_archive_action); file_context_menu->add_separator(); } @@ -1243,7 +1243,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) { auto error_message = String::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast<Error const&>(result.error())); - GUI::MessageBox::show(window, error_message, "File Manager", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error); } else { had_accepted_copy = true; } @@ -1288,7 +1288,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& window->show(); - directory_view->set_view_mode_from_string(Config::read_string("FileManager", "DirectoryView", "ViewMode", "Icon")); + directory_view->set_view_mode_from_string(Config::read_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Icon"sv)); if (!entry_focused_on_init.is_empty()) { auto matches = directory_view->current_view().model()->matches(entry_focused_on_init, GUI::Model::MatchesFlag::MatchFull | GUI::Model::MatchesFlag::FirstMatchOnly); @@ -1298,12 +1298,12 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& // Write window position to config file on close request. window->on_close_request = [&] { - Config::write_bool("FileManager", "Window", "Maximized", window->is_maximized()); + Config::write_bool("FileManager"sv, "Window"sv, "Maximized"sv, window->is_maximized()); if (!window->is_maximized()) { - Config::write_i32("FileManager", "Window", "Left", window->x()); - Config::write_i32("FileManager", "Window", "Top", window->y()); - Config::write_i32("FileManager", "Window", "Width", window->width()); - Config::write_i32("FileManager", "Window", "Height", window->height()); + Config::write_i32("FileManager"sv, "Window"sv, "Left"sv, window->x()); + Config::write_i32("FileManager"sv, "Window"sv, "Top"sv, window->y()); + Config::write_i32("FileManager"sv, "Window"sv, "Width"sv, window->width()); + Config::write_i32("FileManager"sv, "Window"sv, "Height"sv, window->height()); } return GUI::Window::CloseRequestDecision::Close; }; diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index 63b34caa11..a9e52ed3b6 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -45,16 +45,16 @@ namespace FontEditor { static constexpr Array pangrams = { - "quick fox jumps nightly above wizard", - "five quacking zephyrs jolt my wax bed", - "pack my box with five dozen liquor jugs", - "quick brown fox jumps over the lazy dog", - "waxy and quivering jocks fumble the pizza", - "~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;", - "byxfjärmat föl gick på duvshowen", - " ", - "float Fox.quick(h){ is_brown && it_jumps_over(doges.lazy) }", - "<fox color=\"brown\" speed=\"quick\" jumps=\"over\">lazy dog</fox>" + "quick fox jumps nightly above wizard"sv, + "five quacking zephyrs jolt my wax bed"sv, + "pack my box with five dozen liquor jugs"sv, + "quick brown fox jumps over the lazy dog"sv, + "waxy and quivering jocks fumble the pizza"sv, + "~#:[@_1%]*{$2.3}/4^(5'6\"sv)-&|7+8!=<9,0\\>?;"sv, + "byxfjärmat föl gick på duvshowen"sv, + " "sv, + "float Fox.quick(h){ is_brown && it_jumps_over(doges.lazy) }"sv, + "<fox color=\"brown\" speed=\"quick\" jumps=\"over\">lazy dog</fox>"sv }; ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window() @@ -92,7 +92,7 @@ ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window() ErrorOr<void> MainWidget::create_actions() { - m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png")), [&](auto&) { + m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png"sv)), [&](auto&) { if (!request_close()) return; auto new_font_wizard = NewFontDialog::construct(window()); @@ -115,7 +115,7 @@ ErrorOr<void> MainWidget::create_actions() m_open_action = GUI::CommonActions::make_open_action([&](auto&) { if (!request_close()) return; - Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"); + Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"sv); if (!open_path.has_value()) return; open_file(open_path.value()); @@ -175,7 +175,7 @@ ErrorOr<void> MainWidget::create_actions() m_undo_selection->set_size(selection.size()); }); - m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png")), [&](auto&) { + m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)), [&](auto&) { if (!m_font_preview_window) { if (auto maybe_window = create_preview_window(); maybe_window.is_error()) warnln("Failed to create preview window: {}", maybe_window.error()); @@ -187,27 +187,27 @@ ErrorOr<void> MainWidget::create_actions() }); m_open_preview_action->set_status_tip("Preview the current font"); - bool show_metadata = Config::read_bool("FontEditor", "Layout", "ShowMetadata", true); + bool show_metadata = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowMetadata"sv, true); set_show_font_metadata(show_metadata); m_show_metadata_action = GUI::Action::create_checkable("Font &Metadata", { Mod_Ctrl, Key_M }, [&](auto& action) { set_show_font_metadata(action.is_checked()); - Config::write_bool("FontEditor", "Layout", "ShowMetadata", action.is_checked()); + Config::write_bool("FontEditor"sv, "Layout"sv, "ShowMetadata"sv, action.is_checked()); }); m_show_metadata_action->set_checked(show_metadata); m_show_metadata_action->set_status_tip("Show or hide metadata about the current font"); - bool show_unicode_blocks = Config::read_bool("FontEditor", "Layout", "ShowUnicodeBlocks", true); + bool show_unicode_blocks = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowUnicodeBlocks"sv, true); set_show_unicode_blocks(show_unicode_blocks); m_show_unicode_blocks_action = GUI::Action::create_checkable("&Unicode Blocks", { Mod_Ctrl, Key_U }, [&](auto& action) { set_show_unicode_blocks(action.is_checked()); - Config::write_bool("FontEditor", "Layout", "ShowUnicodeBlocks", action.is_checked()); + Config::write_bool("FontEditor"sv, "Layout"sv, "ShowUnicodeBlocks"sv, action.is_checked()); }); m_show_unicode_blocks_action->set_checked(show_unicode_blocks); m_show_unicode_blocks_action->set_status_tip("Show or hide the Unicode block list"); - m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png")), [&](auto&) { + m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) { String input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecResult::OK && !input.is_empty()) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) return; @@ -220,17 +220,17 @@ ErrorOr<void> MainWidget::create_actions() }); m_go_to_glyph_action->set_status_tip("Go to the specified code point"); - m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png")), [&](auto&) { + m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) { m_glyph_map_widget->select_previous_existing_glyph(); }); m_previous_glyph_action->set_status_tip("Seek the previous visible glyph"); - m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png")), [&](auto&) { + m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) { m_glyph_map_widget->select_next_existing_glyph(); }); m_next_glyph_action->set_status_tip("Seek the next visible glyph"); - i32 scale = Config::read_i32("FontEditor", "GlyphEditor", "Scale", 10); + i32 scale = Config::read_i32("FontEditor"sv, "GlyphEditor"sv, "Scale"sv, 10); set_scale(scale); m_scale_five_action = GUI::Action::create_checkable("500%", { Mod_Ctrl, Key_1 }, [this](auto&) { set_scale_and_save(5); @@ -253,12 +253,12 @@ ErrorOr<void> MainWidget::create_actions() m_glyph_editor_scale_actions.add_action(*m_scale_fifteen_action); m_glyph_editor_scale_actions.set_exclusive(true); - m_paint_glyph_action = GUI::Action::create_checkable("Paint Glyph", { Mod_Ctrl, KeyCode::Key_J }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/pen.png")), [&](auto&) { + m_paint_glyph_action = GUI::Action::create_checkable("Paint Glyph", { Mod_Ctrl, KeyCode::Key_J }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/pen.png"sv)), [&](auto&) { m_glyph_editor_widget->set_mode(GlyphEditorWidget::Paint); }); m_paint_glyph_action->set_checked(true); - m_move_glyph_action = GUI::Action::create_checkable("Move Glyph", { Mod_Ctrl, KeyCode::Key_K }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png")), [&](auto&) { + m_move_glyph_action = GUI::Action::create_checkable("Move Glyph", { Mod_Ctrl, KeyCode::Key_K }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png"sv)), [&](auto&) { m_glyph_editor_widget->set_mode(GlyphEditorWidget::Move); }); @@ -274,15 +274,15 @@ ErrorOr<void> MainWidget::create_actions() m_glyph_editor_widget->rotate_90(GlyphEditorWidget::Clockwise); }); - m_flip_horizontal_action = GUI::Action::create("Flip Horizontally", { Mod_Ctrl | Mod_Shift, Key_Q }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png")), [&](auto&) { + m_flip_horizontal_action = GUI::Action::create("Flip Horizontally", { Mod_Ctrl | Mod_Shift, Key_Q }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)), [&](auto&) { m_glyph_editor_widget->flip_horizontally(); }); - m_flip_vertical_action = GUI::Action::create("Flip Vertically", { Mod_Ctrl | Mod_Shift, Key_W }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png")), [&](auto&) { + m_flip_vertical_action = GUI::Action::create("Flip Vertically", { Mod_Ctrl | Mod_Shift, Key_W }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)), [&](auto&) { m_glyph_editor_widget->flip_vertically(); }); - m_copy_text_action = GUI::Action::create("Copy as Te&xt", { Mod_Ctrl, Key_T }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png")), [&](auto&) { + m_copy_text_action = GUI::Action::create("Copy as Te&xt", { Mod_Ctrl, Key_T }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) { StringBuilder builder; auto selection = m_glyph_map_widget->selection().normalized(); for (auto code_point = selection.start(); code_point < selection.start() + selection.size(); ++code_point) { @@ -348,7 +348,7 @@ ErrorOr<void> MainWidget::create_models() m_unicode_block_model = GUI::ItemListModel<String>::create(m_unicode_block_list); m_filter_model = TRY(GUI::FilteringProxyModel::create(*m_unicode_block_model)); - m_filter_model->set_filter_term(""); + m_filter_model->set_filter_term(""sv); m_unicode_block_listview = find_descendant_of_type_named<GUI::ListView>("unicode_block_listview"); m_unicode_block_listview->on_selection_change = [this, unicode_blocks] { @@ -658,7 +658,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) { Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/FontEditor.md"), "/bin/Help"); }))); - TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Font Editor", TRY(GUI::Icon::try_create_default_icon("app-font-editor")), &window))); + TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Font Editor", TRY(GUI::Icon::try_create_default_icon("app-font-editor"sv)), &window))); return {}; } @@ -668,7 +668,7 @@ bool MainWidget::save_file(String const& path) auto saved_font = m_edited_font->masked_character_set(); auto ret_val = saved_font->write_to_file(path); if (!ret_val) { - GUI::MessageBox::show(window(), "The font file could not be saved.", "Save failed", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "The font file could not be saved."sv, "Save failed"sv, GUI::MessageBox::Type::Error); return false; } m_path = path; @@ -699,7 +699,7 @@ bool MainWidget::open_file(String const& path) auto bitmap_font = Gfx::BitmapFont::load_from_file(path); if (!bitmap_font) { String message = String::formatted("Couldn't load font: {}\n", path); - GUI::MessageBox::show(window(), message, "Font Editor", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), message, "Font Editor"sv, GUI::MessageBox::Type::Error); return false; } auto new_font = bitmap_font->unmasked_character_set(); @@ -748,7 +748,7 @@ void MainWidget::undo() auto glyph = m_undo_selection->restored_active_glyph(); auto glyph_width = edited_font().raw_glyph_width(glyph); if (glyph < m_range.first || glyph > m_range.last) - m_search_textbox->set_text(""); + m_search_textbox->set_text(""sv); deferred_invoke([this, glyph] { auto start = m_undo_selection->restored_start(); @@ -778,7 +778,7 @@ void MainWidget::redo() auto glyph = m_undo_selection->restored_active_glyph(); auto glyph_width = edited_font().raw_glyph_width(glyph); if (glyph < m_range.first || glyph > m_range.last) - m_search_textbox->set_text(""); + m_search_textbox->set_text(""sv); deferred_invoke([this, glyph] { auto start = m_undo_selection->restored_start(); @@ -818,10 +818,10 @@ void MainWidget::update_title() { StringBuilder title; if (m_path.is_empty()) - title.append("Untitled"); + title.append("Untitled"sv); else title.append(m_path); - title.append("[*] - Font Editor"); + title.append("[*] - Font Editor"sv); window()->set_title(title.to_string()); } @@ -894,7 +894,7 @@ void MainWidget::set_scale(i32 scale) void MainWidget::set_scale_and_save(i32 scale) { set_scale(scale); - Config::write_i32("FontEditor", "GlyphEditor", "Scale", scale); + Config::write_i32("FontEditor"sv, "GlyphEditor"sv, "Scale"sv, scale); m_glyph_editor_widget->set_fixed_size(m_glyph_editor_widget->preferred_width(), m_glyph_editor_widget->preferred_height()); } @@ -926,7 +926,7 @@ void MainWidget::cut_selected_glyphs() void MainWidget::paste_glyphs() { auto [data, mime_type, metadata] = GUI::Clipboard::the().fetch_data_and_type(); - if (!mime_type.starts_with("glyph/")) + if (!mime_type.starts_with("glyph/"sv)) return; auto glyph_count = metadata.get("count").value().to_uint().value_or(0); diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index baebc63864..b89953e776 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No); args_parser.parse(arguments); - auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-font-editor")); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-font-editor"sv)); auto window = TRY(GUI::Window::try_create()); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp index 97e534b838..82d830498d 100644 --- a/Userland/Applications/Help/MainWidget.cpp +++ b/Userland/Applications/Help/MainWidget.cpp @@ -94,7 +94,7 @@ MainWidget::MainWidget() m_web_view->on_link_click = [this](auto& url, auto&, unsigned) { if (url.protocol() == "file") { auto path = url.path(); - if (!path.starts_with("/usr/share/man/")) { + if (!path.starts_with("/usr/share/man/"sv)) { open_external(url); return; } @@ -181,7 +181,7 @@ void MainWidget::set_start_page(StringView start_page, u32 section) m_history.push(path); open_page(path); set_start_page = true; - } else if (URL url = URL::create_with_url_or_path(start_page); url.is_valid() && url.path().ends_with(".md")) { + } else if (URL url = URL::create_with_url_or_path(start_page); url.is_valid() && url.path().ends_with(".md"sv)) { // > Help [/path/to/documentation/file.md] m_history.push(url.path()); open_page(url.path()); @@ -241,11 +241,11 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window) TRY(go_menu->try_add_action(*m_go_home_action)); auto help_menu = TRY(window.try_add_menu("&Help")); - TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png")), [&](auto&) { + TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [&](auto&) { String path = "/usr/share/man/man1/Help.md"; open_page(path); }))); - TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Help", TRY(GUI::Icon::try_create_default_icon("app-help")), &window))); + TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Help", TRY(GUI::Icon::try_create_default_icon("app-help"sv)), &window))); m_context_menu = TRY(GUI::Menu::try_create()); TRY(m_context_menu->try_add_action(*m_go_back_action)); @@ -259,7 +259,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window) m_browse_view->set_model(*m_manual_model); m_filter_model = TRY(GUI::FilteringProxyModel::create(*m_manual_model)); m_search_view->set_model(*m_filter_model); - m_filter_model->set_filter_term(""); + m_filter_model->set_filter_term(""sv); return {}; } @@ -287,7 +287,7 @@ void MainWidget::open_url(URL const& url) void MainWidget::open_external(URL const& url) { if (!Desktop::Launcher::open(url)) - GUI::MessageBox::show(window(), String::formatted("The link to '{}' could not be opened.", url), "Failed to open link", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), String::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error); } void MainWidget::open_page(String const& path) diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 7f35f565d5..619086bc04 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -23,9 +23,9 @@ static ManualSectionNode s_sections[] = { ManualModel::ManualModel() { - m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); - m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png").release_value_but_fixme_should_propagate_errors()); - m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors()); + m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors()); + m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png"sv).release_value_but_fixme_should_propagate_errors()); + m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors()); } Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 4dbb1741f0..e91471d70b 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -77,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } }); args_parser.parse(arguments); - auto app_icon = GUI::Icon::default_icon("app-help"); + auto app_icon = GUI::Icon::default_icon("app-help"sv); auto window = TRY(GUI::Window::try_create()); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 03b8b7fd1f..9c3c73ed43 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -26,8 +26,8 @@ struct Option { static constexpr Array<Option, 2> options = { { - { "ASCII String", OPTION_ASCII_STRING, true, true }, - { "Hex value", OPTION_HEX_VALUE, true, false }, + { "ASCII String"sv, OPTION_ASCII_STRING, true, true }, + { "Hex value"sv, OPTION_HEX_VALUE, true, false }, } }; @@ -79,7 +79,7 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId } case OPTION_HEX_VALUE: { - auto decoded = decode_hex(text_value.replace(" ", "", ReplaceMode::All)); + auto decoded = decode_hex(text_value.replace(" "sv, ""sv, ReplaceMode::All)); if (decoded.is_error()) return String::formatted("Input is invalid: {}", decoded.error().string_literal()); diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp index f24428b14e..d22f861b23 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp @@ -126,9 +126,9 @@ GoToOffsetDialog::GoToOffsetDialog() m_text_editor->on_change = [this]() { auto text = m_text_editor->text(); - if (text.starts_with("0x")) { + if (text.starts_with("0x"sv)) { m_offset_type_box->set_selected_index(1); - m_text_editor->set_text(text.replace("0x", "", ReplaceMode::FirstOnly)); + m_text_editor->set_text(text.replace("0x"sv, ""sv, ReplaceMode::FirstOnly)); } update_statusbar(); }; diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index c76504e3f4..0233c4e388 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -194,17 +194,17 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code() StringBuilder output_string_builder; output_string_builder.appendff("unsigned char raw_data[{}] = {{\n", m_selection_end - m_selection_start); - output_string_builder.append(" "); + output_string_builder.append(" "sv); for (size_t i = m_selection_start, j = 1; i < m_selection_end; i++, j++) { output_string_builder.appendff("{:#02X}", m_document->get(i).value); if (i >= m_selection_end - 1) continue; if ((j % 12) == 0) - output_string_builder.append(",\n "); + output_string_builder.append(",\n "sv); else - output_string_builder.append(", "); + output_string_builder.append(", "sv); } - output_string_builder.append("\n};\n"); + output_string_builder.append("\n};\n"sv); GUI::Clipboard::the().set_plain_text(output_string_builder.to_string()); return true; diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 72077951f6..bba7af05a2 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -92,19 +92,19 @@ HexEditorWidget::HexEditorWidget() m_editor->update(); }; - m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [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"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { String value; - if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { + if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:"sv, "New file size"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto file_size = value.to_int(); if (file_size.has_value() && file_size.value() > 0) { window()->set_modified(false); if (!m_editor->open_new_file(file_size.value())) { - GUI::MessageBox::show(window(), "Entered file size is too large.", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Entered file size is too large."sv, "Error"sv, GUI::MessageBox::Type::Error); return; } set_path({}); } else { - GUI::MessageBox::show(window(), "Invalid file size entered.", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Invalid file size entered."sv, "Error"sv, GUI::MessageBox::Type::Error); } } }); @@ -125,7 +125,7 @@ HexEditorWidget::HexEditorWidget() return m_save_as_action->activate(); if (!m_editor->save()) { - GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error); } else { window()->set_modified(false); m_editor->update(); @@ -139,7 +139,7 @@ HexEditorWidget::HexEditorWidget() return; auto file = response.release_value(); if (!m_editor->save_as(file)) { - GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error); return; } @@ -148,7 +148,7 @@ HexEditorWidget::HexEditorWidget() dbgln("Wrote document to {}", file->filename()); }); - m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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::ExecResult::OK) { @@ -158,7 +158,7 @@ HexEditorWidget::HexEditorWidget() m_search_results->update(); if (matches.is_empty()) { - GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } @@ -174,7 +174,7 @@ HexEditorWidget::HexEditorWidget() auto result = m_editor->find_and_highlight(m_search_buffer, same_buffers ? last_found_index() : 0); if (!result.has_value()) { - GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } @@ -185,7 +185,7 @@ HexEditorWidget::HexEditorWidget() } }); - 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").release_value_but_fixme_should_propagate_errors(), [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"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { int new_offset; auto result = GoToOffsetDialog::show( window(), @@ -201,31 +201,31 @@ HexEditorWidget::HexEditorWidget() m_layout_toolbar_action = GUI::Action::create_checkable("&Toolbar", [&](auto& action) { m_toolbar_container->set_visible(action.is_checked()); - Config::write_bool("HexEditor", "Layout", "ShowToolbar", action.is_checked()); + Config::write_bool("HexEditor"sv, "Layout"sv, "ShowToolbar"sv, action.is_checked()); }); m_layout_search_results_action = GUI::Action::create_checkable("&Search Results", [&](auto& action) { set_search_results_visible(action.is_checked()); }); - m_copy_hex_action = GUI::Action::create("Copy &Hex", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hex.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + m_copy_hex_action = GUI::Action::create("Copy &Hex", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hex.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { m_editor->copy_selected_hex_to_clipboard(); }); m_copy_hex_action->set_enabled(false); - m_copy_text_action = GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + m_copy_text_action = GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { m_editor->copy_selected_text_to_clipboard(); }); m_copy_text_action->set_enabled(false); - m_copy_as_c_code_action = GUI::Action::create("Copy as &C Code", { Mod_Alt | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/c.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + m_copy_as_c_code_action = GUI::Action::create("Copy as &C Code", { Mod_Alt | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/c.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { m_editor->copy_selected_hex_to_clipboard_as_c_code(); }); m_copy_as_c_code_action->set_enabled(false); m_fill_selection_action = GUI::Action::create("Fill &Selection...", { Mod_Ctrl, Key_B }, [&](const GUI::Action&) { String value; - if (GUI::InputBox::show(window(), value, "Fill byte (hex):", "Fill Selection") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Fill byte (hex):"sv, "Fill Selection"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto fill_byte = strtol(value.characters(), nullptr, 16); m_editor->fill_selection(fill_byte); } @@ -386,29 +386,29 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) edit_menu.add_action(*m_copy_as_c_code_action); 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::try_load_from_file("/res/icons/16x16/find-next.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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); + GUI::MessageBox::show(&window, "Nothing to search for"sv, "Not found"sv, GUI::MessageBox::Type::Warning); return; } auto result = m_editor->find_and_highlight(m_search_buffer, last_found_index()); if (!result.has_value()) { - GUI::MessageBox::show(&window, String::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not found", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(&window, String::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } m_editor->update(); m_last_found_index = result.value(); })); - 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").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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))); m_search_results->update(); if (matches.is_empty()) { - GUI::MessageBox::show(&window, "No strings found in this file", "Not found", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(&window, "No strings found in this file"sv, "Not found"sv, GUI::MessageBox::Type::Warning); return; } @@ -420,7 +420,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) auto& view_menu = window.add_menu("&View"); - auto show_toolbar = Config::read_bool("HexEditor", "Layout", "ShowToolbar", true); + auto show_toolbar = Config::read_bool("HexEditor"sv, "Layout"sv, "ShowToolbar"sv, true); m_layout_toolbar_action->set_checked(show_toolbar); m_toolbar_container->set_visible(show_toolbar); view_menu.add_action(*m_layout_toolbar_action); @@ -428,7 +428,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) view_menu.add_action(*m_layout_value_inspector_action); view_menu.add_separator(); - auto bytes_per_row = Config::read_i32("HexEditor", "Layout", "BytesPerRow", 16); + auto bytes_per_row = Config::read_i32("HexEditor"sv, "Layout"sv, "BytesPerRow"sv, 16); m_editor->set_bytes_per_row(bytes_per_row); m_editor->update(); @@ -438,7 +438,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) auto action = GUI::Action::create_checkable(String::number(i), [this, i](auto&) { m_editor->set_bytes_per_row(i); m_editor->update(); - Config::write_i32("HexEditor", "Layout", "BytesPerRow", i); + Config::write_i32("HexEditor"sv, "Layout"sv, "BytesPerRow"sv, i); }); m_bytes_per_row_actions.add_action(action); bytes_per_row_menu.add_action(action); @@ -466,7 +466,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) little_endian_mode->set_checked(true); auto& help_menu = window.add_menu("&Help"); - help_menu.add_action(GUI::CommonActions::make_about_action("Hex Editor", GUI::Icon::default_icon("app-hex-editor"), &window)); + help_menu.add_action(GUI::CommonActions::make_about_action("Hex Editor", GUI::Icon::default_icon("app-hex-editor"sv), &window)); } void HexEditorWidget::set_path(StringView path) @@ -488,10 +488,10 @@ void HexEditorWidget::update_title() { StringBuilder builder; if (m_path.is_empty()) - builder.append("Untitled"); + builder.append("Untitled"sv); else builder.append(m_path); - builder.append("[*] - Hex Editor"); + builder.append("[*] - Hex Editor"sv); window()->set_title(builder.to_string()); } diff --git a/Userland/Applications/HexEditor/main.cpp b/Userland/Applications/HexEditor/main.cpp index df42d6223d..63c77a1c08 100644 --- a/Userland/Applications/HexEditor/main.cpp +++ b/Userland/Applications/HexEditor/main.cpp @@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domain("HexEditor"); - auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-hex-editor")); + auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-hex-editor"sv)); auto window = TRY(GUI::Window::try_create()); window->set_title("Hex Editor"); 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); }); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 7b17e604e8..54039fda5b 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -58,7 +58,7 @@ void KeyboardMapperWidget::create_frame() tmp_button.on_click = [this, &tmp_button]() { String value; - if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), value, "New Character:"sv, "Select Character"sv) == GUI::InputBox::ExecResult::OK) { int i = m_keys.find_first_index(&tmp_button).value_or(0); VERIFY(i > 0); @@ -90,11 +90,11 @@ void KeyboardMapperWidget::create_frame() m_map_group->set_layout<GUI::HorizontalBoxLayout>(); m_map_group->set_fixed_width(450); - add_map_radio_button("map", "Default"); - add_map_radio_button("shift_map", "Shift"); - add_map_radio_button("altgr_map", "AltGr"); - add_map_radio_button("alt_map", "Alt"); - add_map_radio_button("shift_altgr_map", "Shift+AltGr"); + add_map_radio_button("map"sv, "Default"sv); + add_map_radio_button("shift_map"sv, "Shift"sv); + add_map_radio_button("altgr_map"sv, "AltGr"sv); + add_map_radio_button("alt_map"sv, "Alt"sv); + add_map_radio_button("shift_altgr_map"sv, "Shift+AltGr"sv); bottom_widget.layout()->add_spacer(); } @@ -257,7 +257,7 @@ void KeyboardMapperWidget::update_window_title() { StringBuilder sb; sb.append(m_filename); - sb.append("[*] - Keyboard Mapper"); + sb.append("[*] - Keyboard Mapper"sv); window()->set_title(sb.to_string()); } diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index c421aec6c0..7e3aa1d133 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd")); - auto app_icon = GUI::Icon::default_icon("app-keyboard-mapper"); + auto app_icon = GUI::Icon::default_icon("app-keyboard-mapper"sv); auto window = GUI::Window::construct(); window->set_title("Keyboard Mapper"); @@ -50,7 +50,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (!keyboard_mapper_widget->request_close()) return; - Optional<String> path = GUI::FilePicker::get_open_filepath(window, "Open", "/res/keymaps/"); + Optional<String> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv); if (!path.has_value()) return; diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 794f78ac04..0513639023 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -62,13 +62,13 @@ private: Core::DirIterator iterator("/res/keymaps/", Core::DirIterator::Flags::SkipDots); if (iterator.has_error()) { - GUI::MessageBox::show(nullptr, String::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, String::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings"sv, GUI::MessageBox::Type::Error); GUI::Application::the()->quit(-1); } while (iterator.has_next()) { auto name = iterator.next_path(); - auto basename = name.replace(".json", "", ReplaceMode::FirstOnly); + auto basename = name.replace(".json"sv, ""sv, ReplaceMode::FirstOnly); if (!selected_keymaps.find(basename).is_end()) continue; m_character_map_files.append(basename); @@ -160,8 +160,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget() auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors(); auto const& keymap_object = json.as_object(); - VERIFY(keymap_object.has("keymap")); - m_initial_active_keymap = keymap_object.get("keymap").to_string(); + VERIFY(keymap_object.has("keymap"sv)); + m_initial_active_keymap = keymap_object.get("keymap"sv).to_string(); dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap); auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors()); @@ -247,7 +247,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget() }; m_num_lock_checkbox = find_descendant_of_type_named<GUI::CheckBox>("num_lock_checkbox"); - m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings", "StartupEnable", "NumLock", true)); + m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings"sv, "StartupEnable"sv, "NumLock"sv, true)); m_num_lock_checkbox->on_checked = [&](auto) { set_modified(true); }; @@ -277,11 +277,11 @@ void KeyboardSettingsWidget::apply_settings() m_initial_keymap_list.append(keymap); } m_initial_active_keymap = m_keymaps_list_model.active_keymap(); - Config::write_bool("KeyboardSettings", "StartupEnable", "NumLock", m_num_lock_checkbox->is_checked()); + Config::write_bool("KeyboardSettings"sv, "StartupEnable"sv, "NumLock"sv, m_num_lock_checkbox->is_checked()); } void KeyboardSettingsWidget::set_keymaps(Vector<String> const& keymaps, String const& active_keymap) { auto keymaps_string = String::join(',', keymaps); - GUI::Process::spawn_or_show_error(window(), "/bin/keymap", Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() }); + GUI::Process::spawn_or_show_error(window(), "/bin/keymap"sv, Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() }); } diff --git a/Userland/Applications/KeyboardSettings/main.cpp b/Userland/Applications/KeyboardSettings/main.cpp index 2315ba15f3..4433c0e35a 100644 --- a/Userland/Applications/KeyboardSettings/main.cpp +++ b/Userland/Applications/KeyboardSettings/main.cpp @@ -33,11 +33,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc/Keyboard.ini", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-keyboard-settings"); + auto app_icon = GUI::Icon::default_icon("app-keyboard-settings"sv); auto window = TRY(GUI::SettingsWindow::create("Keyboard Settings")); window->set_icon(app_icon.bitmap_for_size(16)); - auto keyboard_settings_widget = TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard", "keyboard")); + auto keyboard_settings_widget = TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard"sv, "keyboard"sv)); window->set_active_tab(selected_tab); window->on_active_window_change = [&](bool is_active_window) { diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index ad93313ad1..47bf2926ce 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-magnifier"); + auto app_icon = GUI::Icon::default_icon("app-magnifier"sv); // 4px on each side for padding constexpr int window_dimensions = 200 + 4 + 4; @@ -78,13 +78,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto timeline_menu = TRY(window->try_add_menu("&Timeline")); auto previous_frame_action = GUI::Action::create( - "&Previous frame", { Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png")), [&](auto&) { + "&Previous frame", { Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) { pause_action->set_checked(true); magnifier->pause_capture(true); magnifier->display_previous_frame(); }); auto next_frame_action = GUI::Action::create( - "&Next frame", { Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png")), [&](auto&) { + "&Next frame", { Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) { pause_action->set_checked(true); magnifier->pause_capture(true); magnifier->display_next_frame(); diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 1b37ee986b..82fb72b7e6 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -44,7 +44,7 @@ MailWidget::MailWidget() GUI::MessageBox::show( window(), String::formatted("The link to '{}' could not be opened.", url), - "Failed to open link", + "Failed to open link"sv, GUI::MessageBox::Type::Error); } }; @@ -98,28 +98,28 @@ MailWidget::MailWidget() bool MailWidget::connect_and_login() { - auto server = Config::read_string("Mail", "Connection", "Server", {}); + auto server = Config::read_string("Mail"sv, "Connection"sv, "Server"sv, {}); if (server.is_empty()) { - auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); + auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?"sv, "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); if (result == GUI::MessageBox::ExecResult::Yes) Desktop::Launcher::open(URL::create_with_file_protocol("/bin/MailSettings")); return false; } // Assume TLS by default, which is on port 993. - auto port = Config::read_i32("Mail", "Connection", "Port", 993); - auto tls = Config::read_bool("Mail", "Connection", "TLS", true); + auto port = Config::read_i32("Mail"sv, "Connection"sv, "Port"sv, 993); + auto tls = Config::read_bool("Mail"sv, "Connection"sv, "TLS"sv, true); - auto username = Config::read_string("Mail", "User", "Username", {}); + auto username = Config::read_string("Mail"sv, "User"sv, "Username"sv, {}); if (username.is_empty()) { - GUI::MessageBox::show_error(window(), "Mail has no username configured. Refer to the Mail(1) man page for more information."); + GUI::MessageBox::show_error(window(), "Mail has no username configured. Refer to the Mail(1) man page for more information."sv); return false; } - auto password = Config::read_string("Mail", "User", "Password", {}); + auto password = Config::read_string("Mail"sv, "User"sv, "Password"sv, {}); while (password.is_empty()) { - if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecResult::OK) + if (GUI::PasswordInputDialog::show(window(), password, "Login"sv, server, username) != GUI::Dialog::ExecResult::OK) return false; } @@ -142,7 +142,7 @@ bool MailWidget::connect_and_login() return false; } - response = m_imap_client->list("", "*")->await().release_value(); + response = m_imap_client->list(""sv, "*"sv)->await().release_value(); if (response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()); @@ -171,7 +171,7 @@ void MailWidget::on_window_close() IMAP::MultiPartBodyStructureData const* MailWidget::look_for_alternative_body_structure(IMAP::MultiPartBodyStructureData const& current_body_structure, Vector<u32>& position_stack) const { - if (current_body_structure.media_type.equals_ignoring_case("ALTERNATIVE")) + if (current_body_structure.media_type.equals_ignoring_case("ALTERNATIVE"sv)) return ¤t_body_structure; u32 structure_index = 1; @@ -227,7 +227,7 @@ Vector<MailWidget::Alternative> MailWidget::get_alternatives(IMAP::MultiPartBody bool MailWidget::is_supported_alternative(Alternative const& alternative) const { - return alternative.body_structure.type.equals_ignoring_case("text") && (alternative.body_structure.subtype.equals_ignoring_case("plain") || alternative.body_structure.subtype.equals_ignoring_case("html")); + return alternative.body_structure.type.equals_ignoring_case("text"sv) && (alternative.body_structure.subtype.equals_ignoring_case("plain"sv) || alternative.body_structure.subtype.equals_ignoring_case("html"sv)); } void MailWidget::selected_mailbox() @@ -351,7 +351,7 @@ void MailWidget::selected_mailbox() }; auto& subject_iterator_value = subject_iterator->get<1>().value(); - auto subject_index = subject_iterator_value.find("Subject:"); + auto subject_index = subject_iterator_value.find("Subject:"sv); String subject; if (subject_index.has_value()) { auto potential_subject = subject_iterator_value.substring(subject_index.value()); @@ -363,7 +363,7 @@ void MailWidget::selected_mailbox() subject = "(no subject)"; auto& from_iterator_value = from_iterator->get<1>().value(); - auto from_index = from_iterator_value.find("From:"); + auto from_index = from_iterator_value.find("From:"sv); VERIFY(from_index.has_value()); auto potential_from = from_iterator_value.substring(from_index.value()); auto from_parts = potential_from.split_limit(':', 2); @@ -419,7 +419,7 @@ void MailWidget::selected_email_to_load() auto alternatives = get_alternatives(data); if (alternatives.is_empty()) { dbgln("No alternatives. The server said: '{}'", fetch_response.response_text()); - GUI::MessageBox::show_error(window(), "The server sent no message to display."); + GUI::MessageBox::show_error(window(), "The server sent no message to display."sv); return; } @@ -430,7 +430,7 @@ void MailWidget::selected_email_to_load() }); if (!chosen_alternative.has_value()) { - GUI::MessageBox::show(window(), "Displaying this type of e-mail is currently unsupported.", "Unsupported", GUI::MessageBox::Type::Information); + GUI::MessageBox::show(window(), "Displaying this type of e-mail is currently unsupported."sv, "Unsupported"sv, GUI::MessageBox::Type::Information); return; } @@ -469,14 +469,14 @@ void MailWidget::selected_email_to_load() if (fetch_data.is_empty()) { dbgln("The server sent no fetch data."); - GUI::MessageBox::show_error(window(), "The server sent no data."); + GUI::MessageBox::show_error(window(), "The server sent no data."sv); return; } auto& fetch_response_data = fetch_data.last().get<IMAP::FetchResponseData>(); if (!fetch_response_data.contains_response_type(IMAP::FetchResponseType::Body)) { - GUI::MessageBox::show_error(window(), "The server sent no body."); + GUI::MessageBox::show_error(window(), "The server sent no body."sv); return; } @@ -493,21 +493,21 @@ void MailWidget::selected_email_to_load() // FIXME: String uses char internally, so 8bit shouldn't be stored in it. // However, it works for now. - if (selected_alternative_encoding.equals_ignoring_case("7bit") || selected_alternative_encoding.equals_ignoring_case("8bit")) { + if (selected_alternative_encoding.equals_ignoring_case("7bit"sv) || selected_alternative_encoding.equals_ignoring_case("8bit"sv)) { decoded_data = encoded_data; - } else if (selected_alternative_encoding.equals_ignoring_case("base64")) { + } else if (selected_alternative_encoding.equals_ignoring_case("base64"sv)) { auto decoded_base64 = decode_base64(encoded_data); if (!decoded_base64.is_error()) decoded_data = decoded_base64.release_value(); - } else if (selected_alternative_encoding.equals_ignoring_case("quoted-printable")) { + } else if (selected_alternative_encoding.equals_ignoring_case("quoted-printable"sv)) { decoded_data = IMAP::decode_quoted_printable(encoded_data); } else { dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding); - GUI::MessageBox::show(window(), String::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported", GUI::MessageBox::Type::Information); + GUI::MessageBox::show(window(), String::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information); return; } // FIXME: I'm not sure what the URL should be. Just use the default URL "about:blank". // FIXME: It would be nice if we could pass over the charset. - m_web_view->load_html(decoded_data, "about:blank"); + m_web_view->load_html(decoded_data, "about:blank"sv); } diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp index 9f78366852..d432b10ce5 100644 --- a/Userland/Applications/Mail/MailboxTreeModel.cpp +++ b/Userland/Applications/Mail/MailboxTreeModel.cpp @@ -11,9 +11,9 @@ MailboxTreeModel::MailboxTreeModel(AccountHolder const& account_holder) : m_account_holder(account_holder) { - m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mail.png").release_value_but_fixme_should_propagate_errors()); - m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-folder.png").release_value_but_fixme_should_propagate_errors()); - m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/home-directory.png").release_value_but_fixme_should_propagate_errors()); + m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mail.png"sv).release_value_but_fixme_should_propagate_errors()); + m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors()); + m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/home-directory.png"sv).release_value_but_fixme_should_propagate_errors()); } GUI::ModelIndex MailboxTreeModel::index(int row, int column, GUI::ModelIndex const& parent) const diff --git a/Userland/Applications/Mail/main.cpp b/Userland/Applications/Mail/main.cpp index 4e8c5e3895..2396d21b34 100644 --- a/Userland/Applications/Mail/main.cpp +++ b/Userland/Applications/Mail/main.cpp @@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto window = GUI::Window::construct(); - auto app_icon = GUI::Icon::default_icon("app-mail"); + auto app_icon = GUI::Icon::default_icon("app-mail"sv); window->set_icon(app_icon.bitmap_for_size(16)); auto mail_widget = TRY(window->try_set_main_widget<MailWidget>()); diff --git a/Userland/Applications/MailSettings/MailSettingsWidget.cpp b/Userland/Applications/MailSettings/MailSettingsWidget.cpp index deb1da6393..040ad3dc7b 100644 --- a/Userland/Applications/MailSettings/MailSettingsWidget.cpp +++ b/Userland/Applications/MailSettings/MailSettingsWidget.cpp @@ -17,10 +17,10 @@ void MailSettingsWidget::reset_default_values() { - m_server_inputbox->set_text(""); - m_port_combobox->set_text("993"); + m_server_inputbox->set_text(""sv); + m_port_combobox->set_text("993"sv); m_tls_checkbox->set_checked(false); - m_email_inputbox->set_text(""); + m_email_inputbox->set_text(""sv); } void MailSettingsWidget::apply_settings() @@ -30,10 +30,10 @@ void MailSettingsWidget::apply_settings() m_tls = m_tls_checkbox->is_checked(); m_email = m_email_inputbox->get_text(); - Config::write_string("Mail", "Connection", "Server", m_server); - Config::write_string("Mail", "Connection", "Port", m_port); - Config::write_bool("Mail", "Connection", "TLS", m_tls); - Config::write_string("Mail", "User", "Username", m_email); + Config::write_string("Mail"sv, "Connection"sv, "Server"sv, m_server); + Config::write_string("Mail"sv, "Connection"sv, "Port"sv, m_port); + Config::write_bool("Mail"sv, "Connection"sv, "TLS"sv, m_tls); + Config::write_string("Mail"sv, "User"sv, "Username"sv, m_email); } MailSettingsWidget::MailSettingsWidget() @@ -45,13 +45,13 @@ MailSettingsWidget::MailSettingsWidget() load_from_gml(mail_settings_widget_gml); m_server_inputbox = *find_descendant_of_type_named<GUI::TextBox>("server_input"); - m_server_inputbox->set_text(Config::read_string("Mail", "Connection", "Server", "")); + m_server_inputbox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Server"sv, ""sv)); m_server_inputbox->on_change = [&]() { set_modified(true); }; m_port_combobox = *find_descendant_of_type_named<GUI::ComboBox>("port_input"); - m_port_combobox->set_text(Config::read_string("Mail", "Connection", "Port", "993")); + m_port_combobox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Port"sv, "993"sv)); m_port_combobox->set_only_allow_values_from_model(false); m_port_combobox->set_model(*GUI::ItemListModel<String>::create(m_common_ports)); m_port_combobox->on_change = [&](auto, auto) { @@ -59,13 +59,13 @@ MailSettingsWidget::MailSettingsWidget() }; m_tls_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("tls_input"); - m_tls_checkbox->set_checked(Config::read_bool("Mail", "Connection", "TLS", false)); + m_tls_checkbox->set_checked(Config::read_bool("Mail"sv, "Connection"sv, "TLS"sv, false)); m_tls_checkbox->on_checked = [&](auto) { set_modified(true); }; m_email_inputbox = *find_descendant_of_type_named<GUI::TextBox>("email_input"); - m_email_inputbox->set_text(Config::read_string("Mail", "User", "Username", "")); + m_email_inputbox->set_text(Config::read_string("Mail"sv, "User"sv, "Username"sv, ""sv)); m_email_inputbox->on_change = [&]() { set_modified(true); }; diff --git a/Userland/Applications/MailSettings/main.cpp b/Userland/Applications/MailSettings/main.cpp index 76ad08d773..75dc3c57a8 100644 --- a/Userland/Applications/MailSettings/main.cpp +++ b/Userland/Applications/MailSettings/main.cpp @@ -31,10 +31,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-mail"); + auto app_icon = GUI::Icon::default_icon("app-mail"sv); auto window = TRY(GUI::SettingsWindow::create("Mail Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes)); - (void)TRY(window->add_tab<MailSettingsWidget>("Mail", "mail")); + (void)TRY(window->add_tab<MailSettingsWidget>("Mail"sv, "mail"sv)); window->set_icon(app_icon.bitmap_for_size(16)); window->set_active_tab(selected_tab); diff --git a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp index 656c108011..73fa86d754 100644 --- a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp +++ b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp @@ -24,7 +24,7 @@ void DoubleClickArrowWidget::set_double_click_speed(int speed) DoubleClickArrowWidget::DoubleClickArrowWidget() { - m_arrow_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/double-click-down-arrow.png").release_value_but_fixme_should_propagate_errors(); + m_arrow_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/double-click-down-arrow.png"sv).release_value_but_fixme_should_propagate_errors(); } void DoubleClickArrowWidget::paint_event(GUI::PaintEvent& event) diff --git a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp index cfbd300e2a..d97c1913c2 100644 --- a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp +++ b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp @@ -30,7 +30,7 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor() return maybe_bitmap; return Gfx::Bitmap::try_load_from_file(default_path); }; - constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"; + constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv; auto cursor_path = String::formatted("/res/cursor-themes/{}/{}", cursor_theme, cursor_theme_config->read_entry("Cursor", "Arrow")); m_cursor_bitmap = TRY(load_bitmap(cursor_path, default_cursor_path)); diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index c357995e38..2c91c7e215 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -54,9 +54,9 @@ void MouseCursorModel::invalidate() while (iterator.has_next()) { auto path = iterator.next_full_path(); - if (path.ends_with(".ini")) + if (path.ends_with(".ini"sv)) continue; - if (path.contains("2x")) + if (path.contains("2x"sv)) continue; Cursor cursor; diff --git a/Userland/Applications/MouseSettings/main.cpp b/Userland/Applications/MouseSettings/main.cpp index 82c200c3e4..9564f996e2 100644 --- a/Userland/Applications/MouseSettings/main.cpp +++ b/Userland/Applications/MouseSettings/main.cpp @@ -31,12 +31,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(selected_tab, "Tab, one of 'cursor-theme', 'cursor-highlight', or 'mouse'", "open-tab", 't', "tab"); args_parser.parse(arguments); - auto app_icon = GUI::Icon::default_icon("app-mouse"); + auto app_icon = GUI::Icon::default_icon("app-mouse"sv); auto window = TRY(GUI::SettingsWindow::create("Mouse Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes)); - (void)TRY(window->add_tab<MouseWidget>("Mouse", "mouse")); - (void)TRY(window->add_tab<ThemeWidget>("Cursor Theme", "cursor-theme")); - (void)TRY(window->add_tab<HighlightWidget>("Cursor Highlight", "cursor-highlight")); + (void)TRY(window->add_tab<MouseWidget>("Mouse"sv, "mouse"sv)); + (void)TRY(window->add_tab<ThemeWidget>("Cursor Theme"sv, "cursor-theme"sv)); + (void)TRY(window->add_tab<HighlightWidget>("Cursor Highlight"sv, "cursor-highlight"sv)); window->set_icon(app_icon.bitmap_for_size(16)); window->set_active_tab(selected_tab); diff --git a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp index ea65051cd7..2e0e9ad821 100644 --- a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp +++ b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp @@ -63,14 +63,14 @@ NetworkSettingsWidget::NetworkSettingsWidget() auto config_file = Core::ConfigFile::open_for_system("Network").release_value_but_fixme_should_propagate_errors(); - auto proc_net_adapters_file = Core::Stream::File::open("/proc/net/adapters", Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors(); + auto proc_net_adapters_file = Core::Stream::File::open("/proc/net/adapters"sv, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors(); auto data = proc_net_adapters_file->read_all().release_value_but_fixme_should_propagate_errors(); JsonParser parser(data); JsonValue proc_net_adapters_json = parser.parse().release_value_but_fixme_should_propagate_errors(); // FIXME: This should be done before creating a window. if (proc_net_adapters_json.as_array().is_empty()) { - GUI::MessageBox::show_error(window(), "No network adapters found!"); + GUI::MessageBox::show_error(window(), "No network adapters found!"sv); ::exit(1); } @@ -78,7 +78,7 @@ NetworkSettingsWidget::NetworkSettingsWidget() size_t index = 0; proc_net_adapters_json.as_array().for_each([&](auto& value) { auto& if_object = value.as_object(); - auto adapter_name = if_object.get("name").to_string(); + auto adapter_name = if_object.get("name"sv).to_string(); if (adapter_name == "loop") return; @@ -160,10 +160,10 @@ void NetworkSettingsWidget::apply_settings() config_file->write_entry(adapter_data.key, "IPv4Gateway", adapter_data.value.default_gateway); } - GUI::Process::spawn_or_show_error(window(), "/bin/NetworkServer"); + GUI::Process::spawn_or_show_error(window(), "/bin/NetworkServer"sv); if (may_need_to_reboot) - GUI::MessageBox::show(window(), "You may need to reboot for changes to take effect.", "Network Settings", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), "You may need to reboot for changes to take effect."sv, "Network Settings"sv, GUI::MessageBox::Type::Warning); } } diff --git a/Userland/Applications/NetworkSettings/main.cpp b/Userland/Applications/NetworkSettings/main.cpp index ca56eb3ea4..b6fb09d721 100644 --- a/Userland/Applications/NetworkSettings/main.cpp +++ b/Userland/Applications/NetworkSettings/main.cpp @@ -30,15 +30,15 @@ ErrorOr<int> serenity_main(Main::Arguments args) auto app = TRY(GUI::Application::try_create(args)); if (getuid() != 0) { - GUI::MessageBox::show_error(nullptr, "You need to be root to run Network Settings!"); + GUI::MessageBox::show_error(nullptr, "You need to be root to run Network Settings!"sv); return 1; } TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd proc exec")); - auto app_icon = GUI::Icon::default_icon("network"); + auto app_icon = GUI::Icon::default_icon("network"sv); auto window = TRY(GUI::SettingsWindow::create("Network Settings", GUI::SettingsWindow::ShowDefaultsButton::No)); - (void)TRY(window->add_tab<NetworkSettings::NetworkSettingsWidget>("Network", "network")); + (void)TRY(window->add_tab<NetworkSettings::NetworkSettingsWidget>("Network"sv, "network"sv)); window->set_icon(app_icon.bitmap_for_size(16)); window->show(); diff --git a/Userland/Applications/PDFViewer/NumericInput.cpp b/Userland/Applications/PDFViewer/NumericInput.cpp index dbd3654c4d..3fb3e79243 100644 --- a/Userland/Applications/PDFViewer/NumericInput.cpp +++ b/Userland/Applications/PDFViewer/NumericInput.cpp @@ -9,7 +9,7 @@ NumericInput::NumericInput() { - set_text("0"); + set_text("0"sv); on_change = [&] { auto number_opt = text().to_int(); diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp index 3ae66220f1..125714bc6f 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.cpp +++ b/Userland/Applications/PDFViewer/OutlineModel.cpp @@ -15,8 +15,8 @@ NonnullRefPtr<OutlineModel> OutlineModel::create(NonnullRefPtr<PDF::OutlineDict> OutlineModel::OutlineModel(NonnullRefPtr<PDF::OutlineDict> const& outline) : m_outline(outline) { - m_closed_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png").release_value_but_fixme_should_propagate_errors()); - m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); + m_closed_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png"sv).release_value_but_fixme_should_propagate_errors()); + m_open_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors()); } 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 0976f5599f..1125c2bf48 100644 --- a/Userland/Applications/PDFViewer/PDFViewer.cpp +++ b/Userland/Applications/PDFViewer/PDFViewer.cpp @@ -44,7 +44,7 @@ PDFViewer::PDFViewer() start_timer(30'000); - m_page_view_mode = static_cast<PageViewMode>(Config::read_i32("PDFViewer", "Display", "PageMode", 0)); + m_page_view_mode = static_cast<PageViewMode>(Config::read_i32("PDFViewer"sv, "Display"sv, "PageMode"sv, 0)); } PDF::PDFErrorOr<void> PDFViewer::set_document(RefPtr<PDF::Document> document) @@ -289,7 +289,7 @@ void PDFViewer::rotate(int degrees) void PDFViewer::set_page_view_mode(PageViewMode mode) { m_page_view_mode = mode; - Config::write_i32("PDFViewer", "Display", "PageMode", static_cast<i32>(mode)); + Config::write_i32("PDFViewer"sv, "Display"sv, "PageMode"sv, static_cast<i32>(mode)); update(); } diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 339d69bc29..0f388d922d 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -65,13 +65,13 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window) view_menu.add_action(*m_reset_zoom_action); auto& help_menu = window.add_menu("&Help"); - help_menu.add_action(GUI::CommonActions::make_about_action("PDF Viewer", GUI::Icon::default_icon("app-pdf-viewer"), &window)); + help_menu.add_action(GUI::CommonActions::make_about_action("PDF Viewer", GUI::Icon::default_icon("app-pdf-viewer"sv), &window)); } void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar) { auto open_outline_action = GUI::Action::create( - "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_sidebar_open = !m_sidebar_open; m_sidebar->set_fixed_width(m_sidebar_open ? 200 : 0); }, @@ -82,13 +82,13 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& 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::try_load_from_file("/res/icons/16x16/go-up.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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::try_load_from_file("/res/icons/16x16/go-down.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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/PDFViewer/main.cpp b/Userland/Applications/PDFViewer/main.cpp index 240194c5c4..73cd91fb5e 100644 --- a/Userland/Applications/PDFViewer/main.cpp +++ b/Userland/Applications/PDFViewer/main.cpp @@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); auto app = TRY(GUI::Application::try_create(arguments)); - auto app_icon = GUI::Icon::default_icon("app-pdf-viewer"); + auto app_icon = GUI::Icon::default_icon("app-pdf-viewer"sv); Config::pledge_domain("PDFViewer"); diff --git a/Userland/Applications/Piano/KeysWidget.cpp b/Userland/Applications/Piano/KeysWidget.cpp index e43f07fc8c..e7f48dd06b 100644 --- a/Userland/Applications/Piano/KeysWidget.cpp +++ b/Userland/Applications/Piano/KeysWidget.cpp @@ -87,30 +87,30 @@ constexpr int black_key_height = 60; constexpr int white_key_labels_count = 12; constexpr Array<StringView, white_key_labels_count> white_key_labels = { - "A", - "S", - "D", - "F", - "G", - "H", - "J", - "K", - "L", - ";", - "\'", - "\u23CE", // Return key symbol + "A"sv, + "S"sv, + "D"sv, + "F"sv, + "G"sv, + "H"sv, + "J"sv, + "K"sv, + "L"sv, + ";"sv, + "\'"sv, + "\u23CE"sv, // Return key symbol }; constexpr int black_key_labels_count = 8; constexpr Array<StringView, black_key_labels_count> black_key_labels = { - "W", - "E", - "T", - "Y", - "U", - "O", - "P", - "]", + "W"sv, + "E"sv, + "T"sv, + "Y"sv, + "U"sv, + "O"sv, + "P"sv, + "]"sv, }; constexpr int black_key_offsets[] = { diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp index a5ff250dba..3c19b17244 100644 --- a/Userland/Applications/Piano/MainWidget.cpp +++ b/Userland/Applications/Piano/MainWidget.cpp @@ -55,11 +55,11 @@ MainWidget::MainWidget(TrackManager& track_manager, AudioPlayerLoop& loop) void MainWidget::add_track_actions(GUI::Menu& menu) { - menu.add_action(GUI::Action::create("&Add Track", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + menu.add_action(GUI::Action::create("&Add Track", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_player_widget->add_track(); })); - menu.add_action(GUI::Action::create("&Next Track", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + menu.add_action(GUI::Action::create("&Next Track", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { turn_off_pressed_keys(); m_player_widget->next_track(); turn_on_pressed_keys(); diff --git a/Userland/Applications/Piano/Music.h b/Userland/Applications/Piano/Music.h index 75dc9b9ada..e1f632ab9d 100644 --- a/Userland/Applications/Piano/Music.h +++ b/Userland/Applications/Piano/Music.h @@ -155,19 +155,19 @@ constexpr int beats_per_bar = 4; constexpr int notes_per_beat = 4; constexpr int roll_length = (sample_rate / (beats_per_minute / 60)) * beats_per_bar; -constexpr char const* note_names[] = { - "C", - "C#", - "D", - "D#", - "E", - "F", - "F#", - "G", - "G#", - "A", - "A#", - "B", +constexpr StringView note_names[] = { + "C"sv, + "C#"sv, + "D"sv, + "D#"sv, + "E"sv, + "F"sv, + "F#"sv, + "G"sv, + "G#"sv, + "A"sv, + "A#"sv, + "B"sv, }; // Equal temperament, A = 440Hz diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp index 3737a601a6..9084435ce0 100644 --- a/Userland/Applications/Piano/PlayerWidget.cpp +++ b/Userland/Applications/Piano/PlayerWidget.cpp @@ -24,12 +24,12 @@ PlayerWidget::PlayerWidget(TrackManager& manager, AudioPlayerLoop& loop) set_fill_with_background_color(true); m_track_number_choices.append("1"); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); // Go back a note - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); // Advance a note - m_add_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png").release_value_but_fixme_should_propagate_errors(); - m_next_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png").release_value_but_fixme_should_propagate_errors(); + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(); // Go back a note + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(); // Advance a note + m_add_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors(); + m_next_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors(); RefPtr<GUI::Label> label = add<GUI::Label>("Track"); label->set_max_width(75); diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp index 16a20d8cab..3756acaf4a 100644 --- a/Userland/Applications/Piano/RollWidget.cpp +++ b/Userland/Applications/Piano/RollWidget.cpp @@ -152,7 +152,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event) } Gfx::IntRect note_name_rect(3, y, 1, note_height); - char const* note_name = note_names[note % notes_per_octave]; + auto note_name = note_names[note % notes_per_octave]; painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft); note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0); diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp index 220ed553f5..372558cd53 100644 --- a/Userland/Applications/Piano/SamplerWidget.cpp +++ b/Userland/Applications/Piano/SamplerWidget.cpp @@ -81,7 +81,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::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors()); + m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors()); 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/Piano/main.cpp b/Userland/Applications/Piano/main.cpp index 6d3ab24b2e..ab1f33319e 100644 --- a/Userland/Applications/Piano/main.cpp +++ b/Userland/Applications/Piano/main.cpp @@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto audio_loop = AudioPlayerLoop::construct(track_manager, need_to_write_wav, wav_writer); - auto app_icon = GUI::Icon::default_icon("app-piano"); + auto app_icon = GUI::Icon::default_icon("app-piano"sv); auto window = GUI::Window::construct(); auto main_widget = TRY(window->try_set_main_widget<MainWidget>(track_manager, audio_loop)); window->set_title("Piano"); @@ -51,13 +51,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) main_widget_updater->start(); auto& file_menu = window->add_menu("&File"); - file_menu.add_action(GUI::Action::create("Export", { Mod_Ctrl, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png")), [&](const GUI::Action&) { + file_menu.add_action(GUI::Action::create("Export", { Mod_Ctrl, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png"sv)), [&](const GUI::Action&) { save_path = GUI::FilePicker::get_save_filepath(window, "Untitled", "wav"); if (!save_path.has_value()) return; wav_writer.set_file(save_path.value()); if (wav_writer.has_error()) { - GUI::MessageBox::show(window, String::formatted("Failed to export WAV file: {}", wav_writer.error_string()), "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, String::formatted("Failed to export WAV file: {}", wav_writer.error_string()), "Error"sv, GUI::MessageBox::Type::Error); wav_writer.clear_error(); return; } diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index a29d8935c0..56f9c44dc6 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -34,7 +34,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) m_name_textbox->on_change = [this] { m_image_name = m_name_textbox->text(); }; - auto default_name = Config::read_string("PixelPaint", "NewImage", "Name"); + auto default_name = Config::read_string("PixelPaint"sv, "NewImage"sv, "Name"sv); m_name_textbox->set_text(default_name); auto& width_label = main_widget.add<GUI::Label>("Width:"); @@ -72,8 +72,8 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) width_spinbox.set_range(1, 16384); height_spinbox.set_range(1, 16384); - auto default_width = Config::read_i32("PixelPaint", "NewImage", "Width", 510); - auto default_height = Config::read_i32("PixelPaint", "NewImage", "Height", 356); + auto default_width = Config::read_i32("PixelPaint"sv, "NewImage"sv, "Width"sv, 510); + auto default_height = Config::read_i32("PixelPaint"sv, "NewImage"sv, "Height"sv, 356); width_spinbox.set_value(default_width); height_spinbox.set_value(default_height); } diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index a681c21015..89f41220bb 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -30,7 +30,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); m_name_textbox = main_widget.add<GUI::TextBox>(); - m_name_textbox->set_text("Layer"); + m_name_textbox->set_text("Layer"sv); m_name_textbox->select_all(); m_name_textbox->on_change = [this] { m_layer_name = m_name_textbox->text(); diff --git a/Userland/Applications/PixelPaint/FilterParams.h b/Userland/Applications/PixelPaint/FilterParams.h index dcbda9220e..57d602ff88 100644 --- a/Userland/Applications/PixelPaint/FilterParams.h +++ b/Userland/Applications/PixelPaint/FilterParams.h @@ -44,7 +44,7 @@ private: // FIXME: Help! Make this GUI less ugly. StringBuilder builder; builder.appendff("{}x{}", N, N); - builder.append(" Convolution"); + builder.append(" Convolution"sv); set_title(builder.string_view()); resize(200, 250); @@ -73,7 +73,7 @@ private: if (endptr != nullptr) element = value; else - textbox.set_text(""); + textbox.set_text(""sv); }; } else { horizontal_container.template add<GUI::Widget>(); diff --git a/Userland/Applications/PixelPaint/FilterTreeModel.cpp b/Userland/Applications/PixelPaint/FilterTreeModel.cpp index cdfc24bf1c..07133f1e83 100644 --- a/Userland/Applications/PixelPaint/FilterTreeModel.cpp +++ b/Userland/Applications/PixelPaint/FilterTreeModel.cpp @@ -26,7 +26,7 @@ namespace PixelPaint { ErrorOr<NonnullRefPtr<GUI::TreeViewModel>> create_filter_tree_model(ImageEditor* editor) { auto directory_icon = GUI::FileIconProvider::directory_icon(); - auto filter_icon = GUI::Icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"))); + auto filter_icon = GUI::Icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv))); auto filter_tree_model = GUI::TreeViewModel::create(); diff --git a/Userland/Applications/PixelPaint/IconBag.cpp b/Userland/Applications/PixelPaint/IconBag.cpp index ec0d45f1cd..0cd63b08d4 100644 --- a/Userland/Applications/PixelPaint/IconBag.cpp +++ b/Userland/Applications/PixelPaint/IconBag.cpp @@ -12,35 +12,35 @@ ErrorOr<IconBag> IconBag::try_create() { IconBag icon_bag; - icon_bag.filetype_pixelpaint = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-pixelpaint.png")); - icon_bag.new_clipboard = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/new-clipboard.png")); - icon_bag.file_export = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png")); - icon_bag.close_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png")); - icon_bag.edit_copy = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png")); - icon_bag.clear_selection = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/clear-selection.png")); - icon_bag.swap_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/swap-colors.png")); - icon_bag.default_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/default-colors.png")); - icon_bag.load_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/load-color-palette.png")); - icon_bag.save_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/save-color-palette.png")); - icon_bag.add_guide = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-guide.png")); - icon_bag.clear_guides = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/clear-guides.png")); - icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png")); - icon_bag.edit_flip_horizontal = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png")); - icon_bag.resize_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png")); - icon_bag.crop = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/crop.png")); - icon_bag.new_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-layer.png")); - icon_bag.previous_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/previous-layer.png")); - icon_bag.next_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/next-layer.png")); - icon_bag.top_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/top-layer.png")); - icon_bag.bottom_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bottom-layer.png")); - icon_bag.active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-up.png")); - icon_bag.active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-down.png")); - icon_bag.delete_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png")); - icon_bag.merge_visible = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-visible.png")); - icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png")); - icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png")); - icon_bag.filter = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png")); - icon_bag.levels = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/levels.png")); + icon_bag.filetype_pixelpaint = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-pixelpaint.png"sv)); + icon_bag.new_clipboard = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/new-clipboard.png"sv)); + icon_bag.file_export = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png"sv)); + icon_bag.close_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"sv)); + icon_bag.edit_copy = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv)); + icon_bag.clear_selection = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/clear-selection.png"sv)); + icon_bag.swap_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/swap-colors.png"sv)); + icon_bag.default_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/default-colors.png"sv)); + icon_bag.load_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/load-color-palette.png"sv)); + icon_bag.save_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/save-color-palette.png"sv)); + icon_bag.add_guide = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-guide.png"sv)); + icon_bag.clear_guides = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/clear-guides.png"sv)); + icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)); + icon_bag.edit_flip_horizontal = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)); + icon_bag.resize_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png"sv)); + icon_bag.crop = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/crop.png"sv)); + icon_bag.new_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-layer.png"sv)); + icon_bag.previous_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/previous-layer.png"sv)); + icon_bag.next_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/next-layer.png"sv)); + icon_bag.top_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/top-layer.png"sv)); + icon_bag.bottom_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bottom-layer.png"sv)); + icon_bag.active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-up.png"sv)); + icon_bag.active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-down.png"sv)); + icon_bag.delete_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv)); + icon_bag.merge_visible = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-visible.png"sv)); + icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png"sv)); + icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png"sv)); + icon_bag.filter = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv)); + icon_bag.levels = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/levels.png"sv)); return icon_bag; } diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index 07cb6200b8..ac616c3968 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -85,37 +85,37 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_bitmap(NonnullRefPtr<Gfx::B ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_pixel_paint_json(JsonObject const& json) { - auto image = TRY(try_create_with_size({ json.get("width").to_i32(), json.get("height").to_i32() })); + auto image = TRY(try_create_with_size({ json.get("width"sv).to_i32(), json.get("height"sv).to_i32() })); - auto layers_value = json.get("layers"); + auto layers_value = json.get("layers"sv); for (auto& layer_value : layers_value.as_array().values()) { auto& layer_object = layer_value.as_object(); - auto name = layer_object.get("name").as_string(); + auto name = layer_object.get("name"sv).as_string(); - auto bitmap_base64_encoded = layer_object.get("bitmap").as_string(); + auto bitmap_base64_encoded = layer_object.get("bitmap"sv).as_string(); auto bitmap_data = TRY(decode_base64(bitmap_base64_encoded)); auto bitmap = TRY(try_decode_bitmap(bitmap_data)); auto layer = TRY(Layer::try_create_with_bitmap(*image, move(bitmap), name)); - if (auto mask_object = layer_object.get("mask"); !mask_object.is_null()) { + if (auto mask_object = layer_object.get("mask"sv); !mask_object.is_null()) { auto mask_base64_encoded = mask_object.as_string(); auto mask_data = TRY(decode_base64(mask_base64_encoded)); auto mask = TRY(try_decode_bitmap(mask_data)); TRY(layer->try_set_bitmaps(layer->content_bitmap(), mask)); } - auto width = layer_object.get("width").to_i32(); - auto height = layer_object.get("height").to_i32(); + auto width = layer_object.get("width"sv).to_i32(); + auto height = layer_object.get("height"sv).to_i32(); if (width != layer->size().width() || height != layer->size().height()) return Error::from_string_literal("Decoded layer bitmap has wrong size"); image->add_layer(*layer); - layer->set_location({ layer_object.get("locationx").to_i32(), layer_object.get("locationy").to_i32() }); - layer->set_opacity_percent(layer_object.get("opacity_percent").to_i32()); - layer->set_visible(layer_object.get("visible").as_bool()); - layer->set_selected(layer_object.get("selected").as_bool()); + layer->set_location({ layer_object.get("locationx"sv).to_i32(), layer_object.get("locationy"sv).to_i32() }); + layer->set_opacity_percent(layer_object.get("opacity_percent"sv).to_i32()); + layer->set_visible(layer_object.get("visible"sv).as_bool()); + layer->set_selected(layer_object.get("selected"sv).as_bool()); } return image; @@ -123,24 +123,24 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_pixel_paint_json(JsonObject void Image::serialize_as_json(JsonObjectSerializer<StringBuilder>& json) const { - MUST(json.add("width", m_size.width())); - MUST(json.add("height", m_size.height())); + MUST(json.add("width"sv, m_size.width())); + MUST(json.add("height"sv, m_size.height())); { - auto json_layers = MUST(json.add_array("layers")); + auto json_layers = MUST(json.add_array("layers"sv)); for (auto const& layer : m_layers) { Gfx::BMPWriter bmp_writer; auto json_layer = MUST(json_layers.add_object()); - MUST(json_layer.add("width", layer.size().width())); - MUST(json_layer.add("height", layer.size().height())); - MUST(json_layer.add("name", layer.name())); - MUST(json_layer.add("locationx", layer.location().x())); - MUST(json_layer.add("locationy", layer.location().y())); - MUST(json_layer.add("opacity_percent", layer.opacity_percent())); - MUST(json_layer.add("visible", layer.is_visible())); - MUST(json_layer.add("selected", layer.is_selected())); - MUST(json_layer.add("bitmap", encode_base64(bmp_writer.dump(layer.content_bitmap())))); + MUST(json_layer.add("width"sv, layer.size().width())); + MUST(json_layer.add("height"sv, layer.size().height())); + MUST(json_layer.add("name"sv, layer.name())); + MUST(json_layer.add("locationx"sv, layer.location().x())); + MUST(json_layer.add("locationy"sv, layer.location().y())); + MUST(json_layer.add("opacity_percent"sv, layer.opacity_percent())); + MUST(json_layer.add("visible"sv, layer.is_visible())); + MUST(json_layer.add("selected"sv, layer.is_selected())); + MUST(json_layer.add("bitmap"sv, encode_base64(bmp_writer.dump(layer.content_bitmap())))); if (layer.is_masked()) - MUST(json_layer.add("mask", encode_base64(bmp_writer.dump(*layer.mask_bitmap())))); + MUST(json_layer.add("mask"sv, encode_base64(bmp_writer.dump(*layer.mask_bitmap())))); MUST(json_layer.finish()); } diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 8a3ffb26d9..2a3e54b7c0 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -36,11 +36,11 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image) set_original_rect(m_image->rect()); set_scale_bounds(0.1f, 100.0f); - m_pixel_grid_threshold = (float)Config::read_i32("PixelPaint", "PixelGrid", "Threshold", 15); - m_show_pixel_grid = Config::read_bool("PixelPaint", "PixelGrid", "Show", true); + m_pixel_grid_threshold = (float)Config::read_i32("PixelPaint"sv, "PixelGrid"sv, "Threshold"sv, 15); + m_show_pixel_grid = Config::read_bool("PixelPaint"sv, "PixelGrid"sv, "Show"sv, true); - m_show_rulers = Config::read_bool("PixelPaint", "Rulers", "Show", true); - m_show_guides = Config::read_bool("PixelPaint", "Guides", "Show", true); + m_show_rulers = Config::read_bool("PixelPaint"sv, "Rulers"sv, "Show"sv, true); + m_show_guides = Config::read_bool("PixelPaint"sv, "Guides"sv, "Show"sv, true); } ImageEditor::~ImageEditor() @@ -618,14 +618,14 @@ Result<void, String> ImageEditor::save_project_to_file(Core::File& file) const StringBuilder builder; auto json = MUST(JsonObjectSerializer<>::try_create(builder)); m_image->serialize_as_json(json); - auto json_guides = MUST(json.add_array("guides")); + auto json_guides = MUST(json.add_array("guides"sv)); for (auto const& guide : m_guides) { auto json_guide = MUST(json_guides.add_object()); MUST(json_guide.add("offset"sv, (double)guide.offset())); if (guide.orientation() == Guide::Orientation::Vertical) - MUST(json_guide.add("orientation", "vertical")); + MUST(json_guide.add("orientation"sv, "vertical")); else if (guide.orientation() == Guide::Orientation::Horizontal) - MUST(json_guide.add("orientation", "horizontal")); + MUST(json_guide.add("orientation"sv, "horizontal")); MUST(json_guide.finish()); } MUST(json_guides.finish()); diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp index af03fd7530..1ad8a5329b 100644 --- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp @@ -23,7 +23,7 @@ LayerPropertiesWidget::LayerPropertiesWidget() { set_layout<GUI::VerticalBoxLayout>(); - auto& group_box = add<GUI::GroupBox>("Layer properties"); + auto& group_box = add<GUI::GroupBox>("Layer properties"sv); auto& layout = group_box.set_layout<GUI::VerticalBoxLayout>(); layout.set_margins({ 8 }); diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index bea5d9e631..b1fe758fe2 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -174,7 +174,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto response = FileSystemAccessClient::Client::the().try_save_file(&window, "untitled", "bmp"); if (response.is_error()) return; - auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) GUI::MessageBox::show_error(&window, String::formatted("Export to BMP failed: {}", result.error())); @@ -189,7 +189,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto response = FileSystemAccessClient::Client::the().try_save_file(&window, "untitled", "png"); if (response.is_error()) return; - auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) GUI::MessageBox::show_error(&window, String::formatted("Export to PNG failed: {}", result.error())); @@ -407,12 +407,12 @@ void MainWidget::initialize_menubar(GUI::Window& window) // Save this so other methods can use it m_show_guides_action = GUI::Action::create_checkable( "Show &Guides", [&](auto& action) { - Config::write_bool("PixelPaint", "Guides", "Show", action.is_checked()); + Config::write_bool("PixelPaint"sv, "Guides"sv, "Show"sv, action.is_checked()); auto* editor = current_image_editor(); VERIFY(editor); editor->set_guide_visibility(action.is_checked()); }); - m_show_guides_action->set_checked(Config::read_bool("PixelPaint", "Guides", "Show", true)); + m_show_guides_action->set_checked(Config::read_bool("PixelPaint"sv, "Guides"sv, "Show"sv, true)); m_view_menu->add_action(*m_zoom_in_action); m_view_menu->add_action(*m_zoom_out_action); @@ -437,32 +437,32 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto show_pixel_grid_action = GUI::Action::create_checkable( "Show &Pixel Grid", [&](auto& action) { - Config::write_bool("PixelPaint", "PixelGrid", "Show", action.is_checked()); + Config::write_bool("PixelPaint"sv, "PixelGrid"sv, "Show"sv, action.is_checked()); auto* editor = current_image_editor(); VERIFY(editor); editor->set_pixel_grid_visibility(action.is_checked()); }); - show_pixel_grid_action->set_checked(Config::read_bool("PixelPaint", "PixelGrid", "Show", true)); + show_pixel_grid_action->set_checked(Config::read_bool("PixelPaint"sv, "PixelGrid"sv, "Show"sv, true)); m_view_menu->add_action(*show_pixel_grid_action); m_show_rulers_action = GUI::Action::create_checkable( "Show R&ulers", { Mod_Ctrl, Key_R }, [&](auto& action) { - Config::write_bool("PixelPaint", "Rulers", "Show", action.is_checked()); + Config::write_bool("PixelPaint"sv, "Rulers"sv, "Show"sv, action.is_checked()); auto* editor = current_image_editor(); VERIFY(editor); editor->set_ruler_visibility(action.is_checked()); }); - m_show_rulers_action->set_checked(Config::read_bool("PixelPaint", "Rulers", "Show", true)); + m_show_rulers_action->set_checked(Config::read_bool("PixelPaint"sv, "Rulers"sv, "Show"sv, true)); m_view_menu->add_action(*m_show_rulers_action); m_show_active_layer_boundary_action = GUI::Action::create_checkable( "Show Active Layer &Boundary", [&](auto& action) { - Config::write_bool("PixelPaint", "ImageEditor", "ShowActiveLayerBoundary", action.is_checked()); + Config::write_bool("PixelPaint"sv, "ImageEditor"sv, "ShowActiveLayerBoundary"sv, action.is_checked()); auto* editor = current_image_editor(); VERIFY(editor); editor->set_show_active_layer_boundary(action.is_checked()); }); - m_show_active_layer_boundary_action->set_checked(Config::read_bool("PixelPaint", "ImageEditor", "ShowActiveLayerBoundary", true)); + m_show_active_layer_boundary_action->set_checked(Config::read_bool("PixelPaint"sv, "ImageEditor"sv, "ShowActiveLayerBoundary"sv, true)); m_view_menu->add_action(*m_show_active_layer_boundary_action); m_tool_menu = window.add_menu("&Tool"); @@ -700,7 +700,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) })); auto& help_menu = window.add_menu("&Help"); - help_menu.add_action(GUI::CommonActions::make_about_action("Pixel Paint", GUI::Icon::default_icon("app-pixel-paint"), &window)); + help_menu.add_action(GUI::CommonActions::make_about_action("Pixel Paint", GUI::Icon::default_icon("app-pixel-paint"sv), &window)); m_levels_dialog_action = GUI::Action::create( "Change &Levels...", { Mod_Ctrl, Key_L }, g_icon_bag.levels, [&](auto&) { @@ -825,7 +825,7 @@ void MainWidget::create_image_from_clipboard() { auto bitmap = GUI::Clipboard::the().fetch_data_and_type().as_bitmap(); if (!bitmap) { - GUI::MessageBox::show(window(), "There is no image in a clipboard to paste.", "PixelPaint", GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), "There is no image in a clipboard to paste."sv, "PixelPaint"sv, GUI::MessageBox::Type::Warning); return; } diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp index bb5a7702df..955430a7b7 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.cpp +++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp @@ -264,7 +264,7 @@ Result<void, String> PaletteWidget::save_palette_file(Vector<Color> palette, Cor { for (auto& color : palette) { file.write(color.to_string_without_alpha()); - file.write("\n"); + file.write("\n"sv); } return {}; } diff --git a/Userland/Applications/PixelPaint/ProjectLoader.cpp b/Userland/Applications/PixelPaint/ProjectLoader.cpp index 8cb03deebd..3356abbd13 100644 --- a/Userland/Applications/PixelPaint/ProjectLoader.cpp +++ b/Userland/Applications/PixelPaint/ProjectLoader.cpp @@ -35,8 +35,8 @@ ErrorOr<void> ProjectLoader::try_load_from_file(Core::File& file) auto& json = json_or_error.value().as_object(); auto image = TRY(Image::try_create_from_pixel_paint_json(json)); - if (json.has("guides")) - m_json_metadata = json.get("guides").as_array(); + if (json.has("guides"sv)) + m_json_metadata = json.get("guides"sv).as_array(); m_image = image; return {}; diff --git a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp index 1353bf91b0..e69a3f4bb8 100644 --- a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp @@ -18,7 +18,7 @@ ToolPropertiesWidget::ToolPropertiesWidget() { set_layout<GUI::VerticalBoxLayout>(); - m_group_box = add<GUI::GroupBox>("Tool properties"); + m_group_box = add<GUI::GroupBox>("Tool properties"sv); auto& layout = m_group_box->set_layout<GUI::VerticalBoxLayout>(); layout.set_margins({ 8 }); m_tool_widget_stack = m_group_box->add<GUI::StackWidget>(); diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index 7cb2e6e0d5..d1cc9a599d 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -68,20 +68,20 @@ void ToolboxWidget::setup_tools() m_tools.append(move(tool)); }; - add_tool("Move", "move", { 0, Key_M }, make<MoveTool>()); - add_tool("Pen", "pen", { 0, Key_N }, make<PenTool>()); - add_tool("Brush", "brush", { 0, Key_P }, make<BrushTool>()); - add_tool("Bucket Fill", "bucket", { Mod_Shift, Key_B }, make<BucketTool>()); - add_tool("Spray", "spray", { Mod_Shift, Key_S }, make<SprayTool>()); - add_tool("Color Picker", "picker", { 0, Key_O }, make<PickerTool>()); - add_tool("Erase", "eraser", { Mod_Shift, Key_E }, make<EraseTool>()); - add_tool("Line", "line", { Mod_Ctrl | Mod_Shift, Key_L }, make<LineTool>()); - add_tool("Rectangle", "rectangle", { Mod_Ctrl | Mod_Shift, Key_R }, make<RectangleTool>()); - add_tool("Ellipse", "circle", { Mod_Ctrl | Mod_Shift, Key_E }, make<EllipseTool>()); - add_tool("Zoom", "zoom", { 0, Key_Z }, make<ZoomTool>()); - add_tool("Rectangle Select", "rectangle-select", { 0, Key_R }, make<RectangleSelectTool>()); - add_tool("Guides", "guides", { 0, Key_G }, make<GuideTool>()); - add_tool("Clone Tool", "clone", { 0, Key_C }, make<CloneTool>()); + add_tool("Move", "move"sv, { 0, Key_M }, make<MoveTool>()); + add_tool("Pen", "pen"sv, { 0, Key_N }, make<PenTool>()); + add_tool("Brush", "brush"sv, { 0, Key_P }, make<BrushTool>()); + add_tool("Bucket Fill", "bucket"sv, { Mod_Shift, Key_B }, make<BucketTool>()); + add_tool("Spray", "spray"sv, { Mod_Shift, Key_S }, make<SprayTool>()); + add_tool("Color Picker", "picker"sv, { 0, Key_O }, make<PickerTool>()); + add_tool("Erase", "eraser"sv, { Mod_Shift, Key_E }, make<EraseTool>()); + add_tool("Line", "line"sv, { Mod_Ctrl | Mod_Shift, Key_L }, make<LineTool>()); + add_tool("Rectangle", "rectangle"sv, { Mod_Ctrl | Mod_Shift, Key_R }, make<RectangleTool>()); + add_tool("Ellipse", "circle"sv, { Mod_Ctrl | Mod_Shift, Key_E }, make<EllipseTool>()); + add_tool("Zoom", "zoom"sv, { 0, Key_Z }, make<ZoomTool>()); + add_tool("Rectangle Select", "rectangle-select"sv, { 0, Key_R }, make<RectangleSelectTool>()); + add_tool("Guides", "guides"sv, { 0, Key_G }, make<GuideTool>()); + add_tool("Clone Tool", "clone"sv, { 0, Key_C }, make<CloneTool>()); } } diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp index a22c814706..3483c4f60c 100644 --- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp @@ -22,7 +22,7 @@ namespace PixelPaint { BucketTool::BucketTool() { - m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png").release_value_but_fixme_should_propagate_errors(); + m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors(); } static float color_distance_squared(Gfx::Color const& lhs, Gfx::Color const& rhs) diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index daa86434c4..5ec08bd599 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -135,7 +135,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) if (!m_context_menu) { m_context_menu = GUI::Menu::construct(); m_context_menu->add_action(GUI::Action::create( - "Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { + "Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (!m_context_menu_guide) return; auto dialog = EditGuideDialog::construct( @@ -153,7 +153,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) }, editor())); m_context_menu->add_action(GUI::Action::create( - "&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { + "&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (!m_context_menu_guide) return; editor()->remove_guide(*m_context_menu_guide); diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index 47cf207c3f..fffe3a79ab 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-pixel-paint"); + auto app_icon = GUI::Icon::default_icon("app-pixel-paint"sv); PixelPaint::g_icon_bag = TRY(PixelPaint::IconBag::try_create()); diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index 3c551b0f2f..20c97e80c7 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -31,7 +31,7 @@ RunWindow::RunWindow() { load_history(); - auto app_icon = GUI::Icon::default_icon("app-run"); + auto app_icon = GUI::Icon::default_icon("app-run"sv); set_title("Run"); set_icon(app_icon.bitmap_for_size(16)); @@ -101,7 +101,7 @@ void RunWindow::do_run() return; } - GUI::MessageBox::show_error(this, "Failed to run. Please check your command, path, or address, and try again."); + GUI::MessageBox::show_error(this, "Failed to run. Please check your command, path, or address, and try again."sv); show(); } diff --git a/Userland/Applications/Settings/main.cpp b/Userland/Applications/Settings/main.cpp index 74368deef9..9f3acbac66 100644 --- a/Userland/Applications/Settings/main.cpp +++ b/Userland/Applications/Settings/main.cpp @@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath proc exec")); - auto app_icon = GUI::Icon::default_icon("app-settings"); + auto app_icon = GUI::Icon::default_icon("app-settings"sv); auto window = TRY(GUI::Window::try_create()); window->set_title("Settings"); diff --git a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp index 888c555257..ceb468e6cd 100644 --- a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp @@ -30,7 +30,7 @@ void AlbumCoverVisualizationWidget::paint_event(GUI::PaintEvent& event) painter.draw_scaled_bitmap(fitted_rect, *m_album_cover, m_album_cover->rect(), 1.0f); } else { if (!m_serenity_bg) - m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png").release_value_but_fixme_should_propagate_errors(); + m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png"sv).release_value_but_fixme_should_propagate_errors(); painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f); } } diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp index 8454d03781..a09a40caa5 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.cpp +++ b/Userland/Applications/SoundPlayer/M3UParser.cpp @@ -20,7 +20,7 @@ NonnullOwnPtr<M3UParser> M3UParser::from_file(const String path) auto file_result = Core::File::open(path, Core::OpenMode::ReadOnly); VERIFY(!file_result.is_error()); auto contents = file_result.value()->read_all(); - auto use_utf8 = path.ends_with(".m3u8", CaseSensitivity::CaseInsensitive); + auto use_utf8 = path.ends_with(".m3u8"sv, CaseSensitivity::CaseInsensitive); return from_memory(String { contents, NoChomp }, use_utf8); } @@ -66,7 +66,7 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info) return {}; }; - if (auto ext_inf = tag("#EXTINF:"); ext_inf.has_value()) { + if (auto ext_inf = tag("#EXTINF:"sv); ext_inf.has_value()) { auto separator = ext_inf.value().find(','); VERIFY(separator.has_value()); auto seconds = ext_inf.value().substring_view(0, separator.value()); @@ -78,15 +78,15 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info) // TODO: support the alternative, non-standard #EXTINF value of a key=value dictionary continue; } - if (auto playlist = tag("#PLAYLIST:"); playlist.has_value()) + if (auto playlist = tag("#PLAYLIST:"sv); playlist.has_value()) m_parsed_playlist_title = move(playlist.value()); - else if (auto ext_grp = tag("#EXTGRP:"); ext_grp.has_value()) + else if (auto ext_grp = tag("#EXTGRP:"sv); ext_grp.has_value()) metadata_for_next_file.group_name = move(ext_grp.value()); - else if (auto ext_alb = tag("#EXTALB:"); ext_alb.has_value()) + else if (auto ext_alb = tag("#EXTALB:"sv); ext_alb.has_value()) metadata_for_next_file.album_title = move(ext_alb.value()); - else if (auto ext_art = tag("#EXTART:"); ext_art.has_value()) + else if (auto ext_art = tag("#EXTART:"sv); ext_art.has_value()) metadata_for_next_file.album_artist = move(ext_art.value()); - else if (auto ext_genre = tag("#EXTGENRE:"); ext_genre.has_value()) + else if (auto ext_genre = tag("#EXTGENRE:"sv); ext_genre.has_value()) metadata_for_next_file.album_genre = move(ext_genre.value()); // TODO: Support M3A files (M3U files with embedded mp3 files) } diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index 30dee3becb..384626ac5b 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -44,7 +44,7 @@ void Player::play_file_path(String const& path) return; if (!Core::File::exists(path)) { - audio_load_error(path, "File does not exist"); + audio_load_error(path, "File does not exist"sv); return; } @@ -71,8 +71,8 @@ void Player::play_file_path(String const& path) bool Player::is_playlist(String const& path) { - return (path.ends_with(".m3u", AK::CaseSensitivity::CaseInsensitive) - || path.ends_with(".m3u8", AK::CaseSensitivity::CaseInsensitive)); + return (path.ends_with(".m3u"sv, AK::CaseSensitivity::CaseInsensitive) + || path.ends_with(".m3u8"sv, AK::CaseSensitivity::CaseInsensitive)); } void Player::set_play_state(PlayState state) diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index bef376a83b..1bd46f0366 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -43,11 +43,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window m_player_view->set_layout<GUI::VerticalBoxLayout>(); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); - m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png").release_value_but_fixme_should_propagate_errors(); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors(); + m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png"sv).release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(); + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(); m_visualization = m_player_view->add<BarsVisualizationWidget>(); @@ -224,7 +224,7 @@ void SoundPlayerWidgetAdvancedView::volume_changed(double volume) void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded) { if (!loaded) { - GUI::MessageBox::show(&m_window, String::formatted("Could not load playlist at \"{}\".", path), "Error opening playlist", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(&m_window, String::formatted("Could not load playlist at \"{}\".", path), "Error opening playlist"sv, GUI::MessageBox::Type::Error); return; } set_playlist_visible(true); @@ -233,6 +233,6 @@ void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded void SoundPlayerWidgetAdvancedView::audio_load_error(StringView path, StringView error_string) { - GUI::MessageBox::show(&m_window, String::formatted("Failed to load audio file: {} ({})", path, error_string.is_null() ? "Unknown error" : error_string), - "Filetype error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(&m_window, String::formatted("Failed to load audio file: {} ({})", path, error_string.is_null() ? "Unknown error"sv : error_string), + "Filetype error"sv, GUI::MessageBox::Type::Error); } diff --git a/Userland/Applications/SoundPlayer/main.cpp b/Userland/Applications/SoundPlayer/main.cpp index 8ff1a76621..42918d8584 100644 --- a/Userland/Applications/SoundPlayer/main.cpp +++ b/Userland/Applications/SoundPlayer/main.cpp @@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd rpath thread")); - auto app_icon = GUI::Icon::default_icon("app-sound-player"); + auto app_icon = GUI::Icon::default_icon("app-sound-player"sv); auto window = TRY(GUI::Window::try_create()); window->set_title("Sound Player"); diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 62ff16025b..b7909ff5be 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -30,7 +30,7 @@ #include <sys/stat.h> #include <unistd.h> -static constexpr StringView APP_NAME = "Space Analyzer"; +static constexpr auto APP_NAME = "Space Analyzer"sv; static constexpr size_t FILES_ENCOUNTERED_UPDATE_STEP_SIZE = 25; struct TreeNode : public SpaceAnalyzer::TreeMapNode { @@ -88,11 +88,11 @@ static void fill_mounts(Vector<MountInfo>& output) auto content = file->read_all(); auto json = JsonValue::from_string(content).release_value_but_fixme_should_propagate_errors(); - json.as_array().for_each([&output](auto& value) { + json.as_array().for_each([&output](JsonValue const& value) { auto& filesystem_object = value.as_object(); MountInfo mount_info; - mount_info.mount_point = filesystem_object.get("mount_point").to_string(); - mount_info.source = filesystem_object.get("source").as_string_or("none"); + mount_info.mount_point = filesystem_object.get("mount_point"sv).to_string(); + mount_info.source = filesystem_object.get("source"sv).as_string_or("none"sv); output.append(mount_info); }); } @@ -254,20 +254,20 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg if (!error_accumulator.is_empty()) { StringBuilder builder; bool first = true; - builder.append("Some directories were not analyzed: "); + builder.append("Some directories were not analyzed: "sv); for (auto& key : error_accumulator.keys()) { if (!first) { - builder.append(", "); + builder.append(", "sv); } auto const* error = strerror(key); builder.append({ error, strlen(error) }); - builder.append(" ("); + builder.append(" ("sv); int value = error_accumulator.get(key).value(); builder.append(String::number(value)); if (value == 1) { - builder.append(" time"); + builder.append(" time"sv); } else { - builder.append(" times"); + builder.append(" times"sv); } builder.append(")"); first = false; @@ -308,7 +308,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) RefPtr<Tree> tree = adopt_ref(*new Tree("")); // Configure application window. - auto app_icon = GUI::Icon::default_icon("app-space-analyzer"); + auto app_icon = GUI::Icon::default_icon("app-space-analyzer"sv); auto window = GUI::Window::construct(); window->set_title(APP_NAME); window->resize(640, 480); @@ -336,14 +336,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) help_menu.add_action(GUI::CommonActions::make_about_action(APP_NAME, app_icon, window)); // Configure the nodes context menu. - auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](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::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), [&](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"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { GUI::Clipboard::the().set_plain_text(get_absolute_path_to_selected_node(treemapwidget)); }); auto delete_action = GUI::CommonActions::make_delete_action([&](auto&) { @@ -358,7 +358,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) String::formatted("Failed to delete \"{}\": {}. Retry?", deletion_result.error().file, static_cast<Error const&>(deletion_result.error())), - "Deletion failed", + "Deletion failed"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); if (retry_message_result == GUI::MessageBox::ExecResult::Yes) { @@ -367,7 +367,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } else { GUI::MessageBox::show(window, String::formatted("Successfully deleted \"{}\".", selected_node_path), - "Deletion completed", + "Deletion completed"sv, GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::OK); } diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index ae49b1b1a5..1a0d6cabae 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -74,10 +74,10 @@ CellType const& Cell::type() const if (m_kind == LiteralString) { if (m_data.to_int().has_value()) - return *CellType::get_by_name("Numeric"); + return *CellType::get_by_name("Numeric"sv); } - return *CellType::get_by_name("Identity"); + return *CellType::get_by_name("Identity"sv); } JS::ThrowCompletionOr<String> Cell::typed_display() const diff --git a/Userland/Applications/Spreadsheet/CellType/Date.cpp b/Userland/Applications/Spreadsheet/CellType/Date.cpp index 9810f162d9..f74a5d5a1b 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Date.cpp @@ -13,7 +13,7 @@ namespace Spreadsheet { DateCell::DateCell() - : CellType("Date") + : CellType("Date"sv) { } @@ -21,7 +21,7 @@ JS::ThrowCompletionOr<String> DateCell::display(Cell& cell, CellTypeMetadata con { return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<String> { auto timestamp = TRY(js_value(cell, metadata)); - auto string = Core::DateTime::from_timestamp(TRY(timestamp.to_i32(cell.sheet().global_object()))).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S" : metadata.format.characters()); + auto string = Core::DateTime::from_timestamp(TRY(timestamp.to_i32(cell.sheet().global_object()))).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S"sv : metadata.format.view()); if (metadata.length >= 0) return string.substring(0, metadata.length); diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.cpp b/Userland/Applications/Spreadsheet/CellType/Identity.cpp index b44c7c5802..580f7b917a 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Identity.cpp @@ -11,7 +11,7 @@ namespace Spreadsheet { IdentityCell::IdentityCell() - : CellType("Identity") + : CellType("Identity"sv) { } diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp index 483c55d0b4..33bda0507a 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp @@ -13,7 +13,7 @@ namespace Spreadsheet { NumericCell::NumericCell() - : CellType("Numeric") + : CellType("Numeric"sv) { } diff --git a/Userland/Applications/Spreadsheet/CellType/String.cpp b/Userland/Applications/Spreadsheet/CellType/String.cpp index c0707be469..8a066bbfe5 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.cpp +++ b/Userland/Applications/Spreadsheet/CellType/String.cpp @@ -11,7 +11,7 @@ namespace Spreadsheet { StringCell::StringCell() - : CellType("String") + : CellType("String"sv) { } diff --git a/Userland/Applications/Spreadsheet/ExportDialog.cpp b/Userland/Applications/Spreadsheet/ExportDialog.cpp index 502e9be0b2..6f5cd8c8f7 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ExportDialog.cpp @@ -26,7 +26,7 @@ #include <unistd.h> // This is defined in ImportDialog.cpp, we can't include it twice, since the generated symbol is exported. -extern char const select_format_page_gml[]; +extern StringView select_format_page_gml; namespace Spreadsheet { @@ -245,7 +245,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File& { auto wizard = GUI::WizardDialog::construct(GUI::Application::the()->active_window()); wizard->set_title("File Export Wizard"); - wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet").bitmap_for_size(16)); + wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet"sv).bitmap_for_size(16)); auto export_xsv = [&]() -> Result<void, String> { // FIXME: Prompt for the user to select a specific sheet to export @@ -283,7 +283,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File& auto const* error = strerror(error_number); StringBuilder sb; - sb.append("Unable to save file. Error: "); + sb.append("Unable to save file. Error: "sv); sb.append({ error, strlen(error) }); return sb.to_string(); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 6a9f5eb71e..4ee6d5089c 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -65,7 +65,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) { resize(530, 365); set_title("Spreadsheet Functions Help"); - set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png").release_value_but_fixme_should_propagate_errors()); + set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors()); set_accessory(true); auto& widget = set_main_widget<GUI::Widget>(); @@ -93,7 +93,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) auto& doc = doc_option.as_object(); const auto& name = url.fragment(); - auto* example_data_ptr = doc.get_ptr("example_data"); + auto* example_data_ptr = doc.get_ptr("example_data"sv); if (!example_data_ptr || !example_data_ptr->is_object()) { GUI::MessageBox::show_error(this, String::formatted("No example data found for '{}'", url.path())); return; @@ -143,47 +143,47 @@ String HelpWindow::render(StringView key) VERIFY(m_docs.has_object(key)); auto& doc = m_docs.get(key).as_object(); - auto name = doc.get("name").to_string(); - auto argc = doc.get("argc").to_u32(0); - VERIFY(doc.has_array("argnames")); - auto& argnames = doc.get("argnames").as_array(); + auto name = doc.get("name"sv).to_string(); + auto argc = doc.get("argc"sv).to_u32(0); + VERIFY(doc.has_array("argnames"sv)); + auto& argnames = doc.get("argnames"sv).as_array(); - auto docstring = doc.get("doc").to_string(); + auto docstring = doc.get("doc"sv).to_string(); StringBuilder markdown_builder; - markdown_builder.append("# NAME\n`"); + markdown_builder.append("# NAME\n`"sv); markdown_builder.append(name); - markdown_builder.append("`\n\n"); + markdown_builder.append("`\n\n"sv); - markdown_builder.append("# ARGUMENTS\n"); + markdown_builder.append("# ARGUMENTS\n"sv); if (argc > 0) markdown_builder.appendff("{} required argument(s):\n", argc); else - markdown_builder.append("No required arguments.\n"); + markdown_builder.append("No required arguments.\n"sv); for (size_t i = 0; i < argc; ++i) markdown_builder.appendff("- `{}`\n", argnames.at(i).to_string()); if (argc > 0) - markdown_builder.append("\n"); + markdown_builder.append("\n"sv); if ((size_t)argnames.size() > argc) { auto opt_count = argnames.size() - argc; markdown_builder.appendff("{} optional argument(s):\n", opt_count); for (size_t i = argc; i < (size_t)argnames.size(); ++i) markdown_builder.appendff("- `{}`\n", argnames.at(i).to_string()); - markdown_builder.append("\n"); + markdown_builder.append("\n"sv); } - markdown_builder.append("# DESCRIPTION\n"); + markdown_builder.append("# DESCRIPTION\n"sv); markdown_builder.append(docstring); - markdown_builder.append("\n\n"); + markdown_builder.append("\n\n"sv); - if (doc.has("examples")) { - auto& examples = doc.get("examples"); + if (doc.has("examples"sv)) { + auto& examples = doc.get("examples"sv); VERIFY(examples.is_object()); - markdown_builder.append("# EXAMPLES\n"); + markdown_builder.append("# EXAMPLES\n"sv); examples.as_object().for_each_member([&](auto& text, auto& description_value) { dbgln("```js\n{}\n```\n\n- {}\n", text, description_value.to_string()); markdown_builder.appendff("```js\n{}\n```\n\n- {}\n", text, description_value.to_string()); diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp index 3b5c794f65..7382f6f2bd 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp @@ -179,7 +179,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W { auto wizard = GUI::WizardDialog::construct(&parent); wizard->set_title("File Import Wizard"); - wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet").bitmap_for_size(16)); + wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet"sv).bitmap_for_size(16)); auto import_xsv = [&]() -> Result<NonnullRefPtrVector<Sheet>, String> { auto contents = file.read_all(); @@ -212,7 +212,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W auto json_value_option = JsonParser(file.read_all()).parse(); if (json_value_option.is_error()) { StringBuilder sb; - sb.append("Failed to parse "); + sb.append("Failed to parse "sv); sb.append(file.filename()); return sb.to_string(); @@ -221,7 +221,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W auto& json_value = json_value_option.value(); if (!json_value.is_array()) { StringBuilder sb; - sb.append("Did not find a spreadsheet in "); + sb.append("Did not find a spreadsheet in "sv); sb.append(file.filename()); return sb.to_string(); diff --git a/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp b/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp index 0103e4c6c0..82a0df5ab3 100644 --- a/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp +++ b/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp @@ -18,29 +18,29 @@ TEST_CASE(should_parse_valid_data) auto data = R"~~~(Foo, Bar, Baz 1, 2, 3 4, 5, 6 - """x", y"z, 9)~~~"; + """x", y"z, 9)~~~"sv; auto csv = Reader::CSV { data, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders | Reader::ParserBehavior::TrimLeadingFieldSpaces }; csv.parse(); EXPECT(!csv.has_error()); - EXPECT_EQ(csv[0]["Foo"], "1"); - EXPECT_EQ(csv[2]["Foo"], "\"x"); - EXPECT_EQ(csv[2]["Bar"], "y\"z"); + EXPECT_EQ(csv[0]["Foo"sv], "1"sv); + EXPECT_EQ(csv[2]["Foo"sv], "\"x"sv); + EXPECT_EQ(csv[2]["Bar"sv], "y\"z"sv); } { auto data = R"~~~(Foo, Bar, Baz 1 , 2, 3 4, "5 " , 6 - """x", y"z, 9 )~~~"; + """x", y"z, 9 )~~~"sv; auto csv = Reader::CSV { data, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders | Reader::ParserBehavior::TrimLeadingFieldSpaces | Reader::ParserBehavior::TrimTrailingFieldSpaces }; csv.parse(); EXPECT(!csv.has_error()); - EXPECT_EQ(csv[0]["Foo"], "1"); - EXPECT_EQ(csv[1]["Bar"], "5 "); - EXPECT_EQ(csv[2]["Foo"], "\"x"); - EXPECT_EQ(csv[2]["Baz"], "9"); + EXPECT_EQ(csv[0]["Foo"sv], "1"sv); + EXPECT_EQ(csv[1]["Bar"sv], "5 "sv); + EXPECT_EQ(csv[2]["Foo"sv], "\"x"sv); + EXPECT_EQ(csv[2]["Baz"sv], "9"sv); } } @@ -48,7 +48,7 @@ TEST_CASE(should_fail_nicely) { { auto data = R"~~~(Foo, Bar, Baz - x, y)~~~"; + x, y)~~~"sv; auto csv = Reader::CSV { data, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders | Reader::ParserBehavior::TrimLeadingFieldSpaces }; csv.parse(); EXPECT(csv.has_error()); @@ -57,7 +57,7 @@ TEST_CASE(should_fail_nicely) { auto data = R"~~~(Foo, Bar, Baz - x, y, "z)~~~"; + x, y, "z)~~~"sv; auto csv = Reader::CSV { data, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders | Reader::ParserBehavior::TrimLeadingFieldSpaces }; csv.parse(); EXPECT(csv.has_error()); @@ -70,7 +70,7 @@ TEST_CASE(should_iterate_rows) auto data = R"~~~(Foo, Bar, Baz 1, 2, 3 4, 5, 6 - """x", y"z, 9)~~~"; + """x", y"z, 9)~~~"sv; auto csv = Reader::CSV { data, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders | Reader::ParserBehavior::TrimLeadingFieldSpaces }; csv.parse(); EXPECT(!csv.has_error()); @@ -93,7 +93,7 @@ BENCHMARK_CASE(fairly_big_data) memcpy(buf.offset_pointer(row * line.length()), line.characters_without_null_termination(), line.length()); } - auto csv = Reader::CSV { (char const*)buf.data(), Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders }; + auto csv = Reader::CSV { StringView { buf.bytes() }, Reader::default_behaviors() | Reader::ParserBehavior::ReadHeaders }; csv.parse(); EXPECT(!csv.has_error()); diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.cpp b/Userland/Applications/Spreadsheet/Readers/XSV.cpp index 4170743195..6a1533aabd 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.cpp +++ b/Userland/Applications/Spreadsheet/Readers/XSV.cpp @@ -133,7 +133,7 @@ Vector<XSV::Field> XSV::read_row(bool header_row) XSV::Field XSV::read_one_field() { if ((m_behaviors & ParserBehavior::TrimLeadingFieldSpaces) != ParserBehavior::None) - m_lexer.consume_while(is_any_of(" \t\v")); + m_lexer.consume_while(is_any_of(" \t\v"sv)); bool is_quoted = false; Field field; @@ -145,7 +145,7 @@ XSV::Field XSV::read_one_field() } if ((m_behaviors & ParserBehavior::TrimTrailingFieldSpaces) != ParserBehavior::None) { - m_lexer.consume_while(is_any_of(" \t\v")); + m_lexer.consume_while(is_any_of(" \t\v"sv)); if (!is_quoted) { // Also have to trim trailing spaces from unquoted fields. diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 1cebe1a055..18de026374 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -48,7 +48,7 @@ Sheet::Sheet(Workbook& workbook) global_object().define_direct_property("thisSheet", &global_object(), JS::default_attributes); // Self-reference is unfortunate, but required. // Sadly, these have to be evaluated once per sheet. - constexpr StringView runtime_file_path = "/res/js/Spreadsheet/runtime.js"; + constexpr auto runtime_file_path = "/res/js/Spreadsheet/runtime.js"sv; auto file_or_error = Core::File::open(runtime_file_path, Core::OpenMode::ReadOnly); if (!file_or_error.is_error()) { auto buffer = file_or_error.value()->read_all(); @@ -94,7 +94,7 @@ size_t Sheet::add_row() static Optional<size_t> convert_from_string(StringView str, unsigned base = 26, StringView map = {}) { if (map.is_null()) - map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"sv; VERIFY(base >= 2 && base <= map.length()); @@ -375,10 +375,10 @@ Vector<CellChange> Sheet::copy_cells(Vector<Position> from, Vector<Position> to, RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) { auto sheet = adopt_ref(*new Sheet(workbook)); - auto rows = object.get("rows").to_u32(default_row_count); - auto columns = object.get("columns"); - auto name = object.get("name").as_string_or("Sheet"); - if (object.has("cells") && !object.has_object("cells")) + auto rows = object.get("rows"sv).to_u32(default_row_count); + auto columns = object.get("columns"sv); + auto name = object.get("name"sv).as_string_or("Sheet"); + if (object.has("cells"sv) && !object.has_object("cells"sv)) return {}; sheet->set_name(name); @@ -403,51 +403,51 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) auto& parse_function = json.as_object().get_without_side_effects("parse").as_function(); auto read_format = [](auto& format, auto const& obj) { - if (auto value = obj.get("foreground_color"); value.is_string()) + if (auto value = obj.get("foreground_color"sv); value.is_string()) format.foreground_color = Color::from_string(value.as_string()); - if (auto value = obj.get("background_color"); value.is_string()) + if (auto value = obj.get("background_color"sv); value.is_string()) format.background_color = Color::from_string(value.as_string()); }; - if (object.has_object("cells")) { - object.get("cells").as_object().for_each_member([&](auto& name, JsonValue const& value) { + if (object.has_object("cells"sv)) { + object.get("cells"sv).as_object().for_each_member([&](auto& name, JsonValue const& value) { auto position_option = sheet->parse_cell_name(name); if (!position_option.has_value()) return IterationDecision::Continue; auto position = position_option.value(); auto& obj = value.as_object(); - auto kind = obj.get("kind").as_string_or("LiteralString") == "LiteralString" ? Cell::LiteralString : Cell::Formula; + auto kind = obj.get("kind"sv).as_string_or("LiteralString") == "LiteralString" ? Cell::LiteralString : Cell::Formula; OwnPtr<Cell> cell; switch (kind) { case Cell::LiteralString: - cell = make<Cell>(obj.get("value").to_string(), position, *sheet); + cell = make<Cell>(obj.get("value"sv).to_string(), position, *sheet); break; case Cell::Formula: { auto& interpreter = sheet->interpreter(); - auto value_or_error = JS::call(interpreter.global_object(), parse_function, json, JS::js_string(interpreter.heap(), obj.get("value").as_string())); + auto value_or_error = JS::call(interpreter.global_object(), parse_function, json, JS::js_string(interpreter.heap(), obj.get("value"sv).as_string())); if (value_or_error.is_error()) { warnln("Failed to load previous value for cell {}, leaving as undefined", position.to_cell_identifier(sheet)); value_or_error = JS::js_undefined(); } - cell = make<Cell>(obj.get("source").to_string(), value_or_error.release_value(), position, *sheet); + cell = make<Cell>(obj.get("source"sv).to_string(), value_or_error.release_value(), position, *sheet); break; } } - auto type_name = obj.has("type") ? obj.get("type").to_string() : "Numeric"; + auto type_name = obj.has("type"sv) ? obj.get("type"sv).to_string() : "Numeric"; cell->set_type(type_name); - auto type_meta = obj.get("type_metadata"); + auto type_meta = obj.get("type_metadata"sv); if (type_meta.is_object()) { auto& meta_obj = type_meta.as_object(); auto meta = cell->type_metadata(); - if (auto value = meta_obj.get("length"); value.is_number()) + if (auto value = meta_obj.get("length"sv); value.is_number()) meta.length = value.to_i32(); - if (auto value = meta_obj.get("format"); value.is_string()) + if (auto value = meta_obj.get("format"sv); value.is_string()) meta.format = value.as_string(); - if (auto value = meta_obj.get("alignment"); value.is_string()) { + if (auto value = meta_obj.get("alignment"sv); value.is_string()) { auto alignment = Gfx::text_alignment_from_string(value.as_string()); if (alignment.has_value()) meta.alignment = alignment.value(); @@ -457,7 +457,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) cell->set_type_metadata(move(meta)); } - auto conditional_formats = obj.get("conditional_formats"); + auto conditional_formats = obj.get("conditional_formats"sv); auto cformats = cell->conditional_formats(); if (conditional_formats.is_array()) { conditional_formats.as_array().for_each([&](const auto& fmt_val) { @@ -465,7 +465,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) return IterationDecision::Continue; auto& fmt_obj = fmt_val.as_object(); - auto fmt_cond = fmt_obj.get("condition").to_string(); + auto fmt_cond = fmt_obj.get("condition"sv).to_string(); if (fmt_cond.is_empty()) return IterationDecision::Continue; @@ -479,7 +479,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) cell->set_conditional_formats(move(cformats)); } - auto evaluated_format = obj.get("evaluated_formats"); + auto evaluated_format = obj.get("evaluated_formats"sv); if (evaluated_format.is_object()) { auto& evaluated_format_obj = evaluated_format.as_object(); auto& evaluated_fmts = cell->evaluated_formats(); @@ -722,8 +722,8 @@ String Sheet::generate_inline_documentation_for(StringView function, size_t argu return String::formatted("{}(...???{})", function, argument_index); auto& entry_object = entry.as_object(); - size_t argc = entry_object.get("argc").to_int(0); - auto argnames_value = entry_object.get("argnames"); + size_t argc = entry_object.get("argc"sv).to_int(0); + auto argnames_value = entry_object.get("argnames"sv); if (!argnames_value.is_array()) return String::formatted("{}(...{}???{})", function, argc, argument_index); auto& argnames = argnames_value.as_array(); @@ -731,7 +731,7 @@ String Sheet::generate_inline_documentation_for(StringView function, size_t argu builder.appendff("{}(", function); for (size_t i = 0; i < (size_t)argnames.size(); ++i) { if (i != 0 && i < (size_t)argnames.size()) - builder.append(", "); + builder.append(", "sv); if (i == argument_index) builder.append('<'); else if (i >= argc) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 3d496c6ad3..dfa11afd00 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -121,12 +121,12 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) StringBuilder builder; builder.appendff("{}\n", error.get_without_side_effects(object.vm().names.message).to_string_without_side_effects()); for (auto const& frame : trace.in_reverse()) { - if (frame.source_range.filename.contains("runtime.js")) { + if (frame.source_range.filename.contains("runtime.js"sv)) { if (frame.function_name == "<unknown>") builder.appendff(" in a builtin function at line {}, column {}\n", frame.source_range.start.line, frame.source_range.start.column); else builder.appendff(" while evaluating builtin '{}'\n", frame.function_name); - } else if (frame.source_range.filename.starts_with("cell ")) { + } else if (frame.source_range.filename.starts_with("cell "sv)) { builder.appendff(" in cell '{}', at line {}, column {}\n", frame.source_range.filename.substring_view(5), frame.source_range.start.line, frame.source_range.start.column); } } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.h b/Userland/Applications/Spreadsheet/SpreadsheetModel.h index a54b210405..8cdabde030 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.h @@ -29,7 +29,7 @@ public: virtual bool is_editable(const GUI::ModelIndex&) const override; virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override; virtual bool is_column_sortable(int) const override { return false; } - virtual StringView drag_data_type() const override { return "text/x-spreadsheet-data"; } + virtual StringView drag_data_type() const override { return "text/x-spreadsheet-data"sv; } Sheet& sheet() { return *m_sheet; } void update(); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index a7fa639f3f..822a4a150e 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -43,12 +43,12 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe current_cell_label.set_fixed_width(50); auto& help_button = top_bar.add<GUI::Button>(""); - help_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png").release_value_but_fixme_should_propagate_errors()); + help_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors()); help_button.set_tooltip("Functions Help"); help_button.set_fixed_size(20, 20); help_button.on_click = [&](auto) { if (!current_view()) { - GUI::MessageBox::show_error(window(), "Can only show function documentation/help when a worksheet exists and is open"); + GUI::MessageBox::show_error(window(), "Can only show function documentation/help when a worksheet exists and is open"sv); } else if (auto* sheet_ptr = current_worksheet_if_available()) { auto docs = sheet_ptr->gather_documentation(); auto help_window = HelpWindow::the(window()); @@ -88,7 +88,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_inline_documentation_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); if (!m_workbook->has_sheets() && should_add_sheet_if_empty) - m_workbook->add_sheet("Sheet 1"); + m_workbook->add_sheet("Sheet 1"sv); m_tab_context_menu = GUI::Menu::construct(); m_rename_action = GUI::CommonActions::make_rename_action([this](auto&) { @@ -98,16 +98,16 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe VERIFY(sheet_ptr); // How did we get here without a sheet? auto& sheet = *sheet_ptr; String new_name; - if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecResult::OK) { + if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet"sv) == GUI::Dialog::ExecResult::OK) { sheet.set_name(new_name); sheet.update(); m_tab_widget->set_tab_title(static_cast<GUI::Widget&>(*m_tab_context_menu_sheet_view), new_name); } }); m_tab_context_menu->add_action(*m_rename_action); - m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { + m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { String name; - if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecResult::OK) { + if (GUI::InputBox::show(window(), name, "Name for new sheet"sv, "Create sheet"sv) == GUI::Dialog::ExecResult::OK) { NonnullRefPtrVector<Sheet> new_sheets; new_sheets.append(m_workbook->add_sheet(name)); setup_tabs(move(new_sheets)); @@ -116,7 +116,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe setup_tabs(m_workbook->sheets()); - m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { add_sheet(); }); @@ -172,7 +172,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe auto* worksheet_ptr = current_worksheet_if_available(); if (!worksheet_ptr) { - GUI::MessageBox::show_error(window(), "There are no active worksheets"); + GUI::MessageBox::show_error(window(), "There are no active worksheets"sv); return; } auto& sheet = *worksheet_ptr; @@ -225,19 +225,19 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_redo_action->set_enabled(false); m_functions_help_action = GUI::Action::create( - "&Functions Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + "&Functions Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { if (auto* worksheet_ptr = current_worksheet_if_available()) { auto docs = worksheet_ptr->gather_documentation(); auto help_window = Spreadsheet::HelpWindow::the(window()); help_window->set_docs(move(docs)); help_window->show(); } else { - GUI::MessageBox::show_error(window(), "Cannot prepare documentation/help without an active worksheet"); + GUI::MessageBox::show_error(window(), "Cannot prepare documentation/help without an active worksheet"sv); } }, window()); - m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"), window()); + m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"sv), window()); toolbar.add_action(*m_new_action); toolbar.add_action(*m_open_action); @@ -279,7 +279,7 @@ void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event) void SpreadsheetWidget::clipboard_content_did_change(String const& mime_type) { if (auto* sheet = current_worksheet_if_available()) - m_paste_action->set_enabled(!sheet->selected_cells().is_empty() && mime_type.starts_with("text/")); + m_paste_action->set_enabled(!sheet->selected_cells().is_empty() && mime_type.starts_with("text/"sv)); } void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets) @@ -303,7 +303,7 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets) VERIFY(!selection.is_empty()); m_cut_action->set_enabled(true); m_copy_action->set_enabled(true); - m_paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type().starts_with("text/")); + m_paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type().starts_with("text/"sv)); m_current_cell_label->set_enabled(true); m_cell_value_editor->set_enabled(true); @@ -338,7 +338,7 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets) auto& first_cell = cells.first(); m_cell_value_editor->on_change = nullptr; - m_cell_value_editor->set_text(""); + m_cell_value_editor->set_text(""sv); m_should_change_selected_cells = false; m_cell_value_editor->on_focusin = [this] { m_should_change_selected_cells = true; }; m_cell_value_editor->on_focusout = [this] { m_should_change_selected_cells = false; }; @@ -500,7 +500,7 @@ bool SpreadsheetWidget::request_close() void SpreadsheetWidget::add_sheet() { StringBuilder name; - name.append("Sheet"); + name.append("Sheet"sv); name.appendff(" {}", m_workbook->sheets().size() + 1); NonnullRefPtrVector<Sheet> new_sheets; @@ -522,10 +522,10 @@ void SpreadsheetWidget::update_window_title() { StringBuilder builder; if (current_filename().is_empty()) - builder.append("Untitled"); + builder.append("Untitled"sv); else builder.append(current_filename()); - builder.append("[*] - Spreadsheet"); + builder.append("[*] - Spreadsheet"sv); window()->set_title(builder.to_string()); } @@ -538,14 +538,14 @@ void SpreadsheetWidget::clipboard_action(bool is_cut) /// - selected cell+ auto* worksheet_ptr = current_worksheet_if_available(); if (!worksheet_ptr) { - GUI::MessageBox::show_error(window(), "There are no active worksheets"); + GUI::MessageBox::show_error(window(), "There are no active worksheets"sv); return; } auto& worksheet = *worksheet_ptr; auto& cells = worksheet.selected_cells(); VERIFY(!cells.is_empty()); StringBuilder text_builder, url_builder; - url_builder.append(is_cut ? "cut\n" : "copy\n"); + url_builder.append(is_cut ? "cut\n"sv : "copy\n"sv); bool first = true; auto cursor = current_selection_cursor(); if (cursor) { diff --git a/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp b/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp index fd294d3a0c..0e356a5ba0 100644 --- a/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp +++ b/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp @@ -42,7 +42,7 @@ TEST_CASE(can_write_with_header) auto buffer = ByteBuffer::create_uninitialized(1024).release_value(); OutputMemoryStream stream { buffer }; - Writer::CSV csv(stream, data, { "A", "B\"", "C" }); + Writer::CSV csv(stream, data, { "A"sv, "B\""sv, "C"sv }); auto expected_output = R"~(A,"B""",C 1,2,3 @@ -63,7 +63,7 @@ TEST_CASE(can_write_with_different_behaviors) auto buffer = ByteBuffer::create_uninitialized(1024).release_value(); OutputMemoryStream stream { buffer }; - Writer::CSV csv(stream, data, { "A", "B\"", "C" }, Writer::WriterBehavior::QuoteOnlyInFieldStart | Writer::WriterBehavior::WriteHeaders); + Writer::CSV csv(stream, data, { "A"sv, "B\""sv, "C"sv }, Writer::WriterBehavior::QuoteOnlyInFieldStart | Writer::WriterBehavior::WriteHeaders); auto expected_output = R"~(A,B",C Well,Hello",Friends diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index 53408b712b..24bf243667 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -48,11 +48,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) // For writing temporary files when exporting. TRY(Core::System::unveil("/tmp", "crw")); TRY(Core::System::unveil("/etc", "r")); - TRY(Core::System::unveil(Core::StandardPaths::home_directory().characters(), "rwc")); + TRY(Core::System::unveil(Core::StandardPaths::home_directory(), "rwc"sv)); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-spreadsheet"); + auto app_icon = GUI::Icon::default_icon("app-spreadsheet"sv); auto window = GUI::Window::construct(); window->resize(640, 480); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/SystemMonitor/GraphWidget.cpp b/Userland/Applications/SystemMonitor/GraphWidget.cpp index 73296c2502..db06da11d4 100644 --- a/Userland/Applications/SystemMonitor/GraphWidget.cpp +++ b/Userland/Applications/SystemMonitor/GraphWidget.cpp @@ -153,8 +153,8 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) text_rect.set_height(font().glyph_height()); auto text = format.text_formatter(current_values[i]); if (format.text_shadow_color != Color::Transparent) - painter.draw_text(text_rect.translated(1, 1), text.characters(), Gfx::TextAlignment::CenterRight, format.text_shadow_color); - painter.draw_text(text_rect, text.characters(), Gfx::TextAlignment::CenterRight, graph_color); + painter.draw_text(text_rect.translated(1, 1), text, Gfx::TextAlignment::CenterRight, format.text_shadow_color); + painter.draw_text(text_rect, text, Gfx::TextAlignment::CenterRight, graph_color); y += text_rect.height() + 4; } } diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 9db1d5d974..0b162e5bb8 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -114,16 +114,16 @@ void MemoryStatsWidget::refresh() auto json_result = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors(); auto const& json = json_result.as_object(); - u32 kmalloc_allocated = json.get("kmalloc_allocated").to_u32(); - u32 kmalloc_available = json.get("kmalloc_available").to_u32(); - u64 user_physical_allocated = json.get("user_physical_allocated").to_u64(); - u64 user_physical_available = json.get("user_physical_available").to_u64(); - u64 user_physical_committed = json.get("user_physical_committed").to_u64(); - u64 user_physical_uncommitted = json.get("user_physical_uncommitted").to_u64(); - u64 super_physical_alloc = json.get("super_physical_allocated").to_u64(); - u64 super_physical_free = json.get("super_physical_available").to_u64(); - u32 kmalloc_call_count = json.get("kmalloc_call_count").to_u32(); - u32 kfree_call_count = json.get("kfree_call_count").to_u32(); + u32 kmalloc_allocated = json.get("kmalloc_allocated"sv).to_u32(); + u32 kmalloc_available = json.get("kmalloc_available"sv).to_u32(); + u64 user_physical_allocated = json.get("user_physical_allocated"sv).to_u64(); + u64 user_physical_available = json.get("user_physical_available"sv).to_u64(); + u64 user_physical_committed = json.get("user_physical_committed"sv).to_u64(); + u64 user_physical_uncommitted = json.get("user_physical_uncommitted"sv).to_u64(); + u64 super_physical_alloc = json.get("super_physical_allocated"sv).to_u64(); + u64 super_physical_free = json.get("super_physical_available"sv).to_u64(); + u32 kmalloc_call_count = json.get("kmalloc_call_count"sv).to_u32(); + u32 kfree_call_count = json.get("kfree_call_count"sv).to_u32(); u64 kmalloc_bytes_total = kmalloc_allocated + kmalloc_available; u64 user_physical_pages_total = user_physical_allocated + user_physical_available; diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index 8518a06f81..5317ae04ba 100644 --- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -24,8 +24,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() layout()->set_margins(4); set_fill_with_background_color(true); - m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png").release_value_but_fixme_should_propagate_errors(); - m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png").release_value_but_fixme_should_propagate_errors(); + m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors(); + m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png"sv).release_value_but_fixme_should_propagate_errors(); m_network_link_down_bitmap = Gfx::Bitmap::try_create(m_network_connected_bitmap->format(), m_network_connected_bitmap->size()).release_value_but_fixme_should_propagate_errors(); { @@ -35,7 +35,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() }); } - auto& adapters_group_box = add<GUI::GroupBox>("Adapters"); + auto& adapters_group_box = add<GUI::GroupBox>("Adapters"sv); adapters_group_box.set_layout<GUI::VerticalBoxLayout>(); adapters_group_box.layout()->set_margins(6); adapters_group_box.set_fixed_height(120); @@ -45,25 +45,25 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields; net_adapters_fields.empend("", Gfx::TextAlignment::CenterLeft, [this](JsonObject const& object) -> GUI::Variant { - if (!object.get("link_up").as_bool()) + if (!object.get("link_up"sv).as_bool()) return *m_network_link_down_bitmap; else - return object.get("ipv4_address").as_string_or("").is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap; + return object.get("ipv4_address"sv).as_string_or(""sv).is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap; }); net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft); net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft); net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft); net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) -> String { - if (!object.get("link_up").as_bool()) + if (!object.get("link_up"sv).as_bool()) return "Down"; - return String::formatted("{} Mb/s {}-duplex", object.get("link_speed").to_i32(), - object.get("link_full_duplex").as_bool() ? "full" : "half"); + return String::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(), + object.get("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv); }); net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) -> String { - return object.get("ipv4_address").as_string_or(""); + return object.get("ipv4_address"sv).as_string_or(""sv); }); net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight); @@ -72,7 +72,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() m_adapter_model = GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields)); m_adapter_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_adapter_model))); - auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"); + auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"sv); tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(); tcp_sockets_group_box.layout()->set_margins(6); @@ -93,7 +93,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() m_tcp_socket_model = GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)); m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model))); - auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"); + auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"sv); udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(); udp_sockets_group_box.layout()->set_margins(6); diff --git a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index 4131632763..ba12888690 100644 --- a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -27,19 +27,19 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() pid_fds_fields.empend("offset", "Offset", Gfx::TextAlignment::CenterRight); pid_fds_fields.empend("absolute_path", "Path", Gfx::TextAlignment::CenterLeft); pid_fds_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) { - return object.get("seekable").to_bool() ? "Seekable" : "Sequential"; + return object.get("seekable"sv).to_bool() ? "Seekable" : "Sequential"; }); pid_fds_fields.empend("Blocking", Gfx::TextAlignment::CenterLeft, [](auto& object) { - return object.get("blocking").to_bool() ? "Blocking" : "Nonblocking"; + return object.get("blocking"sv).to_bool() ? "Blocking" : "Nonblocking"; }); pid_fds_fields.empend("On exec", Gfx::TextAlignment::CenterLeft, [](auto& object) { - return object.get("cloexec").to_bool() ? "Close" : "Keep"; + return object.get("cloexec"sv).to_bool() ? "Close" : "Keep"; }); pid_fds_fields.empend("Can read", Gfx::TextAlignment::CenterLeft, [](auto& object) { - return object.get("can_read").to_bool() ? "Yes" : "No"; + return object.get("can_read"sv).to_bool() ? "Yes" : "No"; }); pid_fds_fields.empend("Can write", Gfx::TextAlignment::CenterLeft, [](auto& object) { - return object.get("can_write").to_bool() ? "Yes" : "No"; + return object.get("can_write"sv).to_bool() ? "Yes" : "No"; }); m_model = GUI::JsonArrayModel::create({}, move(pid_fds_fields)); diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index f25c17cf98..6625397af6 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -57,35 +57,35 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields; pid_vm_fields.empend( "Address", Gfx::TextAlignment::CenterLeft, - [](auto& object) { return String::formatted("{:p}", object.get("address").to_u64()); }, - [](auto& object) { return object.get("address").to_u64(); }); + [](auto& object) { return String::formatted("{:p}", object.get("address"sv).to_u64()); }, + [](auto& object) { return object.get("address"sv).to_u64(); }); pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight); pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight); pid_vm_fields.empend("amount_dirty", "Dirty", Gfx::TextAlignment::CenterRight); pid_vm_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) { StringBuilder builder; - if (object.get("readable").to_bool()) + if (object.get("readable"sv).to_bool()) builder.append('R'); - if (object.get("writable").to_bool()) + if (object.get("writable"sv).to_bool()) builder.append('W'); - if (object.get("executable").to_bool()) + if (object.get("executable"sv).to_bool()) builder.append('X'); - if (object.get("shared").to_bool()) + if (object.get("shared"sv).to_bool()) builder.append('S'); - if (object.get("syscall").to_bool()) + if (object.get("syscall"sv).to_bool()) builder.append('C'); - if (object.get("stack").to_bool()) + if (object.get("stack"sv).to_bool()) builder.append('T'); return builder.to_string(); }); pid_vm_fields.empend("VMObject type", Gfx::TextAlignment::CenterLeft, [](auto& object) { - auto type = object.get("vmobject").to_string(); - if (type.ends_with("VMObject")) + auto type = object.get("vmobject"sv).to_string(); + if (type.ends_with("VMObject"sv)) type = type.substring(0, type.length() - 8); return type; }); pid_vm_fields.empend("Purgeable", Gfx::TextAlignment::CenterLeft, [](auto& object) { - if (object.get("volatile").to_bool()) + if (object.get("volatile"sv).to_bool()) return "Volatile"; return "Non-volatile"; }); @@ -98,7 +98,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() return GUI::Variant(0); }, [](JsonObject const& object) { - auto pagemap = object.get("pagemap").as_string_or({}); + auto pagemap = object.get("pagemap"sv).as_string_or({}); return pagemap; }); pid_vm_fields.empend("cow_pages", "# CoW", Gfx::TextAlignment::CenterRight); diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index 03322e6d24..092cbbdca4 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -38,7 +38,7 @@ ProcessModel::ProcessModel() auto cpuinfo_array = json.value().as_array(); cpuinfo_array.for_each([&](auto& value) { auto& cpu_object = value.as_object(); - auto cpu_id = cpu_object.get("processor").as_u32(); + auto cpu_id = cpu_object.get("processor"sv).as_u32(); m_cpus.append(make<CpuInfo>(cpu_id)); }); } @@ -46,7 +46,7 @@ ProcessModel::ProcessModel() if (m_cpus.is_empty()) m_cpus.append(make<CpuInfo>(0)); - m_kernel_process_icon = GUI::Icon::default_icon("gear"); + m_kernel_process_icon = GUI::Icon::default_icon("gear"sv); } int ProcessModel::row_count(GUI::ModelIndex const& index) const diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 98065b3599..4a940b0452 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -138,7 +138,7 @@ public: processors_field.empend("brand", "Brand", Gfx::TextAlignment::CenterLeft); processors_field.empend("Features", Gfx::TextAlignment::CenterLeft, [](auto& object) { StringBuilder builder; - auto features = object.get("features").as_array(); + auto features = object.get("features"sv).as_array(); for (auto& feature : features.values()) { builder.append(feature.to_string()); builder.append(' '); @@ -163,38 +163,38 @@ public: pci_fields.empend( "Address", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { - auto seg = object.get("seg").to_u32(); - auto bus = object.get("bus").to_u32(); - auto device = object.get("device").to_u32(); - auto function = object.get("function").to_u32(); + auto seg = object.get("seg"sv).to_u32(); + auto bus = object.get("bus"sv).to_u32(); + auto device = object.get("device"sv).to_u32(); + auto function = object.get("function"sv).to_u32(); return String::formatted("{:04x}:{:02x}:{:02x}.{}", seg, bus, device, function); }); pci_fields.empend( "Class", Gfx::TextAlignment::CenterLeft, [this](const JsonObject& object) { - auto class_id = object.get("class").to_u32(); - String class_name = m_db ? m_db->get_class(class_id) : nullptr; + auto class_id = object.get("class"sv).to_u32(); + String class_name = m_db ? m_db->get_class(class_id) : StringView {}; return class_name.is_empty() ? String::formatted("Unknown class: {:04x}", class_id) : class_name; }); pci_fields.empend( "Vendor", Gfx::TextAlignment::CenterLeft, [this](const JsonObject& object) { - auto vendor_id = object.get("vendor_id").to_u32(); - String vendor_name = m_db ? m_db->get_vendor(vendor_id) : nullptr; + auto vendor_id = object.get("vendor_id"sv).to_u32(); + String vendor_name = m_db ? m_db->get_vendor(vendor_id) : StringView {}; return vendor_name.is_empty() ? String::formatted("Unknown vendor: {:02x}", vendor_id) : vendor_name; }); pci_fields.empend( "Device", Gfx::TextAlignment::CenterLeft, [this](const JsonObject& object) { - auto vendor_id = object.get("vendor_id").to_u32(); - auto device_id = object.get("device_id").to_u32(); - String device_name = m_db ? m_db->get_device(vendor_id, device_id) : nullptr; + auto vendor_id = object.get("vendor_id"sv).to_u32(); + auto device_id = object.get("device_id"sv).to_u32(); + String device_name = m_db ? m_db->get_device(vendor_id, device_id) : StringView {}; return device_name.is_empty() ? String::formatted("Unknown device: {:02x}", device_id) : device_name; }); pci_fields.empend( "Revision", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { - auto revision_id = object.get("revision_id").to_u32(); + auto revision_id = object.get("revision_id"sv).to_u32(); return String::formatted("{:02x}", revision_id); }); @@ -227,18 +227,18 @@ public: [](const JsonObject& object) { StringBuilder size_builder; size_builder.append(" "); - size_builder.append(human_readable_size(object.get("total_block_count").to_u64() * object.get("block_size").to_u64())); + size_builder.append(human_readable_size(object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64())); size_builder.append(" "); return size_builder.to_string(); }, [](const JsonObject& object) { - return object.get("total_block_count").to_u64() * object.get("block_size").to_u64(); + return object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64(); }, [](const JsonObject& object) { - auto total_blocks = object.get("total_block_count").to_u64(); + auto total_blocks = object.get("total_block_count"sv).to_u64(); if (total_blocks == 0) return 0; - auto free_blocks = object.get("free_block_count").to_u64(); + auto free_blocks = object.get("free_block_count"sv).to_u64(); auto used_blocks = total_blocks - free_blocks; int percentage = (static_cast<double>(used_blocks) / static_cast<double>(total_blocks) * 100.0); return percentage; @@ -246,34 +246,34 @@ public: df_fields.empend( "Used", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { - auto total_blocks = object.get("total_block_count").to_u64(); - auto free_blocks = object.get("free_block_count").to_u64(); + auto total_blocks = object.get("total_block_count"sv).to_u64(); + auto free_blocks = object.get("free_block_count"sv).to_u64(); auto used_blocks = total_blocks - free_blocks; - return human_readable_size(used_blocks * object.get("block_size").to_u64()); }, + return human_readable_size(used_blocks * object.get("block_size"sv).to_u64()); }, [](const JsonObject& object) { - auto total_blocks = object.get("total_block_count").to_u64(); - auto free_blocks = object.get("free_block_count").to_u64(); + auto total_blocks = object.get("total_block_count"sv).to_u64(); + auto free_blocks = object.get("free_block_count"sv).to_u64(); auto used_blocks = total_blocks - free_blocks; - return used_blocks * object.get("block_size").to_u64(); + return used_blocks * object.get("block_size"sv).to_u64(); }); df_fields.empend( "Available", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { - return human_readable_size(object.get("free_block_count").to_u64() * object.get("block_size").to_u64()); + return human_readable_size(object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64()); }, [](const JsonObject& object) { - return object.get("free_block_count").to_u64() * object.get("block_size").to_u64(); + return object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64(); }); df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { - bool readonly = object.get("readonly").to_bool(); - int mount_flags = object.get("mount_flags").to_int(); + bool readonly = object.get("readonly"sv).to_bool(); + int mount_flags = object.get("mount_flags"sv).to_int(); return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write"; }); df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { - int mount_flags = object.get("mount_flags").to_int(); + int mount_flags = object.get("mount_flags"sv).to_int(); StringBuilder builder; bool first = true; - auto check = [&](int flag, const char* name) { + auto check = [&](int flag, StringView name) { if (!(mount_flags & flag)) return; if (!first) @@ -281,13 +281,13 @@ public: builder.append(name); first = false; }; - check(MS_NODEV, "nodev"); - check(MS_NOEXEC, "noexec"); - check(MS_NOSUID, "nosuid"); - check(MS_BIND, "bind"); - check(MS_RDONLY, "ro"); - check(MS_WXALLOWED, "wxallowed"); - check(MS_AXALLOWED, "axallowed"); + check(MS_NODEV, "nodev"sv); + check(MS_NOEXEC, "noexec"sv); + check(MS_NOSUID, "nosuid"sv); + check(MS_BIND, "bind"sv); + check(MS_RDONLY, "ro"sv); + check(MS_WXALLOWED, "wxallowed"sv); + check(MS_AXALLOWED, "axallowed"sv); if (builder.string_view().is_empty()) return String("defaults"); return builder.to_string(); @@ -365,7 +365,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) parser.parse(arguments); StringView args_tab_view = args_tab; - auto app_icon = GUI::Icon::default_icon("app-system-monitor"); + auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv); auto window = GUI::Window::construct(); window->set_title("System Monitor"); @@ -402,10 +402,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) process_table_view.set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending); process_model->update(); - i32 frequency = Config::read_i32("SystemMonitor", "Monitor", "Frequency", 3); + i32 frequency = Config::read_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, 3); if (frequency != 1 && frequency != 3 && frequency != 5) { frequency = 3; - Config::write_i32("SystemMonitor", "Monitor", "Frequency", frequency); + Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, frequency); } auto& refresh_timer = window->add<Core::Timer>( @@ -439,29 +439,29 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; auto kill_action = GUI::Action::create( - "&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + "&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; - auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGKILL); }, &process_table_view); auto stop_action = GUI::Action::create( - "&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + "&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; - auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGSTOP); }, &process_table_view); auto continue_action = GUI::Action::create( - "&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { + "&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid != -1) kill(pid, SIGCONT); @@ -470,12 +470,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto profile_action = GUI::Action::create( "&Profile Process", { Mod_Ctrl, Key_P }, - Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { + Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; auto pid_string = String::number(pid); - GUI::Process::spawn_or_show_error(window, "/bin/Profiler", Array { "--pid", pid_string.characters() }); + GUI::Process::spawn_or_show_error(window, "/bin/Profiler"sv, Array { "--pid", pid_string.characters() }); }, &process_table_view); @@ -531,7 +531,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto make_frequency_action = [&](int seconds) { auto action = GUI::Action::create_checkable(String::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) { - Config::write_i32("SystemMonitor", "Monitor", "Frequency", seconds); + Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, seconds); refresh_timer.restart(seconds * 1000); }); action->set_status_tip(String::formatted("Refresh every {} seconds", seconds)); @@ -597,7 +597,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid) window->resize(480, 360); window->set_title(String::formatted("PID {} - System Monitor", pid)); - auto app_icon = GUI::Icon::default_icon("app-system-monitor"); + auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv); window->set_icon(app_icon.bitmap_for_size(16)); auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>()); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index bc942f7a97..c0e0cedbc0 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -157,11 +157,11 @@ static ErrorOr<void> run_command(String command, bool keep_open) arguments.append(shell); if (!command.is_empty()) { if (keep_open) - arguments.append("--keep-open"); - arguments.append("-c"); + arguments.append("--keep-open"sv); + arguments.append("-c"sv); arguments.append(command); } - auto env = TRY(FixedArray<StringView>::try_create({ "TERM=xterm", "PAGER=more", "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin" })); + auto env = TRY(FixedArray<StringView>::try_create({ "TERM=xterm"sv, "PAGER=more"sv, "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"sv })); TRY(Core::System::exec(shell, arguments, Core::System::SearchInPath::No, env.span())); VERIFY_NOT_REACHED(); } @@ -189,13 +189,13 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget find_textbox->set_fixed_width(230); find_textbox->set_focus(true); if (terminal.has_selection()) - find_textbox->set_text(terminal.selected_text().replace("\n", " ", ReplaceMode::All)); + find_textbox->set_text(terminal.selected_text().replace("\n"sv, " "sv, ReplaceMode::All)); auto find_backwards = TRY(find->try_add<GUI::Button>()); find_backwards->set_fixed_width(25); - find_backwards->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors()); + find_backwards->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors()); auto find_forwards = TRY(find->try_add<GUI::Button>()); find_forwards->set_fixed_width(25); - find_forwards->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors()); + find_forwards->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors()); find_textbox->on_return_pressed = [find_backwards]() mutable { find_backwards->click(); @@ -280,14 +280,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (command_to_execute) TRY(run_command(command_to_execute, keep_open)); else - TRY(run_command(Config::read_string("Terminal", "Startup", "Command", ""), false)); + TRY(run_command(Config::read_string("Terminal"sv, "Startup"sv, "Command"sv, ""sv), false)); VERIFY_NOT_REACHED(); } auto ptsname = TRY(Core::System::ptsname(ptm_fd)); utmp_update(ptsname, shell_pid, true); - auto app_icon = GUI::Icon::default_icon("app-terminal"); + auto app_icon = GUI::Icon::default_icon("app-terminal"sv); auto window = TRY(GUI::Window::try_create()); window->set_title("Terminal"); @@ -308,10 +308,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); Config::monitor_domain("Terminal"); - auto should_confirm_close = Config::read_bool("Terminal", "Terminal", "ConfirmClose", true); + auto should_confirm_close = Config::read_bool("Terminal"sv, "Terminal"sv, "ConfirmClose"sv, true); TerminalChangeListener listener { terminal }; - auto bell = Config::read_string("Terminal", "Window", "Bell", "Visible"); + auto bell = Config::read_string("Terminal"sv, "Window"sv, "Bell"sv, "Visible"sv); if (bell == "AudibleBeep") { terminal->set_bell_mode(VT::TerminalWidget::BellMode::AudibleBeep); } else if (bell == "Disabled") { @@ -320,35 +320,35 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) terminal->set_bell_mode(VT::TerminalWidget::BellMode::Visible); } - auto cursor_shape = VT::TerminalWidget::parse_cursor_shape(Config::read_string("Terminal", "Cursor", "Shape", "Block")).value_or(VT::CursorShape::Block); + auto cursor_shape = VT::TerminalWidget::parse_cursor_shape(Config::read_string("Terminal"sv, "Cursor"sv, "Shape"sv, "Block"sv)).value_or(VT::CursorShape::Block); terminal->set_cursor_shape(cursor_shape); - auto cursor_blinking = Config::read_bool("Terminal", "Cursor", "Blinking", true); + auto cursor_blinking = Config::read_bool("Terminal"sv, "Cursor"sv, "Blinking"sv, true); terminal->set_cursor_blinking(cursor_blinking); auto find_window = TRY(create_find_window(terminal)); - auto new_opacity = Config::read_i32("Terminal", "Window", "Opacity", 255); + auto new_opacity = Config::read_i32("Terminal"sv, "Window"sv, "Opacity"sv, 255); terminal->set_opacity(new_opacity); window->set_has_alpha_channel(new_opacity < 255); - auto new_scrollback_size = Config::read_i32("Terminal", "Terminal", "MaxHistorySize", terminal->max_history_size()); + auto new_scrollback_size = Config::read_i32("Terminal"sv, "Terminal"sv, "MaxHistorySize"sv, terminal->max_history_size()); terminal->set_max_history_size(new_scrollback_size); - auto show_scroll_bar = Config::read_bool("Terminal", "Terminal", "ShowScrollBar", true); + auto show_scroll_bar = Config::read_bool("Terminal"sv, "Terminal"sv, "ShowScrollBar"sv, true); terminal->set_show_scrollbar(show_scroll_bar); - auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(), + auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { - GUI::Process::spawn_or_show_error(window, "/bin/TerminalSettings"); + GUI::Process::spawn_or_show_error(window, "/bin/TerminalSettings"sv); }); TRY(terminal->context_menu().try_add_separator()); TRY(terminal->context_menu().try_add_action(open_settings_action)); auto file_menu = TRY(window->try_add_menu("&File")); - TRY(file_menu->try_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").release_value_but_fixme_should_propagate_errors(), [&](auto&) { - GUI::Process::spawn_or_show_error(window, "/bin/Terminal"); + TRY(file_menu->try_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"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { + GUI::Process::spawn_or_show_error(window, "/bin/Terminal"sv); }))); TRY(file_menu->try_add_action(open_settings_action)); @@ -383,7 +383,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) close_message = "There is a background process running in this terminal. Closing the terminal may kill it."; } if (close_message.has_value()) - return GUI::MessageBox::show(window, *close_message, "Close this terminal?", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); + return GUI::MessageBox::show(window, *close_message, "Close this terminal?"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); return GUI::MessageBox::ExecResult::OK; }; @@ -397,7 +397,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(edit_menu->try_add_action(terminal->copy_action())); TRY(edit_menu->try_add_action(terminal->paste_action())); TRY(edit_menu->try_add_separator()); - TRY(edit_menu->try_add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), + TRY(edit_menu->try_add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { find_window->show(); find_window->move_to_front(); diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp index a2d6f388d8..ca3c9ab51f 100644 --- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp +++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp @@ -38,7 +38,7 @@ TerminalSettingsMainWidget::TerminalSettingsMainWidget() auto& visual_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("visual_bell_radio"); auto& no_bell_radio = *find_descendant_of_type_named<GUI::RadioButton>("no_bell_radio"); - m_bell_mode = parse_bell(Config::read_string("Terminal", "Window", "Bell")); + m_bell_mode = parse_bell(Config::read_string("Terminal"sv, "Window"sv, "Bell"sv)); m_original_bell_mode = m_bell_mode; switch (m_bell_mode) { @@ -55,46 +55,46 @@ TerminalSettingsMainWidget::TerminalSettingsMainWidget() beep_bell_radio.on_checked = [this](bool) { m_bell_mode = VT::TerminalWidget::BellMode::AudibleBeep; - Config::write_string("Terminal", "Window", "Bell", stringify_bell(m_bell_mode)); + Config::write_string("Terminal"sv, "Window"sv, "Bell"sv, stringify_bell(m_bell_mode)); set_modified(true); }; visual_bell_radio.on_checked = [this](bool) { m_bell_mode = VT::TerminalWidget::BellMode::Visible; - Config::write_string("Terminal", "Window", "Bell", stringify_bell(m_bell_mode)); + Config::write_string("Terminal"sv, "Window"sv, "Bell"sv, stringify_bell(m_bell_mode)); set_modified(true); }; no_bell_radio.on_checked = [this](bool) { m_bell_mode = VT::TerminalWidget::BellMode::Disabled; - Config::write_string("Terminal", "Window", "Bell", stringify_bell(m_bell_mode)); + Config::write_string("Terminal"sv, "Window"sv, "Bell"sv, stringify_bell(m_bell_mode)); set_modified(true); }; - m_max_history_size = Config::read_i32("Terminal", "Terminal", "MaxHistorySize"); + m_max_history_size = Config::read_i32("Terminal"sv, "Terminal"sv, "MaxHistorySize"sv); m_original_max_history_size = m_max_history_size; auto& history_size_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("history_size_spinbox"); history_size_spinbox.set_value(m_max_history_size, GUI::AllowCallback::No); history_size_spinbox.on_change = [this](int value) { m_max_history_size = value; - Config::write_i32("Terminal", "Terminal", "MaxHistorySize", static_cast<i32>(m_max_history_size)); + Config::write_i32("Terminal"sv, "Terminal"sv, "MaxHistorySize"sv, static_cast<i32>(m_max_history_size)); set_modified(true); }; - m_show_scrollbar = Config::read_bool("Terminal", "Terminal", "ShowScrollBar", true); + m_show_scrollbar = Config::read_bool("Terminal"sv, "Terminal"sv, "ShowScrollBar"sv, true); m_orignal_show_scrollbar = m_show_scrollbar; auto& show_scrollbar_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("terminal_show_scrollbar"); show_scrollbar_checkbox.on_checked = [&](bool show_scrollbar) { m_show_scrollbar = show_scrollbar; - Config::write_bool("Terminal", "Terminal", "ShowScrollBar", show_scrollbar); + Config::write_bool("Terminal"sv, "Terminal"sv, "ShowScrollBar"sv, show_scrollbar); set_modified(true); }; show_scrollbar_checkbox.set_checked(m_show_scrollbar, GUI::AllowCallback::No); - m_confirm_close = Config::read_bool("Terminal", "Terminal", "ConfirmClose", true); + m_confirm_close = Config::read_bool("Terminal"sv, "Terminal"sv, "ConfirmClose"sv, true); m_orignal_confirm_close = m_confirm_close; auto& confirm_close_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("terminal_confirm_close"); confirm_close_checkbox.on_checked = [&](bool confirm_close) { m_confirm_close = confirm_close; - Config::write_bool("Terminal", "Terminal", "ConfirmClose", confirm_close); + Config::write_bool("Terminal"sv, "Terminal"sv, "ConfirmClose"sv, confirm_close); set_modified(true); }; confirm_close_checkbox.set_checked(m_confirm_close, GUI::AllowCallback::No); @@ -105,16 +105,16 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() load_from_gml(terminal_settings_view_gml); auto& slider = *find_descendant_of_type_named<GUI::OpacitySlider>("background_opacity_slider"); - m_opacity = Config::read_i32("Terminal", "Window", "Opacity"); + m_opacity = Config::read_i32("Terminal"sv, "Window"sv, "Opacity"sv); m_original_opacity = m_opacity; slider.set_value(m_opacity); slider.on_change = [this](int value) { m_opacity = value; - Config::write_i32("Terminal", "Window", "Opacity", static_cast<i32>(m_opacity)); + Config::write_i32("Terminal"sv, "Window"sv, "Opacity"sv, static_cast<i32>(m_opacity)); set_modified(true); }; - m_color_scheme = Config::read_string("Terminal", "Window", "ColorScheme"); + m_color_scheme = Config::read_string("Terminal"sv, "Window"sv, "ColorScheme"sv); m_original_color_scheme = m_color_scheme; // The settings window takes a reference to this vector, so it needs to outlive this scope. // As long as we ensure that only one settings window may be open at a time (which we do), @@ -124,7 +124,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() Core::DirIterator iterator("/res/terminal-colors", Core::DirIterator::SkipParentAndBaseDir); while (iterator.has_next()) { auto path = iterator.next_path(); - color_scheme_names.append(path.replace(".ini", "", ReplaceMode::FirstOnly)); + color_scheme_names.append(path.replace(".ini"sv, ""sv, ReplaceMode::FirstOnly)); } quick_sort(color_scheme_names); auto& color_scheme_combo = *find_descendant_of_type_named<GUI::ComboBox>("color_scheme_combo"); @@ -134,13 +134,13 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() color_scheme_combo.set_enabled(color_scheme_names.size() > 1); color_scheme_combo.on_change = [&](auto&, const GUI::ModelIndex& index) { m_color_scheme = index.data().as_string(); - Config::write_string("Terminal", "Window", "ColorScheme", m_color_scheme); + Config::write_string("Terminal"sv, "Window"sv, "ColorScheme"sv, m_color_scheme); set_modified(true); }; auto& font_button = *find_descendant_of_type_named<GUI::Button>("terminal_font_button"); auto& font_text = *find_descendant_of_type_named<GUI::Label>("terminal_font_label"); - auto font_name = Config::read_string("Terminal", "Text", "Font"); + auto font_name = Config::read_string("Terminal"sv, "Text"sv, "Font"sv); if (font_name.is_empty()) m_font = Gfx::FontDatabase::the().default_fixed_width_font(); else @@ -154,7 +154,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() m_font = picker->font(); font_text.set_text(m_font->human_readable_name()); font_text.set_font(m_font); - Config::write_string("Terminal", "Text", "Font", m_font->qualified_name()); + Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); set_modified(true); } }; @@ -167,13 +167,13 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() m_font = Gfx::FontDatabase::the().default_fixed_width_font(); font_text.set_text(m_font->human_readable_name()); font_text.set_font(m_font); - Config::write_string("Terminal", "Text", "Font", m_font->qualified_name()); + Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); } else { font_selection.set_enabled(true); m_font = font_name.is_empty() ? Gfx::FontDatabase::the().default_fixed_width_font() : Gfx::FontDatabase::the().get_by_name(font_name); - Config::write_string("Terminal", "Text", "Font", m_font->qualified_name()); + Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); } set_modified(true); }; @@ -188,10 +188,10 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() auto& terminal_cursor_blinking = *find_descendant_of_type_named<GUI::CheckBox>("terminal_cursor_blinking"); - m_cursor_shape = VT::TerminalWidget::parse_cursor_shape(Config::read_string("Terminal", "Cursor", "Shape")).value_or(VT::CursorShape::Block); + m_cursor_shape = VT::TerminalWidget::parse_cursor_shape(Config::read_string("Terminal"sv, "Cursor"sv, "Shape"sv)).value_or(VT::CursorShape::Block); m_original_cursor_shape = m_cursor_shape; - m_cursor_is_blinking_set = Config::read_bool("Terminal", "Cursor", "Blinking", true); + m_cursor_is_blinking_set = Config::read_bool("Terminal"sv, "Cursor"sv, "Blinking"sv, true); m_original_cursor_is_blinking_set = m_cursor_is_blinking_set; switch (m_cursor_shape) { @@ -208,30 +208,30 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() terminal_cursor_blinking.on_checked = [&](bool is_checked) { set_modified(true); m_cursor_is_blinking_set = is_checked; - Config::write_bool("Terminal", "Cursor", "Blinking", is_checked); + Config::write_bool("Terminal"sv, "Cursor"sv, "Blinking"sv, is_checked); }; - terminal_cursor_blinking.set_checked(Config::read_bool("Terminal", "Cursor", "Blinking", true)); + terminal_cursor_blinking.set_checked(Config::read_bool("Terminal"sv, "Cursor"sv, "Blinking"sv, true)); terminal_cursor_block.on_checked = [&](bool) { set_modified(true); m_cursor_shape = VT::CursorShape::Block; - Config::write_string("Terminal", "Cursor", "Shape", "Block"); + Config::write_string("Terminal"sv, "Cursor"sv, "Shape"sv, "Block"sv); }; - terminal_cursor_block.set_checked(Config::read_string("Terminal", "Cursor", "Shape") == "Block"); + terminal_cursor_block.set_checked(Config::read_string("Terminal"sv, "Cursor"sv, "Shape"sv) == "Block"sv); terminal_cursor_underline.on_checked = [&](bool) { set_modified(true); m_cursor_shape = VT::CursorShape::Underline; - Config::write_string("Terminal", "Cursor", "Shape", "Underline"); + Config::write_string("Terminal"sv, "Cursor"sv, "Shape"sv, "Underline"sv); }; - terminal_cursor_underline.set_checked(Config::read_string("Terminal", "Cursor", "Shape") == "Underline"); + terminal_cursor_underline.set_checked(Config::read_string("Terminal"sv, "Cursor"sv, "Shape"sv) == "Underline"sv); terminal_cursor_bar.on_checked = [&](bool) { set_modified(true); m_cursor_shape = VT::CursorShape::Bar; - Config::write_string("Terminal", "Cursor", "Shape", "Bar"); + Config::write_string("Terminal"sv, "Cursor"sv, "Shape"sv, "Bar"sv); }; - terminal_cursor_bar.set_checked(Config::read_string("Terminal", "Cursor", "Shape") == "Bar"); + terminal_cursor_bar.set_checked(Config::read_string("Terminal"sv, "Cursor"sv, "Shape"sv) == "Bar"sv); } VT::TerminalWidget::BellMode TerminalSettingsMainWidget::parse_bell(StringView bell_string) @@ -266,10 +266,10 @@ void TerminalSettingsMainWidget::apply_settings() } void TerminalSettingsMainWidget::write_back_settings() const { - Config::write_i32("Terminal", "Terminal", "MaxHistorySize", static_cast<i32>(m_original_max_history_size)); - Config::write_bool("Terminal", "Terminal", "ShowScrollBar", m_orignal_show_scrollbar); - Config::write_bool("Terminal", "Terminal", "ConfirmClose", m_orignal_confirm_close); - Config::write_string("Terminal", "Window", "Bell", stringify_bell(m_original_bell_mode)); + Config::write_i32("Terminal"sv, "Terminal"sv, "MaxHistorySize"sv, static_cast<i32>(m_original_max_history_size)); + Config::write_bool("Terminal"sv, "Terminal"sv, "ShowScrollBar"sv, m_orignal_show_scrollbar); + Config::write_bool("Terminal"sv, "Terminal"sv, "ConfirmClose"sv, m_orignal_confirm_close); + Config::write_string("Terminal"sv, "Window"sv, "Bell"sv, stringify_bell(m_original_bell_mode)); } void TerminalSettingsMainWidget::cancel_settings() @@ -289,11 +289,11 @@ void TerminalSettingsViewWidget::apply_settings() void TerminalSettingsViewWidget::write_back_settings() const { - Config::write_i32("Terminal", "Window", "Opacity", static_cast<i32>(m_original_opacity)); - Config::write_string("Terminal", "Text", "Font", m_original_font->qualified_name()); - Config::write_string("Terminal", "Window", "ColorScheme", m_original_color_scheme); - Config::write_string("Terminal", "Cursor", "Shape", VT::TerminalWidget::stringify_cursor_shape(m_original_cursor_shape)); - Config::write_bool("Terminal", "Cursor", "Blinking", m_original_cursor_is_blinking_set); + Config::write_i32("Terminal"sv, "Window"sv, "Opacity"sv, static_cast<i32>(m_original_opacity)); + Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_original_font->qualified_name()); + Config::write_string("Terminal"sv, "Window"sv, "ColorScheme"sv, m_original_color_scheme); + Config::write_string("Terminal"sv, "Cursor"sv, "Shape"sv, VT::TerminalWidget::stringify_cursor_shape(m_original_cursor_shape)); + Config::write_bool("Terminal"sv, "Cursor"sv, "Blinking"sv, m_original_cursor_is_blinking_set); } void TerminalSettingsViewWidget::cancel_settings() diff --git a/Userland/Applications/TerminalSettings/main.cpp b/Userland/Applications/TerminalSettings/main.cpp index bfa191df20..1deafcc8a2 100644 --- a/Userland/Applications/TerminalSettings/main.cpp +++ b/Userland/Applications/TerminalSettings/main.cpp @@ -30,12 +30,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-terminal"); + auto app_icon = GUI::Icon::default_icon("app-terminal"sv); auto window = TRY(GUI::SettingsWindow::create("Terminal Settings")); window->set_icon(app_icon.bitmap_for_size(16)); - (void)TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal", "terminal")); - (void)TRY(window->add_tab<TerminalSettingsViewWidget>("View", "view")); + (void)TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal"sv, "terminal"sv)); + (void)TRY(window->add_tab<TerminalSettingsViewWidget>("View"sv, "view"sv)); window->set_active_tab(selected_tab); window->show(); diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 383d0e2d47..13d1eaf2e6 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -76,10 +76,10 @@ MainWidget::MainWidget() m_replace_widget = *find_descendant_of_type_named<GUI::Widget>("replace_widget"); m_find_textbox = *find_descendant_of_type_named<GUI::TextBox>("find_textbox"); - m_find_textbox->set_placeholder("Find"); + m_find_textbox->set_placeholder("Find"sv); m_replace_textbox = *find_descendant_of_type_named<GUI::TextBox>("replace_textbox"); - m_replace_textbox->set_placeholder("Replace"); + m_replace_textbox->set_placeholder("Replace"sv); m_match_case_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("match_case_checkbox"); m_match_case_checkbox->on_checked = [this](auto is_checked) { @@ -99,11 +99,11 @@ MainWidget::MainWidget() }; m_wrap_around_checkbox->set_checked(true); - 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").release_value_but_fixme_should_propagate_errors(), [this](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"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { find_text(GUI::TextEditor::SearchDirection::Forward, ShowMessageIfNoResutls::Yes); }); - 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").release_value_but_fixme_should_propagate_errors(), [this](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"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { find_text(GUI::TextEditor::SearchDirection::Backward, ShowMessageIfNoResutls::Yes); }); @@ -122,7 +122,7 @@ MainWidget::MainWidget() } else { GUI::MessageBox::show(window(), String::formatted("Not found: \"{}\"", needle), - "Not found", + "Not found"sv, GUI::MessageBox::Type::Information); } }); @@ -147,11 +147,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::try_load_from_file("/res/icons/16x16/find-previous.png").release_value_but_fixme_should_propagate_errors()); + m_find_previous_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"sv).release_value_but_fixme_should_propagate_errors()); 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::try_load_from_file("/res/icons/16x16/find-next.png").release_value_but_fixme_should_propagate_errors()); + m_find_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors()); m_find_textbox->on_return_pressed = [this] { m_find_next_button->click(); @@ -191,7 +191,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::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [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"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { m_find_replace_widget->set_visible(true); m_find_widget->set_visible(true); m_replace_widget->set_visible(true); @@ -216,7 +216,7 @@ MainWidget::MainWidget() m_statusbar->segment(1).set_clickable(true); m_statusbar->segment(1).set_menu(m_syntax_statusbar_menu); m_statusbar->segment(2).set_mode(GUI::Statusbar::Segment::Mode::Fixed); - auto width = font().width("Ln 0000, Col 000") + font().max_glyph_width(); + auto width = font().width("Ln 0000, Col 000"sv) + font().max_glyph_width(); m_statusbar->segment(2).set_fixed_width(width); m_statusbar->segment(2).set_clickable(true); m_statusbar->segment(2).set_menu(m_line_column_statusbar_menu); @@ -236,7 +236,7 @@ MainWidget::MainWidget() m_editor->on_selection_change = [this] { update_statusbar(); }; m_editor->on_highlighter_change = [this] { update_statusbar(); }; - m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [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"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) { if (editor().document().is_modified()) { auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp()); if (save_document_first_result == GUI::Dialog::ExecResult::Yes) @@ -273,7 +273,7 @@ MainWidget::MainWidget() auto file = response.release_value(); if (!m_editor->write_to_file(*file)) { - GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error); return; } @@ -291,7 +291,7 @@ MainWidget::MainWidget() return; if (!m_editor->write_to_file(*response.value())) { - GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error); } }); @@ -327,7 +327,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view() GUI::MessageBox::show( window(), String::formatted("The link to '{}' could not be opened.", url), - "Failed to open link", + "Failed to open link"sv, GUI::MessageBox::Type::Error); } }; @@ -389,26 +389,26 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_layout_toolbar_action = GUI::Action::create_checkable("&Toolbar", [&](auto& action) { action.is_checked() ? m_toolbar_container->set_visible(true) : m_toolbar_container->set_visible(false); - Config::write_bool("TextEditor", "Layout", "ShowToolbar", action.is_checked()); + Config::write_bool("TextEditor"sv, "Layout"sv, "ShowToolbar"sv, action.is_checked()); }); - auto show_toolbar = Config::read_bool("TextEditor", "Layout", "ShowToolbar", true); + auto show_toolbar = Config::read_bool("TextEditor"sv, "Layout"sv, "ShowToolbar"sv, true); m_layout_toolbar_action->set_checked(show_toolbar); m_toolbar_container->set_visible(show_toolbar); m_layout_statusbar_action = GUI::Action::create_checkable("&Status Bar", [&](auto& action) { action.is_checked() ? m_statusbar->set_visible(true) : m_statusbar->set_visible(false); - Config::write_bool("TextEditor", "Layout", "ShowStatusbar", action.is_checked()); + Config::write_bool("TextEditor"sv, "Layout"sv, "ShowStatusbar"sv, action.is_checked()); update_statusbar(); }); - auto show_statusbar = Config::read_bool("TextEditor", "Layout", "ShowStatusbar", true); + auto show_statusbar = Config::read_bool("TextEditor"sv, "Layout"sv, "ShowStatusbar"sv, true); m_layout_statusbar_action->set_checked(show_statusbar); m_statusbar->set_visible(show_statusbar); m_layout_ruler_action = GUI::Action::create_checkable("&Ruler", [&](auto& action) { action.is_checked() ? m_editor->set_ruler_visible(true) : m_editor->set_ruler_visible(false); - Config::write_bool("TextEditor", "Layout", "ShowRuler", action.is_checked()); + Config::write_bool("TextEditor"sv, "Layout"sv, "ShowRuler"sv, action.is_checked()); }); - auto show_ruler = Config::read_bool("TextEditor", "Layout", "ShowRuler", true); + auto show_ruler = Config::read_bool("TextEditor"sv, "Layout"sv, "ShowRuler"sv, true); m_layout_ruler_action->set_checked(show_ruler); m_editor->set_ruler_visible(show_ruler); @@ -420,7 +420,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) view_menu.add_separator(); - view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), + view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto picker = GUI::FontPicker::construct(&window, &m_editor->font(), false); if (picker->exec() == GUI::Dialog::ExecResult::OK) { @@ -435,15 +435,15 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode"); m_no_wrapping_action = GUI::Action::create_checkable("&No Wrapping", [&](auto&) { m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); - Config::write_string("TextEditor", "View", "WrappingMode", "None"); + Config::write_string("TextEditor"sv, "View"sv, "WrappingMode"sv, "None"sv); }); m_wrap_anywhere_action = GUI::Action::create_checkable("Wrap &Anywhere", [&](auto&) { m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAnywhere); - Config::write_string("TextEditor", "View", "WrappingMode", "Anywhere"); + Config::write_string("TextEditor"sv, "View"sv, "WrappingMode"sv, "Anywhere"sv); }); m_wrap_at_words_action = GUI::Action::create_checkable("Wrap at &Words", [&](auto&) { m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAtWords); - Config::write_string("TextEditor", "View", "WrappingMode", "Words"); + Config::write_string("TextEditor"sv, "View"sv, "WrappingMode"sv, "Words"sv); }); m_wrapping_mode_actions.add_action(*m_no_wrapping_action); @@ -454,7 +454,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) wrapping_mode_menu.add_action(*m_wrap_anywhere_action); wrapping_mode_menu.add_action(*m_wrap_at_words_action); - auto word_wrap = Config::read_string("TextEditor", "View", "WrappingMode", "Words"); + auto word_wrap = Config::read_string("TextEditor"sv, "View"sv, "WrappingMode"sv, "Words"sv); if (word_wrap == "None") { m_no_wrapping_action->set_checked(true); m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); @@ -610,7 +610,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/TextEditor.md"), "/bin/Help"); })); - help_menu.add_action(GUI::CommonActions::make_about_action("Text Editor", GUI::Icon::default_icon("app-text-editor"), &window)); + help_menu.add_action(GUI::CommonActions::make_about_action("Text Editor", GUI::Icon::default_icon("app-text-editor"sv), &window)); auto& wrapping_statusbar_menu = m_line_column_statusbar_menu->add_submenu("&Wrapping Mode"); wrapping_statusbar_menu.add_action(*m_no_wrapping_action); @@ -691,10 +691,10 @@ void MainWidget::update_title() { StringBuilder builder; if (m_path.is_empty()) - builder.append("Untitled"); + builder.append("Untitled"sv); else builder.append(m_path); - builder.append("[*] - Text Editor"); + builder.append("[*] - Text Editor"sv); window()->set_title(builder.to_string()); } @@ -742,7 +742,7 @@ void MainWidget::drop_event(GUI::DropEvent& event) if (urls.is_empty()) return; if (urls.size() > 1) { - GUI::MessageBox::show(window(), "TextEditor can only open one file at a time!", "One at a time please!", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "TextEditor can only open one file at a time!"sv, "One at a time please!"sv, GUI::MessageBox::Type::Error); return; } @@ -854,7 +854,7 @@ void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessa if (!result.is_valid() && show_message == ShowMessageIfNoResutls::Yes) { GUI::MessageBox::show(window(), String::formatted("Not found: \"{}\"", needle), - "Not found", + "Not found"sv, GUI::MessageBox::Type::Information); } } diff --git a/Userland/Applications/TextEditor/main.cpp b/Userland/Applications/TextEditor/main.cpp index a291bf46cb..11e07a7911 100644 --- a/Userland/Applications/TextEditor/main.cpp +++ b/Userland/Applications/TextEditor/main.cpp @@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domain("TextEditor"); - char const* preview_mode = "auto"; + auto preview_mode = "auto"sv; char const* file_to_edit = nullptr; Core::ArgsParser parser; parser.add_option(preview_mode, "Preview mode, one of 'none', 'html', 'markdown', 'auto'", "preview-mode", '\0', "mode"); @@ -37,9 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); - StringView preview_mode_view = preview_mode; - - auto app_icon = GUI::Icon::default_icon("app-text-editor"); + auto app_icon = GUI::Icon::default_icon("app-text-editor"sv); auto window = TRY(GUI::Window::try_create()); window->resize(640, 400); @@ -54,13 +52,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return GUI::Window::CloseRequestDecision::StayOpen; }; - if (preview_mode_view == "auto") { + if (preview_mode == "auto") { text_widget->set_auto_detect_preview_mode(true); - } else if (preview_mode_view == "markdown") { + } else if (preview_mode == "markdown") { text_widget->set_preview_mode(MainWidget::PreviewMode::Markdown); - } else if (preview_mode_view == "html") { + } else if (preview_mode == "html") { text_widget->set_preview_mode(MainWidget::PreviewMode::HTML); - } else if (preview_mode_view == "none") { + } else if (preview_mode == "none") { text_widget->set_preview_mode(MainWidget::PreviewMode::None); } else { warnln("Invalid mode '{}'", preview_mode); diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp index 9583d8c2fe..1bc253c724 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.cpp +++ b/Userland/Applications/ThemeEditor/MainWidget.cpp @@ -208,7 +208,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) { auto file_menu = TRY(window.try_add_menu("&File")); TRY(file_menu->try_add_action(GUI::CommonActions::make_open_action([&](auto&) { - auto response = FileSystemAccessClient::Client::the().try_open_file(&window, "Select theme file", "/res/themes"); + auto response = FileSystemAccessClient::Client::the().try_open_file(&window, "Select theme file", "/res/themes"sv); if (response.is_error()) return; load_from_file(*response.value()); @@ -304,7 +304,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) TRY(accessibility_menu->try_add_action(achromatomaly_accessibility_action)); auto help_menu = TRY(window.try_add_menu("&Help")); - TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Theme Editor", GUI::Icon::default_icon("app-theme-editor"), &window))); + TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Theme Editor", GUI::Icon::default_icon("app-theme-editor"sv), &window))); return {}; } @@ -604,7 +604,7 @@ void MainWidget::set_palette(Gfx::Palette palette) void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI::TextBox& path_input, PathPickerTarget path_picker_target) { bool open_folder = path_picker_target == PathPickerTarget::Folder; - auto window_title = String::formatted(open_folder ? "Select {} folder" : "Select {} file", property_display_name); + auto window_title = String::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name); auto target_path = path_input.text(); if (Core::File::exists(target_path)) { if (!Core::File::is_directory(target_path)) diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp index ea9590c035..1e9e4b5384 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp +++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp @@ -96,17 +96,17 @@ void PreviewWidget::update_preview_window_locations() void PreviewWidget::paint_preview(GUI::PaintEvent&) { - paint_window("Inactive window", m_inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, active_window_icon()); - paint_window("Active window", m_active_window_rect, Gfx::WindowTheme::WindowState::Active, inactive_window_icon()); + paint_window("Inactive window"sv, m_inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, active_window_icon()); + paint_window("Active window"sv, m_active_window_rect, Gfx::WindowTheme::WindowState::Active, inactive_window_icon()); } void PreviewWidget::paint_hightlight_window() { GUI::Painter painter(*this); - paint_window("Highlight window", m_highlight_window_rect, Gfx::WindowTheme::WindowState::Highlighted, inactive_window_icon(), 1); + paint_window("Highlight window"sv, m_highlight_window_rect, Gfx::WindowTheme::WindowState::Highlighted, inactive_window_icon(), 1); auto button_rect = Gfx::IntRect(0, 0, 80, 22).centered_within(m_highlight_window_rect); Gfx::StylePainter::paint_button(painter, button_rect, preview_palette(), Gfx::ButtonStyle::Normal, false, false, false, true, false, false); - painter.draw_text(button_rect, ":^)", Gfx::TextAlignment::Center, preview_palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap); + painter.draw_text(button_rect, ":^)"sv, Gfx::TextAlignment::Center, preview_palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap); } void PreviewWidget::second_paint_event(GUI::PaintEvent&) @@ -144,7 +144,7 @@ void PreviewWidget::drop_event(GUI::DropEvent& event) if (urls.is_empty()) return; if (urls.size() > 1) { - GUI::MessageBox::show(window(), "ThemeEditor can only open one file at a time!", "One at a time please!", GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), "ThemeEditor can only open one file at a time!"sv, "One at a time please!"sv, GUI::MessageBox::Type::Error); return; } diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index ebfce7407e..82e13efc31 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-theme-editor"); + auto app_icon = GUI::Icon::default_icon("app-theme-editor"sv); auto window = GUI::Window::construct(); auto main_widget = TRY(window->try_set_main_widget<ThemeEditor::MainWidget>()); diff --git a/Userland/Applications/VideoPlayer/main.cpp b/Userland/Applications/VideoPlayer/main.cpp index 9d3f178082..22c2d103e1 100644 --- a/Userland/Applications/VideoPlayer/main.cpp +++ b/Userland/Applications/VideoPlayer/main.cpp @@ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); auto window = TRY(GUI::Window::try_create()); - auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"); + auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv); auto const& optional_track = document->track_for_track_type(Video::TrackEntry::TrackType::Video); if (!optional_track.has_value()) return 1; diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index e580d0d717..0370a2c547 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -30,14 +30,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::try_load_from_file("/res/icons/32x32/app-welcome.png").release_value_but_fixme_should_propagate_errors()); + light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png"sv).release_value_but_fixme_should_propagate_errors()); m_web_view = *find_descendant_of_type_named<WebView::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::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors()); + m_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors()); m_next_button->on_click = [&](auto) { if (!tip_frame.is_visible()) { m_web_view->set_visible(false); @@ -52,7 +52,7 @@ WelcomeWidget::WelcomeWidget() }; m_help_button = *find_descendant_of_type_named<GUI::Button>("help_button"); - m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors()); + m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors()); m_help_button->on_click = [&](auto) { GUI::Process::spawn_or_show_error(window(), "/bin/Help"sv); }; @@ -68,11 +68,11 @@ WelcomeWidget::WelcomeWidget() GUI::Application::the()->quit(); }; - auto exec_path = Config::read_string("SystemServer", "Welcome", "Executable", {}); + auto exec_path = Config::read_string("SystemServer"sv, "Welcome"sv, "Executable"sv, {}); m_startup_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("startup_checkbox"); m_startup_checkbox->set_checked(!exec_path.is_empty()); m_startup_checkbox->on_checked = [](bool is_checked) { - Config::write_string("SystemServer", "Welcome", "Executable", is_checked ? "/bin/Welcome" : ""); + Config::write_string("SystemServer"sv, "Welcome"sv, "Executable"sv, is_checked ? "/bin/Welcome"sv : ""sv); }; open_and_parse_readme_file(); @@ -129,8 +129,8 @@ void WelcomeWidget::paint_event(GUI::PaintEvent& event) GUI::Painter painter(*this); painter.add_clip_rect(event.rect()); - static auto font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font"); - painter.draw_text({ 12, 4, 1, 30 }, "Welcome to ", *font, Gfx::TextAlignment::CenterLeft, palette().base_text()); - painter.draw_text({ 12 + font->width("Welcome to "), 4, 1, 30 }, "Serenity", font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base_text()); - painter.draw_text({ 12 + font->width("Welcome to ") + font->bold_variant().width("Serenity"), 4, 1, 30 }, "OS", font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base() == palette().window() ? palette().base_text() : palette().base()); + static auto font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font"sv); + painter.draw_text({ 12, 4, 1, 30 }, "Welcome to "sv, *font, Gfx::TextAlignment::CenterLeft, palette().base_text()); + painter.draw_text({ 12 + font->width("Welcome to "sv), 4, 1, 30 }, "Serenity"sv, font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base_text()); + painter.draw_text({ 12 + font->width("Welcome to "sv) + font->bold_variant().width("Serenity"sv), 4, 1, 30 }, "OS"sv, font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base() == palette().window() ? palette().base_text() : palette().base()); } diff --git a/Userland/Applications/Welcome/main.cpp b/Userland/Applications/Welcome/main.cpp index 988e439638..94f3c1a7c4 100644 --- a/Userland/Applications/Welcome/main.cpp +++ b/Userland/Applications/Welcome/main.cpp @@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); TRY(Core::System::unveil("/bin/Help", "x")); TRY(Core::System::unveil(nullptr, nullptr)); - auto app_icon = GUI::Icon::default_icon("app-welcome"); + auto app_icon = GUI::Icon::default_icon("app-welcome"sv); auto window = TRY(GUI::Window::try_create()); window->resize(480, 250); |