1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 20:37:35 +00:00

Everywhere: Use _{short_,}string to create Strings from literals

This commit is contained in:
Linus Groh 2023-02-25 16:40:37 +01:00
parent 85414d9338
commit 09d40bfbb2
92 changed files with 334 additions and 310 deletions

View file

@ -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);
}

View file

@ -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);
};
}