1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:17:34 +00:00

Everywhere: Rename to_{string => deprecated_string}() where applicable

This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
This commit is contained in:
Linus Groh 2022-12-06 01:12:49 +00:00 committed by Andreas Kling
parent 6e19ab2bbc
commit 57dc179b1f
597 changed files with 1973 additions and 1972 deletions

View file

@ -72,7 +72,7 @@ void AbstractTableView::auto_resize_column(int column)
} else if (cell_data.is_bitmap()) {
cell_width = cell_data.as_bitmap().width();
} else if (cell_data.is_valid()) {
cell_width = font().width(cell_data.to_string());
cell_width = font().width(cell_data.to_deprecated_string());
}
if (is_empty && cell_width > 0)
is_empty = false;
@ -110,7 +110,7 @@ void AbstractTableView::update_column_sizes()
} else if (cell_data.is_bitmap()) {
cell_width = cell_data.as_bitmap().width();
} else if (cell_data.is_valid()) {
cell_width = font().width(cell_data.to_string());
cell_width = font().width(cell_data.to_deprecated_string());
}
column_width = max(column_width, cell_width);
}

View file

@ -605,7 +605,7 @@ void AbstractView::keydown_event(KeyEvent& event)
}
auto index = find_next_search_match(sb.string_view());
if (index.is_valid()) {
m_highlighted_search = sb.to_string();
m_highlighted_search = sb.to_deprecated_string();
highlight_search(index);
start_highlighted_search_timer();
}
@ -630,7 +630,7 @@ void AbstractView::keydown_event(KeyEvent& event)
auto index = find_next_search_match(sb.string_view());
if (index.is_valid()) {
m_highlighted_search = sb.to_string();
m_highlighted_search = sb.to_deprecated_string();
highlight_search(index);
start_highlighted_search_timer();
set_cursor(index, SelectionUpdate::None, true);

View file

@ -183,7 +183,7 @@ CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying Autoco
return hide_when_done;
auto suggestion_index = m_suggestion_view->model()->index(selected_index.row());
auto completion = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::Completion).to_string();
auto completion = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::Completion).to_deprecated_string();
size_t partial_length = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::PartialInputLength).to_i64();
auto hide_after_applying = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::HideAutocompleteAfterApplying).to_bool();

View file

@ -43,7 +43,7 @@ void ColorInput::set_color_internal(Color color, AllowCallback allow_callback, b
return;
m_color = color;
if (change_text)
set_text(m_color_has_alpha_channel ? color.to_string() : color.to_string_without_alpha(), AllowCallback::No);
set_text(m_color_has_alpha_channel ? color.to_deprecated_string() : color.to_deprecated_string_without_alpha(), AllowCallback::No);
update();
if (allow_callback == AllowCallback::Yes && on_change)
on_change();

View file

@ -320,7 +320,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
html_label.set_text("HTML:");
m_html_text = html_container.add<GUI::TextBox>();
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_string() : m_color.to_string_without_alpha());
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha());
m_html_text->on_change = [this]() {
auto color_name = m_html_text->text();
auto optional_color = Color::from_string(color_name);
@ -416,7 +416,7 @@ void ColorPicker::update_color_widgets()
{
m_preview_widget->set_color(m_color);
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_string() : m_color.to_string_without_alpha());
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha());
m_red_spinbox->set_value(m_color.red());
m_green_spinbox->set_value(m_color.green());

View file

@ -158,7 +158,7 @@ void ColumnsView::paint_event(PaintEvent& event)
icon_rect.right() + 1 + icon_spacing(), row * item_height(),
column.width - icon_spacing() - icon_size() - icon_spacing() - icon_spacing() - static_cast<int>(s_arrow_bitmap.width()) - icon_spacing(), item_height()
};
draw_item_text(painter, index, is_selected_row, text_rect, index.data().to_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::None);
draw_item_text(painter, index, is_selected_row, text_rect, index.data().to_deprecated_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::None);
if (is_focused() && index == cursor_index()) {
painter.draw_rect(row_rect, palette().color(background_role()));
@ -227,7 +227,7 @@ void ColumnsView::update_column_sizes()
for (int row = 0; row < row_count; row++) {
ModelIndex index = model()->index(row, m_model_column, column.parent_index);
VERIFY(index.is_valid());
auto text = index.data().to_string();
auto text = index.data().to_deprecated_string();
int row_width = icon_spacing() + icon_size() + icon_spacing() + font().width(text) + icon_spacing() + s_arrow_bitmap.width() + icon_spacing();
if (row_width > column.width)
column.width = row_width;

View file

@ -182,7 +182,7 @@ void ComboBox::selection_updated(ModelIndex const& index)
m_selected_index = index;
else
m_selected_index.clear();
auto new_value = index.data().to_string();
auto new_value = index.data().to_deprecated_string();
m_editor->set_text(new_value);
if (!m_only_allow_values_from_model)
m_editor->select_all();

View file

@ -129,7 +129,7 @@ public:
case Column::Shortcut:
if (!action.shortcut().is_valid())
return "";
return action.shortcut().to_string();
return action.shortcut().to_deprecated_string();
}
VERIFY_NOT_REACHED();

View file

@ -61,8 +61,8 @@ void CommonLocationsProvider::load_from_json(DeprecatedString const& json_path)
if (!entry_value.is_object())
continue;
auto entry = entry_value.as_object();
auto name = entry.get("name"sv).to_string();
auto path = entry.get("path"sv).to_string();
auto name = entry.get("name"sv).to_deprecated_string();
auto path = entry.get("path"sv).to_deprecated_string();
s_common_locations.append({ name, path });
}

View file

@ -155,24 +155,24 @@ static Action* action_for_shortcut(Window& window, Shortcut const& shortcut)
if (!shortcut.is_valid())
return nullptr;
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, "Looking up action for {}", shortcut.to_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, "Looking up action for {}", shortcut.to_deprecated_string());
for (auto* widget = window.focused_widget(); widget; widget = widget->parent_widget()) {
if (auto* action = widget->action_for_shortcut(shortcut)) {
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Focused widget {} gave action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", *widget, action, action->text(), action->is_enabled(), action->shortcut().to_string(), action->alternate_shortcut().to_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Focused widget {} gave action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", *widget, action, action->text(), action->is_enabled(), action->shortcut().to_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
return action;
}
}
if (auto* action = window.action_for_shortcut(shortcut)) {
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked window {}, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", window, action, action->text(), action->is_enabled(), action->shortcut().to_string(), action->alternate_shortcut().to_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked window {}, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", window, action, action->text(), action->is_enabled(), action->shortcut().to_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
return action;
}
// NOTE: Application-global shortcuts are ignored while a blocking modal window is up.
if (!window.is_blocking() && !window.is_popup()) {
if (auto* action = Application::the()->action_for_shortcut(shortcut)) {
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked application, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", action, action->text(), action->is_enabled(), action->shortcut().to_string(), action->alternate_shortcut().to_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked application, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", action, action->text(), action->is_enabled(), action->shortcut().to_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
return action;
}
}

View file

@ -174,7 +174,7 @@ auto EmojiInputDialog::supported_emoji() -> Vector<Emoji>
builder.append_code_point(*code_point);
code_points.append(*code_point);
});
auto text = builder.to_string();
auto text = builder.to_deprecated_string();
auto emoji = Unicode::find_emoji_for_code_points(code_points);
if (!emoji.has_value()) {

View file

@ -20,7 +20,7 @@ DropEvent::DropEvent(Gfx::IntPoint const& position, DeprecatedString const& text
{
}
DeprecatedString KeyEvent::to_string() const
DeprecatedString KeyEvent::to_deprecated_string() const
{
Vector<DeprecatedString, 8> parts;
@ -44,7 +44,7 @@ DeprecatedString KeyEvent::to_string() const
if (i != parts.size() - 1)
builder.append('+');
}
return builder.to_string();
return builder.to_deprecated_string();
}
ActionEvent::ActionEvent(Type type, Action& action)

View file

@ -390,11 +390,11 @@ public:
{
StringBuilder sb;
sb.append_code_point(m_code_point);
return sb.to_string();
return sb.to_deprecated_string();
}
u32 scancode() const { return m_scancode; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool is_arrow_key() const
{

View file

@ -194,7 +194,7 @@ DeprecatedString FileSystemModel::Node::full_path() const
}
builder.append('/');
builder.append(name);
return LexicalPath::canonicalized_path(builder.to_string());
return LexicalPath::canonicalized_path(builder.to_deprecated_string());
}
ModelIndex FileSystemModel::index(DeprecatedString path, int column) const
@ -325,7 +325,7 @@ static DeprecatedString permission_string(mode_t mode)
builder.append('t');
else
builder.append(mode & S_IXOTH ? 'x' : '-');
return builder.to_string();
return builder.to_deprecated_string();
}
void FileSystemModel::Node::set_selected(bool selected)
@ -761,7 +761,7 @@ void FileSystemModel::set_data(ModelIndex const& index, Variant const& data)
VERIFY(is_editable(index));
Node& node = const_cast<Node&>(this->node(index));
auto dirname = LexicalPath::dirname(node.full_path());
auto new_full_path = DeprecatedString::formatted("{}/{}", dirname, data.to_string());
auto new_full_path = DeprecatedString::formatted("{}/{}", dirname, data.to_deprecated_string());
int rc = rename(node.full_path().characters(), new_full_path.characters());
if (rc < 0) {
if (on_rename_error)

View file

@ -140,7 +140,7 @@ public:
static DeprecatedString timestamp_string(time_t timestamp)
{
return Core::DateTime::from_timestamp(timestamp).to_string();
return Core::DateTime::from_timestamp(timestamp).to_deprecated_string();
}
bool should_show_dotfiles() const { return m_should_show_dotfiles; }

View file

@ -58,7 +58,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
m_family_list_view->on_selection_change = [this] {
const auto& index = m_family_list_view->selection().first();
m_family = index.data().to_string();
m_family = index.data().to_deprecated_string();
m_variants.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())
@ -79,7 +79,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
m_variant_list_view->on_selection_change = [this] {
const auto& index = m_variant_list_view->selection().first();
bool font_is_fixed_size = false;
m_variant = index.data().to_string();
m_variant = index.data().to_deprecated_string();
m_sizes.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())

View file

@ -37,11 +37,11 @@ public:
return try_make_ref_counted<NodeT>(token.m_view);
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
StringBuilder builder;
format(builder, 0, false);
return builder.to_string();
return builder.to_deprecated_string();
}
// Format this AST node with the builder at the given indentation level.

View file

@ -15,7 +15,7 @@ namespace GUI::GML {
inline ErrorOr<DeprecatedString> format_gml(StringView string)
{
return TRY(parse_gml(string))->to_string();
return TRY(parse_gml(string))->to_deprecated_string();
}
}

View file

@ -100,7 +100,7 @@ auto IconView::get_item_data(int item_index) const -> ItemData&
return item_data;
item_data.index = model()->index(item_index, model_column());
item_data.text = item_data.index.data().to_string();
item_data.text = item_data.index.data().to_deprecated_string();
get_item_rects(item_index, item_data, font_for_index(item_data.index));
item_data.valid = true;
return item_data;

View file

@ -96,7 +96,7 @@ public:
for (auto it = m_data.begin(); it != m_data.end(); ++it) {
for (auto it2d = (*it).begin(); it2d != (*it).end(); ++it2d) {
GUI::ModelIndex index = this->index(it.index(), it2d.index());
if (!string_matches(data(index, ModelRole::Display).to_string(), searching, flags))
if (!string_matches(data(index, ModelRole::Display).to_deprecated_string(), searching, flags))
continue;
found_indices.append(index);
@ -107,7 +107,7 @@ public:
} else {
for (auto it = m_data.begin(); it != m_data.end(); ++it) {
GUI::ModelIndex index = this->index(it.index());
if (!string_matches(data(index, ModelRole::Display).to_string(), searching, flags))
if (!string_matches(data(index, ModelRole::Display).to_deprecated_string(), searching, flags))
continue;
found_indices.append(index);

View file

@ -54,7 +54,7 @@ bool JsonArrayModel::store()
return false;
}
file->write(m_array.to_string());
file->write(m_array.to_deprecated_string());
file->close();
return true;
}
@ -124,7 +124,7 @@ Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
return field_spec.massage_for_display(object);
if (data.is_number())
return data;
return object.get(json_field_name).to_string();
return object.get(json_field_name).to_deprecated_string();
}
if (role == ModelRole::Sort) {

View file

@ -42,7 +42,7 @@ void ListView::update_content_size()
int content_width = 0;
for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) {
auto text = model()->index(row, m_model_column).data();
content_width = max(content_width, font().width(text.to_string()) + horizontal_padding() * 2);
content_width = max(content_width, font().width(text.to_deprecated_string()) + horizontal_padding() * 2);
}
m_max_item_width = content_width;
content_width = max(content_width, widget_inner_rect().width());
@ -133,7 +133,7 @@ void ListView::paint_list_item(Painter& painter, int row_index, int painted_item
text_rect.translate_by(horizontal_padding(), 0);
text_rect.set_width(text_rect.width() - horizontal_padding() * 2);
auto text_alignment = index.data(ModelRole::TextAlignment).to_text_alignment(Gfx::TextAlignment::CenterLeft);
draw_item_text(painter, index, is_selected_row, text_rect, data.to_string(), font, text_alignment, Gfx::TextElision::None);
draw_item_text(painter, index, is_selected_row, text_rect, data.to_deprecated_string(), font, text_alignment, Gfx::TextElision::None);
}
}

View file

@ -197,7 +197,7 @@ void Menu::realize_menu_item(MenuItem& item, int item_id)
break;
case MenuItem::Type::Action: {
auto& action = *item.action();
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : DeprecatedString();
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_deprecated_string() : DeprecatedString();
bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable();
bool is_default = (m_current_default_action.ptr() == &action);
auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();

View file

@ -73,7 +73,7 @@ void MenuItem::update_window_server()
if (m_menu_id < 0)
return;
auto& action = *m_action;
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : DeprecatedString();
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_deprecated_string() : DeprecatedString();
auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text, icon);
}

View file

@ -109,12 +109,12 @@ RefPtr<Core::MimeData> Model::mime_data(ModelSelection const& selection) const
auto text_data = index.data();
if (!first)
text_builder.append(", "sv);
text_builder.append(text_data.to_string());
text_builder.append(text_data.to_deprecated_string());
if (!first)
data_builder.append('\n');
auto data = index.data(ModelRole::MimeData);
data_builder.append(data.to_string());
data_builder.append(data.to_deprecated_string());
first = false;
@ -126,7 +126,7 @@ RefPtr<Core::MimeData> Model::mime_data(ModelSelection const& selection) const
});
mime_data->set_data(drag_data_type(), data_builder.to_byte_buffer());
mime_data->set_text(text_builder.to_string());
mime_data->set_text(text_builder.to_deprecated_string());
if (bitmap)
mime_data->set_data("image/x-raw-bitmap", bitmap->serialize_to_byte_buffer());

View file

@ -96,7 +96,7 @@ public:
virtual void set_value(Variant const& value, SelectionBehavior selection_behavior) override
{
auto& textbox = static_cast<TextBox&>(*widget());
textbox.set_text(value.to_string());
textbox.set_text(value.to_deprecated_string());
if (selection_behavior == SelectionBehavior::SelectAll)
textbox.select_all();
}

View file

@ -67,7 +67,7 @@ void Progressbar::paint_event(PaintEvent& event)
} else if (m_format == Format::ValueSlashMax) {
builder.appendff("{}/{}", m_value, m_max);
}
progress_text = builder.to_string();
progress_text = builder.to_deprecated_string();
}
Gfx::StylePainter::paint_progressbar(painter, rect, palette(), m_min, m_max, m_value, progress_text, m_orientation);

View file

@ -12,7 +12,7 @@
namespace GUI {
DeprecatedString Shortcut::to_string() const
DeprecatedString Shortcut::to_deprecated_string() const
{
Vector<DeprecatedString, 8> parts;
@ -41,7 +41,7 @@ DeprecatedString Shortcut::to_string() const
StringBuilder builder;
builder.join('+', parts);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -46,7 +46,7 @@ public:
Mouse,
};
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Type type() const { return m_type; }
bool is_valid() const { return m_type == Type::Keyboard ? (m_keyboard_key != Key_Invalid) : (m_mouse_button != MouseButton::None); }
u8 modifiers() const { return m_modifiers; }

View file

@ -42,7 +42,7 @@ TabWidget::TabWidget()
"text_alignment",
[this] { return Gfx::to_string(text_alignment()); },
[this](auto& value) {
auto alignment = Gfx::text_alignment_from_string(value.to_string());
auto alignment = Gfx::text_alignment_from_string(value.to_deprecated_string());
if (alignment.has_value()) {
set_text_alignment(alignment.value());
return true;

View file

@ -131,7 +131,7 @@ void TableView::paint_event(PaintEvent& event)
}
auto text_alignment = cell_index.data(ModelRole::TextAlignment).to_text_alignment(Gfx::TextAlignment::CenterLeft);
draw_item_text(painter, cell_index, is_selected_row, cell_rect, data.to_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
draw_item_text(painter, cell_index, is_selected_row, cell_rect, data.to_deprecated_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
}
}

View file

@ -152,7 +152,7 @@ DeprecatedString TextDocumentLine::to_utf8() const
{
StringBuilder builder;
builder.append(view());
return builder.to_string();
return builder.to_deprecated_string();
}
TextDocumentLine::TextDocumentLine(TextDocument& document)
@ -353,7 +353,7 @@ DeprecatedString TextDocument::text() const
if (i != line_count() - 1)
builder.append('\n');
}
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString TextDocument::text_in_range(TextRange const& a_range) const
@ -379,7 +379,7 @@ DeprecatedString TextDocument::text_in_range(TextRange const& a_range) const
builder.append('\n');
}
return builder.to_string();
return builder.to_deprecated_string();
}
u32 TextDocument::code_point_at(TextPosition const& position) const
@ -800,7 +800,7 @@ bool InsertTextCommand::merge_with(GUI::Command const& other)
StringBuilder builder(m_text.length() + typed_other.m_text.length());
builder.append(m_text);
builder.append(typed_other.m_text);
m_text = builder.to_string();
m_text = builder.to_deprecated_string();
m_range.set_end(typed_other.m_range.end());
m_timestamp = Time::now_monotonic();
@ -900,7 +900,7 @@ bool RemoveTextCommand::merge_with(GUI::Command const& other)
StringBuilder builder(m_text.length() + typed_other.m_text.length());
builder.append(typed_other.m_text);
builder.append(m_text);
m_text = builder.to_string();
m_text = builder.to_deprecated_string();
m_range.set_start(typed_other.m_range.start());
m_timestamp = Time::now_monotonic();

View file

@ -1189,7 +1189,7 @@ void TextEditor::add_code_point(u32 code_point)
else
m_autocomplete_timer->start();
}
insert_at_cursor_or_replace_selection(sb.to_string());
insert_at_cursor_or_replace_selection(sb.to_deprecated_string());
};
void TextEditor::reset_cursor_blink()
@ -2047,7 +2047,7 @@ void TextEditor::document_did_update_undo_stack()
builder.append(' ');
builder.append(suffix.value());
}
return builder.to_string();
return builder.to_deprecated_string();
};
m_undo_action->set_enabled(can_undo() && !text_is_secret());

View file

@ -76,10 +76,10 @@ private:
builder.append(action.text());
if (action.shortcut().is_valid()) {
builder.append(" ("sv);
builder.append(action.shortcut().to_string());
builder.append(action.shortcut().to_deprecated_string());
builder.append(')');
}
return builder.to_string();
return builder.to_deprecated_string();
}
virtual void enter_event(Core::Event& event) override

View file

@ -185,7 +185,7 @@ void TreeView::traverse_in_paint_order(Callback callback) const
if (index.is_valid()) {
auto& metadata = ensure_metadata_for_index(index);
int x_offset = tree_column_x_offset + horizontal_padding() + indent_level * indent_width_in_pixels();
auto node_text = index.data().to_string();
auto node_text = index.data().to_deprecated_string();
Gfx::IntRect rect = {
x_offset, y_offset,
icon_size() + icon_spacing() + text_padding() + font_for_index(index)->width(node_text) + text_padding(), row_height()
@ -317,7 +317,7 @@ void TreeView::paint_event(PaintEvent& event)
}
} else {
auto text_alignment = cell_index.data(ModelRole::TextAlignment).to_text_alignment(Gfx::TextAlignment::CenterLeft);
draw_item_text(painter, cell_index, is_selected_row, cell_rect, data.to_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
draw_item_text(painter, cell_index, is_selected_row, cell_rect, data.to_deprecated_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
}
}
} else {
@ -346,7 +346,7 @@ void TreeView::paint_event(PaintEvent& event)
}
auto display_data = index.data();
if (display_data.is_string() || display_data.is_u32() || display_data.is_i32() || display_data.is_u64() || display_data.is_i64() || display_data.is_bool() || display_data.is_float())
draw_item_text(painter, index, is_selected_row, text_rect, display_data.to_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::Right);
draw_item_text(painter, index, is_selected_row, text_rect, display_data.to_deprecated_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::Right);
if (selection_behavior() == SelectionBehavior::SelectItems && is_focused() && index == cursor_index()) {
painter.draw_rect(background_rect, palette().color(background_role()));
@ -683,7 +683,7 @@ void TreeView::auto_resize_column(int column)
} else if (cell_data.is_bitmap()) {
cell_width = cell_data.as_bitmap().width();
} else if (cell_data.is_valid()) {
cell_width = font().width(cell_data.to_string());
cell_width = font().width(cell_data.to_deprecated_string());
}
if (is_empty && cell_width > 0)
is_empty = false;
@ -726,7 +726,7 @@ void TreeView::update_column_sizes()
} else if (cell_data.is_bitmap()) {
cell_width = cell_data.as_bitmap().width();
} else if (cell_data.is_valid()) {
cell_width = font().width(cell_data.to_string());
cell_width = font().width(cell_data.to_deprecated_string());
}
column_width = max(column_width, cell_width);
return IterationDecision::Continue;
@ -743,7 +743,7 @@ void TreeView::update_column_sizes()
auto cell_data = model.index(index.row(), tree_column, index.parent()).data();
int cell_width = 0;
if (cell_data.is_valid()) {
cell_width = font().width(cell_data.to_string());
cell_width = font().width(cell_data.to_deprecated_string());
cell_width += horizontal_padding() * 2 + indent_level * indent_width_in_pixels() + icon_size() / 2 + text_padding() * 2;
}
tree_column_width = max(tree_column_width, cell_width);

View file

@ -66,11 +66,11 @@ bool Variant::operator==(Variant const& other) const
return &own_value.impl() == &other_value.impl();
// FIXME: Figure out if this silly behaviour is actually used anywhere, then get rid of it.
else
return to_string() == other.to_string();
return to_deprecated_string() == other.to_deprecated_string();
},
[&](auto const&) {
// FIXME: Figure out if this silly behaviour is actually used anywhere, then get rid of it.
return to_string() == other.to_string();
return to_deprecated_string() == other.to_deprecated_string();
});
});
}
@ -92,10 +92,10 @@ bool Variant::operator<(Variant const& other) const
return own_value < other_value;
// FIXME: Figure out if this silly behaviour is actually used anywhere, then get rid of it.
else
return to_string() < other.to_string();
return to_deprecated_string() < other.to_deprecated_string();
},
[&](auto const&) -> bool {
return to_string() < other.to_string(); // FIXME: Figure out if this silly behaviour is actually used anywhere, then get rid of it.
return to_deprecated_string() < other.to_deprecated_string(); // FIXME: Figure out if this silly behaviour is actually used anywhere, then get rid of it.
});
});
}

View file

@ -199,7 +199,7 @@ public:
return default_value;
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
return visit(
[](Empty) -> DeprecatedString { return "[null]"; },

View file

@ -1489,14 +1489,14 @@ void VimEditingEngine::put_before()
sb.append(m_yank_buffer);
sb.append_code_point(0x0A);
}
m_editor->insert_at_cursor_or_replace_selection(sb.to_string());
m_editor->insert_at_cursor_or_replace_selection(sb.to_deprecated_string());
m_editor->set_cursor({ m_editor->cursor().line(), m_editor->current_line().first_non_whitespace_column() });
} else {
StringBuilder sb = StringBuilder(m_yank_buffer.length() * amount);
for (auto i = 0; i < amount; i++) {
sb.append(m_yank_buffer);
}
m_editor->insert_at_cursor_or_replace_selection(sb.to_string());
m_editor->insert_at_cursor_or_replace_selection(sb.to_deprecated_string());
move_one_left();
}
}
@ -1512,7 +1512,7 @@ void VimEditingEngine::put_after()
sb.append_code_point(0x0A);
sb.append(m_yank_buffer);
}
m_editor->insert_at_cursor_or_replace_selection(sb.to_string());
m_editor->insert_at_cursor_or_replace_selection(sb.to_deprecated_string());
m_editor->set_cursor({ m_editor->cursor().line(), m_editor->current_line().first_non_whitespace_column() });
} else {
// FIXME: If attempting to put on the last column a line,
@ -1522,7 +1522,7 @@ void VimEditingEngine::put_after()
for (auto i = 0; i < amount; i++) {
sb.append(m_yank_buffer);
}
m_editor->insert_at_cursor_or_replace_selection(sb.to_string());
m_editor->insert_at_cursor_or_replace_selection(sb.to_deprecated_string());
move_one_left();
}
}

View file

@ -81,11 +81,11 @@ Widget::Widget()
register_property(
"font_type", [this] { return m_font->is_fixed_width() ? "FixedWidth" : "Normal"; },
[this](auto& value) {
if (value.to_string() == "FixedWidth") {
if (value.to_deprecated_string() == "FixedWidth") {
set_font_fixed_width(true);
return true;
}
if (value.to_string() == "Normal") {
if (value.to_deprecated_string() == "Normal") {
set_font_fixed_width(false);
return true;
}
@ -127,9 +127,9 @@ Widget::Widget()
});
register_property(
"foreground_color", [this]() -> JsonValue { return palette().color(foreground_role()).to_string(); },
"foreground_color", [this]() -> JsonValue { return palette().color(foreground_role()).to_deprecated_string(); },
[this](auto& value) {
auto c = Color::from_string(value.to_string());
auto c = Color::from_string(value.to_deprecated_string());
if (c.has_value()) {
auto _palette = palette();
_palette.set_color(foreground_role(), c.value());
@ -140,9 +140,9 @@ Widget::Widget()
});
register_property(
"background_color", [this]() -> JsonValue { return palette().color(background_role()).to_string(); },
"background_color", [this]() -> JsonValue { return palette().color(background_role()).to_deprecated_string(); },
[this](auto& value) {
auto c = Color::from_string(value.to_string());
auto c = Color::from_string(value.to_deprecated_string());
if (c.has_value()) {
auto _palette = palette();
_palette.set_color(background_role(), c.value());
@ -1188,12 +1188,12 @@ bool Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::O
if (auto* registration = Core::ObjectClassRegistration::find(class_name)) {
auto layout = registration->construct();
if (!layout || !registration->is_derived_from(layout_class)) {
dbgln("Invalid layout class: '{}'", class_name.to_string());
dbgln("Invalid layout class: '{}'", class_name.to_deprecated_string());
return false;
}
set_layout(static_ptr_cast<Layout>(layout).release_nonnull());
} else {
dbgln("Unknown layout class: '{}'", class_name.to_string());
dbgln("Unknown layout class: '{}'", class_name.to_deprecated_string());
return false;
}

View file

@ -80,7 +80,7 @@ Window::Window(Core::Object* parent)
"title",
[this] { return title(); },
[this](auto& value) {
set_title(value.to_string());
set_title(value.to_deprecated_string());
return true;
});