mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 23:27:44 +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
|
@ -217,7 +217,7 @@ enum class ImageType {
|
|||
class Mandelbrot : public GUI::Frame {
|
||||
C_OBJECT(Mandelbrot)
|
||||
|
||||
ErrorOr<void> export_image(DeprecatedString const& export_path, ImageType image_type);
|
||||
ErrorOr<void> export_image(ByteString const& export_path, ImageType image_type);
|
||||
|
||||
enum class Zoom {
|
||||
In,
|
||||
|
@ -366,7 +366,7 @@ void Mandelbrot::resize_event(GUI::ResizeEvent& event)
|
|||
m_set.resize(event.size());
|
||||
}
|
||||
|
||||
ErrorOr<void> Mandelbrot::export_image(DeprecatedString const& export_path, ImageType image_type)
|
||||
ErrorOr<void> Mandelbrot::export_image(ByteString const& export_path, ImageType image_type)
|
||||
{
|
||||
m_set.resize(Gfx::IntSize { 1920, 1080 });
|
||||
ByteBuffer encoded_data;
|
||||
|
@ -386,7 +386,7 @@ ErrorOr<void> Mandelbrot::export_image(DeprecatedString const& export_path, Imag
|
|||
m_set.resize(size());
|
||||
auto file = fopen(export_path.characters(), "wb");
|
||||
if (!file) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error);
|
||||
return {};
|
||||
}
|
||||
fwrite(encoded_data.data(), 1, encoded_data.size(), file);
|
||||
|
@ -419,27 +419,27 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
export_submenu->add_action(GUI::Action::create("As &BMP...",
|
||||
[&](GUI::Action&) {
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp");
|
||||
Optional<ByteString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
if (auto result = mandelbrot->export_image(export_path.value(), ImageType::BMP); result.is_error())
|
||||
GUI::MessageBox::show_error(window, DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window, ByteString::formatted("{}", result.error()));
|
||||
}));
|
||||
export_submenu->add_action(GUI::Action::create("As &PNG...", { Mod_Ctrl | Mod_Shift, Key_S },
|
||||
[&](GUI::Action&) {
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png");
|
||||
Optional<ByteString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
if (auto result = mandelbrot->export_image(export_path.value(), ImageType::PNG); result.is_error())
|
||||
GUI::MessageBox::show_error(window, DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window, ByteString::formatted("{}", result.error()));
|
||||
}));
|
||||
export_submenu->add_action(GUI::Action::create("As &QOI...",
|
||||
[&](GUI::Action&) {
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi");
|
||||
Optional<ByteString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
if (auto result = mandelbrot->export_image(export_path.value(), ImageType::QOI); result.is_error())
|
||||
GUI::MessageBox::show_error(window, DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window, ByteString::formatted("{}", result.error()));
|
||||
}));
|
||||
|
||||
export_submenu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv)));
|
||||
|
|
|
@ -50,7 +50,7 @@ GUI::ModelIndex BasicModel::index(int row, int column, GUI::ModelIndex const& pa
|
|||
return create_index(row, column);
|
||||
}
|
||||
|
||||
void BasicModel::add_item(DeprecatedString const& item)
|
||||
void BasicModel::add_item(ByteString const& item)
|
||||
{
|
||||
begin_insert_rows({}, m_items.size(), m_items.size());
|
||||
m_items.append(item);
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
Function<void()> on_invalidate;
|
||||
|
||||
void add_item(DeprecatedString const& item);
|
||||
void add_item(ByteString const& item);
|
||||
void remove_item(GUI::ModelIndex const&);
|
||||
|
||||
private:
|
||||
|
@ -37,5 +37,5 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> m_items;
|
||||
Vector<ByteString> m_items;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ class DemoWizardDialog : public GUI::WizardDialog {
|
|||
C_OBJECT(DemoWizardDialog);
|
||||
|
||||
public:
|
||||
DeprecatedString page_1_location() { return m_page_1_location_text_box->get_text(); }
|
||||
ByteString page_1_location() { return m_page_1_location_text_box->get_text(); }
|
||||
|
||||
private:
|
||||
DemoWizardDialog(GUI::Window* parent_window);
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
{
|
||||
m_cursors.clear();
|
||||
|
||||
Core::DirIterator iterator(DeprecatedString::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots);
|
||||
Core::DirIterator iterator(ByteString::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots);
|
||||
|
||||
while (iterator.has_next()) {
|
||||
auto path = iterator.next_full_path();
|
||||
|
@ -90,8 +90,8 @@ private:
|
|||
|
||||
struct Cursor {
|
||||
RefPtr<Gfx::Bitmap> bitmap;
|
||||
DeprecatedString path;
|
||||
DeprecatedString name;
|
||||
ByteString path;
|
||||
ByteString name;
|
||||
Gfx::CursorParams params;
|
||||
};
|
||||
|
||||
|
@ -194,7 +194,7 @@ private:
|
|||
struct IconSet {
|
||||
RefPtr<Gfx::Bitmap> big_icon;
|
||||
RefPtr<Gfx::Bitmap> little_icon;
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
};
|
||||
|
||||
Vector<IconSet> m_icon_sets;
|
||||
|
|
|
@ -53,7 +53,7 @@ GalleryWidget::GalleryWidget()
|
|||
m_frame_shapes.append("Sunken Panel");
|
||||
|
||||
m_frame_shape_combobox = basics_tab.find_descendant_of_type_named<GUI::ComboBox>("frame_style_combobox");
|
||||
m_frame_shape_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_frame_shapes));
|
||||
m_frame_shape_combobox->set_model(*GUI::ItemListModel<ByteString>::create(m_frame_shapes));
|
||||
|
||||
m_frame_shape_combobox->on_change = [&](auto&, auto const& index) {
|
||||
m_label_frame->set_frame_style(static_cast<Gfx::FrameStyle>(index.row()));
|
||||
|
@ -61,7 +61,7 @@ GalleryWidget::GalleryWidget()
|
|||
};
|
||||
|
||||
m_frame_shape_combobox->on_return_pressed = [&]() {
|
||||
m_enabled_label->set_text(String::from_deprecated_string(m_frame_shape_combobox->text()).release_value_but_fixme_should_propagate_errors());
|
||||
m_enabled_label->set_text(String::from_byte_string(m_frame_shape_combobox->text()).release_value_but_fixme_should_propagate_errors());
|
||||
};
|
||||
|
||||
m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
|
@ -141,7 +141,7 @@ GalleryWidget::GalleryWidget()
|
|||
m_msgbox_buttons.append("Yes No Cancel");
|
||||
|
||||
m_msgbox_icon_combobox = basics_tab.find_descendant_of_type_named<GUI::ComboBox>("msgbox_icon_combobox");
|
||||
m_msgbox_icon_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_msgbox_icons));
|
||||
m_msgbox_icon_combobox->set_model(*GUI::ItemListModel<ByteString>::create(m_msgbox_icons));
|
||||
m_msgbox_icon_combobox->set_selected_index(0);
|
||||
|
||||
m_msgbox_icon_combobox->on_change = [&](auto&, auto const& index) {
|
||||
|
@ -149,7 +149,7 @@ GalleryWidget::GalleryWidget()
|
|||
};
|
||||
|
||||
m_msgbox_buttons_combobox = basics_tab.find_descendant_of_type_named<GUI::ComboBox>("msgbox_buttons_combobox");
|
||||
m_msgbox_buttons_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_msgbox_buttons));
|
||||
m_msgbox_buttons_combobox->set_model(*GUI::ItemListModel<ByteString>::create(m_msgbox_buttons));
|
||||
m_msgbox_buttons_combobox->set_selected_index(0);
|
||||
|
||||
m_msgbox_buttons_combobox->on_change = [&](auto&, auto const& index) {
|
||||
|
@ -260,20 +260,20 @@ GalleryWidget::GalleryWidget()
|
|||
" _||_-\n"
|
||||
};
|
||||
|
||||
m_wizard_output->set_text(DeprecatedString::formatted("{}{}", serenityos_ascii, wizard_ascii));
|
||||
m_wizard_output->set_text(ByteString::formatted("{}{}", serenityos_ascii, wizard_ascii));
|
||||
|
||||
m_wizard_button->on_click = [&](auto) {
|
||||
StringBuilder sb;
|
||||
sb.append(m_wizard_output->get_text());
|
||||
sb.append("\nWizard started."sv);
|
||||
m_wizard_output->set_text(sb.to_deprecated_string());
|
||||
m_wizard_output->set_text(sb.to_byte_string());
|
||||
|
||||
auto wizard = DemoWizardDialog::try_create(window()).release_value_but_fixme_should_propagate_errors();
|
||||
auto result = wizard->exec();
|
||||
|
||||
sb.append(DeprecatedString::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result)));
|
||||
sb.append(ByteString::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result)));
|
||||
if (result == GUI::Dialog::ExecResult::OK)
|
||||
sb.append(DeprecatedString::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location()));
|
||||
sb.append(ByteString::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location()));
|
||||
m_wizard_output->set_text(sb.string_view());
|
||||
};
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ private:
|
|||
RefPtr<GUI::ValueSlider> m_opacity_value_slider;
|
||||
RefPtr<GUI::ImageWidget> m_opacity_imagewidget;
|
||||
|
||||
Vector<DeprecatedString> m_frame_shapes;
|
||||
Vector<DeprecatedString> m_msgbox_icons;
|
||||
Vector<DeprecatedString> m_msgbox_buttons;
|
||||
Vector<ByteString> m_frame_shapes;
|
||||
Vector<ByteString> m_msgbox_icons;
|
||||
Vector<ByteString> m_msgbox_buttons;
|
||||
Vector<RefPtr<Gfx::Bitmap>> m_button_icons;
|
||||
|
||||
GUI::MessageBox::Type m_msgbox_type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue