1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:18:11 +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:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -63,7 +63,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
String path;
if (!m_wallpaper_view->selection().is_empty()) {
auto index = m_wallpaper_view->selection().first();
auto path_or_error = String::from_deprecated_string(static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->full_path(index));
auto path_or_error = String::from_byte_string(static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->full_path(index));
if (path_or_error.is_error()) {
GUI::MessageBox::show_error(window(), "Unable to load wallpaper"sv);
return;
@ -78,7 +78,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
m_context_menu = GUI::Menu::construct();
auto const file_manager_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv));
m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", file_manager_icon, [this](GUI::Action const&) {
LexicalPath path { m_monitor_widget->wallpaper().value().to_deprecated_string() };
LexicalPath path { m_monitor_widget->wallpaper().value().to_byte_string() };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
});
m_context_menu->add_action(*m_show_in_file_manager_action);
@ -88,7 +88,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
[this](auto&) {
auto wallpaper = m_monitor_widget->wallpaper();
if (wallpaper.has_value())
GUI::Clipboard::the().set_data(URL::create_with_file_scheme(wallpaper.value().to_deprecated_string()).to_deprecated_string().bytes(), "text/uri-list");
GUI::Clipboard::the().set_data(URL::create_with_file_scheme(wallpaper.value().to_byte_string()).to_byte_string().bytes(), "text/uri-list");
},
this);
m_context_menu->add_action(*m_copy_action);
@ -144,14 +144,14 @@ ErrorOr<void> BackgroundSettingsWidget::load_current_settings()
{
auto ws_config = TRY(Core::ConfigFile::open("/etc/WindowServer.ini"));
auto selected_wallpaper = TRY(String::from_deprecated_string(Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv)));
auto selected_wallpaper = TRY(String::from_byte_string(Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv)));
if (!selected_wallpaper.is_empty()) {
auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper.to_deprecated_string(), m_wallpaper_view->model_column());
auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper.to_byte_string(), m_wallpaper_view->model_column());
m_wallpaper_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
m_monitor_widget->set_wallpaper(selected_wallpaper);
}
auto mode = TRY(String::from_deprecated_string(ws_config->read_entry("Background", "Mode", "Center")));
auto mode = TRY(String::from_byte_string(ws_config->read_entry("Background", "Mode", "Center")));
if (!m_modes.contains_slow(mode)) {
warnln("Invalid background mode '{}' in WindowServer config, falling back to 'Center'", mode);
mode = "Center"_string;