mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
2048: Replace usage of DeprecatedString
This commit is contained in:
parent
87bf5045e4
commit
bc8cad31de
Notes:
sideshowbarker
2024-07-17 01:06:10 +09:00
Author: https://github.com/aryanbaburajan 🔰 Commit: https://github.com/SerenityOS/serenity/commit/bc8cad31de Pull-request: https://github.com/SerenityOS/serenity/pull/19687 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/linusg
2 changed files with 6 additions and 6 deletions
|
@ -45,7 +45,7 @@ void BoardView::set_board(Game::Board const* board)
|
|||
|
||||
void BoardView::pick_font()
|
||||
{
|
||||
DeprecatedString best_font_name;
|
||||
String best_font_name;
|
||||
int best_font_size = -1;
|
||||
auto& font_database = Gfx::FontDatabase::the();
|
||||
font_database.for_each_font([&](Gfx::Font const& font) {
|
||||
|
@ -53,7 +53,7 @@ void BoardView::pick_font()
|
|||
return;
|
||||
auto size = font.pixel_size_rounded_up();
|
||||
if (size * 2 <= m_cell_size && size > best_font_size) {
|
||||
best_font_name = font.qualified_name();
|
||||
best_font_name = String::from_deprecated_string(font.qualified_name()).release_value_but_fixme_should_propagate_errors();
|
||||
best_font_size = size;
|
||||
}
|
||||
});
|
||||
|
@ -234,7 +234,7 @@ void BoardView::paint_event(GUI::PaintEvent& event)
|
|||
auto rect = Gfx::IntRect::centered_on(center, tile_size);
|
||||
|
||||
painter.fill_rect(rect, background_color_for_cell(sliding_tile.value_from));
|
||||
painter.draw_text(rect, DeprecatedString::number(sliding_tile.value_from), font(), Gfx::TextAlignment::Center, text_color_for_cell(sliding_tile.value_from));
|
||||
painter.draw_text(rect, String::number(sliding_tile.value_from).release_value_but_fixme_should_propagate_errors(), font(), Gfx::TextAlignment::Center, text_color_for_cell(sliding_tile.value_from));
|
||||
}
|
||||
} else {
|
||||
for (size_t column = 0; column < columns(); ++column) {
|
||||
|
@ -249,7 +249,7 @@ void BoardView::paint_event(GUI::PaintEvent& event)
|
|||
auto entry = tiles[row][column];
|
||||
painter.fill_rect(rect, background_color_for_cell(entry));
|
||||
if (entry > 0)
|
||||
painter.draw_text(rect, DeprecatedString::number(entry), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry));
|
||||
painter.draw_text(rect, String::number(entry).release_value_but_fixme_should_propagate_errors(), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
case Game::MoveOutcome::Won: {
|
||||
update();
|
||||
auto want_to_continue = GUI::MessageBox::show(window,
|
||||
DeprecatedString::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()),
|
||||
String::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()).release_value_but_fixme_should_propagate_errors(),
|
||||
"Congratulations!"sv,
|
||||
GUI::MessageBox::Type::Question,
|
||||
GUI::MessageBox::InputType::YesNo);
|
||||
|
@ -157,7 +157,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
case Game::MoveOutcome::GameOver:
|
||||
update();
|
||||
GUI::MessageBox::show(window,
|
||||
DeprecatedString::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()),
|
||||
String::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()).release_value_but_fixme_should_propagate_errors(),
|
||||
"You lost!"sv,
|
||||
GUI::MessageBox::Type::Information);
|
||||
start_a_new_game();
|
||||
|
|
Loading…
Reference in a new issue