mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +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:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -175,7 +175,7 @@ void Cube::timer_event(Core::TimerEvent&)
|
|||
|
||||
if ((m_cycles % 50) == 0) {
|
||||
dbgln("{} total cycles. finished 50 in {} ms, avg {} ms", m_cycles, m_accumulated_time, m_accumulated_time / 50);
|
||||
m_stats->set_text(String::formatted("{} ms", m_accumulated_time / 50));
|
||||
m_stats->set_text(DeprecatedString::formatted("{} ms", m_accumulated_time / 50));
|
||||
m_accumulated_time = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ void Fire::timer_event(Core::TimerEvent&)
|
|||
|
||||
if ((cycles % 50) == 0) {
|
||||
dbgln("{} total cycles. finished 50 in {} ms, avg {} ms", cycles, timeAvg, timeAvg / 50);
|
||||
stats->set_text(String::formatted("{} ms", timeAvg / 50));
|
||||
stats->set_text(DeprecatedString::formatted("{} ms", timeAvg / 50));
|
||||
timeAvg = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ enum class ImageType {
|
|||
class Mandelbrot : public GUI::Frame {
|
||||
C_OBJECT(Mandelbrot)
|
||||
|
||||
void export_image(String const& export_path, ImageType image_type);
|
||||
void export_image(DeprecatedString 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());
|
||||
}
|
||||
|
||||
void Mandelbrot::export_image(String const& export_path, ImageType image_type)
|
||||
void Mandelbrot::export_image(DeprecatedString const& export_path, ImageType image_type)
|
||||
{
|
||||
m_set.resize(Gfx::IntSize { 1920, 1080 });
|
||||
ByteBuffer encoded_data;
|
||||
|
@ -388,7 +388,7 @@ void Mandelbrot::export_image(String const& export_path, ImageType image_type)
|
|||
m_set.resize(size());
|
||||
auto file = fopen(export_path.characters(), "wb");
|
||||
if (!file) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
fwrite(encoded_data.data(), 1, encoded_data.size(), file);
|
||||
|
@ -420,21 +420,21 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(export_submenu.try_add_action(GUI::Action::create("As &BMP",
|
||||
[&](GUI::Action&) {
|
||||
Optional<String> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp");
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
mandelbrot->export_image(export_path.value(), ImageType::BMP);
|
||||
})));
|
||||
TRY(export_submenu.try_add_action(GUI::Action::create("As &PNG", { Mod_Ctrl | Mod_Shift, Key_S },
|
||||
[&](GUI::Action&) {
|
||||
Optional<String> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png");
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
mandelbrot->export_image(export_path.value(), ImageType::PNG);
|
||||
})));
|
||||
TRY(export_submenu.try_add_action(GUI::Action::create("As &QOI",
|
||||
[&](GUI::Action&) {
|
||||
Optional<String> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi");
|
||||
Optional<DeprecatedString> export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi");
|
||||
if (!export_path.has_value())
|
||||
return;
|
||||
mandelbrot->export_image(export_path.value(), ImageType::QOI);
|
||||
|
|
|
@ -46,7 +46,7 @@ GUI::ModelIndex BasicModel::index(int row, int column, GUI::ModelIndex const& pa
|
|||
return create_index(row, column);
|
||||
}
|
||||
|
||||
void BasicModel::add_item(String const& item)
|
||||
void BasicModel::add_item(DeprecatedString const& item)
|
||||
{
|
||||
begin_insert_rows({}, m_items.size(), m_items.size());
|
||||
m_items.append(item);
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_items.size(); }
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return 1; }
|
||||
virtual String column_name(int) const override { return "Item"; }
|
||||
virtual DeprecatedString column_name(int) const override { return "Item"; }
|
||||
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole = GUI::ModelRole::Display) const override;
|
||||
virtual TriState data_matches(GUI::ModelIndex const&, GUI::Variant const&) const override;
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
Function<void()> on_invalidate;
|
||||
|
||||
void add_item(String const& item);
|
||||
void add_item(DeprecatedString const& item);
|
||||
void remove_item(GUI::ModelIndex const&);
|
||||
|
||||
private:
|
||||
|
@ -37,5 +37,5 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
Vector<String> m_items;
|
||||
Vector<DeprecatedString> m_items;
|
||||
};
|
||||
|
|
|
@ -34,10 +34,10 @@ ErrorOr<void> GalleryWidget::load_basic_model_tab()
|
|||
|
||||
m_basic_model->on_invalidate = [&] {
|
||||
m_invalidation_count++;
|
||||
m_statusbar->set_text(String::formatted("Times invalidated: {}", m_invalidation_count));
|
||||
m_statusbar->set_text(DeprecatedString::formatted("Times invalidated: {}", m_invalidation_count));
|
||||
};
|
||||
|
||||
m_statusbar->set_text(String::formatted("Times invalidated: {}", m_invalidation_count));
|
||||
m_statusbar->set_text(DeprecatedString::formatted("Times invalidated: {}", m_invalidation_count));
|
||||
|
||||
m_basic_model->add_item("Well...");
|
||||
m_basic_model->add_item("...hello...");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/API/VirGL.h>
|
||||
|
|
|
@ -17,7 +17,7 @@ class DemoWizardDialog : public GUI::WizardDialog {
|
|||
C_OBJECT(DemoWizardDialog);
|
||||
|
||||
public:
|
||||
String page_1_location() { return m_page_1_location_text_box->get_text(); }
|
||||
DeprecatedString page_1_location() { return m_page_1_location_text_box->get_text(); }
|
||||
|
||||
private:
|
||||
DemoWizardDialog(GUI::Window* parent_window);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); }
|
||||
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
|
||||
virtual String column_name(int column_index) const override
|
||||
virtual DeprecatedString column_name(int column_index) const override
|
||||
{
|
||||
switch (column_index) {
|
||||
case Column::Bitmap:
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
{
|
||||
m_cursors.clear();
|
||||
|
||||
Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots);
|
||||
Core::DirIterator iterator(DeprecatedString::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;
|
||||
String path;
|
||||
String name;
|
||||
DeprecatedString path;
|
||||
DeprecatedString name;
|
||||
Gfx::CursorParams params;
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
|||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override { return m_icon_sets.size(); }
|
||||
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
|
||||
virtual String column_name(int column_index) const override
|
||||
virtual DeprecatedString column_name(int column_index) const override
|
||||
{
|
||||
switch (column_index) {
|
||||
case Column::BigIcon:
|
||||
|
@ -194,7 +194,7 @@ private:
|
|||
struct IconSet {
|
||||
RefPtr<Gfx::Bitmap> big_icon;
|
||||
RefPtr<Gfx::Bitmap> little_icon;
|
||||
String name;
|
||||
DeprecatedString name;
|
||||
};
|
||||
|
||||
Vector<IconSet> m_icon_sets;
|
||||
|
|
|
@ -54,7 +54,7 @@ GalleryWidget::GalleryWidget()
|
|||
m_frame_shapes.append("Sunken Panel");
|
||||
|
||||
m_frame_shape_combobox = basics_tab->find_descendant_of_type_named<GUI::ComboBox>("frame_shape_combobox");
|
||||
m_frame_shape_combobox->set_model(*GUI::ItemListModel<String>::create(m_frame_shapes));
|
||||
m_frame_shape_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_frame_shapes));
|
||||
|
||||
m_frame_shape_combobox->on_change = [&](auto&, auto const& index) {
|
||||
m_label_frame->set_frame_shape(static_cast<Gfx::FrameShape>((index.row() - 1) % 3 + 1));
|
||||
|
@ -118,7 +118,7 @@ GalleryWidget::GalleryWidget()
|
|||
m_input_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
m_input_button->on_click = [&](auto) {
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
if (GUI::InputBox::show(window(), value, "Enter input:"sv, "Input"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty())
|
||||
m_text_editor->set_text(value);
|
||||
};
|
||||
|
@ -150,7 +150,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<String>::create(m_msgbox_icons));
|
||||
m_msgbox_icon_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_msgbox_icons));
|
||||
m_msgbox_icon_combobox->set_selected_index(0);
|
||||
|
||||
m_msgbox_icon_combobox->on_change = [&](auto&, auto const& index) {
|
||||
|
@ -158,7 +158,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<String>::create(m_msgbox_buttons));
|
||||
m_msgbox_buttons_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_msgbox_buttons));
|
||||
m_msgbox_buttons_combobox->set_selected_index(0);
|
||||
|
||||
m_msgbox_buttons_combobox->on_change = [&](auto&, auto const& index) {
|
||||
|
@ -269,7 +269,7 @@ GalleryWidget::GalleryWidget()
|
|||
" _||_-\n"
|
||||
};
|
||||
|
||||
m_wizard_output->set_text(String::formatted("{}{}", serenityos_ascii, wizard_ascii));
|
||||
m_wizard_output->set_text(DeprecatedString::formatted("{}{}", serenityos_ascii, wizard_ascii));
|
||||
|
||||
m_wizard_button->on_click = [&](auto) {
|
||||
StringBuilder sb;
|
||||
|
@ -280,9 +280,9 @@ GalleryWidget::GalleryWidget()
|
|||
auto wizard = DemoWizardDialog::try_create(window()).release_value_but_fixme_should_propagate_errors();
|
||||
auto result = wizard->exec();
|
||||
|
||||
sb.append(String::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result)));
|
||||
sb.append(DeprecatedString::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result)));
|
||||
if (result == GUI::Dialog::ExecResult::OK)
|
||||
sb.append(String::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location()));
|
||||
sb.append(DeprecatedString::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<String> m_frame_shapes;
|
||||
Vector<String> m_msgbox_icons;
|
||||
Vector<String> m_msgbox_buttons;
|
||||
Vector<DeprecatedString> m_frame_shapes;
|
||||
Vector<DeprecatedString> m_msgbox_icons;
|
||||
Vector<DeprecatedString> 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