mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:17:36 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
|
||||
struct KeyPosition {
|
||||
u32 scancode;
|
||||
|
@ -16,7 +16,7 @@ struct KeyPosition {
|
|||
int height;
|
||||
bool enabled;
|
||||
int map_index;
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
};
|
||||
|
||||
#define KEY_COUNT 63
|
||||
|
|
|
@ -51,7 +51,7 @@ void KeyboardMapperWidget::create_frame()
|
|||
|
||||
auto& tmp_button = main_widget.add<KeyButton>();
|
||||
tmp_button.set_relative_rect(rect);
|
||||
tmp_button.set_text(String::from_deprecated_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
|
||||
tmp_button.set_text(String::from_byte_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
|
||||
tmp_button.set_enabled(keys[i].enabled);
|
||||
|
||||
tmp_button.on_click = [this, &tmp_button]() {
|
||||
|
@ -125,7 +125,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name)
|
|||
return map;
|
||||
}
|
||||
|
||||
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(DeprecatedString const& filename)
|
||||
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(ByteString const& filename)
|
||||
{
|
||||
auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename));
|
||||
|
||||
|
@ -147,7 +147,7 @@ ErrorOr<void> KeyboardMapperWidget::load_map_from_system()
|
|||
{
|
||||
auto character_map = TRY(Keyboard::CharacterMap::fetch_system_map());
|
||||
|
||||
m_filename = DeprecatedString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
|
||||
m_filename = ByteString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
|
||||
m_character_map = character_map.character_map_data();
|
||||
set_current_map("map");
|
||||
|
||||
|
@ -169,14 +169,14 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
{
|
||||
JsonObject map_json;
|
||||
|
||||
auto add_array = [&](DeprecatedString name, u32* values) {
|
||||
auto add_array = [&](ByteString name, u32* values) {
|
||||
JsonArray items;
|
||||
for (int i = 0; i < 90; i++) {
|
||||
StringBuilder sb;
|
||||
if (values[i])
|
||||
sb.append_code_point(values[i]);
|
||||
|
||||
JsonValue val(sb.to_deprecated_string());
|
||||
JsonValue val(sb.to_byte_string());
|
||||
items.must_append(move(val));
|
||||
}
|
||||
map_json.set(name, move(items));
|
||||
|
@ -189,7 +189,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
|
||||
|
||||
// Write to file.
|
||||
DeprecatedString file_content = map_json.to_deprecated_string();
|
||||
ByteString file_content = map_json.to_byte_string();
|
||||
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Write));
|
||||
TRY(file->write_until_depleted(file_content.bytes()));
|
||||
file->close();
|
||||
|
@ -234,7 +234,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
|
||||
void KeyboardMapperWidget::set_current_map(const ByteString current_map)
|
||||
{
|
||||
m_current_map_name = current_map;
|
||||
u32* map = map_from_name(m_current_map_name);
|
||||
|
@ -259,7 +259,7 @@ void KeyboardMapperWidget::update_window_title()
|
|||
sb.append(m_filename);
|
||||
sb.append("[*] - Keyboard Mapper"sv);
|
||||
|
||||
window()->set_title(sb.to_deprecated_string());
|
||||
window()->set_title(sb.to_byte_string());
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::show_error_to_user(Error error)
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual ~KeyboardMapperWidget() override = default;
|
||||
|
||||
void create_frame();
|
||||
ErrorOr<void> load_map_from_file(DeprecatedString const&);
|
||||
ErrorOr<void> load_map_from_file(ByteString 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 DeprecatedString);
|
||||
void set_current_map(const ByteString);
|
||||
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&);
|
||||
|
||||
DeprecatedString m_filename;
|
||||
ByteString m_filename;
|
||||
Keyboard::CharacterMapData m_character_map;
|
||||
DeprecatedString m_current_map_name;
|
||||
ByteString m_current_map_name;
|
||||
bool m_automatic_modifier { false };
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!keyboard_mapper_widget->request_close())
|
||||
return;
|
||||
|
||||
Optional<DeprecatedString> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
|
||||
Optional<ByteString> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
|
||||
if (!path.has_value())
|
||||
return;
|
||||
|
||||
|
@ -63,8 +63,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
});
|
||||
|
||||
auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
DeprecatedString name = "Unnamed";
|
||||
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
|
||||
ByteString name = "Unnamed";
|
||||
Optional<ByteString> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
|
||||
if (!save_path.has_value())
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue