diff options
92 files changed, 334 insertions, 310 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp index fbe93fbf4d..f3acc8bada 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp @@ -1375,7 +1375,7 @@ static LanguageMapping const* resolve_likely_subtag(LanguageID const& language_i if (!language_id.script.has_value()) continue; - search_key.language = String::from_utf8_short_string("und"sv); + search_key.language = "und"_short_string; search_key.script = *language_id.script; break; diff --git a/Tests/AK/TestFlyString.cpp b/Tests/AK/TestFlyString.cpp index f2eb60b232..ff0cd0d5f7 100644 --- a/Tests/AK/TestFlyString.cpp +++ b/Tests/AK/TestFlyString.cpp @@ -22,13 +22,13 @@ TEST_CASE(empty_string) TEST_CASE(short_string) { - FlyString fly1 { MUST(String::from_utf8("foo"sv)) }; + FlyString fly1 { MUST("foo"_string) }; EXPECT_EQ(fly1, "foo"sv); - FlyString fly2 { MUST(String::from_utf8("foo"sv)) }; + FlyString fly2 { MUST("foo"_string) }; EXPECT_EQ(fly2, "foo"sv); - FlyString fly3 { MUST(String::from_utf8("bar"sv)) }; + FlyString fly3 { MUST("bar"_string) }; EXPECT_EQ(fly3, "bar"sv); EXPECT_EQ(fly1, fly2); @@ -45,15 +45,15 @@ TEST_CASE(short_string) TEST_CASE(long_string) { - FlyString fly1 { MUST(String::from_utf8("thisisdefinitelymorethan7bytes"sv)) }; + FlyString fly1 { MUST("thisisdefinitelymorethan7bytes"_string) }; EXPECT_EQ(fly1, "thisisdefinitelymorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); - FlyString fly2 { MUST(String::from_utf8("thisisdefinitelymorethan7bytes"sv)) }; + FlyString fly2 { MUST("thisisdefinitelymorethan7bytes"_string) }; EXPECT_EQ(fly2, "thisisdefinitelymorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); - FlyString fly3 { MUST(String::from_utf8("thisisalsoforsuremorethan7bytes"sv)) }; + FlyString fly3 { MUST("thisisalsoforsuremorethan7bytes"_string) }; EXPECT_EQ(fly3, "thisisalsoforsuremorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 2u); @@ -68,15 +68,15 @@ TEST_CASE(long_string) TEST_CASE(from_string_view) { - auto fly1 = MUST(FlyString::from_utf8("thisisdefinitelymorethan7bytes"sv)); + auto fly1 = MUST("thisisdefinitelymorethan7bytes"_fly_string); EXPECT_EQ(fly1, "thisisdefinitelymorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); - auto fly2 = MUST(FlyString::from_utf8("thisisdefinitelymorethan7bytes"sv)); + auto fly2 = MUST("thisisdefinitelymorethan7bytes"_fly_string); EXPECT_EQ(fly2, "thisisdefinitelymorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); - auto fly3 = MUST(FlyString::from_utf8("foo"sv)); + auto fly3 = MUST("foo"_fly_string); EXPECT_EQ(fly3, "foo"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); @@ -91,7 +91,7 @@ TEST_CASE(fly_string_keep_string_data_alive) { FlyString fly {}; { - auto string = MUST(String::from_utf8("thisisdefinitelymorethan7bytes"sv)); + auto string = MUST("thisisdefinitelymorethan7bytes"_string); fly = FlyString { string }; EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); } @@ -108,7 +108,7 @@ TEST_CASE(moved_fly_string_becomes_empty) FlyString fly1 {}; EXPECT(fly1.is_empty()); - FlyString fly2 { MUST(String::from_utf8("thisisdefinitelymorethan7bytes"sv)) }; + FlyString fly2 { MUST("thisisdefinitelymorethan7bytes"_string) }; EXPECT_EQ(fly2, "thisisdefinitelymorethan7bytes"sv); EXPECT_EQ(FlyString::number_of_fly_strings(), 1u); diff --git a/Tests/AK/TestHashMap.cpp b/Tests/AK/TestHashMap.cpp index 6e70540a9f..3ca4dbe71b 100644 --- a/Tests/AK/TestHashMap.cpp +++ b/Tests/AK/TestHashMap.cpp @@ -227,11 +227,11 @@ TEST_CASE(take) EXPECT(!map.take("foo"sv).has_value()); EXPECT(!map.take("bar"sv).has_value()); - EXPECT(!map.take(String::from_utf8_short_string("baz"sv)).has_value()); + EXPECT(!map.take("baz"_short_string).has_value()); - map.set(String::from_utf8_short_string("foo"sv), 1); - map.set(String::from_utf8_short_string("bar"sv), 2); - map.set(String::from_utf8_short_string("baz"sv), 3); + map.set("foo"_short_string, 1); + map.set("bar"_short_string, 2); + map.set("baz"_short_string, 3); auto foo = map.take("foo"sv); EXPECT_EQ(foo, 1); @@ -245,9 +245,9 @@ TEST_CASE(take) bar = map.take("bar"sv); EXPECT(!bar.has_value()); - auto baz = map.take(String::from_utf8_short_string("baz"sv)); + auto baz = map.take("baz"_short_string); EXPECT_EQ(baz, 3); - baz = map.take(String::from_utf8_short_string("baz"sv)); + baz = map.take("baz"_short_string); EXPECT(!baz.has_value()); } diff --git a/Tests/AK/TestString.cpp b/Tests/AK/TestString.cpp index 59668da04f..f992fa1bc0 100644 --- a/Tests/AK/TestString.cpp +++ b/Tests/AK/TestString.cpp @@ -21,17 +21,21 @@ TEST_CASE(construct_empty) String empty; EXPECT(empty.is_empty()); EXPECT_EQ(empty.bytes().size(), 0u); + EXPECT_EQ(empty, ""sv); - auto empty2 = MUST(String::from_utf8(""sv)); + auto empty2 = MUST(""_string); EXPECT(empty2.is_empty()); EXPECT_EQ(empty, empty2); - EXPECT_EQ(empty, ""sv); + + auto empty3 = MUST(String::from_utf8(""sv)); + EXPECT(empty3.is_empty()); + EXPECT_EQ(empty, empty3); } TEST_CASE(move_assignment) { - String string1 = MUST(String::from_utf8("hello"sv)); - string1 = MUST(String::from_utf8("friends!"sv)); + String string1 = MUST("hello"_string); + string1 = MUST("friends!"_string); EXPECT_EQ(string1, "friends!"sv); } @@ -47,6 +51,16 @@ TEST_CASE(short_strings) EXPECT_EQ(string2.is_short_string(), true); EXPECT_EQ(string2.bytes().size(), 7u); EXPECT_EQ(string2, string1); + + auto string3 = MUST("abcdefg"_string); + EXPECT_EQ(string3.is_short_string(), true); + EXPECT_EQ(string3.bytes().size(), 7u); + EXPECT_EQ(string3, string1); + + constexpr auto string4 = "abcdefg"_short_string; + EXPECT_EQ(string4.is_short_string(), true); + EXPECT_EQ(string4.bytes().size(), 7u); + EXPECT_EQ(string4, string1); #else auto string1 = MUST(String::from_utf8("abc"sv)); EXPECT_EQ(string1.is_short_string(), true); @@ -57,6 +71,16 @@ TEST_CASE(short_strings) EXPECT_EQ(string2.is_short_string(), true); EXPECT_EQ(string2.bytes().size(), 3u); EXPECT_EQ(string2, string1); + + auto string3 = MUST("abc"_string); + EXPECT_EQ(string3.is_short_string(), true); + EXPECT_EQ(string3.bytes().size(), 3u); + EXPECT_EQ(string3, string1); + + constexpr auto string4 = "abc"_short_string; + EXPECT_EQ(string4.is_short_string(), true); + EXPECT_EQ(string4.bytes().size(), 3u); + EXPECT_EQ(string4, string1); #endif } @@ -138,7 +162,7 @@ TEST_CASE(from_code_points) TEST_CASE(substring) { - auto superstring = MUST(String::from_utf8("Hello I am a long string"sv)); + auto superstring = MUST("Hello I am a long string"_string); auto short_substring = MUST(superstring.substring_from_byte_offset(0, 5)); EXPECT_EQ(short_substring, "Hello"sv); @@ -148,7 +172,7 @@ TEST_CASE(substring) TEST_CASE(substring_with_shared_superstring) { - auto superstring = MUST(String::from_utf8("Hello I am a long string"sv)); + auto superstring = MUST("Hello I am a long string"_string); auto substring1 = MUST(superstring.substring_from_byte_offset_with_shared_superstring(0, 5)); EXPECT_EQ(substring1, "Hello"sv); @@ -159,7 +183,7 @@ TEST_CASE(substring_with_shared_superstring) TEST_CASE(code_points) { - auto string = MUST(String::from_utf8("🦬🪒"sv)); + auto string = MUST("🦬🪒"_string); Vector<u32> code_points; for (auto code_point : string.code_points()) @@ -182,20 +206,20 @@ TEST_CASE(string_builder) TEST_CASE(ak_format) { - auto foo = MUST(String::formatted("Hello {}", MUST(String::from_utf8("friends"sv)))); + auto foo = MUST(String::formatted("Hello {}", MUST("friends"_string))); EXPECT_EQ(foo, "Hello friends"sv); } TEST_CASE(replace) { { - auto haystack = MUST(String::from_utf8("Hello enemies"sv)); + auto haystack = MUST("Hello enemies"_string); auto result = MUST(haystack.replace("enemies"sv, "friends"sv, ReplaceMode::All)); EXPECT_EQ(result, "Hello friends"sv); } { - auto base_title = MUST(String::from_utf8("anon@courage:~"sv)); + auto base_title = MUST("anon@courage:~"_string); auto result = MUST(base_title.replace("[*]"sv, "(*)"sv, ReplaceMode::FirstOnly)); EXPECT_EQ(result, "anon@courage:~"sv); } @@ -221,17 +245,17 @@ TEST_CASE(reverse) TEST_CASE(to_lowercase) { { - auto string = MUST(String::from_utf8("Aa"sv)); + auto string = MUST("Aa"_string); auto result = MUST(string.to_lowercase()); EXPECT_EQ(result, "aa"sv); } { - auto string = MUST(String::from_utf8("Ωω"sv)); + auto string = MUST("Ωω"_string); auto result = MUST(string.to_lowercase()); EXPECT_EQ(result, "ωω"sv); } { - auto string = MUST(String::from_utf8("İi̇"sv)); + auto string = MUST("İi̇"_string); auto result = MUST(string.to_lowercase()); EXPECT_EQ(result, "i̇i̇"sv); } @@ -240,17 +264,17 @@ TEST_CASE(to_lowercase) TEST_CASE(to_uppercase) { { - auto string = MUST(String::from_utf8("Aa"sv)); + auto string = MUST("Aa"_string); auto result = MUST(string.to_uppercase()); EXPECT_EQ(result, "AA"sv); } { - auto string = MUST(String::from_utf8("Ωω"sv)); + auto string = MUST("Ωω"_string); auto result = MUST(string.to_uppercase()); EXPECT_EQ(result, "ΩΩ"sv); } { - auto string = MUST(String::from_utf8("ʼn"sv)); + auto string = MUST("ʼn"_string); auto result = MUST(string.to_uppercase()); EXPECT_EQ(result, "ʼN"sv); } @@ -259,22 +283,22 @@ TEST_CASE(to_uppercase) TEST_CASE(to_titlecase) { { - auto string = MUST(String::from_utf8("foo bar baz"sv)); + auto string = MUST("foo bar baz"_string); auto result = MUST(string.to_titlecase()); EXPECT_EQ(result, "Foo Bar Baz"sv); } { - auto string = MUST(String::from_utf8("foo \n \r bar \t baz"sv)); + auto string = MUST("foo \n \r bar \t baz"_string); auto result = MUST(string.to_titlecase()); EXPECT_EQ(result, "Foo \n \r Bar \t Baz"sv); } { - auto string = MUST(String::from_utf8("f\"oo\" b'ar'"sv)); + auto string = MUST("f\"oo\" b'ar'"_string); auto result = MUST(string.to_titlecase()); EXPECT_EQ(result, "F\"Oo\" B'ar'"sv); } { - auto string = MUST(String::from_utf8("123dollars"sv)); + auto string = MUST("123dollars"_string); auto result = MUST(string.to_titlecase()); EXPECT_EQ(result, "123Dollars"sv); } @@ -289,10 +313,10 @@ TEST_CASE(equals_ignoring_case) EXPECT(MUST(string1.equals_ignoring_case(string2))); } { - auto string1 = MUST(String::from_utf8("abcd"sv)); - auto string2 = MUST(String::from_utf8("ABCD"sv)); - auto string3 = MUST(String::from_utf8("AbCd"sv)); - auto string4 = MUST(String::from_utf8("dcba"sv)); + auto string1 = MUST("abcd"_string); + auto string2 = MUST("ABCD"_string); + auto string3 = MUST("AbCd"_string); + auto string4 = MUST("dcba"_string); EXPECT(MUST(string1.equals_ignoring_case(string2))); EXPECT(MUST(string1.equals_ignoring_case(string3))); @@ -307,12 +331,12 @@ TEST_CASE(equals_ignoring_case) EXPECT(!MUST(string3.equals_ignoring_case(string4))); } { - auto string1 = MUST(String::from_utf8("\u00DF"sv)); // LATIN SMALL LETTER SHARP S - auto string2 = MUST(String::from_utf8("SS"sv)); - auto string3 = MUST(String::from_utf8("Ss"sv)); - auto string4 = MUST(String::from_utf8("ss"sv)); - auto string5 = MUST(String::from_utf8("S"sv)); - auto string6 = MUST(String::from_utf8("s"sv)); + auto string1 = MUST("\u00DF"_string); // LATIN SMALL LETTER SHARP S + auto string2 = MUST("SS"_string); + auto string3 = MUST("Ss"_string); + auto string4 = MUST("ss"_string); + auto string5 = MUST("S"_string); + auto string6 = MUST("s"_string); EXPECT(MUST(string1.equals_ignoring_case(string2))); EXPECT(MUST(string1.equals_ignoring_case(string3))); @@ -342,8 +366,8 @@ TEST_CASE(equals_ignoring_case) TEST_CASE(is_one_of) { - auto foo = MUST(String::from_utf8("foo"sv)); - auto bar = MUST(String::from_utf8("bar"sv)); + auto foo = MUST("foo"_string); + auto bar = MUST("bar"_string); EXPECT(foo.is_one_of(foo)); EXPECT(foo.is_one_of(foo, bar)); @@ -359,7 +383,7 @@ TEST_CASE(is_one_of) TEST_CASE(split) { { - auto test = MUST(String::from_utf8("foo bar baz"sv)); + auto test = MUST("foo bar baz"_string); auto parts = MUST(test.split(' ')); EXPECT_EQ(parts.size(), 3u); EXPECT_EQ(parts[0], "foo"); @@ -367,7 +391,7 @@ TEST_CASE(split) EXPECT_EQ(parts[2], "baz"); } { - auto test = MUST(String::from_utf8("ωΣ2ωΣω"sv)); + auto test = MUST("ωΣ2ωΣω"_string); auto parts = MUST(test.split(0x03A3u)); EXPECT_EQ(parts.size(), 3u); EXPECT_EQ(parts[0], "ω"sv); @@ -387,7 +411,7 @@ TEST_CASE(find_byte_offset) EXPECT(!index2.has_value()); } { - auto string = MUST(String::from_utf8("foo"sv)); + auto string = MUST("foo"_string); auto index1 = string.find_byte_offset('f'); EXPECT_EQ(index1, 0u); @@ -402,7 +426,7 @@ TEST_CASE(find_byte_offset) EXPECT(!index4.has_value()); } { - auto string = MUST(String::from_utf8("foo"sv)); + auto string = MUST("foo"_string); auto index1 = string.find_byte_offset("fo"sv); EXPECT_EQ(index1, 0u); @@ -417,7 +441,7 @@ TEST_CASE(find_byte_offset) EXPECT(!index4.has_value()); } { - auto string = MUST(String::from_utf8("ωΣωΣω"sv)); + auto string = MUST("ωΣωΣω"_string); auto index1 = string.find_byte_offset(0x03C9U); EXPECT_EQ(index1, 0u); @@ -435,7 +459,7 @@ TEST_CASE(find_byte_offset) EXPECT_EQ(index5, 8u); } { - auto string = MUST(String::from_utf8("ωΣωΣω"sv)); + auto string = MUST("ωΣωΣω"_string); auto index1 = string.find_byte_offset("ω"sv); EXPECT_EQ(index1, 0u); @@ -549,7 +573,7 @@ TEST_CASE(join) auto string5 = MUST(String::join(',', Array { 1, 2, 3 }, "[{}]"sv)); EXPECT_EQ(string5, "[1],[2],[3]"sv); - auto string6 = MUST(String::join(String::from_utf8_short_string("!!!"sv), Array { "foo"sv, "bar"sv, "baz"sv })); + auto string6 = MUST(String::join("!!!"_short_string, Array { "foo"sv, "bar"sv, "baz"sv })); EXPECT_EQ(string6, "foo!!!bar!!!baz"sv); auto string7 = MUST(String::join(" - "sv, Array { 1, 16, 256, 4096 }, "[{:#04x}]"sv)); @@ -571,7 +595,7 @@ TEST_CASE(trim) EXPECT(result.is_empty()); } { - auto string = MUST(String::from_utf8("word"sv)); + auto string = MUST("word"_string); auto result = MUST(string.trim(" "sv, TrimMode::Both)); EXPECT_EQ(result, "word"sv); @@ -583,7 +607,7 @@ TEST_CASE(trim) EXPECT_EQ(result, "word"sv); } { - auto string = MUST(String::from_utf8(" word"sv)); + auto string = MUST(" word"_string); auto result = MUST(string.trim(" "sv, TrimMode::Both)); EXPECT_EQ(result, "word"sv); @@ -595,7 +619,7 @@ TEST_CASE(trim) EXPECT_EQ(result, " word"sv); } { - auto string = MUST(String::from_utf8("word "sv)); + auto string = MUST("word "_string); auto result = MUST(string.trim(" "sv, TrimMode::Both)); EXPECT_EQ(result, "word"sv); @@ -607,7 +631,7 @@ TEST_CASE(trim) EXPECT_EQ(result, "word"sv); } { - auto string = MUST(String::from_utf8(" word "sv)); + auto string = MUST(" word "_string); auto result = MUST(string.trim(" "sv, TrimMode::Both)); EXPECT_EQ(result, "word"sv); @@ -619,7 +643,7 @@ TEST_CASE(trim) EXPECT_EQ(result, " word"sv); } { - auto string = MUST(String::from_utf8(" word "sv)); + auto string = MUST(" word "_string); auto result = MUST(string.trim("\t"sv, TrimMode::Both)); EXPECT_EQ(result, " word "sv); @@ -631,7 +655,7 @@ TEST_CASE(trim) EXPECT_EQ(result, " word "sv); } { - auto string = MUST(String::from_utf8("ωΣωΣω"sv)); + auto string = MUST("ωΣωΣω"_string); auto result = MUST(string.trim("ω"sv, TrimMode::Both)); EXPECT_EQ(result, "ΣωΣ"sv); @@ -643,7 +667,7 @@ TEST_CASE(trim) EXPECT_EQ(result, "ωΣωΣ"sv); } { - auto string = MUST(String::from_utf8("ωΣωΣω"sv)); + auto string = MUST("ωΣωΣω"_string); auto result = MUST(string.trim("ωΣ"sv, TrimMode::Both)); EXPECT(result.is_empty()); @@ -655,7 +679,7 @@ TEST_CASE(trim) EXPECT(result.is_empty()); } { - auto string = MUST(String::from_utf8("ωΣωΣω"sv)); + auto string = MUST("ωΣωΣω"_string); auto result = MUST(string.trim("Σω"sv, TrimMode::Both)); EXPECT(result.is_empty()); diff --git a/Tests/AK/TestUtf16.cpp b/Tests/AK/TestUtf16.cpp index ada7196bc2..302e5357e2 100644 --- a/Tests/AK/TestUtf16.cpp +++ b/Tests/AK/TestUtf16.cpp @@ -53,7 +53,7 @@ TEST_CASE(decode_utf8) TEST_CASE(encode_utf8) { { - auto utf8_string = MUST(String::from_utf8("Привет, мир! 😀 γειά σου κόσμος こんにちは世界"sv)); + auto utf8_string = MUST("Привет, мир! 😀 γειά σου κόσμος こんにちは世界"_string); auto string = MUST(AK::utf8_to_utf16(utf8_string)); Utf16View view { string }; EXPECT_EQ(MUST(view.to_utf8(Utf16View::AllowInvalidCodeUnits::Yes)), utf8_string); diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 6f4d1c81c8..149a8cc29f 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -85,7 +85,7 @@ private: m_root_container->set_layout<GUI::VerticalBoxLayout>(4, 0); m_root_container->set_frame_shape(Gfx::FrameShape::Window); - m_percent_box = m_root_container->add<GUI::CheckBox>(String::from_utf8_short_string("\xE2\x84\xB9"sv)); + m_percent_box = m_root_container->add<GUI::CheckBox>("\xE2\x84\xB9"_short_string); m_percent_box->set_tooltip(m_show_percent ? "Hide percent" : "Show percent"); m_percent_box->set_checked(m_show_percent); m_percent_box->on_checked = [&](bool show_percent) { @@ -110,7 +110,7 @@ private: update(); }; - m_mute_box = m_root_container->add<GUI::CheckBox>(String::from_utf8_short_string("\xE2\x9D\x8C"sv)); + m_mute_box = m_root_container->add<GUI::CheckBox>("\xE2\x9D\x8C"_short_string); m_mute_box->set_checked(m_audio_muted); m_mute_box->set_tooltip(m_audio_muted ? "Unmute" : "Mute"); m_mute_box->on_checked = [&](bool is_muted) { diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 5155b9e596..ac6cfa313f 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -84,7 +84,7 @@ DownloadWidget::DownloadWidget(const URL& url) destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); destination_label.set_fixed_height(16); - m_close_on_finish_checkbox = add<GUI::CheckBox>(String::from_utf8("Close when finished"sv).release_value_but_fixme_should_propagate_errors()); + m_close_on_finish_checkbox = add<GUI::CheckBox>("Close when finished"_string.release_value_but_fixme_should_propagate_errors()); m_close_on_finish_checkbox->set_checked(close_on_finish); m_close_on_finish_checkbox->on_checked = [&](bool checked) { @@ -94,7 +94,7 @@ DownloadWidget::DownloadWidget(const URL& url) auto& button_container = add<GUI::Widget>(); button_container.set_layout<GUI::HorizontalBoxLayout>(); button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); - m_cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); + m_cancel_button = button_container.add<GUI::Button>("Cancel"_short_string); m_cancel_button->set_fixed_size(100, 22); m_cancel_button->on_click = [this](auto) { bool success = m_download->stop(); @@ -102,7 +102,7 @@ DownloadWidget::DownloadWidget(const URL& url) window()->close(); }; - m_close_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + m_close_button = button_container.add<GUI::Button>("OK"_short_string); m_close_button->set_enabled(false); m_close_button->set_fixed_size(100, 22); m_close_button->on_click = [this](auto) { @@ -151,7 +151,7 @@ void DownloadWidget::did_finish(bool success) 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(String::from_utf8("Open in Folder"sv).release_value_but_fixme_should_propagate_errors()); + m_cancel_button->set_text("Open in Folder"_string.release_value_but_fixme_should_propagate_errors()); m_cancel_button->on_click = [this](auto) { Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename())); window()->close(); diff --git a/Userland/Applications/Calculator/RoundingDialog.cpp b/Userland/Applications/Calculator/RoundingDialog.cpp index 759c17c5e2..9f9e49e709 100644 --- a/Userland/Applications/Calculator/RoundingDialog.cpp +++ b/Userland/Applications/Calculator/RoundingDialog.cpp @@ -46,8 +46,8 @@ RoundingDialog::RoundingDialog(GUI::Window* parent_window, StringView title) m_rounding_spinbox = GUI::SpinBox::construct(); m_buttons_container = GUI::Widget::construct(); - m_ok_button = GUI::DialogButton::construct(String::from_utf8_short_string("OK"sv)); - m_cancel_button = GUI::DialogButton::construct(String::from_utf8_short_string("Cancel"sv)); + m_ok_button = GUI::DialogButton::construct("OK"_short_string); + m_cancel_button = GUI::DialogButton::construct("Cancel"_short_string); main_widget->add_child(*m_rounding_spinbox); main_widget->add_child(*m_buttons_container); diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 2e02f94098..3be8ec5aa7 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -90,7 +90,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) button_container.set_fixed_height(20); button_container.set_layout<GUI::HorizontalBoxLayout>(); button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); - auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& ok_button = button_container.add<GUI::Button>("OK"_short_string); ok_button.set_fixed_size(80, 20); ok_button.on_click = [this](auto) { dbgln("TODO: Add event icon on specific tile"); diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index f268ddd690..b9a8a73b34 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -154,17 +154,17 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) TRY(button_widget->add_spacer()); - auto ok_button = TRY(make_button(String::from_utf8_short_string("OK"sv), button_widget)); + auto ok_button = TRY(make_button("OK"_short_string, button_widget)); ok_button->on_click = [this](auto) { if (apply_changes()) close(); }; - auto cancel_button = TRY(make_button(String::from_utf8_short_string("Cancel"sv), button_widget)); + auto cancel_button = TRY(make_button("Cancel"_short_string, button_widget)); cancel_button->on_click = [this](auto) { close(); }; - m_apply_button = TRY(make_button(String::from_utf8_short_string("Apply"sv), button_widget)); + m_apply_button = TRY(make_button("Apply"_short_string, button_widget)); m_apply_button->on_click = [this](auto) { apply_changes(); }; m_apply_button->set_enabled(false); diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp index be58ec69f1..9478604a9e 100644 --- a/Userland/Applications/Help/MainWidget.cpp +++ b/Userland/Applications/Help/MainWidget.cpp @@ -213,7 +213,7 @@ 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")); - String help_page_path = TRY(TRY(try_make_ref_counted<Manual::PageNode>(Manual::sections[1 - 1], TRY(String::from_utf8("Help"sv))))->path()); + String help_page_path = TRY(TRY(try_make_ref_counted<Manual::PageNode>(Manual::sections[1 - 1], TRY("Help"_string)))->path()); TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window))); TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [this, help_page_path = move(help_page_path)](auto&) { open_page(help_page_path); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 738e102d3e..438212deb6 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -88,11 +88,11 @@ void KeyboardMapperWidget::create_frame() m_map_group->set_layout<GUI::HorizontalBoxLayout>(); m_map_group->set_fixed_width(450); - add_map_radio_button("map"sv, String::from_utf8_short_string("Default"sv)); - add_map_radio_button("shift_map"sv, String::from_utf8_short_string("Shift"sv)); - add_map_radio_button("altgr_map"sv, String::from_utf8_short_string("AltGr"sv)); - add_map_radio_button("alt_map"sv, String::from_utf8_short_string("Alt"sv)); - add_map_radio_button("shift_altgr_map"sv, String::from_utf8("Shift+AltGr"sv).release_value_but_fixme_should_propagate_errors()); + add_map_radio_button("map"sv, "Default"_short_string); + add_map_radio_button("shift_map"sv, "Shift"_short_string); + add_map_radio_button("altgr_map"sv, "AltGr"_short_string); + add_map_radio_button("alt_map"sv, "Alt"_short_string); + add_map_radio_button("shift_altgr_map"sv, "Shift+AltGr"_string.release_value_but_fixme_should_propagate_errors()); bottom_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); } diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 3d0210dee4..d2ebec6cd4 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -339,11 +339,11 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar) toolbar.add_separator(); m_show_clipping_paths = toolbar.add<GUI::CheckBox>(); - m_show_clipping_paths->set_text(String::from_utf8("Show clipping paths"sv).release_value_but_fixme_should_propagate_errors()); + m_show_clipping_paths->set_text("Show clipping paths"_string.release_value_but_fixme_should_propagate_errors()); m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No); m_show_clipping_paths->on_checked = [&](auto checked) { m_viewer->set_show_clipping_paths(checked); }; m_show_images = toolbar.add<GUI::CheckBox>(); - m_show_images->set_text(String::from_utf8("Show images"sv).release_value_but_fixme_should_propagate_errors()); + m_show_images->set_text("Show images"_string.release_value_but_fixme_should_propagate_errors()); m_show_images->set_checked(m_viewer->show_images(), GUI::AllowCallback::No); m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); }; } diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index dec5c81ed9..f837a5e0cf 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -110,12 +110,12 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) }; auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>(); - set_defaults_checkbox.set_text(String::from_utf8("Use these settings as default"sv).release_value_but_fixme_should_propagate_errors()); + set_defaults_checkbox.set_text("Use these settings as default"_string.release_value_but_fixme_should_propagate_errors()); auto& button_container = main_widget->add<GUI::Widget>(); button_container.set_layout<GUI::HorizontalBoxLayout>(); - auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& ok_button = button_container.add<GUI::Button>("OK"_short_string); ok_button.on_click = [&](auto) { if (set_defaults_checkbox.is_checked()) { Config::write_string("PixelPaint"sv, "NewImage"sv, "Name"sv, m_image_name); @@ -128,7 +128,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) }; ok_button.set_default(true); - auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); + auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index b18123887f..a39da30d04 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -47,13 +47,13 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win auto& button_container = main_widget->add<GUI::Widget>(); button_container.set_layout<GUI::HorizontalBoxLayout>(); - auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& ok_button = button_container.add<GUI::Button>("OK"_short_string); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; ok_button.set_default(true); - auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); + auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Applications/PixelPaint/FilterParams.h b/Userland/Applications/PixelPaint/FilterParams.h index e8d0d02b94..1e8df1918e 100644 --- a/Userland/Applications/PixelPaint/FilterParams.h +++ b/Userland/Applications/PixelPaint/FilterParams.h @@ -80,13 +80,13 @@ private: } } - auto& norm_checkbox = main_widget->template add<GUI::CheckBox>(String::from_utf8("Normalize"sv).release_value_but_fixme_should_propagate_errors()); + auto& norm_checkbox = main_widget->template add<GUI::CheckBox>("Normalize"_string.release_value_but_fixme_should_propagate_errors()); norm_checkbox.set_checked(false); - auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>(String::from_utf8_short_string("Wrap"sv)); + auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>("Wrap"_short_string); wrap_checkbox.set_checked(m_should_wrap); - auto& button = main_widget->template add<GUI::Button>(String::from_utf8_short_string("Done"sv)); + auto& button = main_widget->template add<GUI::Button>("Done"_short_string); button.on_click = [&](auto) { m_should_wrap = wrap_checkbox.is_checked(); if (norm_checkbox.is_checked()) diff --git a/Userland/Applications/PixelPaint/Filters/Bloom.cpp b/Userland/Applications/PixelPaint/Filters/Bloom.cpp index 6ebad51bce..aa51a7080f 100644 --- a/Userland/Applications/PixelPaint/Filters/Bloom.cpp +++ b/Userland/Applications/PixelPaint/Filters/Bloom.cpp @@ -69,7 +69,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget() radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_label->set_fixed_height(20); - auto radius_slider = TRY(radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto radius_slider = TRY(radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); radius_slider->set_range(0, 50); radius_slider->set_value(m_blur_radius); radius_slider->on_change = [&](int value) { diff --git a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp index 6be4e75f77..870163dbd6 100644 --- a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp +++ b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp @@ -47,7 +47,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_fixed_height(10); - auto asymmetric_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Use Asymmetric Radii"sv)))); + auto asymmetric_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("Use Asymmetric Radii"_string))); asymmetric_checkbox->set_checked(false); asymmetric_checkbox->set_fixed_height(15); asymmetric_checkbox->on_checked = [this](bool checked) { @@ -68,7 +68,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() update_preview(); }; - m_vector_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Use Direction and magnitude"sv)))); + m_vector_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("Use Direction and magnitude"_string))); m_vector_checkbox->set_checked(false); m_vector_checkbox->set_visible(false); m_vector_checkbox->set_fixed_height(15); @@ -92,7 +92,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_label->set_fixed_size(50, 20); - auto radius_slider = TRY(m_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto radius_slider = TRY(m_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); radius_slider->set_range(0, 25); radius_slider->set_value(m_radius); radius_slider->on_change = [&](int value) { @@ -113,7 +113,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() radius_x_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_x_label->set_fixed_size(50, 20); - m_radius_x_slider = TRY(radius_x_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + m_radius_x_slider = TRY(radius_x_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); m_radius_x_slider->set_range(0, 50); m_radius_x_slider->set_value(m_radius_x); m_radius_x_slider->on_change = [&](int value) { @@ -129,7 +129,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_y_label->set_fixed_size(50, 20); - m_radius_y_slider = TRY(radius_y_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + m_radius_y_slider = TRY(radius_y_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); m_radius_y_slider->set_range(0, 50); m_radius_y_slider->set_value(m_radius_y); m_radius_y_slider->on_change = [&](int value) { @@ -150,7 +150,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() angle_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); angle_label->set_fixed_size(60, 20); - m_angle_slider = TRY(angle_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("°"sv))); + m_angle_slider = TRY(angle_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "°"_short_string)); m_angle_slider->set_range(0, 360); m_angle_slider->set_value(m_angle); m_angle_slider->on_change = [&](int value) { @@ -166,7 +166,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); magnitude_label->set_fixed_size(60, 20); - m_magnitude_slider = TRY(magnitude_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + m_magnitude_slider = TRY(magnitude_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); m_magnitude_slider->set_range(0, 50); m_magnitude_slider->set_value(m_radius); m_magnitude_slider->on_change = [&](int value) { @@ -178,7 +178,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() gaussian_container->set_fixed_height(20); TRY(gaussian_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); - m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Approximate Gaussian Blur"sv)))); + m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>(TRY("Approximate Gaussian Blur"_string))); m_gaussian_checkbox->set_checked(m_approximate_gauss); m_gaussian_checkbox->set_tooltip("A real gaussian blur can be approximated by running the box blur multiple times with different weights."); m_gaussian_checkbox->on_checked = [this](bool checked) { diff --git a/Userland/Applications/PixelPaint/Filters/Sepia.cpp b/Userland/Applications/PixelPaint/Filters/Sepia.cpp index 789ebdc9f5..1755e8f96a 100644 --- a/Userland/Applications/PixelPaint/Filters/Sepia.cpp +++ b/Userland/Applications/PixelPaint/Filters/Sepia.cpp @@ -36,7 +36,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget() amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); amount_label->set_fixed_size(50, 20); - auto amount_slider = TRY(amount_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto amount_slider = TRY(amount_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); amount_slider->set_range(0, 100); amount_slider->set_value(m_amount * 100); amount_slider->on_change = [this](int value) { diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp index f436773540..c9ba4f8137 100644 --- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp @@ -56,7 +56,7 @@ LayerPropertiesWidget::LayerPropertiesWidget() m_layer->set_opacity_percent(value); }; - m_visibility_checkbox = group_box.add<GUI::CheckBox>(String::from_utf8_short_string("Visible"sv)); + m_visibility_checkbox = group_box.add<GUI::CheckBox>("Visible"_short_string); m_visibility_checkbox->set_fixed_height(20); m_visibility_checkbox->on_checked = [this](bool checked) { if (m_layer) diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp index 4520ecae66..383963c14b 100644 --- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp @@ -151,7 +151,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget() size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); - auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); size_slider->set_range(1, 100); size_slider->set_value(m_size); size_slider->set_override_cursor(cursor()); @@ -171,7 +171,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget() hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); - auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); hardness_slider->set_range(1, 100); hardness_slider->set_value(m_hardness); diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp index 4fc56ce9e1..39e6a83f0c 100644 --- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp @@ -75,7 +75,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget() threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); threshold_label->set_fixed_size(80, 20); - auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); threshold_slider->set_range(0, 100); threshold_slider->set_value(m_threshold); diff --git a/Userland/Applications/PixelPaint/Tools/CloneTool.cpp b/Userland/Applications/PixelPaint/Tools/CloneTool.cpp index 6f3a6d333b..4e64896bba 100644 --- a/Userland/Applications/PixelPaint/Tools/CloneTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/CloneTool.cpp @@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget() size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); - auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); size_slider->set_range(1, 100); size_slider->set_value(size()); @@ -164,7 +164,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget() hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); - auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); hardness_slider->set_range(1, 100); hardness_slider->on_change = [&](int value) { set_hardness(value); diff --git a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp index d46888b0e5..a1140171fe 100644 --- a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp @@ -140,7 +140,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); thickness_label->set_fixed_size(80, 20); - auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); thickness_slider->set_range(1, 10); thickness_slider->set_value(m_thickness); @@ -157,9 +157,9 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>()); (void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>()); - auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Outline"sv))); - auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Fill"sv))); - auto aa_enable_checkbox = TRY(mode_radio_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Anti-alias"sv)))); + auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Outline"_short_string)); + auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Fill"_short_string)); + auto aa_enable_checkbox = TRY(mode_radio_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string))); aa_enable_checkbox->on_checked = [this](bool checked) { m_antialias_enabled = checked; diff --git a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp index e28ffc905f..46c432f479 100644 --- a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp @@ -67,7 +67,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); - auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); size_slider->set_range(1, 100); size_slider->set_value(size()); @@ -85,7 +85,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); - auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); hardness_slider->set_range(1, 100); hardness_slider->set_value(hardness()); @@ -100,7 +100,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() auto use_secondary_color_checkbox = TRY(secondary_color_container->try_add<GUI::CheckBox>()); use_secondary_color_checkbox->set_checked(m_use_secondary_color); - use_secondary_color_checkbox->set_text(TRY(String::from_utf8("Use secondary color"sv))); + use_secondary_color_checkbox->set_text(TRY("Use secondary color"_string)); use_secondary_color_checkbox->on_checked = [this](bool checked) { m_use_secondary_color = checked; }; @@ -114,8 +114,8 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>()); (void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>()); - auto pencil_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Pencil"sv))); - auto brush_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Brush"sv))); + auto pencil_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Pencil"_short_string)); + auto brush_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Brush"_short_string)); pencil_mode_radio->on_checked = [this, hardness_slider, size_slider](bool) { m_draw_mode = DrawMode::Pencil; diff --git a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp index b8f7181ecd..78bb405cc3 100644 --- a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp @@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() set_primary_slider(opacity_slider); - auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Use secondary color"sv)))); + auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Use secondary color"_string))); use_secondary_color_checkbox->on_checked = [this](bool checked) { m_use_secondary_color = checked; m_editor->update(); @@ -217,7 +217,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>()); button_container->add_spacer().release_value_but_fixme_should_propagate_errors(); - auto apply_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Apply"sv))); + auto apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_short_string)); apply_button->on_click = [this](auto) { rasterize_gradient(); }; diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index 67d3c15e23..ac1b5f1073 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -191,7 +191,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget() snapping_label->set_fixed_size(80, 20); snapping_label->set_tooltip("Press Shift to snap"); - auto snapping_slider = TRY(snapping_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto snapping_slider = TRY(snapping_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); snapping_slider->set_range(0, 50); snapping_slider->set_value(m_snap_size); diff --git a/Userland/Applications/PixelPaint/Tools/LineTool.cpp b/Userland/Applications/PixelPaint/Tools/LineTool.cpp index 7aa170cc97..a6cfc85caa 100644 --- a/Userland/Applications/PixelPaint/Tools/LineTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/LineTool.cpp @@ -133,7 +133,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget() thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); thickness_label->set_fixed_size(80, 20); - auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); thickness_slider->set_range(1, 10); thickness_slider->set_value(m_thickness); @@ -150,7 +150,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget() mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); - auto aa_enable_checkbox = TRY(mode_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Anti-alias"sv)))); + auto aa_enable_checkbox = TRY(mode_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string))); aa_enable_checkbox->on_checked = [this](bool checked) { m_antialias_enabled = checked; }; diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index 0dd4a902ef..10252259bc 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -304,9 +304,9 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget() auto mode_radio_container = TRY(selection_mode_container->try_add<GUI::Widget>()); (void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>()); - m_selection_mode_foreground = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY(String::from_utf8("Foreground"sv)))); + m_selection_mode_foreground = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Foreground"_string))); - m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY(String::from_utf8("Active Layer"sv)))); + m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Active Layer"_string))); m_selection_mode_foreground->on_checked = [this](bool) { m_layer_selection_mode = LayerSelectionMode::ForegroundLayer; diff --git a/Userland/Applications/PixelPaint/Tools/PenTool.cpp b/Userland/Applications/PixelPaint/Tools/PenTool.cpp index e6233c971b..b72c48ef73 100644 --- a/Userland/Applications/PixelPaint/Tools/PenTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PenTool.cpp @@ -49,7 +49,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget() size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); - auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); size_slider->set_range(1, 20); size_slider->set_value(size()); diff --git a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp index 5f95194300..ce231098a8 100644 --- a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp @@ -46,7 +46,7 @@ ErrorOr<GUI::Widget*> PickerTool::get_properties_widget() auto properties_widget = TRY(GUI::Widget::try_create()); (void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Sample all layers"sv)))); + auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Sample all layers"_string))); sample_checkbox->set_checked(m_sample_all_layers); sample_checkbox->on_checked = [this](bool value) { m_sample_all_layers = value; diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp index 0375b3b26c..f1bfc6c269 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp @@ -166,7 +166,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget() feather_label->set_fixed_size(80, 20); int const feather_slider_max = 100; - auto feather_slider = TRY(feather_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto feather_slider = TRY(feather_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); feather_slider->set_range(0, feather_slider_max); feather_slider->set_value((int)floorf(m_edge_feathering * (float)feather_slider_max)); diff --git a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp index d41d26f0b8..f7987dd1dd 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp @@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() thickness_or_radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); thickness_or_radius_label->set_fixed_size(80, 20); - auto thickness_or_radius_slider = TRY(thickness_or_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto thickness_or_radius_slider = TRY(thickness_or_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); thickness_or_radius_slider->on_change = [&](int value) { if (m_fill_mode == FillMode::RoundedCorners) { @@ -187,12 +187,12 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>()); (void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>()); - auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Outline"sv))); - auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Fill"sv))); - auto gradient_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY(String::from_utf8("Gradient"sv)))); + auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Outline"_short_string)); + auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Fill"_short_string)); + auto gradient_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Gradient"_string))); mode_radio_container->set_fixed_width(70); - auto rounded_corners_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Rounded"sv))); + auto rounded_corners_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Rounded"_short_string)); outline_mode_radio->on_checked = [this, update_slider](bool) { m_fill_mode = FillMode::Outline; @@ -215,7 +215,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() auto mode_extras_container = TRY(mode_container->try_add<GUI::Widget>()); (void)TRY(mode_extras_container->try_set_layout<GUI::VerticalBoxLayout>()); - auto aa_enable_checkbox = TRY(mode_extras_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Anti-alias"sv)))); + auto aa_enable_checkbox = TRY(mode_extras_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string))); aa_enable_checkbox->on_checked = [this](bool checked) { m_antialias_enabled = checked; }; diff --git a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp index aaf2ef652d..c56185e781 100644 --- a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp @@ -104,7 +104,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget() size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); - auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv))); + auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string)); size_slider->set_range(1, 20); size_slider->set_value(m_thickness); @@ -121,7 +121,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget() density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); density_label->set_fixed_size(80, 20); - auto density_slider = TRY(density_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto density_slider = TRY(density_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); density_slider->set_range(1, 100); density_slider->set_value(m_density); diff --git a/Userland/Applications/PixelPaint/Tools/TextTool.cpp b/Userland/Applications/PixelPaint/Tools/TextTool.cpp index 3a030571df..e8488104d9 100644 --- a/Userland/Applications/PixelPaint/Tools/TextTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/TextTool.cpp @@ -116,7 +116,7 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget() m_font_label = TRY(properties_widget->try_add<GUI::Label>(m_selected_font->human_readable_name())); - auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY(String::from_utf8("Change Font..."sv)))); + auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY("Change Font..."_string))); change_font_button->on_click = [this](auto) { auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false); if (picker->exec() == GUI::Dialog::ExecResult::OK) { diff --git a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp index 45bf033ac6..74dbb0c019 100644 --- a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp @@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget() threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); threshold_label->set_fixed_size(80, 20); - auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); threshold_slider->set_range(0, 100); threshold_slider->set_value(m_threshold); diff --git a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp index 78ad3c4829..dc61602174 100644 --- a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp @@ -37,7 +37,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget() sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); sensitivity_label->set_fixed_size(80, 20); - auto sensitivity_slider = TRY(sensitivity_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv))); + auto sensitivity_slider = TRY(sensitivity_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string)); sensitivity_slider->set_range(1, 100); sensitivity_slider->set_value(100 * m_sensitivity); diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 4e38fe7413..1f5979217d 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -56,7 +56,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet, buttonbox.set_shrink_to_fit(true); buttonbox.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 10); buttonbox.add_spacer().release_value_but_fixme_should_propagate_errors(); - auto& ok_button = buttonbox.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& ok_button = buttonbox.add<GUI::Button>("OK"_short_string); ok_button.set_fixed_width(80); ok_button.on_click = [&](auto) { done(ExecResult::OK); }; } @@ -157,7 +157,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po }; { - auto& checkbox = right_side.add<GUI::CheckBox>(String::from_utf8("Override max length"sv).release_value_but_fixme_should_propagate_errors()); + auto& checkbox = right_side.add<GUI::CheckBox>("Override max length"_string.release_value_but_fixme_should_propagate_errors()); auto& spinbox = right_side.add<GUI::SpinBox>(); checkbox.set_checked(m_length != -1); spinbox.set_min(0); @@ -177,7 +177,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po }; } { - auto& checkbox = right_side.add<GUI::CheckBox>(String::from_utf8("Override display format"sv).release_value_but_fixme_should_propagate_errors()); + auto& checkbox = right_side.add<GUI::CheckBox>("Override display format"_string.release_value_but_fixme_should_propagate_errors()); auto& editor = right_side.add<GUI::TextEditor>(); checkbox.set_checked(!m_format.is_empty()); editor.set_name("format_editor"); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 72da1fc030..3aa8f7d6cf 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -201,8 +201,8 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget find_forwards->click(); }; - auto match_case = TRY(main_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Case sensitive"sv)))); - auto wrap_around = TRY(main_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Wrap around"sv)))); + auto match_case = TRY(main_widget->try_add<GUI::CheckBox>(TRY("Case sensitive"_string))); + auto wrap_around = TRY(main_widget->try_add<GUI::CheckBox>(TRY("Wrap around"_string))); find_backwards->on_click = [&terminal, find_textbox, match_case, wrap_around](auto) { auto needle = find_textbox->text(); diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index 410662e094..a950b98e3e 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -122,7 +122,7 @@ FindInFilesWidget::FindInFilesWidget() m_textbox = top_container.add<GUI::TextBox>(); - m_button = top_container.add<GUI::Button>(String::from_utf8("Find in files"sv).release_value_but_fixme_should_propagate_errors()); + m_button = top_container.add<GUI::Button>("Find in files"_string.release_value_but_fixme_should_propagate_errors()); m_button->set_fixed_width(100); m_result_view = add<GUI::TableView>(); diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index b16a8d418b..3e5b82dea5 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-inspector"sv)); if (gui_mode) { choose_pid: - auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector"sv, String::from_utf8_short_string("Inspect"sv), app_icon.bitmap_for_size(16))); + auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector"sv, "Inspect"_short_string, app_icon.bitmap_for_size(16))); if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel) return 0; pid = process_chooser->pid(); diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 0364365d21..8269403d28 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -325,7 +325,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_ }).release_value_but_fixme_should_propagate_errors(); update_timer->start(); - auto& stop_button = widget->add<GUI::Button>(String::from_utf8_short_string("Stop"sv)); + auto& stop_button = widget->add<GUI::Button>("Stop"_short_string); stop_button.set_fixed_size(140, 22); stop_button.on_click = [&](auto) { GUI::Application::the()->quit(); @@ -338,7 +338,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_ bool generate_profile(pid_t& pid) { if (!pid) { - auto process_chooser = GUI::ProcessChooser::construct("Profiler"sv, String::from_utf8_short_string("Profile"sv), Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors()); + auto process_chooser = GUI::ProcessChooser::construct("Profiler"sv, "Profile"_short_string, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors()); if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel) return false; pid = process_chooser->pid(); diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 2996d21c7d..dcaafcbf42 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -78,7 +78,7 @@ Game::Game() m_players[3].name = "Lisa"; m_players[3].taken_cards_target = { width, height / 2 - Card::height / 2 }; - m_passing_button = add<GUI::Button>(String::from_utf8("Pass Left"sv).release_value_but_fixme_should_propagate_errors()); + m_passing_button = add<GUI::Button>("Pass Left"_string.release_value_but_fixme_should_propagate_errors()); constexpr int button_width = 120; constexpr int button_height = 30; m_passing_button->set_relative_rect(width / 2 - button_width / 2, height - 3 * outer_border_size - Card::height - button_height, button_width, button_height); @@ -133,7 +133,7 @@ void Game::show_score_card(bool game_over) button_container.set_shrink_to_fit(true); button_container.set_layout<GUI::VerticalBoxLayout>(); - auto& close_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& close_button = button_container.add<GUI::Button>("OK"_short_string); close_button.on_click = [&score_dialog](auto) { score_dialog->done(GUI::Dialog::ExecResult::OK); }; @@ -178,13 +178,13 @@ void Game::setup(DeprecatedString player_name, int hand_number) m_human_can_play = true; switch (passing_direction()) { case PassingDirection::Left: - m_passing_button->set_text(String::from_utf8("Pass Left"sv).release_value_but_fixme_should_propagate_errors()); + m_passing_button->set_text("Pass Left"_string.release_value_but_fixme_should_propagate_errors()); break; case PassingDirection::Across: - m_passing_button->set_text(String::from_utf8("Pass Across"sv).release_value_but_fixme_should_propagate_errors()); + m_passing_button->set_text("Pass Across"_string.release_value_but_fixme_should_propagate_errors()); break; case PassingDirection::Right: - m_passing_button->set_text(String::from_utf8("Pass Right"sv).release_value_but_fixme_should_propagate_errors()); + m_passing_button->set_text("Pass Right"_string.release_value_but_fixme_should_propagate_errors()); break; default: VERIFY_NOT_REACHED(); @@ -869,7 +869,7 @@ void Game::pass_cards() } m_state = State::PassingAccept; - m_passing_button->set_text(String::from_utf8_short_string("OK"sv)); + m_passing_button->set_text("OK"_short_string); m_passing_button->set_enabled(true); } diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp index 27a4016e03..dcb87822e8 100644 --- a/Userland/Games/Hearts/SettingsDialog.cpp +++ b/Userland/Games/Hearts/SettingsDialog.cpp @@ -39,11 +39,11 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name auto& button_box = main_widget->add<GUI::Widget>(); button_box.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 12); - button_box.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)).on_click = [this](auto) { + button_box.add<GUI::Button>("Cancel"_short_string).on_click = [this](auto) { done(ExecResult::Cancel); }; - button_box.add<GUI::Button>(String::from_utf8_short_string("OK"sv)).on_click = [this](auto) { + button_box.add<GUI::Button>("OK"_short_string).on_click = [this](auto) { done(ExecResult::OK); }; } diff --git a/Userland/Libraries/LibCore/Process.cpp b/Userland/Libraries/LibCore/Process.cpp index 33e65ee494..22d5f67898 100644 --- a/Userland/Libraries/LibCore/Process.cpp +++ b/Userland/Libraries/LibCore/Process.cpp @@ -111,7 +111,7 @@ ErrorOr<String> Process::get_name() return String::from_utf8(StringView { buffer, strlen(buffer) }); #else // FIXME: Implement Process::get_name() for other platforms. - return String::from_utf8_short_string("???"sv); + return "???"_short_string; #endif } diff --git a/Userland/Libraries/LibCore/StandardPaths.cpp b/Userland/Libraries/LibCore/StandardPaths.cpp index 41755490e6..5157c7073c 100644 --- a/Userland/Libraries/LibCore/StandardPaths.cpp +++ b/Userland/Libraries/LibCore/StandardPaths.cpp @@ -116,14 +116,14 @@ ErrorOr<Vector<String>> StandardPaths::font_directories() { return Vector { { #if defined(AK_OS_SERENITY) - TRY(String::from_utf8("/res/fonts"sv)), + TRY("/res/fonts"_string), #elif defined(AK_OS_MACOS) - TRY(String::from_utf8("/System/Library/Fonts"sv)), - TRY(String::from_utf8("/Library/Fonts"sv)), + TRY("/System/Library/Fonts"_string), + TRY("/Library/Fonts"_string), TRY(String::formatted("{}/Library/Fonts"sv, home_directory())), #else - TRY(String::from_utf8("/usr/share/fonts"sv)), - TRY(String::from_utf8("/usr/local/share/fonts"sv)), + TRY("/usr/share/fonts"_string), + TRY("/usr/local/share/fonts"_string), TRY(String::formatted("{}/.local/share/fonts"sv, home_directory())), #endif } }; diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 4cd143dfda..f643b6dee8 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -150,7 +150,7 @@ ErrorOr<String> UnsignedBigInteger::to_base(u16 N) const { VERIFY(N <= 36); if (*this == UnsignedBigInteger { 0 }) - return String::from_utf8_short_string("0"sv); + return "0"_short_string; StringBuilder builder; UnsignedBigInteger temp(*this); diff --git a/Userland/Libraries/LibDSP/Effects.cpp b/Userland/Libraries/LibDSP/Effects.cpp index b7e3f58d35..48f3e2b58d 100644 --- a/Userland/Libraries/LibDSP/Effects.cpp +++ b/Userland/Libraries/LibDSP/Effects.cpp @@ -12,9 +12,9 @@ namespace DSP::Effects { Delay::Delay(NonnullRefPtr<Transport> transport) : EffectProcessor(move(transport)) - , m_delay_decay(String::from_utf8_short_string("Decay"sv), 0.01, 0.99, 0.33, Logarithmic::No) - , m_delay_time(String::from_utf8("Delay Time"sv), 3, 2000, 900, Logarithmic::Yes) - , m_dry_gain(String::from_utf8_short_string("Dry"sv), 0, 1, 0.9, Logarithmic::No) + , m_delay_decay("Decay"_short_string, 0.01, 0.99, 0.33, Logarithmic::No) + , m_delay_time("Delay Time"_string, 3, 2000, 900, Logarithmic::Yes) + , m_dry_gain("Dry"_short_string, 0, 1, 0.9, Logarithmic::No) { m_parameters.append(m_delay_decay); @@ -59,9 +59,9 @@ void Delay::process_impl(Signal const& input_signal, Signal& output_signal) Mastering::Mastering(NonnullRefPtr<Transport> transport) : EffectProcessor(move(transport)) - , m_pan(String::from_utf8_short_string("Pan"sv), -1, 1, 0, Logarithmic::No) - , m_volume(String::from_utf8_short_string("Volume"sv), 0, 1, 1, Logarithmic::No) - , m_muted(String::from_utf8_short_string("Mute"sv), false) + , m_pan("Pan"_short_string, -1, 1, 0, Logarithmic::No) + , m_volume("Volume"_short_string, 0, 1, 1, Logarithmic::No) + , m_muted("Mute"_short_string, false) { m_parameters.append(m_muted); m_parameters.append(m_volume); diff --git a/Userland/Libraries/LibDSP/Synthesizers.cpp b/Userland/Libraries/LibDSP/Synthesizers.cpp index 897c4c8bff..44df72e435 100644 --- a/Userland/Libraries/LibDSP/Synthesizers.cpp +++ b/Userland/Libraries/LibDSP/Synthesizers.cpp @@ -19,11 +19,11 @@ namespace DSP::Synthesizers { Classic::Classic(NonnullRefPtr<Transport> transport) : DSP::SynthesizerProcessor(move(transport)) - , m_waveform(String::from_utf8("Waveform"sv), Waveform::Saw) - , m_attack(String::from_utf8_short_string("Attack"sv), 0.01, 2000, 5, Logarithmic::Yes) - , m_decay(String::from_utf8_short_string("Decay"sv), 0.01, 20'000, 80, Logarithmic::Yes) - , m_sustain(String::from_utf8_short_string("Sustain"sv), 0.001, 1, 0.725, Logarithmic::No) - , m_release(String::from_utf8_short_string("Release"sv), 0.01, 6'000, 120, Logarithmic::Yes) + , m_waveform("Waveform"_string, Waveform::Saw) + , m_attack("Attack"_short_string, 0.01, 2000, 5, Logarithmic::Yes) + , m_decay("Decay"_short_string, 0.01, 20'000, 80, Logarithmic::Yes) + , m_sustain("Sustain"_short_string, 0.001, 1, 0.725, Logarithmic::No) + , m_release("Release"_short_string, 0.01, 6'000, 120, Logarithmic::Yes) { m_parameters.append(m_waveform); m_parameters.append(m_attack); diff --git a/Userland/Libraries/LibGLSL/Linker.cpp b/Userland/Libraries/LibGLSL/Linker.cpp index 50e7790a89..0d9fb3e66a 100644 --- a/Userland/Libraries/LibGLSL/Linker.cpp +++ b/Userland/Libraries/LibGLSL/Linker.cpp @@ -15,8 +15,8 @@ ErrorOr<NonnullOwnPtr<LinkedShader>> Linker::link(Vector<ObjectFile const*> cons GPU::IR::Shader shader; - auto input_name = TRY(String::from_utf8("input0"sv)); - auto output_name = TRY(String::from_utf8("output0"sv)); + auto input_name = TRY("input0"_string); + auto output_name = TRY("output0"_string); TRY(shader.inputs.try_append({ move(input_name), GPU::IR::StorageType::Vector4 })); TRY(shader.outputs.try_append({ move(output_name), GPU::IR::StorageType::Vector4 })); GPU::IR::Instruction instruction { diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index b4d757e47b..7de9564f48 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -228,14 +228,14 @@ void ColorPicker::build_ui() button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& ok_button = button_container.add<DialogButton>(); - ok_button.set_text(String::from_utf8_short_string("OK"sv)); + ok_button.set_text("OK"_short_string); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; ok_button.set_default(true); auto& cancel_button = button_container.add<DialogButton>(); - cancel_button.set_text(String::from_utf8_short_string("Cancel"sv)); + cancel_button.set_text("Cancel"_short_string); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; @@ -407,7 +407,7 @@ void ColorPicker::build_ui_custom(Widget& root_container) make_spinbox(Blue, m_color.blue()); make_spinbox(Alpha, m_color.alpha()); - m_selector_button = vertical_container.add<GUI::Button>(String::from_utf8("Select on screen"sv).release_value_but_fixme_should_propagate_errors()); + m_selector_button = vertical_container.add<GUI::Button>("Select on screen"_string.release_value_but_fixme_should_propagate_errors()); m_selector_button->on_click = [this](auto) { auto selector = ColorSelectOverlay::construct(); auto original_color = m_color; diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index b5db27f7da..795832447d 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -224,7 +224,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St ok_button.set_enabled(m_mode == Mode::OpenFolder || !m_filename_textbox->text().is_empty()); auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button"); - cancel_button.set_text(String::from_utf8_short_string("Cancel"sv)); + cancel_button.set_text("Cancel"_short_string); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Libraries/LibGUI/FilePicker.h b/Userland/Libraries/LibGUI/FilePicker.h index ad0d8277f1..0096877844 100644 --- a/Userland/Libraries/LibGUI/FilePicker.h +++ b/Userland/Libraries/LibGUI/FilePicker.h @@ -54,11 +54,11 @@ private: case Mode::Open: case Mode::OpenMultiple: case Mode::OpenFolder: - return String::from_utf8_short_string("Open"sv); + return "Open"_short_string; case Mode::Save: - return String::from_utf8_short_string("Save"sv); + return "Save"_short_string; default: - return String::from_utf8_short_string("OK"sv); + return "OK"_short_string; } } diff --git a/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp index c4580352b7..ecba03dd3a 100644 --- a/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp +++ b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp @@ -37,7 +37,7 @@ IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor) }; m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button"); - m_close_button->set_text(String::from_utf8_short_string("\xE2\x9D\x8C"sv)); + m_close_button->set_text("\xE2\x9D\x8C"_short_string); m_close_button->on_click = [this](auto) { hide(); }; diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index 834a0f09c9..5c590d821a 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -103,7 +103,7 @@ void InputBox::build() button_container_inner.add_spacer().release_value_but_fixme_should_propagate_errors(); m_ok_button = button_container_inner.add<DialogButton>(); - m_ok_button->set_text(String::from_utf8_short_string("OK"sv)); + m_ok_button->set_text("OK"_short_string); m_ok_button->on_click = [this](auto) { dbgln("GUI::InputBox: OK button clicked"); done(ExecResult::OK); @@ -111,7 +111,7 @@ void InputBox::build() m_ok_button->set_default(true); m_cancel_button = button_container_inner.add<DialogButton>(); - m_cancel_button->set_text(String::from_utf8_short_string("Cancel"sv)); + m_cancel_button->set_text("Cancel"_short_string); m_cancel_button->on_click = [this](auto) { dbgln("GUI::InputBox: Cancel button clicked"); done(ExecResult::Cancel); diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index b056a03d10..13e3b0de3c 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -50,11 +50,11 @@ Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window, box->set_icon(parent_window->icon()); if (path.is_empty()) - box->m_yes_button->set_text(String::from_utf8("Save As..."sv).release_value_but_fixme_should_propagate_errors()); + box->m_yes_button->set_text("Save As..."_string.release_value_but_fixme_should_propagate_errors()); else - box->m_yes_button->set_text(String::from_utf8_short_string("Save"sv)); - box->m_no_button->set_text(String::from_utf8_short_string("Discard"sv)); - box->m_cancel_button->set_text(String::from_utf8_short_string("Cancel"sv)); + box->m_yes_button->set_text("Save"_short_string); + box->m_no_button->set_text("Discard"_short_string); + box->m_cancel_button->set_text("Cancel"_short_string); return box->exec(); } @@ -162,13 +162,13 @@ void MessageBox::build() button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); if (should_include_ok_button()) - m_ok_button = add_button(String::from_utf8_short_string("OK"sv), ExecResult::OK); + m_ok_button = add_button("OK"_short_string, ExecResult::OK); if (should_include_yes_button()) - m_yes_button = add_button(String::from_utf8_short_string("Yes"sv), ExecResult::Yes); + m_yes_button = add_button("Yes"_short_string, ExecResult::Yes); if (should_include_no_button()) - m_no_button = add_button(String::from_utf8_short_string("No"sv), ExecResult::No); + m_no_button = add_button("No"_short_string, ExecResult::No); if (should_include_cancel_button()) - m_cancel_button = add_button(String::from_utf8_short_string("Cancel"sv), ExecResult::Cancel); + m_cancel_button = add_button("Cancel"_short_string, ExecResult::Cancel); button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); int width = (button_count * button_width) + ((button_count - 1) * button_container.layout()->spacing()) + 32; diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index bbf8db72f1..e4638ecb7d 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -61,7 +61,7 @@ ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx auto index = m_table_view->selection().first(); set_pid_from_index_and_close(index); }; - auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); + auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string); cancel_button.set_fixed_width(80); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); diff --git a/Userland/Libraries/LibGUI/ProcessChooser.h b/Userland/Libraries/LibGUI/ProcessChooser.h index 64e67a7292..725b4b5f8a 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.h +++ b/Userland/Libraries/LibGUI/ProcessChooser.h @@ -23,7 +23,7 @@ public: pid_t pid() const { return m_pid; } private: - ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = String::from_utf8_short_string("Select"sv), Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr); + ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = "Select"_short_string, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr); void set_pid_from_index_and_close(ModelIndex const&); diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index c859df52e0..96df0d6dda 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -43,7 +43,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 6)); if (show_defaults_button == ShowDefaultsButton::Yes) { - window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY(String::from_utf8("Defaults"sv)))); + window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY("Defaults"_string))); window->m_reset_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->reset_default_values(); }; @@ -51,19 +51,19 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t TRY(button_container->add_spacer()); - window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("OK"sv))); + window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK"_short_string)); window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->apply_settings(); GUI::Application::the()->quit(); }; - window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Cancel"sv))); + window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel"_short_string)); window->m_cancel_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->cancel_settings(); GUI::Application::the()->quit(); }; - window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Apply"sv))); + window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_short_string)); window->m_apply_button->set_enabled(false); window->m_apply_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->apply_settings(); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp index c9abe0bd37..81b593a78b 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp @@ -43,12 +43,12 @@ WizardDialog::WizardDialog(Window* parent_window) nav_container_widget.set_fixed_height(42); nav_container_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); - m_back_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("< Back"sv)); + m_back_button = nav_container_widget.add<DialogButton>("< Back"_short_string); m_back_button->on_click = [&](auto) { pop_page(); }; - m_next_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("Next >"sv)); + m_next_button = nav_container_widget.add<DialogButton>("Next >"_short_string); m_next_button->on_click = [&](auto) { VERIFY(has_pages()); @@ -65,7 +65,7 @@ WizardDialog::WizardDialog(Window* parent_window) auto& button_spacer = nav_container_widget.add<Widget>(); button_spacer.set_fixed_width(10); - m_cancel_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("Cancel"sv)); + m_cancel_button = nav_container_widget.add<DialogButton>("Cancel"_short_string); m_cancel_button->on_click = [&](auto) { handle_cancel(); }; @@ -120,11 +120,11 @@ void WizardDialog::update_navigation() if (has_pages()) { m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next()); if (current_page().is_final_page()) - m_next_button->set_text(String::from_utf8_short_string("Finish"sv)); + m_next_button->set_text("Finish"_short_string); else - m_next_button->set_text(String::from_utf8_short_string("Next >"sv)); + m_next_button->set_text("Next >"_short_string); } else { - m_next_button->set_text(String::from_utf8_short_string("Next >"sv)); + m_next_button->set_text("Next >"_short_string); m_next_button->set_enabled(false); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 216ac98e98..a95c980d97 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -147,7 +147,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e for (size_t i = 0; i < registers().size(); ++i) { String value_string; if (registers()[i].is_empty()) - value_string = MUST(String::from_utf8("(empty)"sv)); + value_string = MUST("(empty)"_string); else value_string = MUST(registers()[i].to_string_without_side_effects()); dbgln("[{:3}] {}", i, value_string); diff --git a/Userland/Libraries/LibJS/Console.cpp b/Userland/Libraries/LibJS/Console.cpp index 99da170119..abce1392dc 100644 --- a/Userland/Libraries/LibJS/Console.cpp +++ b/Userland/Libraries/LibJS/Console.cpp @@ -104,7 +104,7 @@ ThrowCompletionOr<Value> Console::trace() for (ssize_t i = execution_context_stack.size() - 2; i >= 0; --i) { auto const& function_name = execution_context_stack[i]->function_name; trace.stack.append(function_name.is_empty() - ? TRY_OR_THROW_OOM(vm, String::from_utf8("<anonymous>"sv)) + ? TRY_OR_THROW_OOM(vm, "<anonymous>"_string) : TRY_OR_THROW_OOM(vm, String::from_deprecated_string(function_name))); } @@ -253,7 +253,7 @@ ThrowCompletionOr<Value> Console::group() } // ... Otherwise, let groupLabel be an implementation-chosen label representing a group. else { - group_label = TRY_OR_THROW_OOM(vm, String::from_utf8("Group"sv)); + group_label = TRY_OR_THROW_OOM(vm, "Group"_string); } // 3. Incorporate groupLabel as a label for group. @@ -289,7 +289,7 @@ ThrowCompletionOr<Value> Console::group_collapsed() } // ... Otherwise, let groupLabel be an implementation-chosen label representing a group. else { - group_label = TRY_OR_THROW_OOM(vm, String::from_utf8("Group"sv)); + group_label = TRY_OR_THROW_OOM(vm, "Group"_string); } // 3. Incorporate groupLabel as a label for group. diff --git a/Userland/Libraries/LibJS/Lexer.cpp b/Userland/Libraries/LibJS/Lexer.cpp index 141c0db911..a0d843c6db 100644 --- a/Userland/Libraries/LibJS/Lexer.cpp +++ b/Userland/Libraries/LibJS/Lexer.cpp @@ -836,7 +836,7 @@ Token Lexer::next() if (m_hit_invalid_unicode.has_value()) { value_start = m_hit_invalid_unicode.value() - 1; - m_current_token = Token(TokenType::Invalid, String::from_utf8("Invalid unicode codepoint in source"sv).release_value_but_fixme_should_propagate_errors(), + m_current_token = Token(TokenType::Invalid, "Invalid unicode codepoint in source"_string.release_value_but_fixme_should_propagate_errors(), ""sv, // Since the invalid unicode can occur anywhere in the current token the trivia is not correct m_source.substring_view(value_start + 1, min(4u, m_source.length() - value_start - 2)), m_filename, diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index 27b4c5858b..db56cbc8f6 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -47,7 +47,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) // 4. If name is undefined, set name to "Error"; otherwise set name to ? ToString(name). auto name = name_property.is_undefined() - ? TRY_OR_THROW_OOM(vm, String::from_utf8("Error"sv)) + ? TRY_OR_THROW_OOM(vm, "Error"_string) : TRY(name_property.to_string(vm)); // 5. Let msg be ? Get(O, "message"). @@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_getter) if (auto name_property = TRY(error.get(vm.names.name)); !name_property.is_undefined()) name = TRY(name_property.to_string(vm)); else - name = TRY_OR_THROW_OOM(vm, String::from_utf8("Error"sv)); + name = TRY_OR_THROW_OOM(vm, "Error"_string); String message {}; if (auto message_property = TRY(error.get(vm.names.message)); !message_property.is_undefined()) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp index 45f2e8f8fd..6562a2b3ed 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp @@ -464,7 +464,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req // 4. Else if keyLocaleData contains "true", then else if (key_locale_data.contains_slow("true"sv)) { // a. Let value be "true". - value = TRY_OR_THROW_OOM(vm, String::from_utf8("true"sv)); + value = TRY_OR_THROW_OOM(vm, "true"_string); // b. Let supportedExtensionAddition be the string-concatenation of "-" and key. supported_extension_addition = ::Locale::Keyword { TRY_OR_THROW_OOM(vm, String::from_utf8(key)), {} }; @@ -487,7 +487,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req // 3. If optionsValue is the empty String, then if (options_value->is_empty()) { // a. Let optionsValue be "true". - options_value = TRY_OR_THROW_OOM(vm, String::from_utf8("true"sv)); + options_value = TRY_OR_THROW_OOM(vm, "true"_string); } } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp index 0e28158b55..d4ff6bcada 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp @@ -83,7 +83,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat // 21. Let collation be r.[[co]]. // 22. If collation is null, let collation be "default". // 23. Set collator.[[Collation]] to collation. - collator.set_collation(result.co.has_value() ? result.co.release_value() : TRY_OR_THROW_OOM(vm, String::from_utf8("default"sv))); + collator.set_collation(result.co.has_value() ? result.co.release_value() : TRY_OR_THROW_OOM(vm, "default"_string)); // 24. If relevantExtensionKeys contains "kn", then if (relevant_extension_keys.span().contains_slow("kn"sv) && result.kn.has_value()) { diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp index 8ee1e6a472..f1958db630 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp @@ -1241,7 +1241,7 @@ ThrowCompletionOr<RawFormatResult> to_raw_fixed(VM& vm, MathematicalValue const& // 7. If n = 0, let m be "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes). result.formatted_string = n.is_zero() - ? String::from_utf8_short_string("0"sv) + ? "0"_short_string : MUST_OR_THROW_OOM(n.to_string(vm)); // 8. If f ≠ 0, then diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index 3c969cf12e..1c4d20b7af 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -450,9 +450,9 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string) if (number_value.is_negative_infinity()) return MUST_OR_THROW_OOM(PrimitiveString::create(vm, "-Infinity"sv)); if (number_value.is_nan()) - return PrimitiveString::create(vm, String::from_utf8_short_string("NaN"sv)); + return PrimitiveString::create(vm, "NaN"_short_string); if (number_value.is_positive_zero() || number_value.is_negative_zero()) - return PrimitiveString::create(vm, String::from_utf8_short_string("0"sv)); + return PrimitiveString::create(vm, "0"_short_string); double number = number_value.as_double(); bool negative = number < 0; diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 446288dc64..2d1ac1fb8a 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -494,7 +494,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all) auto string = TRY(this_object.to_utf16_string(vm)); - auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, String::from_utf8_short_string("g"sv)))); + auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, "g"_short_string))); return TRY(Value(rx).invoke(vm, *vm.well_known_symbol_match_all(), PrimitiveString::create(vm, move(string)))); } @@ -509,7 +509,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::normalize) // 3. If form is undefined, let f be "NFC". if (auto form_value = vm.argument(0); form_value.is_undefined()) { - form = String::from_utf8_short_string("NFC"sv); + form = "NFC"_short_string; } // 4. Else, let f be ? ToString(form). else { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 8258b0b62b..bb64f9c511 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -159,7 +159,7 @@ ThrowCompletionOr<String> to_temporal_overflow(VM& vm, Object const* options) { // 1. If options is undefined, return "constrain". if (options == nullptr) - return TRY_OR_THROW_OOM(vm, String::from_utf8("constrain"sv)); + return TRY_OR_THROW_OOM(vm, "constrain"_string); // 2. Return ? GetOption(options, "overflow", "string", « "constrain", "reject" », "constrain"). auto option = TRY(get_option(vm, *options, vm.names.overflow, OptionType::String, { "constrain"sv, "reject"sv }, "constrain"sv)); @@ -173,7 +173,7 @@ ThrowCompletionOr<String> to_temporal_disambiguation(VM& vm, Object const* optio { // 1. If options is undefined, return "compatible". if (options == nullptr) - return TRY_OR_THROW_OOM(vm, String::from_utf8("compatible"sv)); + return TRY_OR_THROW_OOM(vm, "compatible"_string); // 2. Return ? GetOption(options, "disambiguation", "string", « "compatible", "earlier", "later", "reject" », "compatible"). auto option = TRY(get_option(vm, *options, vm.names.disambiguation, OptionType::String, { "compatible"sv, "earlier"sv, "later"sv, "reject"sv }, "compatible"sv)); @@ -1269,7 +1269,7 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(VM& vm, ParseResult const& pa } // 7. Let yearMV be ! ToIntegerOrInfinity(CodePointsToString(year)). - auto year_mv = *normalized_year.value_or(String::from_utf8_short_string("0"sv)).to_number<i32>(); + auto year_mv = *normalized_year.value_or("0"_short_string).to_number<i32>(); // 8. If month is empty, then // a. Let monthMV be 1. @@ -1425,7 +1425,7 @@ ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM& vm, StringV // 4. If result.[[TimeZone]].[[Z]] is true, then if (result.time_zone.z) { // a. Set offsetString to "+00:00". - offset_string = TRY_OR_THROW_OOM(vm, String::from_utf8("+00:00"sv)); + offset_string = TRY_OR_THROW_OOM(vm, "+00:00"_string); } // 6. Assert: offsetString is not undefined. @@ -1460,7 +1460,7 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(VM& vm, StringView iso_ // b. If calendar is undefined, return "iso8601". if (!calendar.has_value()) - return TRY_OR_THROW_OOM(vm, String::from_utf8("iso8601"sv)); + return TRY_OR_THROW_OOM(vm, "iso8601"_string); // c. Else, return calendar. else return calendar.release_value(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 01d2927e1e..1bd9997832 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -99,7 +99,7 @@ ThrowCompletionOr<Calendar*> get_builtin_calendar(VM& vm, String const& identifi Calendar* get_iso8601_calendar(VM& vm) { // 1. Return ! GetBuiltinCalendar("iso8601"). - return MUST(get_builtin_calendar(vm, String::from_utf8("iso8601"sv).release_value_but_fixme_should_propagate_errors())); + return MUST(get_builtin_calendar(vm, "iso8601"_string.release_value_but_fixme_should_propagate_errors())); } // 12.2.4 CalendarFields ( calendar, fieldNames ), https://tc39.es/proposal-temporal/#sec-temporal-calendarfields @@ -824,10 +824,10 @@ ThrowCompletionOr<ISODateRecord> iso_date_from_fields(VM& vm, Object const& fiel // 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »). auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, - { String::from_utf8_short_string("day"sv), - TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) }, + { "day"_short_string, + TRY_OR_THROW_OOM(vm, "month"_string), + TRY_OR_THROW_OOM(vm, "monthCode"_string), + TRY_OR_THROW_OOM(vm, "year"_string) }, Vector<StringView> { "year"sv, "day"sv })); // 3. Let overflow be ? ToTemporalOverflow(options). @@ -859,9 +859,9 @@ ThrowCompletionOr<ISOYearMonth> iso_year_month_from_fields(VM& vm, Object const& // 2. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode", "year" », « "year" »). auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, - { TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) }, + { TRY_OR_THROW_OOM(vm, "month"_string), + TRY_OR_THROW_OOM(vm, "monthCode"_string), + TRY_OR_THROW_OOM(vm, "year"_string) }, Vector<StringView> { "year"sv })); // 3. Let overflow be ? ToTemporalOverflow(options). @@ -890,10 +890,10 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(VM& vm, Object const& f // 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »). auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, - { String::from_utf8_short_string("day"sv), - TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) }, + { "day"_short_string, + TRY_OR_THROW_OOM(vm, "month"_string), + TRY_OR_THROW_OOM(vm, "monthCode"_string), + TRY_OR_THROW_OOM(vm, "year"_string) }, Vector<StringView> { "day"sv })); // 3. Let overflow be ? ToTemporalOverflow(options). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index 99c80af7ab..db28e6527d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -216,7 +216,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_until) // 8. If largestUnit is "auto", set largestUnit to "day". if (largest_unit == "auto") - largest_unit = String::from_utf8_short_string("day"sv); + largest_unit = "day"_short_string; // 9. Let result be DifferenceISODate(one.[[ISOYear]], one.[[ISOMonth]], one.[[ISODay]], two.[[ISOYear]], two.[[ISOMonth]], two.[[ISODay]], largestUnit). auto result = difference_iso_date(vm, one->iso_year(), one->iso_month(), one->iso_day(), two->iso_year(), two->iso_month(), two->iso_day(), *largest_unit); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index d2ee9304bc..ef46f95f2e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -369,7 +369,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round) smallest_unit_present = false; // b. Set smallestUnit to "nanosecond". - smallest_unit = TRY_OR_THROW_OOM(vm, String::from_utf8("nanosecond"sv)); + smallest_unit = TRY_OR_THROW_OOM(vm, "nanosecond"_string); } // 10. Let defaultLargestUnit be ! DefaultTemporalLargestUnit(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]]). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 2533434491..53bb1d020f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -267,7 +267,7 @@ ThrowCompletionOr<String> temporal_instant_to_string(VM& vm, Instant& instant, V // 8. If timeZone is undefined, then if (time_zone.is_undefined()) { // a. Let timeZoneString be "Z". - time_zone_string = String::from_utf8_short_string("Z"sv); + time_zone_string = "Z"_short_string; } // 9. Else, else { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp index 52d666e8d5..043ea55bc3 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp @@ -344,12 +344,12 @@ ThrowCompletionOr<TemporalTimeLikeRecord> to_temporal_time_record(VM& vm, Object // 2. Let partial be ? PrepareTemporalFields(temporalTimeLike, « "hour", "microsecond", "millisecond", "minute", "nanosecond", "second" », partial). auto* partial = TRY(prepare_temporal_fields(vm, temporal_time_like, - { TRY_OR_THROW_OOM(vm, String::from_utf8("hour"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("microsecond"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("millisecond"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("minute"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("nanosecond"sv)), - TRY_OR_THROW_OOM(vm, String::from_utf8("second"sv)) }, + { TRY_OR_THROW_OOM(vm, "hour"_string), + TRY_OR_THROW_OOM(vm, "microsecond"_string), + TRY_OR_THROW_OOM(vm, "millisecond"_string), + TRY_OR_THROW_OOM(vm, "minute"_string), + TRY_OR_THROW_OOM(vm, "nanosecond"_string), + TRY_OR_THROW_OOM(vm, "second"_string) }, PrepareTemporalFieldsPartial {})); TemporalTimeLikeRecord result; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index 88fdbdc9ff..d6ccc82410 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -150,10 +150,10 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item auto field_names = TRY(calendar_fields(vm, *calendar, { "day"sv, "hour"sv, "microsecond"sv, "millisecond"sv, "minute"sv, "month"sv, "monthCode"sv, "nanosecond"sv, "second"sv, "year"sv })); // d. Append "timeZone" to fieldNames. - field_names.append(TRY_OR_THROW_OOM(vm, String::from_utf8("timeZone"sv))); + field_names.append(TRY_OR_THROW_OOM(vm, "timeZone"_string)); // e. Append "offset" to fieldNames. - field_names.append(TRY_OR_THROW_OOM(vm, String::from_utf8("offset"sv))); + field_names.append(TRY_OR_THROW_OOM(vm, "offset"_string)); // f. Let fields be ? PrepareTemporalFields(item, fieldNames, « "timeZone" »). auto* fields = TRY(prepare_temporal_fields(vm, item_object, field_names, Vector<StringView> { "timeZone"sv })); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 1c669fc9c1..e7c47fbff6 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -769,7 +769,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with) auto field_names = TRY(calendar_fields(vm, calendar, { "day"sv, "hour"sv, "microsecond"sv, "millisecond"sv, "minute"sv, "month"sv, "monthCode"sv, "nanosecond"sv, "second"sv, "year"sv })); // 7. Append "offset" to fieldNames. - field_names.append(TRY_OR_THROW_OOM(vm, String::from_utf8("offset"sv))); + field_names.append(TRY_OR_THROW_OOM(vm, "offset"_string)); // 8. Let partialZonedDateTime be ? PrepareTemporalFields(temporalZonedDateTimeLike, fieldNames, partial). auto* partial_zoned_date_time = TRY(prepare_temporal_fields(vm, temporal_zoned_date_time_like.as_object(), field_names, PrepareTemporalFieldsPartial {})); @@ -787,7 +787,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with) auto& time_zone = zoned_date_time->time_zone(); // 13. Append "timeZone" to fieldNames. - field_names.append(TRY_OR_THROW_OOM(vm, String::from_utf8("timeZone"sv))); + field_names.append(TRY_OR_THROW_OOM(vm, "timeZone"_string)); // 14. Let fields be ? PrepareTemporalFields(zonedDateTime, fieldNames, « "timeZone", "offset" »). auto* fields = TRY(prepare_temporal_fields(vm, *zoned_date_time, field_names, Vector<StringView> { "timeZone"sv, "offset"sv })); diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 2ee2579f76..52483f3fb7 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -362,11 +362,11 @@ ErrorOr<String> Value::to_string_without_side_effects() const switch (m_value.tag) { case UNDEFINED_TAG: - return String::from_utf8("undefined"sv); + return "undefined"_string; case NULL_TAG: - return String::from_utf8("null"sv); + return "null"_string; case BOOLEAN_TAG: - return String::from_utf8(as_bool() ? "true"sv : "false"sv); + return as_bool() ? "true"_string : "false"_string; case INT32_TAG: return String::number(as_i32()); case STRING_TAG: @@ -389,7 +389,7 @@ ErrorOr<String> Value::to_string_without_side_effects() const case OBJECT_TAG: return String::formatted("[object {}]", as_object().class_name()); case ACCESSOR_TAG: - return String::from_utf8("<accessor>"sv); + return "<accessor>"_string; default: VERIFY_NOT_REACHED(); } @@ -418,14 +418,14 @@ ThrowCompletionOr<String> Value::to_string(VM& vm) const return vm.throw_completion<TypeError>(ErrorType::Convert, "symbol", "string"); // 3. If argument is undefined, return "undefined". case UNDEFINED_TAG: - return TRY_OR_THROW_OOM(vm, String::from_utf8("undefined"sv)); + return TRY_OR_THROW_OOM(vm, "undefined"_string); // 4. If argument is null, return "null". case NULL_TAG: - return TRY_OR_THROW_OOM(vm, String::from_utf8("null"sv)); + return TRY_OR_THROW_OOM(vm, "null"_string); // 5. If argument is true, return "true". // 6. If argument is false, return "false". case BOOLEAN_TAG: - return TRY_OR_THROW_OOM(vm, String::from_utf8(as_bool() ? "true"sv : "false"sv)); + return TRY_OR_THROW_OOM(vm, as_bool() ? "true"_string : "false"_string); // 7. If argument is a Number, return Number::toString(argument, 10). case INT32_TAG: return TRY_OR_THROW_OOM(vm, String::number(as_i32())); diff --git a/Userland/Libraries/LibManual/PageNode.cpp b/Userland/Libraries/LibManual/PageNode.cpp index ceb2ee04bb..d2b6605cc0 100644 --- a/Userland/Libraries/LibManual/PageNode.cpp +++ b/Userland/Libraries/LibManual/PageNode.cpp @@ -29,7 +29,7 @@ ErrorOr<String> PageNode::path() const ErrorOr<NonnullRefPtr<PageNode>> PageNode::help_index_page() { - static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], TRY(String::from_utf8("Help-index"sv)))); + static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], TRY("Help-index"_string))); return help_index_page; } diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp index 00a08d45c2..128651f1af 100644 --- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp +++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp @@ -61,9 +61,9 @@ ErrorOr<String> GridSize::to_string() const case Type::FlexibleLength: return String::formatted("{}fr", m_flexible_length); case Type::MaxContent: - return String::from_utf8("max-content"sv); + return "max-content"_string; case Type::MinContent: - return String::from_utf8("min-content"sv); + return "min-content"_string; } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index cd6b848282..3bdfd7a68e 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -117,7 +117,7 @@ ErrorOr<String> Length::to_string() const if (is_calculated()) return m_calculated_style->to_string(); if (is_auto()) - return String::from_utf8("auto"sv); + return "auto"_string; return String::formatted("{}{}", m_value, unit_name()); } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp index db07758519..dfd110eb5e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp @@ -39,7 +39,7 @@ ErrorOr<String> Token::to_string() const case Type::Url: return serialize_a_url(url()); case Type::BadUrl: - return String::from_utf8("url()"sv); + return "url()"_string; case Type::Delim: return String { m_value }; case Type::Number: @@ -49,29 +49,29 @@ ErrorOr<String> Token::to_string() const case Type::Dimension: return String::formatted("{}{}", m_number_value.value(), dimension_unit()); case Type::Whitespace: - return String::from_utf8_short_string(" "sv); + return " "_short_string; case Type::CDO: - return String::from_utf8("<!--"sv); + return "<!--"_string; case Type::CDC: - return String::from_utf8_short_string("-->"sv); + return "-->"_short_string; case Type::Colon: - return String::from_utf8_short_string(":"sv); + return ":"_short_string; case Type::Semicolon: - return String::from_utf8_short_string(";"sv); + return ";"_short_string; case Type::Comma: - return String::from_utf8_short_string(","sv); + return ","_short_string; case Type::OpenSquare: - return String::from_utf8_short_string("["sv); + return "["_short_string; case Type::CloseSquare: - return String::from_utf8_short_string("]"sv); + return "]"_short_string; case Type::OpenParen: - return String::from_utf8_short_string("("sv); + return "("_short_string; case Type::CloseParen: - return String::from_utf8_short_string(")"sv); + return ")"_short_string; case Type::OpenCurly: - return String::from_utf8_short_string("{"sv); + return "{"_short_string; case Type::CloseCurly: - return String::from_utf8_short_string("}"sv); + return "}"_short_string; case Type::Invalid: default: VERIFY_NOT_REACHED(); @@ -85,7 +85,7 @@ ErrorOr<String> Token::to_debug_string() const VERIFY_NOT_REACHED(); case Type::EndOfFile: - return String::from_utf8("__EOF__"sv); + return "__EOF__"_string; case Type::Ident: return String::formatted("Ident: {}", ident()); case Type::Function: @@ -97,11 +97,11 @@ ErrorOr<String> Token::to_debug_string() const case Type::String: return String::formatted("String: {}", string()); case Type::BadString: - return String::from_utf8("BadString"sv); + return "BadString"_string; case Type::Url: return String::formatted("Url: {}", url()); case Type::BadUrl: - return String::from_utf8("BadUrl"sv); + return "BadUrl"_string; case Type::Delim: return String::formatted("Delim: {}", m_value); case Type::Number: @@ -111,29 +111,29 @@ ErrorOr<String> Token::to_debug_string() const case Type::Dimension: return String::formatted("Dimension: {}{} (number_type: {})", dimension_value(), dimension_unit(), m_number_value.is_integer() ? "Integer" : "Number"); case Type::Whitespace: - return String::from_utf8("Whitespace"sv); + return "Whitespace"_string; case Type::CDO: - return String::from_utf8("CDO"sv); + return "CDO"_string; case Type::CDC: - return String::from_utf8("CDC"sv); + return "CDC"_string; case Type::Colon: - return String::from_utf8("Colon"sv); + return "Colon"_string; case Type::Semicolon: - return String::from_utf8("Semicolon"sv); + return "Semicolon"_string; case Type::Comma: - return String::from_utf8("Comma"sv); + return "Comma"_string; case Type::OpenSquare: - return String::from_utf8("OpenSquare"sv); + return "OpenSquare"_string; case Type::CloseSquare: - return String::from_utf8("CloseSquare"sv); + return "CloseSquare"_string; case Type::OpenParen: - return String::from_utf8("OpenParen"sv); + return "OpenParen"_string; case Type::CloseParen: - return String::from_utf8("CloseParen"sv); + return "CloseParen"_string; case Type::OpenCurly: - return String::from_utf8("OpenCurly"sv); + return "OpenCurly"_string; case Type::CloseCurly: - return String::from_utf8("CloseCurly"sv); + return "CloseCurly"_string; } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/CSS/Size.cpp b/Userland/Libraries/LibWeb/CSS/Size.cpp index 1f0e04b3d3..9b6ea918eb 100644 --- a/Userland/Libraries/LibWeb/CSS/Size.cpp +++ b/Userland/Libraries/LibWeb/CSS/Size.cpp @@ -78,18 +78,18 @@ ErrorOr<String> Size::to_string() const { switch (m_type) { case Type::Auto: - return String::from_utf8("auto"sv); + return "auto"_string; case Type::Length: case Type::Percentage: return m_length_percentage.to_string(); case Type::MinContent: - return String::from_utf8("min-content"sv); + return "min-content"_string; case Type::MaxContent: - return String::from_utf8("max-content"sv); + return "max-content"_string; case Type::FitContent: return String::formatted("fit-content({})", TRY(m_length_percentage.to_string())); case Type::None: - return String::from_utf8("none"sv); + return "none"_string; } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 638f2dfe07..a3881cd909 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -1591,7 +1591,7 @@ public: } virtual ~InheritStyleValue() override = default; - ErrorOr<String> to_string() const override { return String::from_utf8("inherit"sv); } + ErrorOr<String> to_string() const override { return "inherit"_string; } bool properties_equal(InheritStyleValue const&) const { return true; } @@ -1611,7 +1611,7 @@ public: } virtual ~InitialStyleValue() override = default; - ErrorOr<String> to_string() const override { return String::from_utf8("initial"sv); } + ErrorOr<String> to_string() const override { return "initial"_string; } bool properties_equal(InitialStyleValue const&) const { return true; } @@ -2029,7 +2029,7 @@ public: } virtual ~UnsetStyleValue() override = default; - ErrorOr<String> to_string() const override { return String::from_utf8("unset"sv); } + ErrorOr<String> to_string() const override { return "unset"_string; } bool properties_equal(UnsetStyleValue const&) const { return true; } diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 22ac299f9f..4c7df52cb2 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -599,7 +599,7 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul builder.append("sources:\n"sv); for (auto const& source : font_face.sources()) { indent(builder, indent_levels + 2); - builder.appendff("url={}, format={}\n", source.url, source.format.value_or(String::from_utf8_short_string("???"sv))); + builder.appendff("url={}, format={}\n", source.url, source.format.value_or("???"_short_string)); } indent(builder, indent_levels + 1); diff --git a/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp b/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp index 73cefdfaeb..05aeb6e485 100644 --- a/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp +++ b/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp @@ -35,7 +35,7 @@ WebIDL::ExceptionOr<XHR::FormDataEntry> create_entry(JS::Realm& realm, String co if (filename.has_value()) name_attribute = filename.value(); else - name_attribute = TRY_OR_THROW_OOM(vm, String::from_utf8("blob"sv)); + name_attribute = TRY_OR_THROW_OOM(vm, "blob"_string); return JS::make_handle(TRY(FileAPI::File::create(realm, { JS::make_handle(*blob) }, name_attribute.to_deprecated_string(), {}))); })); diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 58c3ecab54..1395523edf 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -26,8 +26,8 @@ namespace Web::HTML { struct WorkerOptions { - String type { String::from_utf8("classic"sv).release_value_but_fixme_should_propagate_errors() }; - String credentials { String::from_utf8("same-origin"sv).release_value_but_fixme_should_propagate_errors() }; + String type { "classic"_string.release_value_but_fixme_should_propagate_errors() }; + String credentials { "same-origin"_string.release_value_but_fixme_should_propagate_errors() }; String name { String {} }; }; diff --git a/Userland/Services/Taskbar/ShutdownDialog.cpp b/Userland/Services/Taskbar/ShutdownDialog.cpp index c936d16863..fa89958c22 100644 --- a/Userland/Services/Taskbar/ShutdownDialog.cpp +++ b/Userland/Services/Taskbar/ShutdownDialog.cpp @@ -93,13 +93,13 @@ ShutdownDialog::ShutdownDialog() button_container.set_fixed_height(23); button_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 5); button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); - auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv)); + auto& ok_button = button_container.add<GUI::Button>("OK"_short_string); ok_button.set_fixed_size(80, 23); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; ok_button.set_default(true); - auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); + auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string); cancel_button.set_fixed_size(80, 23); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index f850c2eb39..0663e6af87 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -112,7 +112,7 @@ void TaskbarWindow::add_system_menu(NonnullRefPtr<GUI::Menu> system_menu) { m_system_menu = move(system_menu); - m_start_button = GUI::Button::construct(String::from_utf8("Serenity"sv).release_value_but_fixme_should_propagate_errors()); + m_start_button = GUI::Button::construct("Serenity"_string.release_value_but_fixme_should_propagate_errors()); set_start_button_font(Gfx::FontDatabase::default_font().bold_variant()); m_start_button->set_icon_spacing(0); auto app_icon = GUI::Icon::default_icon("ladyball"sv); diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index a64c9b3f41..6e2a000096 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -117,7 +117,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request) if (Configuration::the().credentials().has_value()) { bool has_authenticated = verify_credentials(request.headers()); if (!has_authenticated) { - auto const basic_auth_header = TRY(String::from_utf8("WWW-Authenticate: Basic realm=\"WebServer\", charset=\"UTF-8\""sv)); + auto const basic_auth_header = TRY("WWW-Authenticate: Basic realm=\"WebServer\", charset=\"UTF-8\""_string); Vector<String> headers {}; TRY(headers.try_append(basic_auth_header)); TRY(send_error_response(401, request, move(headers))); @@ -338,7 +338,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str auto response = builder.to_deprecated_string(); FixedMemoryStream stream { response.bytes() }; - return send_response(stream, request, { .type = TRY(String::from_utf8("text/html"sv)), .length = response.length() }); + return send_response(stream, request, { .type = TRY("text/html"_string), .length = response.length() }); } ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const& request, Vector<String> const& headers) diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp index 01bcd0d67c..ecbf66928f 100644 --- a/Userland/Services/WebServer/main.cpp +++ b/Userland/Services/WebServer/main.cpp @@ -22,9 +22,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { - static auto const default_listen_address = TRY(String::from_utf8("0.0.0.0"sv)); + static auto const default_listen_address = TRY("0.0.0.0"_string); static auto const default_port = 8000; - static auto const default_document_root_path = TRY(String::from_utf8("/www"sv)); + static auto const default_document_root_path = TRY("/www"_string); DeprecatedString listen_address = default_listen_address.to_deprecated_string(); int port = default_port; diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp index c664e28fee..27ff9284a4 100644 --- a/Userland/Utilities/man.cpp +++ b/Userland/Utilities/man.cpp @@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto buffer = TRY(file->read_until_eof()); auto source = DeprecatedString::copy(buffer); - auto const title = TRY(String::from_utf8("SerenityOS manual"sv)); + auto const title = TRY("SerenityOS manual"_string); int spaces = max(view_width / 2 - page_name.code_points().length() - section->section_name().code_points().length() - title.code_points().length() / 2 - 4, 0); outln("{}({}){}{}", page_name, section->section_name(), DeprecatedString::repeated(' ', spaces), title); |