mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:17:35 +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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue