1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:47:46 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -75,14 +75,14 @@ bool ViewWidget::is_previous_available() const
return false;
}
Vector<String> ViewWidget::load_files_from_directory(String const& path) const
Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString const& path) const
{
Vector<String> files_in_directory;
Vector<DeprecatedString> files_in_directory;
auto current_dir = LexicalPath(path).parent().string();
Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots);
while (iterator.has_next()) {
String file = iterator.next_full_path();
DeprecatedString file = iterator.next_full_path();
if (!Gfx::Bitmap::is_path_a_supported_image_format(file))
continue;
files_in_directory.append(file);
@ -90,7 +90,7 @@ Vector<String> ViewWidget::load_files_from_directory(String const& path) const
return files_in_directory;
}
void ViewWidget::set_path(String const& path)
void ViewWidget::set_path(DeprecatedString const& path)
{
m_path = path;
m_files_in_same_dir = load_files_from_directory(path);
@ -151,10 +151,10 @@ void ViewWidget::mouseup_event(GUI::MouseEvent& event)
GUI::AbstractZoomPanWidget::mouseup_event(event);
}
void ViewWidget::load_from_file(String const& path)
void ViewWidget::load_from_file(DeprecatedString const& path)
{
auto show_error = [&] {
GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), DeprecatedString::formatted("Failed to open {}", path), "Cannot open image"sv, GUI::MessageBox::Type::Error);
};
auto file_or_error = Core::MappedFile::map(path);

View file

@ -30,12 +30,12 @@ public:
virtual ~ViewWidget() override = default;
Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); }
String const& path() const { return m_path; }
DeprecatedString const& path() const { return m_path; }
void set_toolbar_height(int height) { m_toolbar_height = height; }
int toolbar_height() { return m_toolbar_height; }
bool scaled_for_first_image() { return m_scaled_for_first_image; }
void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
void set_path(String const& path);
void set_path(DeprecatedString const& path);
void resize_window();
void set_scaling_mode(Gfx::Painter::ScalingMode);
@ -46,7 +46,7 @@ public:
void flip(Gfx::Orientation);
void rotate(Gfx::RotationDirection);
void navigate(Directions);
void load_from_file(String const&);
void load_from_file(DeprecatedString const&);
Function<void()> on_doubleclick;
Function<void(const GUI::DropEvent&)> on_drop;
@ -63,9 +63,9 @@ private:
void set_bitmap(Gfx::Bitmap const* bitmap);
void animate();
Vector<String> load_files_from_directory(String const& path) const;
Vector<DeprecatedString> load_files_from_directory(DeprecatedString const& path) const;
String m_path;
DeprecatedString m_path;
RefPtr<Gfx::Bitmap> m_bitmap;
Optional<ImageDecoderClient::DecodedImage> m_decoded_image;
@ -75,7 +75,7 @@ private:
int m_toolbar_height { 28 };
bool m_scaled_for_first_image { false };
Vector<String> m_files_in_same_dir;
Vector<DeprecatedString> m_files_in_same_dir;
Optional<size_t> m_current_index;
Gfx::Painter::ScalingMode m_scaling_mode { Gfx::Painter::ScalingMode::NearestNeighbor };
};

View file

@ -74,7 +74,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
}
window->set_title(String::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100)));
window->set_title(DeprecatedString::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100)));
if (!widget->scaled_for_first_image()) {
widget->set_scaled_for_first_image(true);
@ -123,7 +123,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
auto msgbox_result = GUI::MessageBox::show(window,
String::formatted("Are you sure you want to delete {}?", path),
DeprecatedString::formatted("Are you sure you want to delete {}?", path),
"Confirm deletion"sv,
GUI::MessageBox::Type::Warning,
GUI::MessageBox::InputType::OKCancel);
@ -134,7 +134,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto unlinked_or_error = Core::System::unlink(widget->path());
if (unlinked_or_error.is_error()) {
GUI::MessageBox::show(window,
String::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()),
DeprecatedString::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()),
"Delete failed"sv,
GUI::MessageBox::Type::Error);
@ -171,7 +171,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
[&](auto&) {
if (!GUI::Desktop::the().set_wallpaper(widget->bitmap(), widget->path())) {
GUI::MessageBox::show(window,
String::formatted("set_wallpaper({}) failed", widget->path()),
DeprecatedString::formatted("set_wallpaper({}) failed", widget->path()),
"Could not set wallpaper"sv,
GUI::MessageBox::Type::Error);
}