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

@ -121,7 +121,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
Config::write_string("PixelPaint"sv, "NewImage"sv, "Name"sv, m_image_name);
Config::write_i32("PixelPaint"sv, "NewImage"sv, "Width"sv, m_image_size.width());
Config::write_i32("PixelPaint"sv, "NewImage"sv, "Height"sv, m_image_size.height());
Config::write_string("PixelPaint"sv, "NewImage"sv, "Background"sv, m_background_color.to_deprecated_string());
Config::write_string("PixelPaint"sv, "NewImage"sv, "Background"sv, m_background_color.to_byte_string());
}
done(ExecResult::OK);

View file

@ -16,13 +16,13 @@ class CreateNewImageDialog final : public GUI::Dialog {
public:
Gfx::IntSize image_size() const { return m_image_size; }
DeprecatedString const& image_name() const { return m_image_name; }
ByteString const& image_name() const { return m_image_name; }
Gfx::Color background_color() const { return m_background_color; }
private:
CreateNewImageDialog(GUI::Window* parent_window);
DeprecatedString m_image_name;
ByteString m_image_name;
Gfx::IntSize m_image_size;
Gfx::Color m_background_color {};

View file

@ -15,7 +15,7 @@ class CreateNewLayerDialog final : public GUI::Dialog {
public:
Gfx::IntSize layer_size() const { return m_layer_size; }
DeprecatedString const& layer_name() const { return m_layer_name; }
ByteString const& layer_name() const { return m_layer_name; }
private:
static constexpr StringView default_layer_name = "Layer"sv;
@ -23,7 +23,7 @@ private:
CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Window* parent_window);
Gfx::IntSize m_layer_size;
DeprecatedString m_layer_name { default_layer_name };
ByteString m_layer_name { default_layer_name };
RefPtr<GUI::TextBox> m_name_textbox;
};

View file

@ -13,7 +13,7 @@
namespace PixelPaint {
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset, Guide::Orientation orientation)
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, ByteString const& offset, Guide::Orientation orientation)
: Dialog(parent_window)
, m_offset(offset)
, m_orientation(orientation)

View file

@ -16,15 +16,15 @@ class EditGuideDialog final : public GUI::Dialog {
C_OBJECT(EditGuideDialog);
public:
DeprecatedString const offset() const { return m_offset; }
ByteString const offset() const { return m_offset; }
Guide::Orientation orientation() const { return m_orientation; }
Optional<float> offset_as_pixel(ImageEditor const&);
private:
EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset);
EditGuideDialog(GUI::Window* parent_window, ByteString const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset);
DeprecatedString m_offset;
ByteString m_offset;
Guide::Orientation m_orientation;
RefPtr<GUI::TextBox> m_offset_text_box;
bool m_is_horizontal_checked { false };

View file

@ -16,7 +16,7 @@ namespace PixelPaint {
class FilterNode final : public GUI::TreeViewModel::Node {
public:
FilterNode(DeprecatedString text, Optional<GUI::Icon> icon, Node* parent_node, NonnullRefPtr<Filter> filter)
FilterNode(ByteString text, Optional<GUI::Icon> icon, Node* parent_node, NonnullRefPtr<Filter> filter)
: Node(move(text), move(icon), parent_node)
, m_filter(move(filter))
{

View file

@ -54,7 +54,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Image::decode_bitmap(ReadonlyBytes bitmap_da
{
// Spawn a new ImageDecoder service process and connect to it.
auto client = TRY(ImageDecoderClient::Client::try_create());
auto optional_mime_type = guessed_mime_type.map([](auto mime_type) { return mime_type.to_deprecated_string(); });
auto optional_mime_type = guessed_mime_type.map([](auto mime_type) { return mime_type.to_byte_string(); });
// FIXME: Find a way to avoid the memory copying here.
auto maybe_decoded_image = client->decode_image(bitmap_data, optional_mime_type);
@ -85,14 +85,14 @@ ErrorOr<NonnullRefPtr<Image>> Image::create_from_pixel_paint_json(JsonObject con
auto layers_value = json.get_array("layers"sv).value();
for (auto& layer_value : layers_value.values()) {
auto const& layer_object = layer_value.as_object();
auto name = layer_object.get_deprecated_string("name"sv).value();
auto name = layer_object.get_byte_string("name"sv).value();
auto bitmap_base64_encoded = layer_object.get_deprecated_string("bitmap"sv).value();
auto bitmap_base64_encoded = layer_object.get_byte_string("bitmap"sv).value();
auto bitmap_data = TRY(decode_base64(bitmap_base64_encoded));
auto bitmap = TRY(decode_bitmap(bitmap_data, {}));
auto layer = TRY(Layer::create_with_bitmap(*image, move(bitmap), name));
if (auto const& mask_object = layer_object.get_deprecated_string("mask"sv); mask_object.has_value()) {
if (auto const& mask_object = layer_object.get_byte_string("mask"sv); mask_object.has_value()) {
auto mask_base64_encoded = mask_object.value();
auto mask_data = TRY(decode_base64(mask_base64_encoded));
auto mask = TRY(decode_bitmap(mask_data, {}));
@ -519,7 +519,7 @@ void Image::did_change_rect(Gfx::IntRect const& a_modified_rect)
client->image_did_change_rect(modified_rect);
}
ImageUndoCommand::ImageUndoCommand(Image& image, DeprecatedString action_text)
ImageUndoCommand::ImageUndoCommand(Image& image, ByteString action_text)
: m_snapshot(image.take_snapshot().release_value_but_fixme_should_propagate_errors())
, m_image(image)
, m_action_text(move(action_text))

View file

@ -136,16 +136,16 @@ private:
class ImageUndoCommand : public GUI::Command {
public:
ImageUndoCommand(Image&, DeprecatedString action_text);
ImageUndoCommand(Image&, ByteString action_text);
virtual void undo() override;
virtual void redo() override;
virtual DeprecatedString action_text() const override { return m_action_text; }
virtual ByteString action_text() const override { return m_action_text; }
private:
RefPtr<Image> m_snapshot;
Image& m_image;
DeprecatedString m_action_text;
ByteString m_action_text;
};
}

View file

@ -34,7 +34,7 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
, m_gui_event_loop(Core::EventLoop::current())
{
set_focus_policy(GUI::FocusPolicy::StrongFocus);
m_undo_stack.push(make<ImageUndoCommand>(*m_image, DeprecatedString()));
m_undo_stack.push(make<ImageUndoCommand>(*m_image, ByteString()));
m_image->add_client(*this);
m_image->selection().add_client(*this);
set_original_rect(m_image->rect());
@ -61,7 +61,7 @@ ImageEditor::~ImageEditor()
m_image->remove_client(*this);
}
void ImageEditor::did_complete_action(DeprecatedString action_text)
void ImageEditor::did_complete_action(ByteString action_text)
{
set_modified(move(action_text));
}
@ -110,13 +110,13 @@ void ImageEditor::set_title(String title)
on_title_change(m_title);
}
void ImageEditor::set_path(DeprecatedString path)
void ImageEditor::set_path(ByteString path)
{
m_path = move(path);
set_title(String::from_deprecated_string(LexicalPath::title(m_path)).release_value_but_fixme_should_propagate_errors());
set_title(String::from_byte_string(LexicalPath::title(m_path)).release_value_but_fixme_should_propagate_errors());
}
void ImageEditor::set_modified(DeprecatedString action_text)
void ImageEditor::set_modified(ByteString action_text)
{
m_undo_stack.push(make<ImageUndoCommand>(*m_image, move(action_text)));
update_modified();
@ -227,7 +227,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
int const editor_x = content_to_frame_position({ x, 0 }).x();
painter.draw_line({ editor_x, 0 }, { editor_x, m_ruler_thickness }, ruler_fg_color);
painter.draw_text(Gfx::IntRect { { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, DeprecatedString::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color);
painter.draw_text(Gfx::IntRect { { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, ByteString::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color);
}
// Vertical ruler
@ -244,7 +244,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
int const editor_y = content_to_frame_position({ 0, y }).y();
painter.draw_line({ 0, editor_y }, { m_ruler_thickness, editor_y }, ruler_fg_color);
painter.draw_text(Gfx::IntRect { { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, DeprecatedString::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color);
painter.draw_text(Gfx::IntRect { { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, ByteString::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color);
}
// Mouse position indicator
@ -360,7 +360,7 @@ void ImageEditor::set_status_info_to_color_at_mouse_position(Gfx::IntPoint posit
if (!color.has_value())
return;
set_appended_status_info(DeprecatedString::formatted("R:{}, G:{}, B:{}, A:{} [{}]", color->red(), color->green(), color->blue(), color->alpha(), color->to_deprecated_string()));
set_appended_status_info(ByteString::formatted("R:{}, G:{}, B:{}, A:{} [{}]", color->red(), color->green(), color->blue(), color->alpha(), color->to_byte_string()));
}
void ImageEditor::set_editor_color_to_color_at_mouse_position(GUI::MouseEvent const& event, bool sample_all_layers = false)
@ -767,7 +767,7 @@ void ImageEditor::save_project()
void ImageEditor::save_project_as()
{
auto response = FileSystemAccessClient::Client::the().save_file(window(), m_title.to_deprecated_string(), "pp");
auto response = FileSystemAccessClient::Client::the().save_file(window(), m_title.to_byte_string(), "pp");
if (response.is_error())
return;
auto file = response.release_value();
@ -776,7 +776,7 @@ void ImageEditor::save_project_as()
GUI::MessageBox::show_error(window(), MUST(String::formatted("Could not save {}: {}", file.filename(), result.release_error())));
return;
}
set_path(file.filename().to_deprecated_string());
set_path(file.filename().to_byte_string());
set_loaded_from_image(false);
set_unmodified();
}
@ -911,25 +911,25 @@ void ImageEditor::selection_did_change()
update();
}
void ImageEditor::set_appended_status_info(DeprecatedString new_status_info)
void ImageEditor::set_appended_status_info(ByteString new_status_info)
{
m_appended_status_info = new_status_info;
if (on_appended_status_info_change)
on_appended_status_info_change(m_appended_status_info);
}
DeprecatedString ImageEditor::generate_unique_layer_name(DeprecatedString const& original_layer_name)
ByteString ImageEditor::generate_unique_layer_name(ByteString const& original_layer_name)
{
constexpr StringView copy_string_view = " copy"sv;
auto copy_suffix_index = original_layer_name.find_last(copy_string_view);
if (!copy_suffix_index.has_value())
return DeprecatedString::formatted("{}{}", original_layer_name, copy_string_view);
return ByteString::formatted("{}{}", original_layer_name, copy_string_view);
auto after_copy_suffix_view = original_layer_name.substring_view(copy_suffix_index.value() + copy_string_view.length());
if (!after_copy_suffix_view.is_empty()) {
auto after_copy_suffix_number = after_copy_suffix_view.trim_whitespace().to_int();
if (!after_copy_suffix_number.has_value())
return DeprecatedString::formatted("{}{}", original_layer_name, copy_string_view);
return ByteString::formatted("{}{}", original_layer_name, copy_string_view);
}
auto layer_with_name_exists = [this](auto name) {
@ -948,7 +948,7 @@ DeprecatedString ImageEditor::generate_unique_layer_name(DeprecatedString const&
new_layer_name.appendff("{}{} {}", base_layer_name, copy_string_view, ++duplicate_name_count);
} while (layer_with_name_exists(new_layer_name.string_view()));
return new_layer_name.to_deprecated_string();
return new_layer_name.to_byte_string();
}
Gfx::IntRect ImageEditor::active_layer_visible_rect()

View file

@ -44,14 +44,14 @@ public:
void set_active_tool(Tool*);
void update_tool_cursor();
void did_complete_action(DeprecatedString action_text);
void did_complete_action(ByteString action_text);
bool undo();
bool redo();
auto& undo_stack() { return m_undo_stack; }
DeprecatedString const& path() const { return m_path; }
void set_path(DeprecatedString);
ByteString const& path() const { return m_path; }
void set_path(ByteString);
String const& title() const { return m_title; }
void set_title(String);
@ -122,13 +122,13 @@ public:
void set_status_info_to_color_at_mouse_position(Gfx::IntPoint position, bool sample_all_layers);
void set_editor_color_to_color_at_mouse_position(GUI::MouseEvent const& event, bool sample_all_layers);
void set_modified(DeprecatedString action_text);
void set_modified(ByteString action_text);
void set_unmodified();
void update_modified();
Function<void(DeprecatedString)> on_appended_status_info_change;
DeprecatedString appended_status_info() { return m_appended_status_info; }
void set_appended_status_info(DeprecatedString);
DeprecatedString generate_unique_layer_name(DeprecatedString const& original_layer_name);
Function<void(ByteString)> on_appended_status_info_change;
ByteString appended_status_info() { return m_appended_status_info; }
void set_appended_status_info(ByteString);
ByteString generate_unique_layer_name(ByteString const& original_layer_name);
private:
explicit ImageEditor(NonnullRefPtr<Image>);
@ -170,7 +170,7 @@ private:
RefPtr<Layer> m_active_layer;
GUI::UndoStack m_undo_stack;
DeprecatedString m_path;
ByteString m_path;
String m_title;
Vector<NonnullRefPtr<Guide>> m_guides;
@ -202,7 +202,7 @@ private:
void draw_marching_ants_pixel(Gfx::Painter&, int x, int y) const;
Core::EventLoop& m_gui_event_loop;
DeprecatedString m_appended_status_info;
ByteString m_appended_status_info;
};
}

View file

@ -378,7 +378,7 @@ void ColorWheelWidget::paint_event(GUI::PaintEvent&)
aa_painter.fill_circle({ 0, 0 }, (height() - 4) / 4, Color::from_hsv(hue(), 1, 1));
painter.restore();
auto hue_text = DeprecatedString::formatted("hue: {:.0}", hue());
auto hue_text = ByteString::formatted("hue: {:.0}", hue());
painter.draw_text(rect().translated(1, 1), hue_text, Gfx::TextAlignment::Center, Color::Black);
painter.draw_text(rect(), hue_text, Gfx::TextAlignment::Center, Color::White);
}

View file

@ -31,7 +31,7 @@ void FilterApplicationCommand::execute()
m_filter->m_editor->gui_event_loop().deferred_invoke([strong_this = NonnullRefPtr(*this)]() {
strong_this->m_target_layer->did_modify_bitmap(strong_this->m_target_layer->rect());
strong_this->m_filter->m_editor->did_complete_action(DeprecatedString::formatted("Filter {}", strong_this->m_filter->filter_name()));
strong_this->m_filter->m_editor->did_complete_action(ByteString::formatted("Filter {}", strong_this->m_filter->filter_name()));
});
}

View file

@ -18,7 +18,7 @@
namespace PixelPaint {
ErrorOr<NonnullRefPtr<Layer>> Layer::create_with_size(Image& image, Gfx::IntSize size, DeprecatedString name)
ErrorOr<NonnullRefPtr<Layer>> Layer::create_with_size(Image& image, Gfx::IntSize size, ByteString name)
{
VERIFY(!size.is_empty());
@ -29,7 +29,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::create_with_size(Image& image, Gfx::IntSize
return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, move(bitmap), move(name)));
}
ErrorOr<NonnullRefPtr<Layer>> Layer::create_with_bitmap(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, DeprecatedString name)
ErrorOr<NonnullRefPtr<Layer>> Layer::create_with_bitmap(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, ByteString name)
{
VERIFY(!bitmap->size().is_empty());
@ -64,7 +64,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::create_snapshot(Image& image, Layer const&
return snapshot;
}
Layer::Layer(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, DeprecatedString name)
Layer::Layer(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, ByteString name)
: m_image(image)
, m_name(move(name))
, m_content_bitmap(move(bitmap))
@ -112,7 +112,7 @@ void Layer::set_opacity_percent(int opacity_percent)
m_image.layer_did_modify_properties({}, *this);
}
void Layer::set_name(DeprecatedString name)
void Layer::set_name(ByteString name)
{
if (m_name == name)
return;
@ -486,7 +486,7 @@ Optional<Gfx::IntRect> Layer::editing_mask_bounding_rect() const
*max_content_y - *min_content_y + 1
};
}
ErrorOr<NonnullRefPtr<Layer>> Layer::duplicate(DeprecatedString name)
ErrorOr<NonnullRefPtr<Layer>> Layer::duplicate(ByteString name)
{
auto duplicated_layer = TRY(Layer::create_snapshot(m_image, *this));
duplicated_layer->m_name = move(name);

View file

@ -9,7 +9,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Noncopyable.h>
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
@ -31,8 +31,8 @@ class Layer
AK_MAKE_NONMOVABLE(Layer);
public:
static ErrorOr<NonnullRefPtr<Layer>> create_with_size(Image&, Gfx::IntSize, DeprecatedString name);
static ErrorOr<NonnullRefPtr<Layer>> create_with_bitmap(Image&, NonnullRefPtr<Gfx::Bitmap>, DeprecatedString name);
static ErrorOr<NonnullRefPtr<Layer>> create_with_size(Image&, Gfx::IntSize, ByteString name);
static ErrorOr<NonnullRefPtr<Layer>> create_with_bitmap(Image&, NonnullRefPtr<Gfx::Bitmap>, ByteString name);
static ErrorOr<NonnullRefPtr<Layer>> create_snapshot(Image&, Layer const&);
~Layer() = default;
@ -68,8 +68,8 @@ public:
Gfx::IntRect relative_rect() const { return { location(), size() }; }
Gfx::IntRect rect() const { return { {}, size() }; }
DeprecatedString const& name() const { return m_name; }
void set_name(DeprecatedString);
ByteString const& name() const { return m_name; }
void set_name(ByteString);
enum class NotifyClients {
Yes,
@ -116,7 +116,7 @@ public:
Gfx::Bitmap& currently_edited_bitmap();
ErrorOr<NonnullRefPtr<Layer>> duplicate(DeprecatedString name);
ErrorOr<NonnullRefPtr<Layer>> duplicate(ByteString name);
ALWAYS_INLINE Color modify_pixel_with_editing_mask(int x, int y, Color const& target_color, Color const& current_color)
{
@ -134,11 +134,11 @@ public:
void on_second_paint(ImageEditor&);
private:
Layer(Image&, NonnullRefPtr<Gfx::Bitmap>, DeprecatedString name);
Layer(Image&, NonnullRefPtr<Gfx::Bitmap>, ByteString name);
Image& m_image;
DeprecatedString m_name;
ByteString m_name;
Gfx::IntPoint m_location;
NonnullRefPtr<Gfx::Bitmap> m_content_bitmap;
RefPtr<Gfx::Bitmap> m_scratch_edited_bitmap { nullptr };

View file

@ -129,7 +129,7 @@ void MainWidget::image_editor_did_update_undo_stack()
builder.append(' ');
builder.append(suffix.value());
}
return builder.to_deprecated_string();
return builder.to_byte_string();
};
auto& undo_stack = image_editor->undo_stack();
@ -141,7 +141,7 @@ void MainWidget::image_editor_did_update_undo_stack()
}
// Note: Update these together! v
static Vector<DeprecatedString> const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" };
static Vector<ByteString> const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" };
static constexpr int s_zoom_level_fit_width = 8;
static constexpr int s_zoom_level_fit_height = 9;
static constexpr int s_zoom_level_fit_image = 10;
@ -174,7 +174,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto& editor = create_new_editor(*image);
auto image_title = dialog->image_name().trim_whitespace();
editor.set_title((image_title.is_empty() ? "Untitled"_string : String::from_deprecated_string(image_title)).release_value_but_fixme_should_propagate_errors());
editor.set_title((image_title.is_empty() ? "Untitled"_string : String::from_byte_string(image_title)).release_value_but_fixme_should_propagate_errors());
editor.set_unmodified();
m_histogram_widget->set_image(image);
@ -205,7 +205,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
editor->save_project_as();
auto path_string = String::from_deprecated_string(editor->path()).release_value_but_fixme_should_propagate_errors();
auto path_string = String::from_byte_string(editor->path()).release_value_but_fixme_should_propagate_errors();
GUI::Application::the()->set_most_recently_open_file(path_string);
});
@ -213,7 +213,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
editor->save_project();
auto path_string = String::from_deprecated_string(editor->path()).release_value_but_fixme_should_propagate_errors();
auto path_string = String::from_byte_string(editor->path()).release_value_but_fixme_should_propagate_errors();
GUI::Application::the()->set_most_recently_open_file(path_string);
});
@ -230,7 +230,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
"As &BMP...", [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_deprecated_string(), "bmp");
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_byte_string(), "bmp");
if (response.is_error())
return;
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
@ -245,7 +245,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
// TODO: fix bmp on line below?
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_deprecated_string(), "png");
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_byte_string(), "png");
if (response.is_error())
return;
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
@ -259,7 +259,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
"As &QOI...", [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_deprecated_string(), "qoi");
auto response = FileSystemAccessClient::Client::the().save_file(&window, editor->title().to_byte_string(), "qoi");
if (response.is_error())
return;
auto result = editor->image().export_qoi_to_file(response.value().release_stream());
@ -325,9 +325,9 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
return;
}
auto layer_rect = editor->active_layer()->relative_rect();
HashMap<DeprecatedString, DeprecatedString> layer_metadata;
layer_metadata.set("pixelpaint-layer-x", DeprecatedString::number(layer_rect.x()));
layer_metadata.set("pixelpaint-layer-y", DeprecatedString::number(layer_rect.y()));
HashMap<ByteString, ByteString> layer_metadata;
layer_metadata.set("pixelpaint-layer-x", ByteString::number(layer_rect.x()));
layer_metadata.set("pixelpaint-layer-y", ByteString::number(layer_rect.y()));
GUI::Clipboard::the().set_bitmap(*bitmap, layer_metadata);
});
@ -1192,8 +1192,8 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
m_zoom_combobox = toolbar.add<GUI::ComboBox>();
m_zoom_combobox->set_max_width(75);
m_zoom_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(s_suggested_zoom_levels));
m_zoom_combobox->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const& index) {
m_zoom_combobox->set_model(*GUI::ItemListModel<ByteString>::create(s_suggested_zoom_levels));
m_zoom_combobox->on_change = [this](ByteString const& value, GUI::ModelIndex const& index) {
auto* editor = current_image_editor();
VERIFY(editor);
@ -1295,7 +1295,7 @@ void MainWidget::open_image(FileSystemAccessClient::File file)
auto& image = *m_loader.release_image();
auto& editor = create_new_editor(image);
editor.set_loaded_from_image(m_loader.is_raw_image());
editor.set_path(file.filename().to_deprecated_string());
editor.set_path(file.filename().to_byte_string());
editor.set_unmodified();
m_layer_list_widget->set_image(&image);
GUI::Application::the()->set_most_recently_open_file(file.filename());
@ -1415,7 +1415,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
};
image_editor.on_scale_change = Core::debounce(100, [this](float scale) {
m_zoom_combobox->set_text(DeprecatedString::formatted("{}%", roundf(scale * 100)));
m_zoom_combobox->set_text(ByteString::formatted("{}%", roundf(scale * 100)));
current_image_editor()->update_tool_cursor();
});
@ -1440,7 +1440,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
if (!value.is_object())
return;
auto& json_object = value.as_object();
auto orientation_value = json_object.get_deprecated_string("orientation"sv);
auto orientation_value = json_object.get_byte_string("orientation"sv);
if (!orientation_value.has_value())
return;
@ -1502,10 +1502,10 @@ void MainWidget::update_window_modified()
{
window()->set_modified(m_tab_widget->is_any_tab_modified());
}
void MainWidget::update_status_bar(DeprecatedString appended_text)
void MainWidget::update_status_bar(ByteString appended_text)
{
StringBuilder builder = StringBuilder();
builder.append(m_last_image_editor_mouse_position.to_deprecated_string());
builder.append(m_last_image_editor_mouse_position.to_byte_string());
if (!appended_text.is_empty()) {
builder.append(" "sv);
builder.append(appended_text);

View file

@ -62,7 +62,7 @@ private:
virtual void drop_event(GUI::DropEvent&) override;
void update_window_modified();
void update_status_bar(DeprecatedString appended_text = DeprecatedString::empty());
void update_status_bar(ByteString appended_text = ByteString::empty());
ProjectLoader m_loader;

View file

@ -240,7 +240,7 @@ ErrorOr<Vector<Color>> PaletteWidget::load_palette_file(NonnullOwnPtr<Core::File
return palette;
}
ErrorOr<Vector<Color>> PaletteWidget::load_palette_path(DeprecatedString const& file_path)
ErrorOr<Vector<Color>> PaletteWidget::load_palette_path(ByteString const& file_path)
{
auto file = TRY(Core::File::open(file_path, Core::File::OpenMode::Read));
return load_palette_file(move(file));
@ -249,7 +249,7 @@ ErrorOr<Vector<Color>> PaletteWidget::load_palette_path(DeprecatedString const&
ErrorOr<void> PaletteWidget::save_palette_file(Vector<Color> palette, NonnullOwnPtr<Core::File> file)
{
for (auto& color : palette) {
TRY(file->write_until_depleted(color.to_deprecated_string_without_alpha().bytes()));
TRY(file->write_until_depleted(color.to_byte_string_without_alpha().bytes()));
TRY(file->write_until_depleted({ "\n", 1 }));
}
return {};

View file

@ -32,7 +32,7 @@ public:
Vector<Color> colors();
static ErrorOr<Vector<Color>> load_palette_file(NonnullOwnPtr<Core::File>);
static ErrorOr<Vector<Color>> load_palette_path(DeprecatedString const&);
static ErrorOr<Vector<Color>> load_palette_path(ByteString const&);
static ErrorOr<void> save_palette_file(Vector<Color>, NonnullOwnPtr<Core::File>);
static Vector<Color> fallback_colors();

View file

@ -52,7 +52,7 @@ ToolboxWidget::ToolboxWidget()
void ToolboxWidget::setup_tools()
{
auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool, bool is_default_tool = false) {
auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::load_from_file(ByteString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
[this, tool = tool.ptr()](auto& action) {
if (action.is_checked()) {
on_tool_selection(tool);

View file

@ -140,7 +140,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
return;
auto dialog = EditGuideDialog::construct(
editor()->window(),
DeprecatedString::formatted("{}", m_context_menu_guide->offset()),
ByteString::formatted("{}", m_context_menu_guide->offset()),
m_context_menu_guide->orientation());
if (dialog->exec() != GUI::Dialog::ExecResult::OK)
return;

View file

@ -209,7 +209,7 @@ NonnullRefPtr<GUI::Widget> RectangleSelectTool::get_properties_widget()
auto& mode_combo = mode_container.add<GUI::ComboBox>();
mode_combo.set_only_allow_values_from_model(true);
mode_combo.set_model(*GUI::ItemListModel<DeprecatedString>::create(m_merge_mode_names));
mode_combo.set_model(*GUI::ItemListModel<ByteString>::create(m_merge_mode_names));
mode_combo.set_selected_index((int)m_merge_mode);
mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) {
VERIFY(index.row() >= 0);

View file

@ -40,7 +40,7 @@ private:
};
RefPtr<GUI::Widget> m_properties_widget;
Vector<DeprecatedString> m_merge_mode_names {};
Vector<ByteString> m_merge_mode_names {};
Selection::MergeMode m_merge_mode { Selection::MergeMode::Set };
float m_edge_feathering { 0.0f };
bool m_selecting { false };

View file

@ -122,7 +122,7 @@ NonnullRefPtr<GUI::Widget> WandSelectTool::get_properties_widget()
auto& mode_combo = mode_container.add<GUI::ComboBox>();
mode_combo.set_only_allow_values_from_model(true);
mode_combo.set_model(*GUI::ItemListModel<DeprecatedString>::create(m_merge_mode_names));
mode_combo.set_model(*GUI::ItemListModel<ByteString>::create(m_merge_mode_names));
mode_combo.set_selected_index((int)m_merge_mode);
mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) {
VERIFY(index.row() >= 0);

View file

@ -31,7 +31,7 @@ private:
int m_threshold { 0 };
RefPtr<GUI::Widget> m_properties_widget;
Vector<DeprecatedString> m_merge_mode_names {};
Vector<ByteString> m_merge_mode_names {};
Selection::MergeMode m_merge_mode { Selection::MergeMode::Set };
};