1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-09-13 12:37:59 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -45,7 +45,7 @@ void BoardView::set_board(Game::Board const* board)
void BoardView::pick_font()
{
String best_font_name;
DeprecatedString best_font_name;
int best_font_size = -1;
auto& font_database = Gfx::FontDatabase::the();
font_database.for_each_font([&](Gfx::Font const& font) {
@ -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, String::number(sliding_tile.value_from), font(), Gfx::TextAlignment::Center, text_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));
}
} 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, String::number(entry), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry));
painter.draw_text(rect, DeprecatedString::number(entry), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry));
}
}
}

View file

@ -6,9 +6,9 @@
#include "Game.h"
#include <AK/Array.h>
#include <AK/DeprecatedString.h>
#include <AK/NumericLimits.h>
#include <AK/ScopeGuard.h>
#include <AK/String.h>
#include <stdlib.h>
Game::Game(size_t grid_size, size_t target_tile, bool evil_ai)

View file

@ -33,7 +33,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
board_size_spinbox->set_value(m_board_size);
auto tile_value_label = main_widget.find_descendant_of_type_named<GUI::Label>("tile_value_label");
tile_value_label->set_text(String::number(target_tile()));
tile_value_label->set_text(DeprecatedString::number(target_tile()));
auto target_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("target_spinbox");
target_spinbox->set_max(Game::max_power_for_board(m_board_size));
target_spinbox->set_value(m_target_tile_power);
@ -45,7 +45,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
target_spinbox->on_change = [this, tile_value_label](auto value) {
m_target_tile_power = value;
tile_value_label->set_text(String::number(target_tile()));
tile_value_label->set_text(DeprecatedString::number(target_tile()));
};
auto evil_ai_checkbox = main_widget.find_descendant_of_type_named<GUI::CheckBox>("evil_ai_checkbox");

View file

@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto update = [&]() {
board_view->set_board(&game.board());
board_view->update();
statusbar->set_text(String::formatted("Score: {}", game.score()));
statusbar->set_text(DeprecatedString::formatted("Score: {}", game.score()));
};
update();
@ -149,7 +149,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
case Game::MoveOutcome::Won: {
update();
auto want_to_continue = GUI::MessageBox::show(window,
String::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()),
DeprecatedString::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()),
"Congratulations!"sv,
GUI::MessageBox::Type::Question,
GUI::MessageBox::InputType::YesNo);
@ -162,7 +162,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
case Game::MoveOutcome::GameOver:
update();
GUI::MessageBox::show(window,
String::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()),
DeprecatedString::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()),
"You lost!"sv,
GUI::MessageBox::Type::Information);
start_a_new_game();