1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 18:37:35 +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

@ -130,7 +130,7 @@ void AnalogClock::paint_event(GUI::PaintEvent& event)
void AnalogClock::update_title_date()
{
window()->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv));
window()->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
}
void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event)

View file

@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock"sv));
auto window = TRY(GUI::Window::try_create());
window->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv));
window->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
window->set_icon(app_icon.bitmap_for_size(16));
window->resize(170, 170);
window->set_resizable(false);

View file

@ -115,7 +115,7 @@ private:
class URLResult final : public Result {
public:
explicit URLResult(const URL& url)
: Result(url.to_string(), "Open URL in Browser"sv, 50)
: Result(url.to_deprecated_string(), "Open URL in Browser"sv, 50)
, m_bitmap(GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16))
{
}

View file

@ -186,8 +186,8 @@ void BookmarksBarWidget::model_did_update(unsigned)
int width = 0;
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto title = model()->index(item_index, 0).data().to_string();
auto url = model()->index(item_index, 1).data().to_string();
auto title = model()->index(item_index, 0).data().to_deprecated_string();
auto url = model()->index(item_index, 1).data().to_deprecated_string();
Gfx::IntRect rect { width, 0, font().width(title) + 32, height() };
@ -263,8 +263,8 @@ bool BookmarksBarWidget::contains_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_string();
auto item_url = model()->index(item_index, 1).data().to_string();
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
if (item_url == url) {
return true;
}
@ -276,8 +276,8 @@ bool BookmarksBarWidget::remove_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_string();
auto item_url = model()->index(item_index, 1).data().to_string();
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
if (item_url == url) {
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
@ -309,8 +309,8 @@ bool BookmarksBarWidget::add_bookmark(DeprecatedString const& url, DeprecatedStr
bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_string();
auto item_url = model()->index(item_index, 1).data().to_string();
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
if (item_url == url) {
auto values = BookmarkEditor::edit_bookmark(window(), item_title, item_url);

View file

@ -51,7 +51,7 @@ static DeprecatedString bookmarks_file_path()
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
builder.append("/bookmarks.json"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
static DeprecatedString search_engines_file_path()
@ -59,7 +59,7 @@ static DeprecatedString search_engines_file_path()
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
builder.append("/SearchEngines.json"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
@ -479,8 +479,8 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
if (!json_item.is_object())
continue;
auto search_engine = json_item.as_object();
auto name = search_engine.get("title"sv).to_string();
auto url_format = search_engine.get("url_format"sv).to_string();
auto name = search_engine.get("title"sv).to_deprecated_string();
auto url_format = search_engine.get("url_format"sv).to_deprecated_string();
auto action = GUI::Action::create_checkable(
name, [&, url_format](auto&) {
@ -543,7 +543,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
{
auto& title = tab.title();
auto url = tab.url();
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_deprecated_string() : title));
}
void BrowserWindow::create_new_tab(URL url, bool activate)
@ -742,7 +742,7 @@ ErrorOr<void> BrowserWindow::take_screenshot(ScreenshotType type)
return Error::from_string_view("Failed to take a screenshot of the current tab"sv);
LexicalPath path { Core::StandardPaths::downloads_directory() };
path = path.append(Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv));
path = path.append(Core::DateTime::now().to_deprecated_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv));
auto encoded = Gfx::PNGWriter::encode(*bitmap.bitmap());

View file

@ -92,9 +92,9 @@ void CookieJar::dump_cookies() const
builder.appendff("{}{}{}\n", key_color, cookie.key.path, no_color);
builder.appendff("\t{}Value{} = {}\n", attribute_color, no_color, cookie.value.value);
builder.appendff("\t{}CreationTime{} = {}\n", attribute_color, no_color, cookie.value.creation_time.to_string());
builder.appendff("\t{}LastAccessTime{} = {}\n", attribute_color, no_color, cookie.value.last_access_time.to_string());
builder.appendff("\t{}ExpiryTime{} = {}\n", attribute_color, no_color, cookie.value.expiry_time.to_string());
builder.appendff("\t{}CreationTime{} = {}\n", attribute_color, no_color, cookie.value.creation_time.to_deprecated_string());
builder.appendff("\t{}LastAccessTime{} = {}\n", attribute_color, no_color, cookie.value.last_access_time.to_deprecated_string());
builder.appendff("\t{}ExpiryTime{} = {}\n", attribute_color, no_color, cookie.value.expiry_time.to_deprecated_string());
builder.appendff("\t{}Secure{} = {:s}\n", attribute_color, no_color, cookie.value.secure);
builder.appendff("\t{}HttpOnly{} = {:s}\n", attribute_color, no_color, cookie.value.http_only);
builder.appendff("\t{}HostOnly{} = {:s}\n", attribute_color, no_color, cookie.value.host_only);

View file

@ -80,7 +80,7 @@ GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
case Column::Value:
return cookie.value;
case Column::ExpiryTime:
return cookie.expiry_time.to_string();
return cookie.expiry_time.to_deprecated_string();
case Column::SameSite:
return Web::Cookie::same_site_to_string(cookie.same_site);
}

View file

@ -34,7 +34,7 @@ DownloadWidget::DownloadWidget(const URL& url)
builder.append(Core::StandardPaths::downloads_directory());
builder.append('/');
builder.append(m_url.basename());
m_destination_path = builder.to_string();
m_destination_path = builder.to_deprecated_string();
}
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false);
@ -129,7 +129,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
builder.append("Downloaded "sv);
builder.append(human_readable_size(downloaded_size));
builder.appendff(" in {} sec", m_elapsed_timer.elapsed() / 1000);
m_progress_label->set_text(builder.to_string());
m_progress_label->set_text(builder.to_deprecated_string());
}
{
@ -142,7 +142,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
}
builder.append(" of "sv);
builder.append(m_url.basename());
window()->set_title(builder.to_string());
window()->set_title(builder.to_deprecated_string());
}
}

View file

@ -32,7 +32,7 @@ void InspectorWidget::set_selection(Selection selection)
auto* model = verify_cast<WebView::DOMTreeModel>(m_dom_tree_view->model());
auto index = model->index_for_node(selection.dom_node_id, selection.pseudo_element);
if (!index.is_valid()) {
dbgln("InspectorWidget told to inspect non-existent node: {}", selection.to_string());
dbgln("InspectorWidget told to inspect non-existent node: {}", selection.to_deprecated_string());
return;
}
@ -151,7 +151,7 @@ void InspectorWidget::clear_dom_json()
void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json)
{
if (selection != m_selection) {
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_string(), selection.to_string());
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_deprecated_string(), selection.to_deprecated_string());
return;
}

View file

@ -29,7 +29,7 @@ public:
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
if (pseudo_element.has_value())
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));

View file

@ -77,7 +77,7 @@ void Tab::view_source(const URL& url, DeprecatedString const& source)
editor.set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
editor.set_ruler_visible(true);
window->resize(640, 480);
window->set_title(url.to_string());
window->set_title(url.to_deprecated_string());
window->set_icon(g_icon_bag.filetype_text);
window->set_window_mode(GUI::WindowMode::Modeless);
window->show();
@ -137,7 +137,7 @@ Tab::Tab(BrowserWindow& window)
m_go_back_context_menu = GUI::Menu::construct();
for (auto& url : m_history.get_back_title_history()) {
i++;
m_go_back_context_menu->add_action(GUI::Action::create(url.to_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
m_go_back_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
}
m_go_back_context_menu->popup(go_back_button.screen_relative_rect().bottom_left());
};
@ -150,7 +150,7 @@ Tab::Tab(BrowserWindow& window)
m_go_forward_context_menu = GUI::Menu::construct();
for (auto& url : m_history.get_forward_title_history()) {
i++;
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
}
m_go_forward_context_menu->popup(go_forward_button.screen_relative_rect().bottom_left());
};
@ -215,7 +215,7 @@ Tab::Tab(BrowserWindow& window)
update_status();
m_location_box->set_icon(nullptr);
m_location_box->set_text(url.to_string());
m_location_box->set_text(url.to_deprecated_string());
// don't add to history if back or forward is pressed
if (!m_is_history_navigation)
@ -223,7 +223,7 @@ Tab::Tab(BrowserWindow& window)
m_is_history_navigation = false;
update_actions();
update_bookmark_button(url.to_string());
update_bookmark_button(url.to_deprecated_string());
if (m_dom_inspector_widget)
m_dom_inspector_widget->clear_dom_json();
@ -309,7 +309,7 @@ Tab::Tab(BrowserWindow& window)
}));
m_link_context_menu->add_separator();
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", g_icon_bag.copy, [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_string());
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
}));
m_link_context_menu->add_separator();
m_link_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
@ -336,7 +336,7 @@ Tab::Tab(BrowserWindow& window)
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
}));
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_string());
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
}));
m_image_context_menu->add_separator();
m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
@ -357,8 +357,8 @@ Tab::Tab(BrowserWindow& window)
view().on_title_change = [this](auto& title) {
if (title.is_null()) {
m_history.update_title(url().to_string());
m_title = url().to_string();
m_history.update_title(url().to_deprecated_string());
m_title = url().to_deprecated_string();
} else {
m_history.update_title(title);
m_title = title;
@ -436,7 +436,7 @@ Tab::Tab(BrowserWindow& window)
view().on_link_hover = [this](auto& url) {
if (url.is_valid())
update_status(url.to_string());
update_status(url.to_deprecated_string());
else
update_status();
};
@ -495,7 +495,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
builder.append(".com"sv);
}
}
DeprecatedString final_text = builder.to_string();
DeprecatedString final_text = builder.to_deprecated_string();
auto url = url_from_user_input(final_text);
return url;
@ -543,7 +543,7 @@ void Tab::update_actions()
void Tab::bookmark_current_url()
{
auto url = this->url().to_string();
auto url = this->url().to_deprecated_string();
if (BookmarksBarWidget::the().contains_bookmark(url)) {
BookmarksBarWidget::the().remove_bookmark(url);
} else {

View file

@ -106,7 +106,7 @@ BrowserSettingsWidget::BrowserSettingsWidget()
m_search_engine_combobox->set_model(move(search_engines_model));
m_search_engine_combobox->set_only_allow_values_from_model(true);
m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) {
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_string();
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_deprecated_string();
m_is_custom_search_engine = url_format.is_empty();
m_custom_search_engine_group->set_enabled(m_is_custom_search_engine);
set_modified(true);
@ -122,7 +122,7 @@ void BrowserSettingsWidget::set_color_scheme(StringView color_scheme)
{
bool found_color_scheme = false;
for (int item_index = 0; item_index < m_color_scheme_combobox->model()->row_count(); ++item_index) {
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_string();
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_deprecated_string();
if (scheme == color_scheme) {
m_color_scheme_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
found_color_scheme = true;
@ -146,7 +146,7 @@ void BrowserSettingsWidget::set_search_engine_url(StringView url)
bool found_url = false;
for (int item_index = 0; item_index < m_search_engine_combobox->model()->row_count(); ++item_index) {
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_string();
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_deprecated_string();
if (url_format == url) {
m_search_engine_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
found_url = true;
@ -189,7 +189,7 @@ void BrowserSettingsWidget::apply_settings()
Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, m_show_bookmarks_bar_checkbox->is_checked());
auto color_scheme_index = m_color_scheme_combobox->selected_index();
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_string();
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_deprecated_string();
Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, color_scheme);
if (!m_enable_search_engine_checkbox->is_checked()) {
@ -198,7 +198,7 @@ void BrowserSettingsWidget::apply_settings()
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, m_custom_search_engine_textbox->text());
} else {
auto selected_index = m_search_engine_combobox->selected_index();
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_string();
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_deprecated_string();
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, url);
}

View file

@ -146,7 +146,7 @@ void CalculatorWidget::mimic_pressed_button(RefPtr<GUI::Button> button)
void CalculatorWidget::update_display()
{
m_entry->set_text(m_keypad.to_string());
m_entry->set_text(m_keypad.to_deprecated_string());
if (m_calculator.has_error())
m_label->set_text("E");
else

View file

@ -112,10 +112,10 @@ void Keypad::set_to_0()
m_state = State::External;
}
DeprecatedString Keypad::to_string() const
DeprecatedString Keypad::to_deprecated_string() const
{
if (m_state == State::External)
return m_internal_value.to_string(m_displayed_fraction_length);
return m_internal_value.to_deprecated_string(m_displayed_fraction_length);
StringBuilder builder;
@ -133,7 +133,7 @@ DeprecatedString Keypad::to_string() const
builder.append(frac_value);
}
return builder.to_string();
return builder.to_deprecated_string();
}
void Keypad::set_rounding_length(unsigned rounding_threshold)

View file

@ -33,7 +33,7 @@ public:
void set_rounding_length(unsigned);
unsigned rounding_length() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
// Internal representation of the current decimal value.

View file

@ -54,7 +54,7 @@ CharacterMapWidget::CharacterMapWidget()
continue;
builder.append_code_point(code_point);
}
GUI::Clipboard::the().set_plain_text(builder.to_string());
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
});
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
@ -179,5 +179,5 @@ void CharacterMapWidget::update_statusbar()
builder.appendff("U+{:04X}", code_point);
if (auto display_name = Unicode::code_point_display_name(code_point); display_name.has_value())
builder.appendff(" - {}", display_name.value());
m_statusbar->set_text(builder.to_string());
m_statusbar->set_text(builder.to_deprecated_string());
}

View file

@ -119,5 +119,5 @@ void ClockSettingsWidget::update_time_format_string()
void ClockSettingsWidget::update_clock_preview()
{
m_clock_preview->set_text(Core::DateTime::now().to_string(m_time_format));
m_clock_preview->set_text(Core::DateTime::now().to_deprecated_string(m_time_format));
}

View file

@ -90,12 +90,12 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
first_entry = false;
else
builder.append('\n');
builder.append(entry.to_string());
builder.append(entry.to_deprecated_string());
}
dbgln("--- Backtrace for thread #{} (TID {}) ---", thread_index, thread_info.tid);
for (auto& entry : backtrace.entries()) {
dbgln("{}", entry.to_string(true));
dbgln("{}", entry.to_deprecated_string(true));
}
return {
@ -290,7 +290,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
auto file = file_or_error.value();
if (!file->write(full_backtrace.to_string()))
if (!file->write(full_backtrace.to_deprecated_string()))
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
};

View file

@ -89,7 +89,7 @@ static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr
if (!insn.has_value())
break;
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_string(offset));
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_deprecated_string(offset));
}
return true;

View file

@ -72,7 +72,7 @@ void BackgroundSettingsWidget::create_frame()
m_context_menu->add_separator();
m_copy_action = GUI::CommonActions::make_copy_action(
[this](auto&) {
auto url = URL::create_with_file_scheme(m_monitor_widget->wallpaper()).to_string();
auto url = URL::create_with_file_scheme(m_monitor_widget->wallpaper()).to_deprecated_string();
GUI::Clipboard::the().set_data(url.bytes(), "text/uri-list");
},
this);

View file

@ -148,7 +148,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
#if 0
if (!m_desktop_resolution.is_null()) {
auto displayed_resolution_string = Gfx::IntSize { m_desktop_resolution.width(), m_desktop_resolution.height() }.to_string();
auto displayed_resolution_string = Gfx::IntSize { m_desktop_resolution.width(), m_desktop_resolution.height() }.to_deprecated_string();
// Render text label scaled with scale factor to hint at its effect.
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor

View file

@ -533,7 +533,7 @@ Vector<DeprecatedString> DirectoryView::selected_file_paths() const
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
auto parent_index = model.parent_index(index);
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
auto path = name_index.data(GUI::ModelRole::Custom).to_string();
auto path = name_index.data(GUI::ModelRole::Custom).to_deprecated_string();
paths.append(path);
});
return paths;

View file

@ -1312,7 +1312,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
continue;
if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) {
auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast<Error const&>(result.error()));
auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_deprecated_string(), new_path, static_cast<Error const&>(result.error()));
GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
} else {
had_accepted_copy = true;

View file

@ -325,7 +325,7 @@ ErrorOr<void> MainWidget::create_actions()
continue;
builder.append_code_point(code_point);
}
GUI::Clipboard::the().set_plain_text(builder.to_string());
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
});
m_copy_text_action->set_status_tip("Copy to clipboard as text");
@ -879,7 +879,7 @@ void MainWidget::update_title()
else
title.append(m_path);
title.append("[*] - Font Editor"sv);
window()->set_title(title.to_string());
window()->set_title(title.to_deprecated_string());
}
void MainWidget::did_modify_font()
@ -920,7 +920,7 @@ void MainWidget::update_statusbar()
builder.appendff(" [{}x{}]", m_edited_font->raw_glyph_width(glyph), m_edited_font->glyph_height());
else if (Gfx::Emoji::emoji_for_code_point(glyph))
builder.appendff(" [emoji]");
m_statusbar->set_text(builder.to_string());
m_statusbar->set_text(builder.to_deprecated_string());
}
void MainWidget::update_preview()

View file

@ -131,7 +131,7 @@ MainWidget::MainWidget()
};
m_web_view->on_link_hover = [this](URL const& url) {
if (url.is_valid())
m_statusbar->set_text(url.to_string());
m_statusbar->set_text(url.to_deprecated_string());
else
m_statusbar->set_text({});
};

View file

@ -172,7 +172,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
for (size_t i = m_selection_start; i < m_selection_end; i++)
output_string_builder.appendff("{:02X} ", m_document->get(i).value);
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
return true;
}
@ -185,7 +185,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
for (size_t i = m_selection_start; i < m_selection_end; i++)
output_string_builder.append(isprint(m_document->get(i).value) ? m_document->get(i).value : '.');
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
return true;
}
@ -208,7 +208,7 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code()
}
output_string_builder.append("\n};\n"sv);
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
return true;
}
@ -768,7 +768,7 @@ Vector<Match> HexEditor::find_all(ByteBuffer& needle, size_t start)
}
}
if (found) {
matches.append({ i, DeprecatedString::formatted("{}", StringView { needle }.to_string().characters()) });
matches.append({ i, DeprecatedString::formatted("{}", StringView { needle }.to_deprecated_string().characters()) });
i += needle.size() - 1;
}
}
@ -803,7 +803,7 @@ Vector<Match> HexEditor::find_all_strings(size_t min_length)
builder.append(c);
} else {
if (builder.length() >= min_length)
matches.append({ offset, builder.to_string() });
matches.append({ offset, builder.to_deprecated_string() });
builder.clear();
found_string = false;
}

View file

@ -520,7 +520,7 @@ void HexEditorWidget::update_title()
else
builder.append(m_path);
builder.append("[*] - Hex Editor"sv);
window()->set_title(builder.to_string());
window()->set_title(builder.to_deprecated_string());
}
void HexEditorWidget::open_file(NonnullRefPtr<Core::File> file)

View file

@ -71,7 +71,7 @@ public:
VERIFY_NOT_REACHED();
}
DeprecatedString inspector_value_type_to_string(ValueType type) const
DeprecatedString inspector_value_type_to_deprecated_string(ValueType type) const
{
switch (type) {
case SignedByte:
@ -112,7 +112,7 @@ public:
if (role == GUI::ModelRole::Display) {
switch (index.column()) {
case Column::Type:
return inspector_value_type_to_string(static_cast<ValueType>(index.row()));
return inspector_value_type_to_deprecated_string(static_cast<ValueType>(index.row()));
case Column::Value:
return m_values.at(index.row());
}

View file

@ -74,7 +74,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
}
window->set_title(DeprecatedString::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_deprecated_string(), (int)(scale * 100)));
if (!widget->scaled_for_first_image()) {
widget->set_scaled_for_first_image(true);

View file

@ -178,7 +178,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
if (values[i])
sb.append_code_point(values[i]);
JsonValue val(sb.to_string());
JsonValue val(sb.to_deprecated_string());
items.append(move(val));
}
map_json.set(name, move(items));
@ -191,7 +191,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
// Write to file.
DeprecatedString file_content = map_json.to_string();
DeprecatedString file_content = map_json.to_deprecated_string();
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write));
TRY(file->write(file_content.bytes()));
file->close();
@ -249,7 +249,7 @@ void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
StringBuilder sb;
sb.append_code_point(map[index]);
m_keys.at(k)->set_text(sb.to_string());
m_keys.at(k)->set_text(sb.to_deprecated_string());
}
this->update();
@ -261,7 +261,7 @@ void KeyboardMapperWidget::update_window_title()
sb.append(m_filename);
sb.append("[*] - Keyboard Mapper"sv);
window()->set_title(sb.to_string());
window()->set_title(sb.to_deprecated_string());
}
void KeyboardMapperWidget::show_error_to_user(Error error)

View file

@ -161,7 +161,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
auto const& keymap_object = json.as_object();
VERIFY(keymap_object.has("keymap"sv));
m_initial_active_keymap = keymap_object.get("keymap"sv).to_string();
m_initial_active_keymap = keymap_object.get("keymap"sv).to_deprecated_string();
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors());

View file

@ -55,7 +55,7 @@ MailWidget::MailWidget()
m_web_view->on_link_hover = [this](auto& url) {
if (url.is_valid())
m_statusbar->set_text(url.to_string());
m_statusbar->set_text(url.to_deprecated_string());
else
m_statusbar->set_text("");
};
@ -68,7 +68,7 @@ MailWidget::MailWidget()
m_link_context_menu_default_action = link_default_action;
m_link_context_menu->add_separator();
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_string());
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
}));
m_web_view->on_link_context_menu_request = [this](auto& url, auto& screen_position) {
@ -82,7 +82,7 @@ MailWidget::MailWidget()
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
}));
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_string());
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
}));
m_image_context_menu->add_separator();
m_image_context_menu->add_action(GUI::Action::create("&Open Image in Browser", [this](auto&) {
@ -347,7 +347,7 @@ void MailWidget::selected_mailbox()
break;
}
return builder.to_string();
return builder.to_deprecated_string();
};
auto& subject_iterator_value = subject_iterator->get<1>().value();

View file

@ -78,7 +78,7 @@ NetworkSettingsWidget::NetworkSettingsWidget()
size_t index = 0;
proc_net_adapters_json.as_array().for_each([&](auto& value) {
auto& if_object = value.as_object();
auto adapter_name = if_object.get("name"sv).to_string();
auto adapter_name = if_object.get("name"sv).to_deprecated_string();
if (adapter_name == "loop")
return;
@ -137,7 +137,7 @@ void NetworkSettingsWidget::apply_settings()
{
auto config_file = Core::ConfigFile::open_for_system("Network", Core::ConfigFile::AllowWriting::Yes).release_value_but_fixme_should_propagate_errors();
for (auto const& adapter_data : m_network_adapters) {
auto netmask = IPv4Address::netmask_from_cidr(adapter_data.value.cidr).to_string();
auto netmask = IPv4Address::netmask_from_cidr(adapter_data.value.cidr).to_deprecated_string();
config_file->write_bool_entry(adapter_data.key, "Enabled", adapter_data.value.enabled);
config_file->write_bool_entry(adapter_data.key, "DHCP", adapter_data.value.dhcp);
if (adapter_data.value.enabled && !adapter_data.value.dhcp) {

View file

@ -26,7 +26,7 @@ NumericInput::NumericInput()
first = false;
}
auto new_number_opt = builder.to_string().to_int();
auto new_number_opt = builder.to_deprecated_string().to_int();
if (!new_number_opt.has_value()) {
m_needs_text_reset = true;
return;
@ -34,7 +34,7 @@ NumericInput::NumericInput()
m_needs_text_reset = false;
}
set_text(builder.to_string());
set_text(builder.to_deprecated_string());
set_current_number(new_number_opt.value(), GUI::AllowCallback::No);
};

View file

@ -130,7 +130,7 @@ void MainWidget::image_editor_did_update_undo_stack()
builder.append(' ');
builder.append(suffix.value());
}
return builder.to_string();
return builder.to_deprecated_string();
};
auto& undo_stack = image_editor->undo_stack();
@ -1080,7 +1080,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
auto const& image_size = current_image_editor()->image().size();
auto image_rectangle = Gfx::IntRect { 0, 0, image_size.width(), image_size.height() };
if (image_rectangle.contains(mouse_position)) {
m_statusbar->set_override_text(mouse_position.to_string());
m_statusbar->set_override_text(mouse_position.to_deprecated_string());
m_histogram_widget->set_color_at_mouseposition(current_image_editor()->image().color_at(mouse_position));
m_vectorscope_widget->set_color_at_mouseposition(current_image_editor()->image().color_at(mouse_position));
} else {

View file

@ -263,7 +263,7 @@ Result<Vector<Color>, DeprecatedString> PaletteWidget::load_palette_path(Depreca
Result<void, DeprecatedString> PaletteWidget::save_palette_file(Vector<Color> palette, Core::File& file)
{
for (auto& color : palette) {
file.write(color.to_string_without_alpha());
file.write(color.to_deprecated_string_without_alpha());
file.write("\n"sv);
}
return {};

View file

@ -112,7 +112,7 @@ HashMap<DeprecatedString, DeprecatedString> Presentation::parse_metadata(JsonObj
HashMap<DeprecatedString, DeprecatedString> metadata;
metadata_object.for_each_member([&](auto const& key, auto const& value) {
metadata.set(key, value.to_string());
metadata.set(key, value.to_deprecated_string());
});
return metadata;

View file

@ -62,9 +62,9 @@ Gfx::IntRect SlideObject::transformed_bounding_box(Gfx::IntRect clip_rect, Gfx::
GraphicsObject::GraphicsObject()
{
register_property(
"color", [this]() { return this->color().to_string(); },
"color", [this]() { return this->color().to_deprecated_string(); },
[this](auto& value) {
auto color = Color::from_string(value.to_string());
auto color = Color::from_string(value.to_deprecated_string());
if (color.has_value()) {
this->set_color(color.value());
return true;

View file

@ -91,7 +91,7 @@ static void fill_mounts(Vector<MountInfo>& output)
json.as_array().for_each([&output](JsonValue const& value) {
auto& filesystem_object = value.as_object();
MountInfo mount_info;
mount_info.mount_point = filesystem_object.get("mount_point"sv).to_string();
mount_info.mount_point = filesystem_object.get("mount_point"sv).to_deprecated_string();
mount_info.source = filesystem_object.get("source"sv).as_string_or("none"sv);
output.append(mount_info);
});
@ -178,7 +178,7 @@ static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, Ha
StringBuilder builder = StringBuilder();
builder.append(root.m_name);
builder.append('/');
MountInfo* root_mount_info = find_mount_for_path(builder.to_string(), mounts);
MountInfo* root_mount_info = find_mount_for_path(builder.to_deprecated_string(), mounts);
if (!root_mount_info) {
return;
}
@ -189,12 +189,12 @@ static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, Ha
builder.append(queue_entry.path);
builder.append('/');
MountInfo* mount_info = find_mount_for_path(builder.to_string(), mounts);
MountInfo* mount_info = find_mount_for_path(builder.to_deprecated_string(), mounts);
if (!mount_info || (mount_info != root_mount_info && mount_info->source != root_mount_info->source)) {
continue;
}
Core::DirIterator dir_iterator(builder.to_string(), Core::DirIterator::SkipParentAndBaseDir);
Core::DirIterator dir_iterator(builder.to_deprecated_string(), Core::DirIterator::SkipParentAndBaseDir);
if (dir_iterator.has_error()) {
int error_sum = error_accumulator.get(dir_iterator.error()).value_or(0);
error_accumulator.set(dir_iterator.error(), error_sum + 1);
@ -218,7 +218,7 @@ static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, Ha
error_accumulator.set(errno, error_sum + 1);
} else {
if (S_ISDIR(st.st_mode)) {
queue.enqueue(QueueEntry(builder.to_string(), &child));
queue.enqueue(QueueEntry(builder.to_deprecated_string(), &child));
} else {
child.m_area = st.st_size;
}
@ -272,7 +272,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg
builder.append(')');
first = false;
}
statusbar.set_text(builder.to_string());
statusbar.set_text(builder.to_deprecated_string());
} else {
statusbar.set_text("No errors");
}

View file

@ -162,7 +162,7 @@ DeprecatedString Cell::source() const
if (m_kind == Formula)
builder.append('=');
builder.append(m_data);
return builder.to_string();
return builder.to_deprecated_string();
}
// FIXME: Find a better way to figure out dependencies

View file

@ -22,7 +22,7 @@ JS::ThrowCompletionOr<DeprecatedString> DateCell::display(Cell& cell, CellTypeMe
return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<DeprecatedString> {
auto& vm = cell.sheet().global_object().vm();
auto timestamp = TRY(js_value(cell, metadata));
auto string = Core::DateTime::from_timestamp(TRY(timestamp.to_i32(vm))).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S"sv : metadata.format.view());
auto string = Core::DateTime::from_timestamp(TRY(timestamp.to_i32(vm))).to_deprecated_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S"sv : metadata.format.view());
if (metadata.length >= 0)
return string.substring(0, metadata.length);

View file

@ -276,7 +276,7 @@ Result<void, DeprecatedString> ExportDialog::make_and_run_for(StringView mime, C
for (auto& sheet : workbook.sheets())
array.append(sheet.to_json());
auto file_content = array.to_string();
auto file_content = array.to_deprecated_string();
bool result = file.write(file_content);
if (!result) {
int error_number = errno;
@ -286,7 +286,7 @@ Result<void, DeprecatedString> ExportDialog::make_and_run_for(StringView mime, C
sb.append("Unable to save file. Error: "sv);
sb.append({ error, strlen(error) });
return sb.to_string();
return sb.to_deprecated_string();
}
return {};

View file

@ -142,12 +142,12 @@ DeprecatedString HelpWindow::render(StringView key)
VERIFY(m_docs.has_object(key));
auto& doc = m_docs.get(key).as_object();
auto name = doc.get("name"sv).to_string();
auto name = doc.get("name"sv).to_deprecated_string();
auto argc = doc.get("argc"sv).to_u32(0);
VERIFY(doc.has_array("argnames"sv));
auto& argnames = doc.get("argnames"sv).as_array();
auto docstring = doc.get("doc"sv).to_string();
auto docstring = doc.get("doc"sv).to_deprecated_string();
StringBuilder markdown_builder;
@ -162,7 +162,7 @@ DeprecatedString HelpWindow::render(StringView key)
markdown_builder.append("No required arguments.\n"sv);
for (size_t i = 0; i < argc; ++i)
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_string());
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_deprecated_string());
if (argc > 0)
markdown_builder.append("\n"sv);
@ -171,7 +171,7 @@ DeprecatedString HelpWindow::render(StringView key)
auto opt_count = argnames.size() - argc;
markdown_builder.appendff("{} optional argument(s):\n", opt_count);
for (size_t i = argc; i < (size_t)argnames.size(); ++i)
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_string());
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_deprecated_string());
markdown_builder.append("\n"sv);
}
@ -184,8 +184,8 @@ DeprecatedString HelpWindow::render(StringView key)
VERIFY(examples.is_object());
markdown_builder.append("# EXAMPLES\n"sv);
examples.as_object().for_each_member([&](auto& text, auto& description_value) {
dbgln("```js\n{}\n```\n\n- {}\n", text, description_value.to_string());
markdown_builder.appendff("```js\n{}\n```\n\n- {}\n", text, description_value.to_string());
dbgln("```js\n{}\n```\n\n- {}\n", text, description_value.to_deprecated_string());
markdown_builder.appendff("```js\n{}\n```\n\n- {}\n", text, description_value.to_deprecated_string());
});
}

View file

@ -215,7 +215,7 @@ Result<NonnullRefPtrVector<Sheet>, DeprecatedString> ImportDialog::make_and_run_
sb.append("Failed to parse "sv);
sb.append(file.filename());
return sb.to_string();
return sb.to_deprecated_string();
}
auto& json_value = json_value_option.value();
@ -224,7 +224,7 @@ Result<NonnullRefPtrVector<Sheet>, DeprecatedString> ImportDialog::make_and_run_
sb.append("Did not find a spreadsheet in "sv);
sb.append(file.filename());
return sb.to_string();
return sb.to_deprecated_string();
}
NonnullRefPtrVector<Sheet> sheets;

View file

@ -196,7 +196,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
auto name_value = vm.argument(0);
if (!name_value.is_string())
return vm.throw_completion<JS::TypeError>("Expected a String argument to get_real_cell_contents()");
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().string());
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().deprecated_string());
if (!position.has_value())
return vm.throw_completion<JS::TypeError>("Invalid cell name");
@ -225,7 +225,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
auto name_value = vm.argument(0);
if (!name_value.is_string())
return vm.throw_completion<JS::TypeError>("Expected the first argument of set_real_cell_contents() to be a String");
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().string());
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().deprecated_string());
if (!position.has_value())
return vm.throw_completion<JS::TypeError>("Invalid cell name");
@ -234,7 +234,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
return vm.throw_completion<JS::TypeError>("Expected the second argument of set_real_cell_contents() to be a String");
auto& cell = sheet_object->m_sheet.ensure(position.value());
auto& new_contents = new_contents_value.as_string().string();
auto& new_contents = new_contents_value.as_string().deprecated_string();
cell.set_data(new_contents);
return JS::js_null();
}
@ -255,7 +255,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
auto name_value = vm.argument(0);
if (!name_value.is_string())
return vm.throw_completion<JS::TypeError>("Expected a String argument to parse_cell_name()");
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().string());
auto position = sheet_object->m_sheet.parse_cell_name(name_value.as_string().deprecated_string());
if (!position.has_value())
return JS::js_undefined();
@ -301,7 +301,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_index)
if (!column_name.is_string())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "String");
auto& column_name_str = column_name.as_string().string();
auto& column_name_str = column_name.as_string().deprecated_string();
auto* this_object = TRY(vm.this_value().to_object(vm));
@ -326,7 +326,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
if (!column_name.is_string())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "String");
auto& column_name_str = column_name.as_string().string();
auto& column_name_str = column_name.as_string().deprecated_string();
auto offset = TRY(vm.argument(1).to_number(vm));
auto offset_number = static_cast<i32>(offset.as_double());
@ -354,7 +354,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_column_bound)
if (!column_name.is_string())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "String");
auto& column_name_str = column_name.as_string().string();
auto& column_name_str = column_name.as_string().deprecated_string();
auto* this_object = TRY(vm.this_value().to_object(vm));
if (!is<SheetGlobalObject>(this_object))
@ -405,7 +405,7 @@ JS_DEFINE_NATIVE_FUNCTION(WorkbookObject::sheet)
auto& workbook = static_cast<WorkbookObject*>(this_object)->m_workbook;
if (name_value.is_string()) {
auto& name = name_value.as_string().string();
auto& name = name_value.as_string().deprecated_string();
for (auto& sheet : workbook.sheets()) {
if (sheet.name() == name)
return JS::Value(&sheet.global_object());

View file

@ -240,7 +240,7 @@ XSV::Field XSV::read_one_quoted_field()
set_error(ReadError::QuoteFailure);
if (is_copy)
return { {}, builder.to_string(), false };
return { {}, builder.to_deprecated_string(), false };
return { m_source.substring_view(start, end - start), {}, true };
}

View file

@ -57,7 +57,7 @@ Sheet::Sheet(Workbook& workbook)
warnln("Spreadsheet: Failed to parse runtime code");
for (auto& error : script_or_error.error()) {
// FIXME: This doesn't print hints anymore
warnln("SyntaxError: {}", error.to_string());
warnln("SyntaxError: {}", error.to_deprecated_string());
}
} else {
auto result = interpreter().run(script_or_error.value());
@ -172,7 +172,7 @@ JS::ThrowCompletionOr<JS::Value> Sheet::evaluate(StringView source, Cell* on_beh
name);
if (script_or_error.is_error())
return interpreter().vm().throw_completion<JS::SyntaxError>(script_or_error.error().first().to_string());
return interpreter().vm().throw_completion<JS::SyntaxError>(script_or_error.error().first().to_deprecated_string());
return interpreter().run(script_or_error.value());
}
@ -260,12 +260,12 @@ Cell* Sheet::from_url(const URL& url)
Optional<Position> Sheet::position_from_url(const URL& url) const
{
if (!url.is_valid()) {
dbgln("Invalid url: {}", url.to_string());
dbgln("Invalid url: {}", url.to_deprecated_string());
return {};
}
if (url.scheme() != "spreadsheet" || url.host() != "cell") {
dbgln("Bad url: {}", url.to_string());
dbgln("Bad url: {}", url.to_deprecated_string());
return {};
}
@ -422,7 +422,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
OwnPtr<Cell> cell;
switch (kind) {
case Cell::LiteralString:
cell = make<Cell>(obj.get("value"sv).to_string(), position, *sheet);
cell = make<Cell>(obj.get("value"sv).to_deprecated_string(), position, *sheet);
break;
case Cell::Formula: {
auto& vm = sheet->interpreter().vm();
@ -431,12 +431,12 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
warnln("Failed to load previous value for cell {}, leaving as undefined", position.to_cell_identifier(sheet));
value_or_error = JS::js_undefined();
}
cell = make<Cell>(obj.get("source"sv).to_string(), value_or_error.release_value(), position, *sheet);
cell = make<Cell>(obj.get("source"sv).to_deprecated_string(), value_or_error.release_value(), position, *sheet);
break;
}
}
auto type_name = obj.has("type"sv) ? obj.get("type"sv).to_string() : "Numeric";
auto type_name = obj.has("type"sv) ? obj.get("type"sv).to_deprecated_string() : "Numeric";
cell->set_type(type_name);
auto type_meta = obj.get("type_metadata"sv);
@ -465,7 +465,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
return IterationDecision::Continue;
auto& fmt_obj = fmt_val.as_object();
auto fmt_cond = fmt_obj.get("condition"sv).to_string();
auto fmt_cond = fmt_obj.get("condition"sv).to_deprecated_string();
if (fmt_cond.is_empty())
return IterationDecision::Continue;
@ -532,9 +532,9 @@ JsonObject Sheet::to_json() const
auto save_format = [](auto const& format, auto& obj) {
if (format.foreground_color.has_value())
obj.set("foreground_color", format.foreground_color.value().to_string());
obj.set("foreground_color", format.foreground_color.value().to_deprecated_string());
if (format.background_color.has_value())
obj.set("background_color", format.background_color.value().to_string());
obj.set("background_color", format.background_color.value().to_deprecated_string());
};
auto bottom_right = written_data_bounds();
@ -552,7 +552,7 @@ JsonObject Sheet::to_json() const
StringBuilder builder;
builder.append(column(it.key.column));
builder.appendff("{}", it.key.row);
auto key = builder.to_string();
auto key = builder.to_deprecated_string();
JsonObject data;
data.set("kind", it.value->kind() == Cell::Kind::Formula ? "Formula" : "LiteralString");
@ -737,7 +737,7 @@ DeprecatedString Sheet::generate_inline_documentation_for(StringView function, s
builder.append('<');
else if (i >= argc)
builder.append('[');
builder.append(argnames[i].to_string());
builder.append(argnames[i].to_deprecated_string());
if (i == argument_index)
builder.append('>');
else if (i >= argc)

View file

@ -23,7 +23,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
if (!cell)
return DeprecatedString::empty();
Function<DeprecatedString(JS::Value)> to_string_as_exception = [&](JS::Value value) {
Function<DeprecatedString(JS::Value)> to_deprecated_string_as_exception = [&](JS::Value value) {
auto& vm = cell->sheet().global_object().vm();
StringBuilder builder;
builder.append("Error: "sv);
@ -36,32 +36,32 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
builder.append(message.to_string_without_side_effects());
else
builder.append(error.release_value());
return builder.to_string();
return builder.to_deprecated_string();
}
}
auto error_message = value.to_string(vm);
if (error_message.is_throw_completion())
return to_string_as_exception(*error_message.release_error().value());
return to_deprecated_string_as_exception(*error_message.release_error().value());
builder.append(error_message.release_value());
return builder.to_string();
return builder.to_deprecated_string();
};
if (cell->kind() == Spreadsheet::Cell::Formula) {
if (auto opt_throw_value = cell->thrown_value(); opt_throw_value.has_value())
return to_string_as_exception(*opt_throw_value);
return to_deprecated_string_as_exception(*opt_throw_value);
}
auto display = cell->typed_display();
if (display.is_error())
return to_string_as_exception(*display.release_error().value());
return to_deprecated_string_as_exception(*display.release_error().value());
return display.release_value();
}
if (role == GUI::ModelRole::MimeData)
return Position { (size_t)index.column(), (size_t)index.row() }.to_url(m_sheet).to_string();
return Position { (size_t)index.column(), (size_t)index.row() }.to_url(m_sheet).to_deprecated_string();
if (role == GUI::ModelRole::TextAlignment) {
auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() });
@ -131,7 +131,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
builder.appendff(" in cell '{}', at line {}, column {}\n", frame.source_range.filename().substring_view(5), frame.source_range.start.line, frame.source_range.start.column);
}
}
return builder.to_string();
return builder.to_deprecated_string();
}
return {};
@ -155,7 +155,7 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
Position cursor_position { (size_t)cursor->column(), (size_t)cursor->row() };
auto mime_data_buffer = mime_data->data("text/x-spreadsheet-data");
auto new_data = DeprecatedString::formatted("{}\n{}",
cursor_position.to_url(m_sheet).to_string(),
cursor_position.to_url(m_sheet).to_deprecated_string(),
StringView(mime_data_buffer));
mime_data->set_data("text/x-spreadsheet-data", new_data.to_byte_buffer());
@ -185,7 +185,7 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu
auto& cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
auto previous_data = cell.data();
cell.set_data(value.to_string());
cell.set_data(value.to_deprecated_string());
if (on_cell_data_change)
on_cell_data_change(cell, previous_data);
did_update(UpdateFlag::DontInvalidateIndices);

View file

@ -495,7 +495,7 @@ void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, Gfx::IntRec
auto text_color = index.data(GUI::ModelRole::ForegroundColor).to_color(palette.color(m_table_view.foreground_role()));
auto data = index.data();
auto text_alignment = index.data(GUI::ModelRole::TextAlignment).to_text_alignment(Gfx::TextAlignment::CenterRight);
painter.draw_text(rect, data.to_string(), m_table_view.font_for_index(index), text_alignment, text_color, Gfx::TextElision::Right);
painter.draw_text(rect, data.to_deprecated_string(), m_table_view.font_for_index(index), text_alignment, text_color, Gfx::TextElision::Right);
}
}

View file

@ -594,7 +594,7 @@ void SpreadsheetWidget::update_window_title()
builder.append(current_filename());
builder.append("[*] - Spreadsheet"sv);
window()->set_title(builder.to_string());
window()->set_title(builder.to_deprecated_string());
}
void SpreadsheetWidget::clipboard_action(bool is_cut)
@ -617,17 +617,17 @@ void SpreadsheetWidget::clipboard_action(bool is_cut)
auto cursor = current_selection_cursor();
if (cursor) {
Spreadsheet::Position position { (size_t)cursor->column(), (size_t)cursor->row() };
url_builder.append(position.to_url(worksheet).to_string());
url_builder.append(position.to_url(worksheet).to_deprecated_string());
url_builder.append('\n');
}
for (auto& cell : cells) {
if (first && !cursor) {
url_builder.append(cell.to_url(worksheet).to_string());
url_builder.append(cell.to_url(worksheet).to_deprecated_string());
url_builder.append('\n');
}
url_builder.append(cell.to_url(worksheet).to_string());
url_builder.append(cell.to_url(worksheet).to_deprecated_string());
url_builder.append('\n');
auto cell_data = worksheet.at(cell);
@ -638,8 +638,8 @@ void SpreadsheetWidget::clipboard_action(bool is_cut)
first = false;
}
HashMap<DeprecatedString, DeprecatedString> metadata;
metadata.set("text/x-spreadsheet-data", url_builder.to_string());
dbgln(url_builder.to_string());
metadata.set("text/x-spreadsheet-data", url_builder.to_deprecated_string());
dbgln(url_builder.to_deprecated_string());
GUI::Clipboard::the().set_data(text_builder.string_view().bytes(), "text/plain", move(metadata));
}

View file

@ -25,7 +25,7 @@ public:
virtual void paint(GUI::Painter& painter, Gfx::IntRect const& a_rect, Gfx::Palette const&, const GUI::ModelIndex& index) override
{
auto rect = a_rect.shrunken(2, 2);
auto pagemap = index.data(GUI::ModelRole::Custom).to_string();
auto pagemap = index.data(GUI::ModelRole::Custom).to_deprecated_string();
float scale_factor = (float)pagemap.length() / (float)rect.width();
@ -76,10 +76,10 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
builder.append('C');
if (object.get("stack"sv).to_bool())
builder.append('T');
return builder.to_string();
return builder.to_deprecated_string();
});
pid_vm_fields.empend("VMObject type", Gfx::TextAlignment::CenterLeft, [](auto& object) {
auto type = object.get("vmobject"sv).to_string();
auto type = object.get("vmobject"sv).to_deprecated_string();
if (type.ends_with("VMObject"sv))
type = type.substring(0, type.length() - 8);
return type;

View file

@ -132,7 +132,7 @@ public:
size_builder.append(' ');
size_builder.append(human_readable_size(object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64()));
size_builder.append(' ');
return size_builder.to_string();
return size_builder.to_deprecated_string();
},
[](const JsonObject& object) {
return object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64();
@ -194,7 +194,7 @@ public:
check(MS_NOREGULAR, "noregular"sv);
if (builder.string_view().is_empty())
return DeprecatedString("defaults");
return builder.to_string();
return builder.to_deprecated_string();
});
df_fields.empend("free_block_count", "Free blocks", Gfx::TextAlignment::CenterRight);
df_fields.empend("total_block_count", "Total blocks", Gfx::TextAlignment::CenterRight);
@ -339,7 +339,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (process_table_view.selection().is_empty())
return {};
auto pid_index = process_table_view.model()->index(process_table_view.selection().first().row(), column, process_table_view.selection().first().parent());
return pid_index.data().to_string();
return pid_index.data().to_deprecated_string();
};
auto kill_action = GUI::Action::create(
@ -528,7 +528,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
main_widget->find_descendant_of_type_named<GUI::Label>("icon_label")->set_icon(icon_data.as_icon().bitmap_for_size(32));
}
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_string(), pid));
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid));
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessStateWidget>("process_state")->set_pid(pid);
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid);

View file

@ -26,9 +26,9 @@ FileArgument::FileArgument(DeprecatedString file_argument)
// Match 0 group 2: column number
if (groups.size() > 2) {
// Both a line and column number were specified.
auto filename = groups.at(0).view.to_string();
auto initial_line_number = groups.at(1).view.to_string().to_int();
auto initial_column_number = groups.at(2).view.to_string().to_int();
auto filename = groups.at(0).view.to_deprecated_string();
auto initial_line_number = groups.at(1).view.to_deprecated_string().to_int();
auto initial_column_number = groups.at(2).view.to_deprecated_string().to_int();
m_filename = filename;
if (initial_line_number.has_value() && initial_line_number.value() > 0)
@ -37,15 +37,15 @@ FileArgument::FileArgument(DeprecatedString file_argument)
m_column = initial_column_number.value();
} else if (groups.size() == 2) {
// Only a line number was specified.
auto filename = groups.at(0).view.to_string();
auto initial_line_number = groups.at(1).view.to_string().to_int();
auto filename = groups.at(0).view.to_deprecated_string();
auto initial_line_number = groups.at(1).view.to_deprecated_string().to_int();
m_filename = filename;
if (initial_line_number.has_value() && initial_line_number.value() > 0)
m_line = initial_line_number.value();
} else {
// A colon was found at the end of the file name but no values were found after it.
m_filename = groups.at(0).view.to_string();
m_filename = groups.at(0).view.to_deprecated_string();
}
}
}

View file

@ -331,7 +331,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
m_page_view = web_view_container.add<WebView::OutOfProcessWebView>();
m_page_view->on_link_hover = [this](auto& url) {
if (url.is_valid())
m_statusbar->set_text(url.to_string());
m_statusbar->set_text(url.to_deprecated_string());
else
update_statusbar();
};
@ -711,7 +711,7 @@ void MainWidget::update_title()
else
builder.append(m_path);
builder.append("[*] - Text Editor"sv);
window()->set_title(builder.to_string());
window()->set_title(builder.to_deprecated_string());
}
bool MainWidget::read_file(Core::File& file)
@ -855,7 +855,7 @@ void MainWidget::update_statusbar()
auto word_count = m_editor->number_of_words();
builder.appendff("{} {} ({} {})", text.length(), text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
}
m_statusbar->set_text(0, builder.to_string());
m_statusbar->set_text(0, builder.to_deprecated_string());
if (m_editor && m_editor->syntax_highlighter()) {
auto language = m_editor->syntax_highlighter()->language();

View file

@ -286,7 +286,7 @@ void MainWidget::save_to_file(Core::File& file)
ENUMERATE_ALIGNMENT_ROLES(__ENUMERATE_ALIGNMENT_ROLE)
#undef __ENUMERATE_ALIGNMENT_ROLE
#define __ENUMERATE_COLOR_ROLE(role) theme->write_entry("Colors", to_string(Gfx::ColorRole::role), m_current_palette.color(Gfx::ColorRole::role).to_string());
#define __ENUMERATE_COLOR_ROLE(role) theme->write_entry("Colors", to_string(Gfx::ColorRole::role), m_current_palette.color(Gfx::ColorRole::role).to_deprecated_string());
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
#undef __ENUMERATE_COLOR_ROLE

View file

@ -261,7 +261,7 @@ void VideoPlayerWidget::update_title()
}
string_builder.append("[*] - Video Player"sv);
window()->set_title(string_builder.to_string());
window()->set_title(string_builder.to_deprecated_string());
}
Video::PlaybackManager::SeekMode VideoPlayerWidget::seek_mode()