mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-masterword"));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-masterword"sv));
|
||||
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
|
||||
|
@ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto game = TRY(window->try_set_main_widget<WordGame>());
|
||||
|
||||
auto use_system_theme = Config::read_bool("MasterWord", "", "use_system_theme", false);
|
||||
auto use_system_theme = Config::read_bool("MasterWord"sv, ""sv, "use_system_theme"sv, false);
|
||||
game->set_use_system_theme(use_system_theme);
|
||||
|
||||
auto shortest_word = game->shortest_word();
|
||||
|
@ -68,33 +68,33 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto settings_menu = TRY(window->try_add_menu("&Settings"));
|
||||
|
||||
TRY(settings_menu->try_add_action(GUI::Action::create("Set &Word Length", [&](auto&) {
|
||||
auto word_length = Config::read_i32("MasterWord", "", "word_length", 5);
|
||||
auto word_length = Config::read_i32("MasterWord"sv, ""sv, "word_length"sv, 5);
|
||||
auto word_length_string = String::number(word_length);
|
||||
if (GUI::InputBox::show(window, word_length_string, "Word length:", "MasterWord") == GUI::InputBox::ExecResult::OK && !word_length_string.is_empty()) {
|
||||
if (GUI::InputBox::show(window, word_length_string, "Word length:"sv, "MasterWord"sv) == GUI::InputBox::ExecResult::OK && !word_length_string.is_empty()) {
|
||||
auto maybe_word_length = word_length_string.template to_uint();
|
||||
if (!maybe_word_length.has_value() || maybe_word_length.value() < shortest_word || maybe_word_length.value() > longest_word) {
|
||||
GUI::MessageBox::show(window, String::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord");
|
||||
GUI::MessageBox::show(window, String::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"sv);
|
||||
return;
|
||||
}
|
||||
|
||||
word_length = maybe_word_length.value();
|
||||
Config::write_i32("MasterWord", "", "word_length", word_length);
|
||||
Config::write_i32("MasterWord"sv, ""sv, "word_length"sv, word_length);
|
||||
game->set_word_length(word_length);
|
||||
window->resize(game->game_size());
|
||||
}
|
||||
})));
|
||||
TRY(settings_menu->try_add_action(GUI::Action::create("Set &Number Of Guesses", [&](auto&) {
|
||||
auto max_guesses = Config::read_i32("MasterWord", "", "max_guesses", 5);
|
||||
auto max_guesses = Config::read_i32("MasterWord"sv, ""sv, "max_guesses"sv, 5);
|
||||
auto max_guesses_string = String::number(max_guesses);
|
||||
if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:", "MasterWord") == GUI::InputBox::ExecResult::OK && !max_guesses_string.is_empty()) {
|
||||
if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:"sv, "MasterWord"sv) == GUI::InputBox::ExecResult::OK && !max_guesses_string.is_empty()) {
|
||||
auto maybe_max_guesses = max_guesses_string.template to_uint();
|
||||
if (!maybe_max_guesses.has_value() || maybe_max_guesses.value() < 1 || maybe_max_guesses.value() > 20) {
|
||||
GUI::MessageBox::show(window, "Please enter a number between 1 and 20.", "MasterWord");
|
||||
GUI::MessageBox::show(window, "Please enter a number between 1 and 20."sv, "MasterWord"sv);
|
||||
return;
|
||||
}
|
||||
|
||||
max_guesses = maybe_max_guesses.value();
|
||||
Config::write_i32("MasterWord", "", "max_guesses", max_guesses);
|
||||
Config::write_i32("MasterWord"sv, ""sv, "max_guesses"sv, max_guesses);
|
||||
game->set_max_guesses(max_guesses);
|
||||
window->resize(game->game_size());
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto toggle_check_guesses = GUI::Action::create_checkable("Check &Guesses in dictionary", [&](auto& action) {
|
||||
auto checked = action.is_checked();
|
||||
game->set_check_guesses_in_dictionary(checked);
|
||||
Config::write_bool("MasterWord", "", "check_guesses_in_dictionary", checked);
|
||||
Config::write_bool("MasterWord"sv, ""sv, "check_guesses_in_dictionary"sv, checked);
|
||||
});
|
||||
toggle_check_guesses->set_checked(game->is_checking_guesses());
|
||||
TRY(settings_menu->try_add_action(toggle_check_guesses));
|
||||
|
@ -111,7 +111,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto theme_menu = TRY(window->try_add_menu("&Theme"));
|
||||
auto system_theme_action = GUI::Action::create("&System", [&](auto&) {
|
||||
game->set_use_system_theme(true);
|
||||
Config::write_bool("MasterWord", "", "use_system_theme", true);
|
||||
Config::write_bool("MasterWord"sv, ""sv, "use_system_theme"sv, true);
|
||||
});
|
||||
system_theme_action->set_checkable(true);
|
||||
system_theme_action->set_checked(use_system_theme);
|
||||
|
@ -119,7 +119,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto wordle_theme_action = GUI::Action::create("&Wordle", [&](auto&) {
|
||||
game->set_use_system_theme(false);
|
||||
Config::write_bool("MasterWord", "", "use_system_theme", false);
|
||||
Config::write_bool("MasterWord"sv, ""sv, "use_system_theme"sv, false);
|
||||
});
|
||||
wordle_theme_action->set_checkable(true);
|
||||
wordle_theme_action->set_checked(!use_system_theme);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue