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

@ -169,7 +169,7 @@ private:
painter.blit({}, audio_bitmap, audio_bitmap.rect());
if (m_show_percent) {
auto volume_text = m_audio_muted ? "mute" : String::formatted("{}%", m_audio_volume);
auto volume_text = m_audio_muted ? "mute" : DeprecatedString::formatted("{}%", m_audio_volume);
painter.draw_text({ 16, 3, 24, 16 }, volume_text, Gfx::FontDatabase::default_fixed_width_font(), Gfx::TextAlignment::TopLeft, palette().window_text());
}
}

View file

@ -21,7 +21,7 @@ ClipboardHistoryModel::ClipboardHistoryModel()
{
}
String ClipboardHistoryModel::column_name(int column) const
DeprecatedString ClipboardHistoryModel::column_name(int column) const
{
switch (column) {
case Column::Data:
@ -37,7 +37,7 @@ String ClipboardHistoryModel::column_name(int column) const
}
}
static StringView bpp_for_format_resilient(String format)
static StringView bpp_for_format_resilient(DeprecatedString format)
{
unsigned format_uint = format.to_uint().value_or(static_cast<unsigned>(Gfx::BitmapFormat::Invalid));
// Cannot use Gfx::Bitmap::bpp_for_format here, as we have to accept invalid enum values.
@ -70,7 +70,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
switch (index.column()) {
case Column::Data:
if (data_and_type.mime_type.starts_with("text/"sv))
return String::copy(data_and_type.data);
return DeprecatedString::copy(data_and_type.data);
if (data_and_type.mime_type == "image/x-serenityos") {
StringBuilder builder;
builder.append('[');
@ -128,7 +128,7 @@ void ClipboardHistoryModel::remove_item(int index)
m_history_items.remove(index);
}
void ClipboardHistoryModel::config_string_did_change(String const& domain, String const& group, String const& key, String const& value_string)
void ClipboardHistoryModel::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value_string)
{
if (domain != "ClipboardHistory" || group != "ClipboardHistory")
return;

View file

@ -42,7 +42,7 @@ public:
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
// ^Config::Listener
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
private:
ClipboardHistoryModel();
@ -50,11 +50,11 @@ private:
// ^GUI::Model
virtual int row_count(const GUI::ModelIndex&) const override { return m_history_items.size(); }
virtual String column_name(int) const override;
virtual DeprecatedString column_name(int) const override;
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
// ^GUI::Clipboard::ClipboardClient
virtual void clipboard_content_did_change(String const&) override { add_item(GUI::Clipboard::the().fetch_data_and_type()); }
virtual void clipboard_content_did_change(DeprecatedString const&) override { add_item(GUI::Clipboard::the().fetch_data_and_type()); }
Vector<ClipboardItem> m_history_items;
size_t m_history_limit;

View file

@ -59,7 +59,7 @@ ErrorOr<void> KeymapStatusWidget::refresh_menu()
return {};
}
void KeymapStatusWidget::set_current_keymap(String const& keymap, ClearBackground clear_background)
void KeymapStatusWidget::set_current_keymap(DeprecatedString const& keymap, ClearBackground clear_background)
{
if (clear_background == ClearBackground::Yes) {
GUI::Painter painter(*this);

View file

@ -22,11 +22,11 @@ class KeymapStatusWidget : public GUI::Label {
virtual void mousedown_event(GUI::MouseEvent& event) override;
void set_current_keymap(String const& keymap, ClearBackground clear_background = ClearBackground::Yes);
void set_current_keymap(DeprecatedString const& keymap, ClearBackground clear_background = ClearBackground::Yes);
private:
RefPtr<GUI::Menu> m_context_menu;
String m_current_keymap;
DeprecatedString m_current_keymap;
ErrorOr<void> refresh_menu();

View file

@ -30,7 +30,7 @@ void KeymapStatusWindow::wm_event(GUI::WMEvent& event)
}
}
void KeymapStatusWindow::set_keymap_text(String const& keymap)
void KeymapStatusWindow::set_keymap_text(DeprecatedString const& keymap)
{
m_status_widget->set_current_keymap(keymap);
}

View file

@ -23,5 +23,5 @@ private:
RefPtr<KeymapStatusWidget> m_status_widget;
void set_keymap_text(String const& keymap);
void set_keymap_text(DeprecatedString const& keymap);
};

View file

@ -103,7 +103,7 @@ private:
m_connected = connected;
}
String get_adapter_info()
DeprecatedString get_adapter_info()
{
StringBuilder adapter_info;
@ -154,7 +154,7 @@ private:
return adapter_info.to_string();
}
String m_adapter_info;
DeprecatedString m_adapter_info;
bool m_connected = false;
bool m_notifications = true;
NonnullRefPtr<Gfx::Bitmap> m_connected_icon;

View file

@ -54,7 +54,7 @@ private:
m_last_idle = idle;
float cpu = total_diff > 0 ? (float)(total_diff - idle_diff) / (float)total_diff : 0;
m_history.enqueue(cpu);
m_tooltip = String::formatted("CPU usage: {:.1}%", 100 * cpu);
m_tooltip = DeprecatedString::formatted("CPU usage: {:.1}%", 100 * cpu);
} else {
m_history.enqueue(-1);
m_tooltip = "Unable to determine CPU usage"sv;
@ -67,7 +67,7 @@ private:
double total_memory = allocated + available;
double memory = (double)allocated / total_memory;
m_history.enqueue(memory);
m_tooltip = String::formatted("Memory: {} MiB of {:.1} MiB in use", allocated / MiB, total_memory / MiB);
m_tooltip = DeprecatedString::formatted("Memory: {} MiB of {:.1} MiB in use", allocated / MiB, total_memory / MiB);
} else {
m_history.enqueue(-1);
m_tooltip = "Unable to determine memory usage"sv;
@ -98,7 +98,7 @@ private:
}
}
m_history.enqueue(static_cast<float>(recent_tx) / static_cast<float>(m_current_scale));
m_tooltip = String::formatted("Network: TX {} / RX {} ({:.1} kbit/s)", tx, rx, static_cast<double>(recent_tx) * 8.0 / 1000.0);
m_tooltip = DeprecatedString::formatted("Network: TX {} / RX {} ({:.1} kbit/s)", tx, rx, static_cast<double>(recent_tx) * 8.0 / 1000.0);
} else {
m_history.enqueue(-1);
m_tooltip = "Unable to determine network usage"sv;
@ -230,7 +230,7 @@ private:
u64 m_last_total { 0 };
static constexpr u64 const scale_unit = 8000;
u64 m_current_scale { scale_unit };
String m_tooltip;
DeprecatedString m_tooltip;
OwnPtr<Core::Stream::File> m_proc_stat;
OwnPtr<Core::Stream::File> m_proc_mem;
OwnPtr<Core::Stream::File> m_proc_net;