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

@ -5,7 +5,7 @@
*/
#include "HighlightPreviewWidget.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibCore/ConfigFile.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h>
@ -22,7 +22,7 @@ HighlightPreviewWidget::HighlightPreviewWidget(Gfx::Palette const& palette)
ErrorOr<void> HighlightPreviewWidget::reload_cursor()
{
auto cursor_theme = GUI::ConnectionToWindowServer::the().get_cursor_theme();
auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini");
auto theme_path = ByteString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini");
auto cursor_theme_config = TRY(Core::ConfigFile::open(theme_path));
auto load_bitmap = [](StringView path, StringView default_path) {
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
@ -31,7 +31,7 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
return Gfx::Bitmap::load_from_file(default_path);
};
constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv;
auto cursor_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}",
auto cursor_path = ByteString::formatted("/res/cursor-themes/{}/{}",
cursor_theme, cursor_theme_config->read_entry("Cursor", "Arrow"));
m_cursor_bitmap = TRY(load_bitmap(cursor_path, default_cursor_path));
m_cursor_params = Gfx::CursorParams::parse_from_filename(cursor_path, m_cursor_bitmap->rect().center()).constrained(*m_cursor_bitmap);

View file

@ -51,7 +51,7 @@ void MouseCursorModel::invalidate()
m_cursors.clear();
// FIXME: Propagate errors.
(void)Core::Directory::for_each_entry(DeprecatedString::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
(void)Core::Directory::for_each_entry(ByteString::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
auto path = LexicalPath::join(directory.path().string(), entry.name);
if (path.has_extension(".ini"sv))
return IterationDecision::Continue;
@ -89,7 +89,7 @@ void ThemeModel::invalidate()
// FIXME: Propagate errors.
(void)Core::Directory::for_each_entry("/res/cursor-themes"sv, Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto&) -> ErrorOr<IterationDecision> {
if (access(DeprecatedString::formatted("/res/cursor-themes/{}/Config.ini", entry.name).characters(), R_OK) == 0)
if (access(ByteString::formatted("/res/cursor-themes/{}/Config.ini", entry.name).characters(), R_OK) == 0)
m_themes.append(entry.name);
return IterationDecision::Continue;
});
@ -127,7 +127,7 @@ ErrorOr<void> ThemeWidget::setup()
m_mouse_cursor_model->change_theme(theme_name);
m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box");
m_theme_name_box->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const&) {
m_theme_name_box->on_change = [this](ByteString const& value, GUI::ModelIndex const&) {
m_mouse_cursor_model->change_theme(value);
set_modified(true);
};

View file

@ -29,7 +29,7 @@ public:
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override;
virtual void invalidate() override;
void change_theme(DeprecatedString const& name)
void change_theme(ByteString const& name)
{
m_theme_name = name;
invalidate();
@ -40,13 +40,13 @@ private:
struct Cursor {
RefPtr<Gfx::Bitmap> bitmap;
DeprecatedString path;
DeprecatedString name;
ByteString path;
ByteString name;
Gfx::CursorParams params;
};
Vector<Cursor> m_cursors;
DeprecatedString m_theme_name;
ByteString m_theme_name;
};
class ThemeModel final : public GUI::Model {
@ -59,7 +59,7 @@ public:
virtual void invalidate() override;
private:
Vector<DeprecatedString> m_themes;
Vector<ByteString> m_themes;
};
class ThemeWidget final : public GUI::SettingsWindow::Tab {