1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:47:35 +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

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
struct KeyPosition {
u32 scancode;
@ -16,7 +16,7 @@ struct KeyPosition {
int height;
bool enabled;
int map_index;
String name;
DeprecatedString name;
};
#define KEY_COUNT 63

View file

@ -57,7 +57,7 @@ void KeyboardMapperWidget::create_frame()
tmp_button.set_enabled(keys[i].enabled);
tmp_button.on_click = [this, &tmp_button]() {
String value;
DeprecatedString value;
if (GUI::InputBox::show(window(), value, "New Character:"sv, "Select Character"sv) == GUI::InputBox::ExecResult::OK) {
int i = m_keys.find_first_index(&tmp_button).value_or(0);
VERIFY(i > 0);
@ -127,7 +127,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name)
return map;
}
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(String const& filename)
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(DeprecatedString const& filename)
{
auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename));
@ -149,7 +149,7 @@ ErrorOr<void> KeyboardMapperWidget::load_map_from_system()
{
auto character_map = TRY(Keyboard::CharacterMap::fetch_system_map());
m_filename = String::formatted("/res/keymaps/{}.json", character_map.character_map_name());
m_filename = DeprecatedString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
m_character_map = character_map.character_map_data();
set_current_map("map");
@ -171,7 +171,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
{
JsonObject map_json;
auto add_array = [&](String name, u32* values) {
auto add_array = [&](DeprecatedString name, u32* values) {
JsonArray items;
for (int i = 0; i < 90; i++) {
StringBuilder sb;
@ -191,7 +191,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
// Write to file.
String file_content = map_json.to_string();
DeprecatedString file_content = map_json.to_string();
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write));
TRY(file->write(file_content.bytes()));
file->close();
@ -236,7 +236,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
}
}
void KeyboardMapperWidget::set_current_map(const String current_map)
void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
{
m_current_map_name = current_map;
u32* map = map_from_name(m_current_map_name);

View file

@ -18,7 +18,7 @@ public:
virtual ~KeyboardMapperWidget() override = default;
void create_frame();
ErrorOr<void> load_map_from_file(String const&);
ErrorOr<void> load_map_from_file(DeprecatedString const&);
ErrorOr<void> load_map_from_system();
ErrorOr<void> save();
ErrorOr<void> save_to_file(StringView);
@ -31,7 +31,7 @@ protected:
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void keyup_event(GUI::KeyEvent&) override;
void set_current_map(const String);
void set_current_map(const DeprecatedString);
void update_window_title();
private:
@ -43,8 +43,8 @@ private:
u32* map_from_name(const StringView map_name);
void update_modifier_radio_buttons(GUI::KeyEvent&);
String m_filename;
DeprecatedString m_filename;
Keyboard::CharacterMapData m_character_map;
String m_current_map_name;
DeprecatedString m_current_map_name;
bool m_automatic_modifier { false };
};

View file

@ -50,7 +50,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!keyboard_mapper_widget->request_close())
return;
Optional<String> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
Optional<DeprecatedString> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
if (!path.has_value())
return;
@ -67,8 +67,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
});
auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
String name = "Unnamed";
Optional<String> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
DeprecatedString name = "Unnamed";
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
if (!save_path.has_value())
return;