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

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -22,7 +22,7 @@ namespace GUI {
NonnullRefPtr<AboutDialog> AboutDialog::create(String const& name, String version, RefPtr<Gfx::Bitmap const> icon, Window* parent_window)
{
auto dialog = adopt_ref(*new AboutDialog(name, version, icon, parent_window));
dialog->set_title(DeprecatedString::formatted("About {}", name));
dialog->set_title(ByteString::formatted("About {}", name));
auto widget = dialog->set_main_widget<Widget>();
MUST(widget->load_from_gml(about_dialog_gml));

View file

@ -73,7 +73,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_deprecated_string());
cell_width = font().width(cell_data.to_byte_string());
}
if (is_empty && cell_width > 0)
is_empty = false;
@ -111,7 +111,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_deprecated_string());
cell_width = font().width(cell_data.to_byte_string());
}
column_width = max(column_width, cell_width);
}

View file

@ -38,14 +38,14 @@ AbstractThemePreview::AbstractThemePreview(Gfx::Palette const& preview_palette)
void AbstractThemePreview::load_theme_bitmaps()
{
auto load_bitmap = [](DeprecatedString const& path, DeprecatedString& last_path, RefPtr<Gfx::Bitmap>& bitmap) {
auto load_bitmap = [](ByteString const& path, ByteString& last_path, RefPtr<Gfx::Bitmap>& bitmap) {
if (path.is_empty()) {
last_path = DeprecatedString::empty();
last_path = ByteString::empty();
bitmap = nullptr;
} else if (last_path != path) {
auto bitmap_or_error = Gfx::Bitmap::load_from_file(path);
if (bitmap_or_error.is_error()) {
last_path = DeprecatedString::empty();
last_path = ByteString::empty();
bitmap = nullptr;
} else {
last_path = path;

View file

@ -70,20 +70,20 @@ private:
RefPtr<Gfx::Bitmap> m_close_bitmap;
RefPtr<Gfx::Bitmap> m_maximize_bitmap;
RefPtr<Gfx::Bitmap> m_minimize_bitmap;
DeprecatedString m_last_close_path;
DeprecatedString m_last_maximize_path;
DeprecatedString m_last_minimize_path;
ByteString m_last_close_path;
ByteString m_last_maximize_path;
ByteString m_last_minimize_path;
RefPtr<Gfx::Bitmap> m_active_window_shadow;
RefPtr<Gfx::Bitmap> m_inactive_window_shadow;
RefPtr<Gfx::Bitmap> m_menu_shadow;
RefPtr<Gfx::Bitmap> m_taskbar_shadow;
RefPtr<Gfx::Bitmap> m_tooltip_shadow;
DeprecatedString m_last_active_window_shadow_path;
DeprecatedString m_last_inactive_window_shadow_path;
DeprecatedString m_last_menu_shadow_path;
DeprecatedString m_last_taskbar_shadow_path;
DeprecatedString m_last_tooltip_shadow_path;
ByteString m_last_active_window_shadow_path;
ByteString m_last_inactive_window_shadow_path;
ByteString m_last_menu_shadow_path;
ByteString m_last_taskbar_shadow_path;
ByteString m_last_tooltip_shadow_path;
};
}

View file

@ -611,7 +611,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_deprecated_string();
m_highlighted_search = sb.to_byte_string();
highlight_search(index);
start_highlighted_search_timer();
}
@ -637,7 +637,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_deprecated_string();
m_highlighted_search = sb.to_byte_string();
highlight_search(index);
start_highlighted_search_timer();
set_cursor(index, SelectionUpdate::None, true);

View file

@ -199,7 +199,7 @@ private:
RefPtr<Model> m_model;
ModelSelection m_selection;
Optional<DeprecatedString> m_highlighted_search;
Optional<ByteString> m_highlighted_search;
RefPtr<Core::Timer> m_highlighted_search_timer;
SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems };
SelectionMode m_selection_mode { SelectionMode::SingleSelection };

View file

@ -15,52 +15,52 @@
namespace GUI {
NonnullRefPtr<Action> Action::create(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create_checkable(ByteString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create_checkable(ByteString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create_checkable(ByteString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
NonnullRefPtr<Action> Action::create_checkable(ByteString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent, true));
}
@ -78,27 +78,27 @@ RefPtr<Action> Action::find_action_for_shortcut(Core::EventReceiver& object, Sho
return found_action;
}
Action::Action(DeprecatedString text, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
Action::Action(ByteString text, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), Shortcut {}, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
Action::Action(ByteString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), Shortcut {}, Shortcut {}, move(icon), move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
Action::Action(ByteString text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), shortcut, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
Action::Action(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), shortcut, alternate_shortcut, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
Action::Action(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Core::EventReceiver(parent)
, on_activation(move(on_activation_callback))
, m_text(move(text))
@ -284,31 +284,31 @@ void Action::set_icon(Gfx::Bitmap const* icon)
});
}
void Action::set_text(DeprecatedString text)
void Action::set_text(ByteString text)
{
if (m_text == text)
return;
m_text = move(text);
for_each_toolbar_button([&](auto& button) {
button.set_text(String::from_deprecated_string(m_text).release_value_but_fixme_should_propagate_errors());
button.set_text(String::from_byte_string(m_text).release_value_but_fixme_should_propagate_errors());
});
for_each_menu_item([&](auto& menu_item) {
menu_item.update_from_action({});
});
}
DeprecatedString Action::tooltip() const
ByteString Action::tooltip() const
{
return m_tooltip.value_or_lazy_evaluated([this] { return Gfx::parse_ampersand_string(m_text); });
}
void Action::set_tooltip(DeprecatedString tooltip)
void Action::set_tooltip(ByteString tooltip)
{
if (m_tooltip == tooltip)
return;
m_tooltip = move(tooltip);
for_each_toolbar_button([&](auto& button) {
button.set_tooltip(MUST(String::from_deprecated_string(*m_tooltip)));
button.set_tooltip(MUST(String::from_byte_string(*m_tooltip)));
});
for_each_menu_item([&](auto& menu_item) {
menu_item.update_from_action({});
@ -320,7 +320,7 @@ Optional<String> Action::status_tip() const
if (!m_status_tip.is_empty())
return m_status_tip;
auto maybe_parsed_action_text = String::from_deprecated_string(Gfx::parse_ampersand_string(m_text));
auto maybe_parsed_action_text = String::from_byte_string(Gfx::parse_ampersand_string(m_text));
if (maybe_parsed_action_text.is_error())
return {};
return maybe_parsed_action_text.release_value();

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/Badge.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/HashTable.h>
#include <AK/NonnullRefPtr.h>
@ -66,26 +66,26 @@ public:
WindowLocal,
ApplicationGlobal,
};
static NonnullRefPtr<Action> create(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(ByteString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(ByteString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(ByteString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(ByteString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(ByteString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static RefPtr<Action> find_action_for_shortcut(Core::EventReceiver& object, Shortcut const& shortcut);
virtual ~Action() override;
DeprecatedString text() const { return m_text; }
void set_text(DeprecatedString);
ByteString text() const { return m_text; }
void set_text(ByteString);
DeprecatedString tooltip() const;
void set_tooltip(DeprecatedString);
ByteString tooltip() const;
void set_tooltip(ByteString);
Optional<String> status_tip() const;
void set_status_tip(String status_tip) { m_status_tip = move(status_tip); }
@ -136,19 +136,19 @@ public:
HashTable<MenuItem*> const& menu_items() const { return m_menu_items; }
private:
Action(DeprecatedString, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(ByteString, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(ByteString, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(ByteString, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(ByteString, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(ByteString, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
template<typename Callback>
void for_each_toolbar_button(Callback);
template<typename Callback>
void for_each_menu_item(Callback);
DeprecatedString m_text;
Optional<DeprecatedString> m_tooltip;
ByteString m_text;
Optional<ByteString> m_tooltip;
String m_status_tip;
RefPtr<Gfx::Bitmap const> m_icon;
Shortcut m_shortcut;

View file

@ -373,7 +373,7 @@ void Application::update_recent_file_actions()
void Application::set_most_recently_open_file(String new_path)
{
Vector<DeprecatedString> new_recent_files_list;
Vector<ByteString> new_recent_files_list;
for (size_t i = 0; i < max_recently_open_files(); ++i) {
static_assert(max_recently_open_files() < 10);
@ -386,7 +386,7 @@ void Application::set_most_recently_open_file(String new_path)
return existing_path.view() == new_path;
});
new_recent_files_list.prepend(new_path.to_deprecated_string());
new_recent_files_list.prepend(new_path.to_byte_string());
for (size_t i = 0; i < max_recently_open_files(); ++i) {
auto& path = new_recent_files_list[i];

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
@ -52,8 +52,8 @@ public:
void did_create_window(Badge<Window>);
void did_delete_last_window(Badge<Window>);
DeprecatedString const& invoked_as() const { return m_invoked_as; }
Vector<DeprecatedString> const& args() const { return m_args; }
ByteString const& invoked_as() const { return m_invoked_as; }
Vector<ByteString> const& args() const { return m_args; }
Gfx::Palette palette() const;
void set_palette(Gfx::Palette&);
@ -123,8 +123,8 @@ private:
bool m_focus_debugging_enabled { false };
bool m_hover_debugging_enabled { false };
bool m_dnd_debugging_enabled { false };
DeprecatedString m_invoked_as;
Vector<DeprecatedString> m_args;
ByteString m_invoked_as;
Vector<ByteString> m_args;
WeakPtr<Widget> m_drag_hovered_widget;
WeakPtr<Widget> m_pending_drop_widget;

View file

@ -182,7 +182,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_deprecated_string();
auto completion = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::Completion).to_byte_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

@ -70,11 +70,11 @@ void Breadcrumbbar::clear_segments()
m_selected_segment = {};
}
void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* icon, DeprecatedString data, String tooltip)
void Breadcrumbbar::append_segment(ByteString text, Gfx::Bitmap const* icon, ByteString data, String tooltip)
{
auto& button = add<BreadcrumbButton>();
button.set_button_style(Gfx::ButtonStyle::Coolbar);
button.set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
button.set_text(String::from_byte_string(text).release_value_but_fixme_should_propagate_errors());
button.set_icon(icon);
button.set_tooltip(move(tooltip));
button.set_focus_policy(FocusPolicy::TabFocus);
@ -124,7 +124,7 @@ void Breadcrumbbar::remove_end_segments(size_t start_segment_index)
m_selected_segment = {};
}
Optional<size_t> Breadcrumbbar::find_segment_with_data(DeprecatedString const& data)
Optional<size_t> Breadcrumbbar::find_segment_with_data(ByteString const& data)
{
for (size_t i = 0; i < segment_count(); ++i) {
if (segment_data(i) == data)

View file

@ -19,13 +19,13 @@ public:
virtual ~Breadcrumbbar() override = default;
void clear_segments();
void append_segment(DeprecatedString text, Gfx::Bitmap const* icon = nullptr, DeprecatedString data = {}, String tooltip = {});
void append_segment(ByteString text, Gfx::Bitmap const* icon = nullptr, ByteString data = {}, String tooltip = {});
void remove_end_segments(size_t segment_index);
void relayout();
size_t segment_count() const { return m_segments.size(); }
DeprecatedString segment_data(size_t index) const { return m_segments[index].data; }
Optional<size_t> find_segment_with_data(DeprecatedString const& data);
ByteString segment_data(size_t index) const { return m_segments[index].data; }
Optional<size_t> find_segment_with_data(ByteString const& data);
void set_selected_segment(Optional<size_t> index);
Optional<size_t> selected_segment() const { return m_selected_segment; }
@ -48,8 +48,8 @@ private:
struct Segment {
RefPtr<const Gfx::Bitmap> icon;
DeprecatedString text;
DeprecatedString data;
ByteString text;
ByteString data;
int width { 0 };
int shrunken_width { 0 };
WeakPtr<GUI::Button> button;

View file

@ -186,7 +186,7 @@ void Button::set_icon(RefPtr<Gfx::Bitmap const> icon)
update();
}
void Button::set_icon_from_path(DeprecatedString const& path)
void Button::set_icon_from_path(ByteString const& path)
{
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
if (maybe_bitmap.is_error()) {

View file

@ -29,7 +29,7 @@ public:
virtual ~Button() override;
void set_icon(RefPtr<Gfx::Bitmap const>);
void set_icon_from_path(DeprecatedString const&);
void set_icon_from_path(ByteString const&);
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; }

View file

@ -636,7 +636,7 @@ void Calendar::paint_tile(GUI::Painter& painter, GUI::Calendar::Tile& tile, Gfx:
text_rect = Gfx::IntRect(tile_rect);
}
auto display_date = DeprecatedString::number(tile.day);
auto display_date = ByteString::number(tile.day);
if (tile.is_selected && (width < 30 || height < 30))
painter.draw_rect(tile_rect, palette().base_text());
@ -659,7 +659,7 @@ void Calendar::paint_tile(GUI::Painter& painter, GUI::Calendar::Tile& tile, Gfx:
set_font(*small_font);
}
auto display_date = DeprecatedString::number(tile.day);
auto display_date = ByteString::number(tile.day);
if (tile.is_selected)
painter.draw_rect(tile_rect, palette().base_text());
@ -820,7 +820,7 @@ void Calendar::doubleclick_event(GUI::MouseEvent& event)
}
}
size_t Calendar::day_of_week_index(DeprecatedString const& day_name)
size_t Calendar::day_of_week_index(ByteString const& day_name)
{
auto const& day_names = AK::long_day_names;
return AK::find_index(day_names.begin(), day_names.end(), day_name);

View file

@ -8,7 +8,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibConfig/Listener.h>
#include <LibCore/DateTime.h>
#include <LibGUI/AbstractScrollableWidget.h>
@ -104,7 +104,7 @@ protected:
Calendar(Core::DateTime date_time = Core::DateTime::now(), Mode mode = Month);
private:
static size_t day_of_week_index(DeprecatedString const&);
static size_t day_of_week_index(ByteString const&);
virtual void resize_event(GUI::ResizeEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
@ -127,14 +127,14 @@ private:
bool is_day_in_weekend(DayOfWeek);
struct Day {
DeprecatedString name;
ByteString name;
int width { 0 };
int height { 16 };
};
Vector<Day> m_days;
struct MonthTile {
DeprecatedString name;
ByteString name;
Gfx::IntRect rect;
int width { 0 };
int height { 0 };

View file

@ -24,7 +24,7 @@ private:
{
}
virtual void clipboard_data_changed(DeprecatedString const& mime_type) override
virtual void clipboard_data_changed(ByteString const& mime_type) override
{
Clipboard::the().clipboard_data_changed({}, mime_type);
}
@ -131,8 +131,8 @@ ErrorOr<Clipboard::DataAndType> Clipboard::DataAndType::from_json(JsonObject con
return Error::from_string_literal("JsonObject does not contain necessary fields");
DataAndType result;
result.data = object.get_deprecated_string("data"sv)->to_byte_buffer();
result.mime_type = *object.get_deprecated_string("mime_type"sv);
result.data = object.get_byte_string("data"sv)->to_byte_buffer();
result.mime_type = *object.get_byte_string("mime_type"sv);
// FIXME: Also read metadata
return result;
@ -141,14 +141,14 @@ ErrorOr<Clipboard::DataAndType> Clipboard::DataAndType::from_json(JsonObject con
ErrorOr<JsonObject> Clipboard::DataAndType::to_json() const
{
JsonObject object;
object.set("data", TRY(DeprecatedString::from_utf8(data.bytes())));
object.set("data", TRY(ByteString::from_utf8(data.bytes())));
object.set("mime_type", mime_type);
// FIXME: Also write metadata
return object;
}
void Clipboard::set_data(ReadonlyBytes data, DeprecatedString const& type, HashMap<DeprecatedString, DeprecatedString> const& metadata)
void Clipboard::set_data(ReadonlyBytes data, ByteString const& type, HashMap<ByteString, ByteString> const& metadata)
{
if (data.is_empty()) {
connection().async_set_clipboard_data({}, type, metadata.clone().release_value_but_fixme_should_propagate_errors());
@ -165,14 +165,14 @@ void Clipboard::set_data(ReadonlyBytes data, DeprecatedString const& type, HashM
connection().async_set_clipboard_data(move(buffer), type, metadata.clone().release_value_but_fixme_should_propagate_errors());
}
void Clipboard::set_bitmap(Gfx::Bitmap const& bitmap, HashMap<DeprecatedString, DeprecatedString> const& additional_metadata)
void Clipboard::set_bitmap(Gfx::Bitmap const& bitmap, HashMap<ByteString, ByteString> const& additional_metadata)
{
HashMap<DeprecatedString, DeprecatedString> metadata = additional_metadata.clone().release_value_but_fixme_should_propagate_errors();
metadata.set("width", DeprecatedString::number(bitmap.width()));
metadata.set("height", DeprecatedString::number(bitmap.height()));
metadata.set("scale", DeprecatedString::number(bitmap.scale()));
metadata.set("format", DeprecatedString::number((int)bitmap.format()));
metadata.set("pitch", DeprecatedString::number(bitmap.pitch()));
HashMap<ByteString, ByteString> metadata = additional_metadata.clone().release_value_but_fixme_should_propagate_errors();
metadata.set("width", ByteString::number(bitmap.width()));
metadata.set("height", ByteString::number(bitmap.height()));
metadata.set("scale", ByteString::number(bitmap.scale()));
metadata.set("format", ByteString::number((int)bitmap.format()));
metadata.set("pitch", ByteString::number(bitmap.pitch()));
set_data({ bitmap.scanline(0), bitmap.size_in_bytes() }, "image/x-serenityos", move(metadata));
}
@ -181,7 +181,7 @@ void Clipboard::clear()
connection().async_set_clipboard_data({}, {}, {});
}
void Clipboard::clipboard_data_changed(Badge<ConnectionToClipboardServer>, DeprecatedString const& mime_type)
void Clipboard::clipboard_data_changed(Badge<ConnectionToClipboardServer>, ByteString const& mime_type)
{
if (on_change)
on_change(mime_type);

View file

@ -8,7 +8,7 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/JsonObject.h>
@ -26,13 +26,13 @@ public:
ClipboardClient();
virtual ~ClipboardClient();
virtual void clipboard_content_did_change(DeprecatedString const& mime_type) = 0;
virtual void clipboard_content_did_change(ByteString const& mime_type) = 0;
};
struct DataAndType {
ByteBuffer data;
DeprecatedString mime_type;
HashMap<DeprecatedString, DeprecatedString> metadata;
ByteString mime_type;
HashMap<ByteString, ByteString> metadata;
RefPtr<Gfx::Bitmap> as_bitmap() const;
@ -44,19 +44,19 @@ public:
static Clipboard& the();
DataAndType fetch_data_and_type() const;
DeprecatedString fetch_mime_type() const { return fetch_data_and_type().mime_type; }
ByteString fetch_mime_type() const { return fetch_data_and_type().mime_type; }
void set_data(ReadonlyBytes data, DeprecatedString const& mime_type = "text/plain", HashMap<DeprecatedString, DeprecatedString> const& metadata = {});
void set_data(ReadonlyBytes data, ByteString const& mime_type = "text/plain", HashMap<ByteString, ByteString> const& metadata = {});
void set_plain_text(StringView text) { set_data(text.bytes()); }
void set_bitmap(Gfx::Bitmap const&, HashMap<DeprecatedString, DeprecatedString> const& additional_metadata = {});
void set_bitmap(Gfx::Bitmap const&, HashMap<ByteString, ByteString> const& additional_metadata = {});
void clear();
void clipboard_data_changed(Badge<ConnectionToClipboardServer>, DeprecatedString const& mime_type);
void clipboard_data_changed(Badge<ConnectionToClipboardServer>, ByteString const& mime_type);
void register_client(Badge<ClipboardClient>, ClipboardClient& client) { m_clients.set(&client); }
void unregister_client(Badge<ClipboardClient>, ClipboardClient& client) { m_clients.remove(&client); }
Function<void(DeprecatedString const& mime_type)> on_change;
Function<void(ByteString const& mime_type)> on_change;
private:
Clipboard() = default;

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_deprecated_string() : color.to_deprecated_string_without_alpha(), AllowCallback::No);
set_text(m_color_has_alpha_channel ? color.to_byte_string() : color.to_byte_string_without_alpha(), AllowCallback::No);
update();
if (allow_callback == AllowCallback::Yes && on_change)
on_change();

View file

@ -24,8 +24,8 @@ public:
void set_color(Color, AllowCallback = AllowCallback::Yes);
Color color() { return m_color; }
void set_color_picker_title(DeprecatedString title) { m_color_picker_title = move(title); }
DeprecatedString color_picker_title() { return m_color_picker_title; }
void set_color_picker_title(ByteString title) { m_color_picker_title = move(title); }
ByteString color_picker_title() { return m_color_picker_title; }
Function<void()> on_change;
@ -42,7 +42,7 @@ private:
void set_color_internal(Color, AllowCallback, bool change_text);
Color m_color;
DeprecatedString m_color_picker_title { "Color Picker" };
ByteString m_color_picker_title { "Color Picker" };
bool m_color_has_alpha_channel { true };
bool m_may_be_color_rect_click { false };
};

View file

@ -183,7 +183,7 @@ private:
Color m_col;
};
ColorPicker::ColorPicker(Color color, Window* parent_window, DeprecatedString title)
ColorPicker::ColorPicker(Color color, Window* parent_window, ByteString title)
: Dialog(parent_window)
, m_original_color(color)
, m_color(color)
@ -340,7 +340,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
html_label.set_text("HTML:"_string);
m_html_text = html_container.add<GUI::TextBox>();
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->set_text(m_color_has_alpha_channel ? m_color.to_byte_string() : m_color.to_byte_string_without_alpha());
m_html_text->on_change = [this]() {
auto color_name = m_html_text->text();
auto optional_color = Color::from_string(color_name);
@ -435,7 +435,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_deprecated_string() : m_color.to_deprecated_string_without_alpha());
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_byte_string() : m_color.to_byte_string_without_alpha());
m_red_spinbox->set_value(m_color.red());
m_green_spinbox->set_value(m_color.green());

View file

@ -29,7 +29,7 @@ public:
Function<void(Color)> on_color_changed;
private:
explicit ColorPicker(Color, Window* parent_window = nullptr, DeprecatedString title = "Color Picker");
explicit ColorPicker(Color, Window* parent_window = nullptr, ByteString title = "Color Picker");
void build_ui();
void build_ui_custom(Widget& root_container);

View file

@ -158,7 +158,7 @@ void ColumnsView::paint_event(PaintEvent& event)
icon_rect.right() + 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_deprecated_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::None);
draw_item_text(painter, index, is_selected_row, text_rect, index.data().to_byte_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()));
@ -231,7 +231,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_deprecated_string();
auto text = index.data().to_byte_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

@ -150,7 +150,7 @@ void ComboBox::set_editor_placeholder(StringView placeholder)
m_editor->set_placeholder(placeholder);
}
DeprecatedString const& ComboBox::editor_placeholder() const
ByteString const& ComboBox::editor_placeholder() const
{
return m_editor->placeholder();
}
@ -179,7 +179,7 @@ void ComboBox::selection_updated(ModelIndex const& index)
{
if (index.is_valid()) {
m_selected_index = index;
auto new_value = index.data().to_deprecated_string();
auto new_value = index.data().to_byte_string();
m_editor->set_text(new_value);
} else {
m_selected_index.clear();
@ -285,12 +285,12 @@ void ComboBox::close()
m_list_window->hide();
}
DeprecatedString ComboBox::text() const
ByteString ComboBox::text() const
{
return m_editor->text();
}
void ComboBox::set_text(DeprecatedString const& text, AllowCallback allow_callback)
void ComboBox::set_text(ByteString const& text, AllowCallback allow_callback)
{
m_editor->set_text(text, allow_callback);
}

View file

@ -20,8 +20,8 @@ class ComboBox : public Frame {
public:
virtual ~ComboBox() override;
DeprecatedString text() const;
void set_text(DeprecatedString const&, AllowCallback = AllowCallback::Yes);
ByteString text() const;
void set_text(ByteString const&, AllowCallback = AllowCallback::Yes);
void open();
void close();
@ -42,12 +42,12 @@ public:
void set_model_column(int);
void set_editor_placeholder(StringView placeholder);
DeprecatedString const& editor_placeholder() const;
ByteString const& editor_placeholder() const;
int max_visible_items() const { return m_max_visible_items; }
void set_max_visible_items(int max) { m_max_visible_items = max; }
Function<void(DeprecatedString const&, ModelIndex const&)> on_change;
Function<void(ByteString const&, ModelIndex const&)> on_change;
Function<void()> on_return_pressed;
protected:

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
namespace GUI {
@ -18,7 +18,7 @@ public:
virtual void undo() { }
virtual void redo() { }
virtual DeprecatedString action_text() const { return {}; }
virtual ByteString action_text() const { return {}; }
virtual bool merge_with(Command const&) { return false; }
protected:

View file

@ -129,7 +129,7 @@ public:
case Column::Shortcut:
if (!action.shortcut().is_valid())
return "";
return action.shortcut().to_deprecated_string();
return action.shortcut().to_byte_string();
}
VERIFY_NOT_REACHED();
@ -141,21 +141,21 @@ public:
if (needle.is_empty())
return { TriState::True };
auto haystack = DeprecatedString::formatted("{} {}", menu_name(index), action_text(index));
auto haystack = ByteString::formatted("{} {}", menu_name(index), action_text(index));
auto match_result = fuzzy_match(needle, haystack);
if (match_result.score > 0)
return { TriState::True, match_result.score };
return { TriState::False };
}
static DeprecatedString action_text(ModelIndex const& index)
static ByteString action_text(ModelIndex const& index)
{
auto& action = *static_cast<GUI::Action*>(index.internal_data());
return Gfx::parse_ampersand_string(action.text());
}
static DeprecatedString menu_name(ModelIndex const& index)
static ByteString menu_name(ModelIndex const& index)
{
auto& action = *static_cast<GUI::Action*>(index.internal_data());
if (action.menu_items().is_empty())

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/WeakPtr.h>
#include <LibCore/Version.h>
@ -20,7 +20,7 @@ namespace CommonActions {
NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_icon, Window* parent)
{
auto weak_parent = AK::make_weak_ptr_if_nonnull<Window>(parent);
auto action = Action::create(DeprecatedString::formatted("&About {}", app_name), app_icon.bitmap_for_size(16), [=](auto&) {
auto action = Action::create(ByteString::formatted("&About {}", app_name), app_icon.bitmap_for_size(16), [=](auto&) {
AboutDialog::show(
app_name,
Core::Version::read_long_version_string().release_value_but_fixme_should_propagate_errors(),

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/Vector.h>
@ -24,7 +24,7 @@ static void initialize_if_needed()
if (s_initialized)
return;
auto user_config = DeprecatedString::formatted("{}/CommonLocations.json", Core::StandardPaths::config_directory());
auto user_config = ByteString::formatted("{}/CommonLocations.json", Core::StandardPaths::config_directory());
if (FileSystem::exists(user_config)) {
auto maybe_error = CommonLocationsProvider::load_from_json(user_config);
if (!maybe_error.is_error())
@ -56,8 +56,8 @@ ErrorOr<void> CommonLocationsProvider::load_from_json(StringView json_path)
if (!entry_value.is_object())
continue;
auto entry = entry_value.as_object();
auto name = entry.get_deprecated_string("name"sv).value_or({});
auto path = entry.get_deprecated_string("path"sv).value_or({});
auto name = entry.get_byte_string("name"sv).value_or({});
auto path = entry.get_byte_string("path"sv).value_or({});
TRY(s_common_locations.try_append({ name, path }));
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Forward.h>
#include <LibGUI/Forward.h>
#include <sys/types.h>
@ -16,8 +16,8 @@ namespace GUI {
class CommonLocationsProvider {
public:
struct CommonLocation {
DeprecatedString name;
DeprecatedString path;
ByteString name;
ByteString path;
};
static ErrorOr<void> load_from_json(StringView json_path);

View file

@ -21,7 +21,7 @@ ConnectionToWindowManagerServer& ConnectionToWindowManagerServer::the()
void ConnectionToWindowManagerServer::window_state_changed(i32 wm_id, i32 client_id, i32 window_id,
u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocked, bool is_minimized, bool is_frameless,
i32 window_type, DeprecatedString const& title, Gfx::IntRect const& rect, Optional<i32> const& progress)
i32 window_type, ByteString const& title, Gfx::IntRect const& rect, Optional<i32> const& progress)
{
if (auto* window = Window::from_window_id(wm_id))
Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(client_id, window_id, title, rect, workspace_row, workspace_column, is_active, is_blocked, static_cast<WindowType>(window_type), is_minimized, is_frameless, progress));
@ -82,7 +82,7 @@ void ConnectionToWindowManagerServer::workspace_changed(i32 wm_id, u32 row, u32
Core::EventLoop::current().post_event(*window, make<WMWorkspaceChangedEvent>(wm_id, row, column));
}
void ConnectionToWindowManagerServer::keymap_changed(i32 wm_id, DeprecatedString const& keymap)
void ConnectionToWindowManagerServer::keymap_changed(i32 wm_id, ByteString const& keymap)
{
if (auto* window = Window::from_window_id(wm_id))
Core::EventLoop::current().post_event(*window, make<WMKeymapChangedEvent>(wm_id, keymap));

View file

@ -29,7 +29,7 @@ private:
}
virtual void window_removed(i32, i32, i32) override;
virtual void window_state_changed(i32, i32, i32, u32, u32, bool, bool, bool, bool, i32, DeprecatedString const&, Gfx::IntRect const&, Optional<i32> const&) override;
virtual void window_state_changed(i32, i32, i32, u32, u32, bool, bool, bool, bool, i32, ByteString const&, Gfx::IntRect const&, Optional<i32> const&) override;
virtual void window_icon_bitmap_changed(i32, i32, i32, Gfx::ShareableBitmap const&) override;
virtual void window_rect_changed(i32, i32, i32, Gfx::IntRect const&) override;
virtual void applet_area_size_changed(i32, Gfx::IntSize) override;
@ -38,7 +38,7 @@ private:
virtual void super_d_key_pressed(i32) override;
virtual void super_digit_key_pressed(i32, u8) override;
virtual void workspace_changed(i32, u32, u32) override;
virtual void keymap_changed(i32, DeprecatedString const&) override;
virtual void keymap_changed(i32, ByteString const&) override;
virtual void add_to_quick_launch(i32, pid_t) override;
};

View file

@ -57,7 +57,7 @@ ConnectionToWindowServer::ConnectionToWindowServer(NonnullOwnPtr<Core::LocalSock
m_client_id = message->client_id();
}
void ConnectionToWindowServer::fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Vector<bool> const&, i32)
void ConnectionToWindowServer::fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, ByteString const&, ByteString const&, ByteString const&, Vector<bool> const&, i32)
{
// NOTE: This message is handled in the constructor.
}
@ -73,7 +73,7 @@ void ConnectionToWindowServer::update_system_theme(Core::AnonymousBuffer const&
Application::the()->dispatch_event(*make<ThemeChangeEvent>());
}
void ConnectionToWindowServer::update_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query)
void ConnectionToWindowServer::update_system_fonts(ByteString const& default_font_query, ByteString const& fixed_width_font_query, ByteString const& window_title_font_query)
{
Gfx::FontDatabase::set_default_font_query(default_font_query);
Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
@ -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_deprecated_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, "Looking up action for {}", shortcut.to_byte_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_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Focused widget {} gave action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", *widget, action, action->text(), action->is_enabled(), action->shortcut().to_byte_string(), action->alternate_shortcut().to_byte_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_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked window {}, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", window, action, action->text(), action->is_enabled(), action->shortcut().to_byte_string(), action->alternate_shortcut().to_byte_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_deprecated_string(), action->alternate_shortcut().to_deprecated_string());
dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked application, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", action, action->text(), action->is_enabled(), action->shortcut().to_byte_string(), action->alternate_shortcut().to_byte_string());
return action;
}
}
@ -349,7 +349,7 @@ void ConnectionToWindowServer::applet_area_rect_changed(Gfx::IntRect const& rect
});
}
void ConnectionToWindowServer::drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, DeprecatedString const& text, HashMap<String, ByteBuffer> const& mime_data)
void ConnectionToWindowServer::drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, ByteString const& text, HashMap<String, ByteBuffer> const& mime_data)
{
if (auto* window = Window::from_window_id(window_id)) {
auto mime_data_obj = Core::MimeData::construct(mime_data);

View file

@ -24,7 +24,7 @@ public:
private:
ConnectionToWindowServer(NonnullOwnPtr<Core::LocalSocket>);
virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Vector<bool> const&, i32) override;
virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, ByteString const&, ByteString const&, ByteString const&, Vector<bool> const&, i32) override;
virtual void paint(i32, Gfx::IntSize, Vector<Gfx::IntRect> const&) override;
virtual void mouse_move(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32, bool, Vector<String> const&) override;
virtual void mouse_down(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32) override;
@ -48,11 +48,11 @@ private:
virtual void menu_visibility_did_change(i32, bool) override;
virtual void screen_rects_changed(Vector<Gfx::IntRect> const&, u32, u32, u32) override;
virtual void applet_area_rect_changed(Gfx::IntRect const&) override;
virtual void drag_dropped(i32, Gfx::IntPoint, DeprecatedString const&, HashMap<String, ByteBuffer> const&) override;
virtual void drag_dropped(i32, Gfx::IntPoint, ByteString const&, HashMap<String, ByteBuffer> const&) override;
virtual void drag_accepted() override;
virtual void drag_cancelled() override;
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override;
virtual void update_system_fonts(ByteString const&, ByteString const&, ByteString const&) override;
virtual void update_system_effects(Vector<bool> const&) override;
virtual void window_state_changed(i32, bool, bool, bool) override;
virtual void display_link_notification() override;

View file

@ -49,7 +49,7 @@ void Desktop::set_wallpaper_mode(StringView mode)
ConnectionToWindowServer::the().async_set_wallpaper_mode(mode);
}
DeprecatedString Desktop::wallpaper_path() const
ByteString Desktop::wallpaper_path() const
{
return Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv);
}

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <LibGUI/Forward.h>
#include <LibGUI/SystemEffects.h>
@ -31,7 +31,7 @@ public:
void set_wallpaper_mode(StringView mode);
DeprecatedString wallpaper_path() const;
ByteString wallpaper_path() const;
RefPtr<Gfx::Bitmap> wallpaper_bitmap() const;
bool set_wallpaper(RefPtr<Gfx::Bitmap const> wallpaper_bitmap, Optional<StringView> path);

View file

@ -73,7 +73,7 @@ void DragOperation::notify_cancelled(Badge<ConnectionToWindowServer>)
s_current_drag_operation->done(Outcome::Cancelled);
}
void DragOperation::set_text(DeprecatedString const& text)
void DragOperation::set_text(ByteString const& text)
{
if (!m_mime_data)
m_mime_data = Core::MimeData::construct();
@ -86,7 +86,7 @@ void DragOperation::set_bitmap(Gfx::Bitmap const* bitmap)
if (bitmap)
m_mime_data->set_data("image/x-raw-bitmap"_string, bitmap->serialize_to_byte_buffer().release_value_but_fixme_should_propagate_errors());
}
void DragOperation::set_data(String const& data_type, DeprecatedString const& data)
void DragOperation::set_data(String const& data_type, ByteString const& data)
{
if (!m_mime_data)
m_mime_data = Core::MimeData::construct();

View file

@ -27,9 +27,9 @@ public:
virtual ~DragOperation() override = default;
void set_mime_data(RefPtr<Core::MimeData> mime_data) { m_mime_data = move(mime_data); }
void set_text(DeprecatedString const& text);
void set_text(ByteString const& text);
void set_bitmap(Gfx::Bitmap const* bitmap);
void set_data(String const& data_type, DeprecatedString const& data);
void set_data(String const& data_type, ByteString const& data);
Outcome exec();
Outcome outcome() const { return m_outcome; }

View file

@ -144,7 +144,7 @@ void DynamicWidgetContainer::restore_view_state()
order_or_error.value().as_array().for_each([&](auto& section_label) {
for (auto& container : containers) {
if (container.section_label() == section_label.to_deprecated_string())
if (container.section_label() == section_label.to_byte_string())
new_child_order.append(container);
}
});
@ -227,7 +227,7 @@ ErrorOr<void> DynamicWidgetContainer::detach_widgets()
{
if (!m_detached_widgets_window.has_value()) {
auto detached_window = TRY(GUI::Window::try_create());
detached_window->set_title(section_label().to_deprecated_string());
detached_window->set_title(section_label().to_byte_string());
detached_window->set_window_type(WindowType::Normal);
if (has_detached_size())
detached_window->resize(detached_size());

View file

@ -423,7 +423,7 @@ bool MoveLineUpOrDownCommand::merge_with(GUI::Command const&)
return false;
}
DeprecatedString MoveLineUpOrDownCommand::action_text() const
ByteString MoveLineUpOrDownCommand::action_text() const
{
return "Move a line";
}

View file

@ -92,7 +92,7 @@ public:
virtual void undo() override;
virtual void redo() override;
bool merge_with(GUI::Command const&) override;
DeprecatedString action_text() const override;
ByteString action_text() const override;
static bool valid_operation(EditingEngine& engine, VerticalDirection direction);

View file

@ -67,7 +67,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
for (auto const& category : s_emoji_groups) {
auto name = Unicode::emoji_group_to_string(category.group);
DeprecatedString tooltip = name;
ByteString tooltip = name;
auto set_filter_action = Action::create_checkable(
category.representative_emoji,
@ -126,7 +126,7 @@ auto EmojiInputDialog::supported_emoji() -> Vector<Emoji>
builder.append_code_point(*code_point);
code_points.append(*code_point);
});
auto text = builder.to_deprecated_string();
auto text = builder.to_byte_string();
auto emoji = Unicode::find_emoji_for_code_points(code_points);
if (!emoji.has_value()) {
@ -135,7 +135,7 @@ auto EmojiInputDialog::supported_emoji() -> Vector<Emoji>
emoji->display_order = NumericLimits<u32>::max();
}
auto button = Button::construct(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
auto button = Button::construct(String::from_byte_string(text).release_value_but_fixme_should_propagate_errors());
button->set_fixed_size(button_size, button_size);
button->set_button_style(Gfx::ButtonStyle::Coolbar);
button->on_click = [this, text](auto) mutable {

View file

@ -19,11 +19,11 @@ class EmojiInputDialog final : public Dialog {
struct Emoji {
RefPtr<Button> button;
Unicode::Emoji emoji;
DeprecatedString text;
ByteString text;
};
public:
DeprecatedString const& selected_emoji_text() const { return m_selected_emoji_text; }
ByteString const& selected_emoji_text() const { return m_selected_emoji_text; }
private:
explicit EmojiInputDialog(Window* parent_window);
@ -40,7 +40,7 @@ private:
RefPtr<Widget> m_emojis_widget;
Vector<Emoji> m_emojis;
Emoji const* m_first_displayed_emoji { nullptr };
DeprecatedString m_selected_emoji_text;
ByteString m_selected_emoji_text;
};
}

View file

@ -12,7 +12,7 @@
namespace GUI {
DropEvent::DropEvent(Gfx::IntPoint position, DeprecatedString const& text, NonnullRefPtr<Core::MimeData const> mime_data)
DropEvent::DropEvent(Gfx::IntPoint position, ByteString const& text, NonnullRefPtr<Core::MimeData const> mime_data)
: Event(Event::Drop)
, m_position(position)
, m_text(text)
@ -20,9 +20,9 @@ DropEvent::DropEvent(Gfx::IntPoint position, DeprecatedString const& text, Nonnu
{
}
DeprecatedString KeyEvent::to_deprecated_string() const
ByteString KeyEvent::to_byte_string() const
{
Vector<DeprecatedString, 8> parts;
Vector<ByteString, 8> parts;
if (m_modifiers & Mod_Ctrl)
parts.append("Ctrl");
@ -44,7 +44,7 @@ DeprecatedString KeyEvent::to_deprecated_string() const
if (i != parts.size() - 1)
builder.append('+');
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
ActionEvent::ActionEvent(Type type, Action& action)

View file

@ -183,7 +183,7 @@ public:
{
}
DeprecatedString const& title() const { return m_title; }
ByteString const& title() const { return m_title; }
Gfx::IntRect const& rect() const { return m_rect; }
bool is_active() const { return m_active; }
bool is_blocked() const { return m_blocked; }
@ -195,7 +195,7 @@ public:
unsigned workspace_column() const { return m_workspace_column; }
private:
DeprecatedString m_title;
ByteString m_title;
Gfx::IntRect m_rect;
WindowType m_window_type;
unsigned m_workspace_row;
@ -254,16 +254,16 @@ private:
class WMKeymapChangedEvent : public WMEvent {
public:
explicit WMKeymapChangedEvent(int client_id, DeprecatedString const& keymap)
explicit WMKeymapChangedEvent(int client_id, ByteString const& keymap)
: WMEvent(Event::Type::WM_KeymapChanged, client_id, 0)
, m_keymap(keymap)
{
}
DeprecatedString const& keymap() const { return m_keymap; }
ByteString const& keymap() const { return m_keymap; }
private:
const DeprecatedString m_keymap;
const ByteString m_keymap;
};
class WMAddToQuickLaunchEvent : public WMEvent {
@ -403,15 +403,15 @@ public:
bool super() const { return m_modifiers & Mod_Super; }
u8 modifiers() const { return m_modifiers; }
u32 code_point() const { return m_code_point; }
DeprecatedString text() const
ByteString text() const
{
StringBuilder sb;
sb.append_code_point(m_code_point);
return sb.to_deprecated_string();
return sb.to_byte_string();
}
u32 scancode() const { return m_scancode; }
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
bool is_arrow_key() const
{
@ -494,17 +494,17 @@ private:
class DropEvent final : public Event {
public:
DropEvent(Gfx::IntPoint, DeprecatedString const& text, NonnullRefPtr<Core::MimeData const> mime_data);
DropEvent(Gfx::IntPoint, ByteString const& text, NonnullRefPtr<Core::MimeData const> mime_data);
~DropEvent() = default;
Gfx::IntPoint position() const { return m_position; }
DeprecatedString const& text() const { return m_text; }
ByteString const& text() const { return m_text; }
Core::MimeData const& mime_data() const { return m_mime_data; }
private:
Gfx::IntPoint m_position;
DeprecatedString m_text;
ByteString m_text;
NonnullRefPtr<Core::MimeData const> m_mime_data;
};

View file

@ -6,7 +6,7 @@
*/
#include <AK/Array.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/LexicalPath.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/MappedFile.h>
@ -42,8 +42,8 @@ static Icon s_filetype_image_icon;
static RefPtr<Gfx::Bitmap> s_symlink_emblem;
static RefPtr<Gfx::Bitmap> s_symlink_emblem_small;
static HashMap<DeprecatedString, Icon> s_filetype_icons;
static HashMap<DeprecatedString, Vector<DeprecatedString>> s_filetype_patterns;
static HashMap<ByteString, Icon> s_filetype_icons;
static HashMap<ByteString, Vector<ByteString>> s_filetype_patterns;
static void initialize_executable_icon_if_needed()
{
@ -91,7 +91,7 @@ static void initialize_if_needed()
initialize_executable_icon_if_needed();
for (auto& filetype : config->keys("Icons")) {
s_filetype_icons.set(filetype, Icon::default_icon(DeprecatedString::formatted("filetype-{}", filetype)));
s_filetype_icons.set(filetype, Icon::default_icon(ByteString::formatted("filetype-{}", filetype)));
s_filetype_patterns.set(filetype, config->read_entry("Icons", filetype).split(','));
}
@ -154,9 +154,9 @@ Icon FileIconProvider::icon_for_path(StringView path)
return icon_for_path(path, stat_or_error.release_value().st_mode);
}
Icon FileIconProvider::icon_for_executable(DeprecatedString const& path)
Icon FileIconProvider::icon_for_executable(ByteString const& path)
{
static HashMap<DeprecatedString, Icon> app_icon_cache;
static HashMap<ByteString, Icon> app_icon_cache;
if (auto it = app_icon_cache.find(path); it != app_icon_cache.end())
return it->value;
@ -265,7 +265,7 @@ Icon FileIconProvider::icon_for_path(StringView path, mode_t mode)
if (raw_symlink_target.starts_with('/')) {
target_path = raw_symlink_target;
} else {
auto error_or_path = FileSystem::real_path(DeprecatedString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
auto error_or_path = FileSystem::real_path(ByteString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
if (error_or_path.is_error())
return s_symlink_icon;

View file

@ -16,7 +16,7 @@ class FileIconProvider {
public:
static Icon icon_for_path(StringView, mode_t);
static Icon icon_for_path(StringView);
static Icon icon_for_executable(DeprecatedString const&);
static Icon icon_for_executable(ByteString const&);
static Icon filetype_image_icon();
static Icon directory_icon();

View file

@ -48,7 +48,7 @@ ErrorOr<Optional<String>> FilePicker::get_filepath(Badge<FileSystemAccessServer:
ConnectionToWindowServer::the().set_window_parent_from_client(window_server_client_id, parent_window_id, picker->window_id());
if (picker->exec() == ExecResult::OK) {
auto file_path = TRY(picker->selected_file().map([](auto& v) { return String::from_deprecated_string(v); }));
auto file_path = TRY(picker->selected_file().map([](auto& v) { return String::from_byte_string(v); }));
if (file_path.has_value() && file_path->is_empty())
return Optional<String> {};
@ -57,7 +57,7 @@ ErrorOr<Optional<String>> FilePicker::get_filepath(Badge<FileSystemAccessServer:
return Optional<String> {};
}
Optional<DeprecatedString> FilePicker::get_open_filepath(Window* parent_window, DeprecatedString const& window_title, StringView path, bool folder, ScreenPosition screen_position, Optional<Vector<FileTypeFilter>> allowed_file_types)
Optional<ByteString> FilePicker::get_open_filepath(Window* parent_window, ByteString const& window_title, StringView path, bool folder, ScreenPosition screen_position, Optional<Vector<FileTypeFilter>> allowed_file_types)
{
auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, ""sv, path, screen_position, move(allowed_file_types));
@ -70,9 +70,9 @@ Optional<DeprecatedString> FilePicker::get_open_filepath(Window* parent_window,
return {};
}
Optional<DeprecatedString> FilePicker::get_save_filepath(Window* parent_window, DeprecatedString const& title, DeprecatedString const& extension, StringView path, ScreenPosition screen_position)
Optional<ByteString> FilePicker::get_save_filepath(Window* parent_window, ByteString const& title, ByteString const& extension, StringView path, ScreenPosition screen_position)
{
auto picker = FilePicker::construct(parent_window, Mode::Save, DeprecatedString::formatted("{}.{}", title, extension), path, screen_position);
auto picker = FilePicker::construct(parent_window, Mode::Save, ByteString::formatted("{}.{}", title, extension), path, screen_position);
if (picker->exec() == ExecResult::OK)
return picker->selected_file();
@ -138,11 +138,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
StringBuilder extension_list;
extension_list.join("; "sv, *filter.extensions);
m_allowed_file_types_names.append(DeprecatedString::formatted("{} ({})", filter.name, extension_list.to_deprecated_string()));
m_allowed_file_types_names.append(ByteString::formatted("{} ({})", filter.name, extension_list.to_byte_string()));
}
file_types_filters_combo->set_model(*GUI::ItemListModel<DeprecatedString, Vector<DeprecatedString>>::create(m_allowed_file_types_names));
file_types_filters_combo->on_change = [this](DeprecatedString const&, GUI::ModelIndex const& index) {
file_types_filters_combo->set_model(*GUI::ItemListModel<ByteString, Vector<ByteString>>::create(m_allowed_file_types_names));
file_types_filters_combo->on_change = [this](ByteString const&, GUI::ModelIndex const& index) {
m_model->set_allowed_file_extensions((*m_allowed_file_types)[index.row()].extensions);
};
file_types_filters_combo->set_selected_index(0);
@ -160,7 +160,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
auto open_parent_directory_action = Action::create(
"Open Parent Directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
set_path(DeprecatedString::formatted("{}/..", m_model->root_path()));
set_path(ByteString::formatted("{}/..", m_model->root_path()));
},
this);
toolbar.add_action(*open_parent_directory_action);
@ -176,10 +176,10 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
"New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
String value;
if (InputBox::show(this, value, "Enter a name:"sv, "New Directory"sv, GUI::InputType::NonemptyText) == InputBox::ExecResult::OK) {
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_model->root_path(), value));
auto new_dir_path = LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", m_model->root_path(), value));
int rc = mkdir(new_dir_path.characters(), 0777);
if (rc < 0) {
(void)MessageBox::try_show_error(this, DeprecatedString::formatted("Making new directory \"{}\" failed: {}", new_dir_path, Error::from_errno(errno)));
(void)MessageBox::try_show_error(this, ByteString::formatted("Making new directory \"{}\" failed: {}", new_dir_path, Error::from_errno(errno)));
} else {
m_model->invalidate();
}
@ -304,7 +304,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
m_view->view_as_columns_action().set_enabled(true);
};
common_locations_tray.on_item_activation = [this](DeprecatedString const& path) {
common_locations_tray.on_item_activation = [this](ByteString const& path) {
set_path(path);
};
for (auto& location : CommonLocationsProvider::common_locations()) {
@ -336,7 +336,7 @@ void FilePicker::on_file_return()
bool file_exists = !stat_or_error.is_error();
if (!file_exists && (m_mode == Mode::Open || m_mode == Mode::OpenFolder)) {
(void)MessageBox::try_show_error(this, DeprecatedString::formatted("Opening \"{}\" failed: {}", m_filename_textbox->text(), Error::from_errno(ENOENT)));
(void)MessageBox::try_show_error(this, ByteString::formatted("Opening \"{}\" failed: {}", m_filename_textbox->text(), Error::from_errno(ENOENT)));
return;
}
@ -360,10 +360,10 @@ void FilePicker::on_file_return()
done(ExecResult::OK);
}
void FilePicker::set_path(DeprecatedString const& path)
void FilePicker::set_path(ByteString const& path)
{
if (access(path.characters(), R_OK | X_OK) == -1) {
(void)GUI::MessageBox::try_show_error(this, DeprecatedString::formatted("Opening \"{}\" failed: {}", path, Error::from_errno(errno)));
(void)GUI::MessageBox::try_show_error(this, ByteString::formatted("Opening \"{}\" failed: {}", path, Error::from_errno(errno)));
auto& common_locations_tray = *find_descendant_of_type_named<GUI::Tray>("common_locations_tray");
for (auto& location_button : m_common_location_buttons)
common_locations_tray.set_item_checked(location_button.tray_item_index, m_model->root_path() == location_button.path);

View file

@ -37,19 +37,19 @@ public:
Save
};
static Optional<DeprecatedString> get_open_filepath(Window* parent_window, DeprecatedString const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent, Optional<Vector<FileTypeFilter>> allowed_file_types = {});
static Optional<DeprecatedString> get_save_filepath(Window* parent_window, DeprecatedString const& title, DeprecatedString const& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
static Optional<ByteString> get_open_filepath(Window* parent_window, ByteString const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent, Optional<Vector<FileTypeFilter>> allowed_file_types = {});
static Optional<ByteString> get_save_filepath(Window* parent_window, ByteString const& title, ByteString const& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
static ErrorOr<Optional<String>> get_filepath(Badge<FileSystemAccessServer::ConnectionFromClient>, i32 window_server_client_id, i32 parent_window_id, Mode, StringView window_title, StringView file_basename = {}, StringView path = Core::StandardPaths::home_directory(), Optional<Vector<FileTypeFilter>> = {});
virtual ~FilePicker() override;
Optional<DeprecatedString> const& selected_file() const { return m_selected_file; }
Optional<ByteString> const& selected_file() const { return m_selected_file; }
private:
void on_file_return();
void set_path(DeprecatedString const&);
void set_path(ByteString const&);
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
@ -71,15 +71,15 @@ private:
}
struct CommonLocationButton {
DeprecatedString path;
ByteString path;
size_t tray_item_index { 0 };
};
RefPtr<MultiView> m_view;
NonnullRefPtr<FileSystemModel> m_model;
Optional<DeprecatedString> m_selected_file;
Optional<ByteString> m_selected_file;
Vector<DeprecatedString> m_allowed_file_types_names;
Vector<ByteString> m_allowed_file_types_names;
Optional<Vector<FileTypeFilter>> m_allowed_file_types;
RefPtr<GUI::Label> m_error_label;

View file

@ -41,7 +41,7 @@ ModelIndex FileSystemModel::Node::index(int column) const
VERIFY_NOT_REACHED();
}
bool FileSystemModel::Node::fetch_data(DeprecatedString const& full_path, bool is_root)
bool FileSystemModel::Node::fetch_data(ByteString const& full_path, bool is_root)
{
struct stat st;
int rc;
@ -67,7 +67,7 @@ bool FileSystemModel::Node::fetch_data(DeprecatedString const& full_path, bool i
if (sym_link_target_or_error.is_error())
perror("readlink");
else {
symlink_target = sym_link_target_or_error.release_value().to_deprecated_string();
symlink_target = sym_link_target_or_error.release_value().to_byte_string();
if (symlink_target.is_empty())
perror("readlink");
}
@ -122,7 +122,7 @@ void FileSystemModel::Node::traverse_if_needed()
return;
}
Vector<DeprecatedString> child_names;
Vector<ByteString> child_names;
while (di.has_next()) {
child_names.append(di.next_path());
}
@ -147,7 +147,7 @@ void FileSystemModel::Node::traverse_if_needed()
}
for (auto& extension : *m_model.m_allowed_file_extensions) {
if (child_name.ends_with(DeprecatedString::formatted(".{}", extension))) {
if (child_name.ends_with(ByteString::formatted(".{}", extension))) {
file_children.append(move(child));
break;
}
@ -181,9 +181,9 @@ bool FileSystemModel::Node::can_delete_or_move() const
return m_can_delete_or_move.value();
}
OwnPtr<FileSystemModel::Node> FileSystemModel::Node::create_child(DeprecatedString const& child_name)
OwnPtr<FileSystemModel::Node> FileSystemModel::Node::create_child(ByteString const& child_name)
{
DeprecatedString child_path = LexicalPath::join(full_path(), child_name).string();
ByteString child_path = LexicalPath::join(full_path(), child_name).string();
auto child = adopt_own(*new Node(m_model));
bool ok = child->fetch_data(child_path, false);
@ -215,9 +215,9 @@ bool FileSystemModel::Node::is_symlink_to_directory() const
return S_ISDIR(st.st_mode);
}
DeprecatedString FileSystemModel::Node::full_path() const
ByteString FileSystemModel::Node::full_path() const
{
Vector<DeprecatedString, 32> lineage;
Vector<ByteString, 32> lineage;
for (auto* ancestor = m_parent; ancestor; ancestor = ancestor->m_parent) {
lineage.append(ancestor->name);
}
@ -229,10 +229,10 @@ DeprecatedString FileSystemModel::Node::full_path() const
}
builder.append('/');
builder.append(name);
return LexicalPath::canonicalized_path(builder.to_deprecated_string());
return LexicalPath::canonicalized_path(builder.to_byte_string());
}
ModelIndex FileSystemModel::index(DeprecatedString path, int column) const
ModelIndex FileSystemModel::index(ByteString path, int column) const
{
auto node = node_for_path(move(path));
if (node.has_value())
@ -241,9 +241,9 @@ ModelIndex FileSystemModel::index(DeprecatedString path, int column) const
return {};
}
Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(DeprecatedString const& path) const
Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(ByteString const& path) const
{
DeprecatedString resolved_path;
ByteString resolved_path;
if (path == m_root_path)
resolved_path = "/";
else if (m_root_path.has_value() && !m_root_path->is_empty() && path.starts_with(*m_root_path))
@ -276,14 +276,14 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated
return {};
}
DeprecatedString FileSystemModel::full_path(ModelIndex const& index) const
ByteString FileSystemModel::full_path(ModelIndex const& index) const
{
auto& node = this->node(index);
const_cast<Node&>(node).reify_if_needed();
return node.full_path();
}
FileSystemModel::FileSystemModel(Optional<DeprecatedString> root_path, Mode mode)
FileSystemModel::FileSystemModel(Optional<ByteString> root_path, Mode mode)
: m_root_path(root_path.map(LexicalPath::canonicalized_path))
, m_mode(mode)
{
@ -311,23 +311,23 @@ FileSystemModel::FileSystemModel(Optional<DeprecatedString> root_path, Mode mode
invalidate();
}
DeprecatedString FileSystemModel::name_for_uid(uid_t uid) const
ByteString FileSystemModel::name_for_uid(uid_t uid) const
{
auto it = m_user_names.find(uid);
if (it == m_user_names.end())
return DeprecatedString::number(uid);
return ByteString::number(uid);
return (*it).value;
}
DeprecatedString FileSystemModel::name_for_gid(gid_t gid) const
ByteString FileSystemModel::name_for_gid(gid_t gid) const
{
auto it = m_group_names.find(gid);
if (it == m_group_names.end())
return DeprecatedString::number(gid);
return ByteString::number(gid);
return (*it).value;
}
static DeprecatedString permission_string(mode_t mode)
static ByteString permission_string(mode_t mode)
{
StringBuilder builder;
if (S_ISDIR(mode))
@ -360,7 +360,7 @@ static DeprecatedString permission_string(mode_t mode)
builder.append('t');
else
builder.append(mode & S_IXOTH ? 'x' : '-');
return builder.to_deprecated_string();
return builder.to_byte_string();
}
void FileSystemModel::Node::set_selected(bool selected)
@ -376,7 +376,7 @@ void FileSystemModel::update_node_on_selection(ModelIndex const& index, bool con
node.set_selected(selected);
}
void FileSystemModel::set_root_path(Optional<DeprecatedString> root_path)
void FileSystemModel::set_root_path(Optional<ByteString> root_path)
{
if (!root_path.has_value())
m_root_path = {};
@ -692,8 +692,8 @@ using BitmapBackgroundAction = Threading::BackgroundAction<NonnullRefPtr<Gfx::Bi
// Mutex protected thumbnail cache data shared between threads.
struct ThumbnailCache {
// Null pointers indicate an image that couldn't be loaded due to errors.
HashMap<DeprecatedString, RefPtr<Gfx::Bitmap>> thumbnail_cache {};
HashMap<DeprecatedString, NonnullRefPtr<BitmapBackgroundAction>> loading_thumbnails {};
HashMap<ByteString, RefPtr<Gfx::Bitmap>> thumbnail_cache {};
HashMap<ByteString, NonnullRefPtr<BitmapBackgroundAction>> loading_thumbnails {};
};
static Threading::MutexProtected<ThumbnailCache> s_thumbnail_cache {};
@ -853,7 +853,7 @@ void FileSystemModel::set_should_show_dotfiles(bool show)
invalidate();
}
void FileSystemModel::set_allowed_file_extensions(Optional<Vector<DeprecatedString>> const& allowed_file_extensions)
void FileSystemModel::set_allowed_file_extensions(Optional<Vector<ByteString>> const& allowed_file_extensions)
{
if (m_allowed_file_extensions == allowed_file_extensions)
return;
@ -874,7 +874,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_deprecated_string());
auto new_full_path = ByteString::formatted("{}/{}", dirname, data.to_byte_string());
int rc = rename(node.full_path().characters(), new_full_path.characters());
if (rc < 0) {
if (on_rename_error)

View file

@ -46,8 +46,8 @@ public:
struct Node {
~Node() = default;
DeprecatedString name;
DeprecatedString symlink_target;
ByteString name;
ByteString symlink_target;
size_t size { 0 };
mode_t mode { 0 };
uid_t uid { 0 };
@ -72,7 +72,7 @@ public:
bool can_delete_or_move() const;
DeprecatedString full_path() const;
ByteString full_path() const;
private:
friend class FileSystemModel;
@ -97,21 +97,21 @@ public:
ModelIndex index(int column) const;
void traverse_if_needed();
void reify_if_needed();
bool fetch_data(DeprecatedString const& full_path, bool is_root);
bool fetch_data(ByteString const& full_path, bool is_root);
OwnPtr<Node> create_child(DeprecatedString const& child_name);
OwnPtr<Node> create_child(ByteString const& child_name);
};
static NonnullRefPtr<FileSystemModel> create(Optional<DeprecatedString> root_path = "/", Mode mode = Mode::FilesAndDirectories)
static NonnullRefPtr<FileSystemModel> create(Optional<ByteString> root_path = "/", Mode mode = Mode::FilesAndDirectories)
{
return adopt_ref(*new FileSystemModel(root_path, mode));
}
virtual ~FileSystemModel() override = default;
DeprecatedString root_path() const { return m_root_path.value_or(""); }
void set_root_path(Optional<DeprecatedString>);
DeprecatedString full_path(ModelIndex const&) const;
ModelIndex index(DeprecatedString path, int column) const;
ByteString root_path() const { return m_root_path.value_or(""); }
void set_root_path(Optional<ByteString>);
ByteString full_path(ModelIndex const&) const;
ModelIndex index(ByteString path, int column) const;
void update_node_on_selection(ModelIndex const&, bool const);
ModelIndex m_previously_selected_index {};
@ -122,7 +122,7 @@ public:
Function<void()> on_complete;
Function<void(int error, char const* error_string)> on_directory_change_error;
Function<void(int error, char const* error_string)> on_rename_error;
Function<void(DeprecatedString const& old_name, DeprecatedString const& new_name)> on_rename_successful;
Function<void(ByteString const& old_name, ByteString const& new_name)> on_rename_successful;
Function<void()> on_root_path_removed;
virtual int tree_column() const override { return Column::Name; }
@ -141,34 +141,34 @@ public:
virtual Vector<ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override;
virtual void invalidate() override;
static DeprecatedString timestamp_string(time_t timestamp)
static ByteString timestamp_string(time_t timestamp)
{
return Core::DateTime::from_timestamp(timestamp).to_deprecated_string();
return Core::DateTime::from_timestamp(timestamp).to_byte_string();
}
bool should_show_dotfiles() const { return m_should_show_dotfiles; }
void set_should_show_dotfiles(bool);
Optional<Vector<DeprecatedString>> allowed_file_extensions() const { return m_allowed_file_extensions; }
void set_allowed_file_extensions(Optional<Vector<DeprecatedString>> const& allowed_file_extensions);
Optional<Vector<ByteString>> allowed_file_extensions() const { return m_allowed_file_extensions; }
void set_allowed_file_extensions(Optional<Vector<ByteString>> const& allowed_file_extensions);
private:
FileSystemModel(Optional<DeprecatedString> root_path, Mode);
FileSystemModel(Optional<ByteString> root_path, Mode);
DeprecatedString name_for_uid(uid_t) const;
DeprecatedString name_for_gid(gid_t) const;
ByteString name_for_uid(uid_t) const;
ByteString name_for_gid(gid_t) const;
Optional<Node const&> node_for_path(DeprecatedString const&) const;
Optional<Node const&> node_for_path(ByteString const&) const;
HashMap<uid_t, DeprecatedString> m_user_names;
HashMap<gid_t, DeprecatedString> m_group_names;
HashMap<uid_t, ByteString> m_user_names;
HashMap<gid_t, ByteString> m_group_names;
bool fetch_thumbnail_for(Node const& node);
GUI::Icon icon_for(Node const& node) const;
void handle_file_event(Core::FileWatcherEvent const& event);
Optional<DeprecatedString> m_root_path;
Optional<ByteString> m_root_path;
Mode m_mode { Invalid };
OwnPtr<Node> m_root { nullptr };
@ -177,7 +177,7 @@ private:
Core::ElapsedTimer m_ui_update_timer;
Optional<Vector<DeprecatedString>> m_allowed_file_extensions;
Optional<Vector<ByteString>> m_allowed_file_extensions;
bool m_should_show_dotfiles { false };

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Optional.h>
#include <AK/Vector.h>
#include <LibIPC/Decoder.h>
@ -15,8 +15,8 @@
namespace GUI {
struct FileTypeFilter {
DeprecatedString name;
Optional<Vector<DeprecatedString>> extensions;
ByteString name;
Optional<Vector<ByteString>> extensions;
static FileTypeFilter all_files()
{
@ -25,7 +25,7 @@ struct FileTypeFilter {
static FileTypeFilter image_files()
{
return FileTypeFilter { "Image Files", Vector<DeprecatedString> { "png", "gif", "bmp", "dip", "pbm", "pgm", "ppm", "ico", "iff", "jpeg", "jpg", "jxl", "dds", "qoi", "tif", "tiff", "webp", "tvg" } };
return FileTypeFilter { "Image Files", Vector<ByteString> { "png", "gif", "bmp", "dip", "pbm", "pgm", "ppm", "ico", "iff", "jpeg", "jpg", "jxl", "dds", "qoi", "tif", "tiff", "webp", "tvg" } };
}
};
@ -44,8 +44,8 @@ inline ErrorOr<void> encode(Encoder& encoder, GUI::FileTypeFilter const& respons
template<>
inline ErrorOr<GUI::FileTypeFilter> decode(Decoder& decoder)
{
auto name = TRY(decoder.decode<DeprecatedString>());
auto extensions = TRY(decoder.decode<Optional<Vector<AK::DeprecatedString>>>());
auto name = TRY(decoder.decode<ByteString>());
auto extensions = TRY(decoder.decode<Optional<Vector<AK::ByteString>>>());
return GUI::FileTypeFilter { move(name), move(extensions) };
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/EnumBits.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
@ -68,7 +68,7 @@ private:
// Maps row to actual model index.
Vector<ModelIndexWithScore> m_matching_indices;
DeprecatedString m_filter_term;
ByteString m_filter_term;
FilteringOptions m_filtering_options;
};

View file

@ -57,7 +57,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 = MUST(String::from_deprecated_string(index.data().to_deprecated_string()));
m_family = MUST(String::from_byte_string(index.data().to_byte_string()));
m_variants.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())
@ -78,7 +78,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 = MUST(String::from_deprecated_string(index.data().to_deprecated_string()));
m_variant = MUST(String::from_byte_string(index.data().to_byte_string()));
m_sizes.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
@ -35,11 +35,11 @@ public:
return try_make_ref_counted<NodeT>(token.m_view);
}
DeprecatedString to_deprecated_string() const
ByteString to_byte_string() const
{
StringBuilder builder;
format(builder, 0, false);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
// Format this AST node with the builder at the given indentation level.
@ -64,7 +64,7 @@ public:
// Single line comments with //.
class Comment : public Node {
public:
Comment(DeprecatedString text)
Comment(ByteString text)
: m_text(move(text))
{
}
@ -82,13 +82,13 @@ public:
virtual ~Comment() override = default;
private:
DeprecatedString m_text {};
ByteString m_text {};
};
// Any JSON-like key: value pair.
class KeyValuePair : public Node {
public:
KeyValuePair(DeprecatedString key, NonnullRefPtr<ValueNode> value)
KeyValuePair(ByteString key, NonnullRefPtr<ValueNode> value)
: m_key(move(key))
, m_value(move(value))
{
@ -104,11 +104,11 @@ public:
builder.append('\n');
}
DeprecatedString key() const { return m_key; }
ByteString key() const { return m_key; }
NonnullRefPtr<ValueNode> value() const { return m_value; }
private:
DeprecatedString m_key;
ByteString m_key;
NonnullRefPtr<ValueNode> m_value;
};
@ -151,7 +151,7 @@ public:
class Object : public ValueNode {
public:
Object() = default;
Object(DeprecatedString name, Vector<NonnullRefPtr<Node const>> properties, Vector<NonnullRefPtr<Node const>> sub_objects)
Object(ByteString name, Vector<NonnullRefPtr<Node const>> properties, Vector<NonnullRefPtr<Node const>> sub_objects)
: m_properties(move(properties))
, m_sub_objects(move(sub_objects))
, m_name(move(name))
@ -161,7 +161,7 @@ public:
virtual ~Object() override = default;
StringView name() const { return m_name; }
void set_name(DeprecatedString name) { m_name = move(name); }
void set_name(ByteString name) { m_name = move(name); }
ErrorOr<void> add_sub_object_child(NonnullRefPtr<Node const> child)
{
@ -289,7 +289,7 @@ private:
Vector<NonnullRefPtr<Node const>> m_properties;
// Sub objects and comments
Vector<NonnullRefPtr<Node const>> m_sub_objects;
DeprecatedString m_name {};
ByteString m_name {};
};
class GMLFile : public Node {

View file

@ -25,8 +25,8 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
InIdentifier,
AfterIdentifier, // Can we introspect this?
} state { Free };
DeprecatedString identifier_string;
Vector<DeprecatedString> class_names;
ByteString identifier_string;
Vector<ByteString> class_names;
Vector<State> previous_states;
bool should_push_state { true };
Token* last_seen_token { nullptr };
@ -118,26 +118,26 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
fuzzy_str_builder.append(character);
fuzzy_str_builder.append('*');
}
return fuzzy_str_builder.to_deprecated_string();
return fuzzy_str_builder.to_byte_string();
};
Vector<CodeComprehension::AutocompleteResultEntry> class_entries, identifier_entries;
auto register_layouts_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_layouts_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
GUI::ObjectClassRegistration::for_each([&](const GUI::ObjectClassRegistration& registration) {
if (registration.is_derived_from(layout_class) && &registration != &layout_class && registration.class_name().matches(pattern))
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(ByteString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_widgets_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_widgets_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
GUI::ObjectClassRegistration::for_each([&](const GUI::ObjectClassRegistration& registration) {
if (registration.is_derived_from(widget_class) && registration.class_name().matches(pattern))
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(ByteString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_class_properties_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_class_properties_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
auto class_name = class_names.last();
// FIXME: Don't show properties that are already specified in the scope.
@ -146,7 +146,7 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
if (auto instance = registration->construct(); !instance.is_error()) {
for (auto& it : instance.value()->properties()) {
if (!it.value->is_readonly() && it.key.matches(pattern))
identifier_entries.empend(DeprecatedString::formatted("{}: ", it.key), partial_input_length, CodeComprehension::Language::Unspecified, it.key);
identifier_entries.empend(ByteString::formatted("{}: ", it.key), partial_input_length, CodeComprehension::Language::Unspecified, it.key);
}
}
}
@ -157,7 +157,7 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
identifier_entries.empend("content_widget: ", partial_input_length, CodeComprehension::Language::Unspecified, "content_widget", CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No);
};
auto register_properties_and_widgets_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_properties_and_widgets_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
if (!class_names.is_empty()) {
register_class_properties_matching_pattern(pattern, partial_input_length);

View file

@ -6,16 +6,16 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Forward.h>
#include <LibGUI/GML/AST.h>
#include <LibGUI/GML/Parser.h>
namespace GUI::GML {
inline ErrorOr<DeprecatedString> format_gml(StringView string)
inline ErrorOr<ByteString> format_gml(StringView string)
{
return TRY(parse_gml(string))->to_deprecated_string();
return TRY(parse_gml(string))->to_byte_string();
}
}

View file

@ -16,7 +16,7 @@ class GroupBox : public Widget {
public:
virtual ~GroupBox() override = default;
DeprecatedString title() const { return m_title; }
ByteString title() const { return m_title; }
void set_title(StringView);
virtual Margins content_margins() const override;
@ -27,7 +27,7 @@ protected:
virtual void fonts_change_event(FontsChangeEvent&) override;
private:
DeprecatedString m_title;
ByteString m_title;
};
}

View file

@ -304,7 +304,7 @@ void HeaderView::paint_vertical(Painter& painter)
bool pressed = section == m_pressed_section && m_pressed_section_is_pressed;
bool hovered = false;
Gfx::StylePainter::paint_button(painter, cell_rect, palette(), Gfx::ButtonStyle::Normal, pressed, hovered);
DeprecatedString text = DeprecatedString::number(section);
ByteString text = ByteString::number(section);
auto text_rect = cell_rect.shrunken(m_table_view.horizontal_padding() * 2, 0);
if (pressed)
text_rect.translate_by(1, 1);
@ -358,7 +358,7 @@ Menu& HeaderView::ensure_context_menu()
int section_count = this->section_count();
for (int section = 0; section < section_count; ++section) {
auto& column_data = this->section_data(section);
auto name = model()->column_name(section).release_value_but_fixme_should_propagate_errors().to_deprecated_string();
auto name = model()->column_name(section).release_value_but_fixme_should_propagate_errors().to_byte_string();
column_data.visibility_action = Action::create_checkable(name, [this, section](auto& action) {
set_section_visible(section, action.is_checked());
});

View file

@ -5,7 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibGUI/Icon.h>
#include <LibGfx/Bitmap.h>
@ -82,9 +82,9 @@ ErrorOr<Icon> Icon::try_create_default_icon(StringView name)
{
RefPtr<Gfx::Bitmap> bitmap16;
RefPtr<Gfx::Bitmap> bitmap32;
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(ByteString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
bitmap16 = bitmap_or_error.release_value();
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(ByteString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
bitmap32 = bitmap_or_error.release_value();
if (!bitmap16 && !bitmap32) {

View file

@ -106,7 +106,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_deprecated_string();
item_data.text = item_data.index.data().to_byte_string();
get_item_rects(item_index, item_data, font_for_index(item_data.index));
item_data.valid = true;
return item_data;

View file

@ -73,7 +73,7 @@ private:
Gfx::IntRect icon_rect;
int icon_offset_y;
int text_offset_y;
DeprecatedString text;
ByteString text;
Vector<StringView> wrapped_text_lines;
ModelIndex index;
bool valid { false };

View file

@ -42,7 +42,7 @@ InputBox::InputBox(Window* parent_window, String text_value, String title, Strin
, m_input_type(input_type)
, m_icon(move(icon))
{
set_title(move(title).to_deprecated_string());
set_title(move(title).to_byte_string());
set_resizable(false);
set_auto_shrink(true);
}
@ -54,7 +54,7 @@ InputBox::InputBox(Window* parent_window, int value, String title, String prompt
, m_input_type(InputType::Numeric)
, m_icon(move(icon))
{
set_title(move(title).to_deprecated_string());
set_title(move(title).to_byte_string());
set_resizable(false);
set_auto_shrink(true);
}
@ -119,7 +119,7 @@ void InputBox::on_done(ExecResult result)
return;
if (m_text_editor) {
auto value = String::from_deprecated_string(m_text_editor->text());
auto value = String::from_byte_string(m_text_editor->text());
if (!value.is_error())
m_text_value = value.release_value();
} else if (m_spinbox)

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_deprecated_string(), searching, flags))
if (!string_matches(data(index, ModelRole::Display).to_byte_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_deprecated_string(), searching, flags))
if (!string_matches(data(index, ModelRole::Display).to_byte_string(), searching, flags))
continue;
found_indices.append(index);

View file

@ -61,7 +61,7 @@ void JsonArrayModel::update()
ErrorOr<void> JsonArrayModel::store()
{
auto file = TRY(Core::File::open(m_json_path, Core::File::OpenMode::Write));
ByteBuffer json_bytes = m_array.to_deprecated_string().to_byte_buffer();
ByteBuffer json_bytes = m_array.to_byte_string().to_byte_buffer();
TRY(file->write_until_depleted(json_bytes));
file->close();
@ -138,7 +138,7 @@ Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
return "";
if (data->is_number())
return data.value();
return data->to_deprecated_string();
return data->to_byte_string();
}
if (role == ModelRole::Sort) {
@ -156,7 +156,7 @@ Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
return {};
}
void JsonArrayModel::set_json_path(DeprecatedString const& json_path)
void JsonArrayModel::set_json_path(ByteString const& json_path)
{
if (m_json_path == json_path)
return;

View file

@ -16,7 +16,7 @@ namespace GUI {
class JsonArrayModel final : public Model {
public:
struct FieldSpec {
FieldSpec(DeprecatedString const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment)
FieldSpec(ByteString const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment)
: json_field_name(a_json_field_name)
, column_name(a_column_name)
, text_alignment(a_text_alignment)
@ -32,7 +32,7 @@ public:
{
}
FieldSpec(DeprecatedString const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(JsonObject const&)>&& a_massage_for_display, Function<Variant(JsonObject const&)>&& a_massage_for_sort = {}, Function<Variant(JsonObject const&)>&& a_massage_for_custom = {})
FieldSpec(ByteString const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(JsonObject const&)>&& a_massage_for_display, Function<Variant(JsonObject const&)>&& a_massage_for_sort = {}, Function<Variant(JsonObject const&)>&& a_massage_for_custom = {})
: json_field_name(a_json_field_name)
, column_name(a_column_name)
, text_alignment(a_text_alignment)
@ -42,7 +42,7 @@ public:
{
}
DeprecatedString json_field_name;
ByteString json_field_name;
String column_name;
Gfx::TextAlignment text_alignment;
Function<Variant(JsonObject const&)> massage_for_display;
@ -50,7 +50,7 @@ public:
Function<Variant(JsonObject const&)> massage_for_custom;
};
static NonnullRefPtr<JsonArrayModel> create(DeprecatedString const& json_path, Vector<FieldSpec>&& fields)
static NonnullRefPtr<JsonArrayModel> create(ByteString const& json_path, Vector<FieldSpec>&& fields)
{
return adopt_ref(*new JsonArrayModel(json_path, move(fields)));
}
@ -64,8 +64,8 @@ public:
virtual void invalidate() override;
virtual void update();
DeprecatedString const& json_path() const { return m_json_path; }
void set_json_path(DeprecatedString const& json_path);
ByteString const& json_path() const { return m_json_path; }
void set_json_path(ByteString const& json_path);
ErrorOr<void> add(Vector<JsonValue> const&& fields);
ErrorOr<void> set(int row, Vector<JsonValue>&& fields);
@ -73,13 +73,13 @@ public:
ErrorOr<void> store();
private:
JsonArrayModel(DeprecatedString const& json_path, Vector<FieldSpec>&& fields)
JsonArrayModel(ByteString const& json_path, Vector<FieldSpec>&& fields)
: m_json_path(json_path)
, m_fields(move(fields))
{
}
DeprecatedString m_json_path;
ByteString m_json_path;
Vector<FieldSpec> m_fields;
JsonArray m_array;
};

View file

@ -43,7 +43,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_deprecated_string()) + horizontal_padding() * 2);
content_width = max(content_width, font().width(text.to_byte_string()) + horizontal_padding() * 2);
}
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_deprecated_string(), font, text_alignment, Gfx::TextElision::None);
draw_item_text(painter, index, is_selected_row, text_rect, data.to_byte_string(), font, text_alignment, Gfx::TextElision::None);
}
}

View file

@ -204,7 +204,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_deprecated_string() : DeprecatedString();
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_byte_string() : ByteString();
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();
@ -215,7 +215,7 @@ void Menu::realize_menu_item(MenuItem& item, int item_id)
auto& submenu = *item.submenu();
submenu.realize_if_needed(m_current_default_action.strong_ref());
auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
ConnectionToWindowServer::the().async_add_menu_item(m_menu_id, item_id, submenu.menu_id(), submenu.name().to_deprecated_string(), true, true, false, false, false, "", icon, false);
ConnectionToWindowServer::the().async_add_menu_item(m_menu_id, item_id, submenu.menu_id(), submenu.name().to_byte_string(), true, true, false, false, false, "", icon, false);
break;
}
case MenuItem::Type::Invalid:

View file

@ -83,7 +83,7 @@ void MenuItem::update_window_server()
switch (m_type) {
case MenuItem::Type::Action: {
auto& action = *m_action;
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_deprecated_string() : DeprecatedString();
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_byte_string() : ByteString();
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_visible(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text, icon);
break;
@ -91,7 +91,7 @@ void MenuItem::update_window_server()
case MenuItem::Type::Submenu: {
auto& submenu = *m_submenu;
auto icon = submenu.icon() ? submenu.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, submenu.menu_id(), submenu.name().to_deprecated_string(), m_enabled, m_visible, false, false, m_default, "", icon);
ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, submenu.menu_id(), submenu.name().to_byte_string(), m_enabled, m_visible, false, false, m_default, "", icon);
break;
}
default:

View file

@ -20,7 +20,7 @@ ErrorOr<NonnullRefPtr<MessageBox>> MessageBox::create(Window* parent_window, Str
{
auto box = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) MessageBox(parent_window, type, input_type)));
TRY(box->build());
box->set_title(TRY(String::from_utf8(title)).to_deprecated_string());
box->set_title(TRY(String::from_utf8(title)).to_byte_string());
box->set_text(TRY(String::from_utf8(text)));
auto size = box->main_widget()->effective_min_size();
box->resize(TRY(size.width().shrink_value()), TRY(size.height().shrink_value()));

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_deprecated_string());
text_builder.append(text_data.to_byte_string());
if (!first)
data_builder.append('\n');
auto data = index.data(ModelRole::MimeData);
data_builder.append(data.to_deprecated_string());
data_builder.append(data.to_byte_string());
first = false;
@ -126,7 +126,7 @@ RefPtr<Core::MimeData> Model::mime_data(ModelSelection const& selection) const
});
mime_data->set_data(MUST(String::from_utf8(drag_data_type())), data_builder.to_byte_buffer().release_value_but_fixme_should_propagate_errors());
mime_data->set_text(text_builder.to_deprecated_string());
mime_data->set_text(text_builder.to_byte_string());
if (bitmap)
mime_data->set_data("image/x-raw-bitmap"_string, bitmap->serialize_to_byte_buffer().release_value_but_fixme_should_propagate_errors());

View file

@ -97,7 +97,7 @@ public:
{
auto& textbox = static_cast<TextBox&>(*widget());
if (value.is_valid())
textbox.set_text(value.to_deprecated_string());
textbox.set_text(value.to_byte_string());
else
textbox.clear();
if (selection_behavior == SelectionBehavior::SelectAll)

View file

@ -15,12 +15,12 @@ Object::Object(Core::EventReceiver* parent)
Object::~Object() = default;
void Object::register_property(DeprecatedString const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
void Object::register_property(ByteString const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
{
m_properties.set(name, make<Property>(name, move(getter), move(setter)));
}
JsonValue Object::property(DeprecatedString const& name) const
JsonValue Object::property(ByteString const& name) const
{
auto it = m_properties.find(name);
if (it == m_properties.end())
@ -28,7 +28,7 @@ JsonValue Object::property(DeprecatedString const& name) const
return it->value->get();
}
bool Object::set_property(DeprecatedString const& name, JsonValue const& value)
bool Object::set_property(ByteString const& name, JsonValue const& value)
{
auto it = m_properties.find(name);
if (it == m_properties.end())

View file

@ -50,17 +50,17 @@ class Object : public Core::EventReceiver {
public:
virtual ~Object() override;
bool set_property(DeprecatedString const& name, JsonValue const& value);
JsonValue property(DeprecatedString const& name) const;
HashMap<DeprecatedString, NonnullOwnPtr<Property>> const& properties() const { return m_properties; }
bool set_property(ByteString const& name, JsonValue const& value);
JsonValue property(ByteString const& name) const;
HashMap<ByteString, NonnullOwnPtr<Property>> const& properties() const { return m_properties; }
protected:
explicit Object(Core::EventReceiver* parent = nullptr);
void register_property(DeprecatedString const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
void register_property(ByteString const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
private:
HashMap<DeprecatedString, NonnullOwnPtr<Property>> m_properties;
HashMap<ByteString, NonnullOwnPtr<Property>> m_properties;
};
}
@ -84,13 +84,13 @@ private:
});
// FIXME: Port JsonValue to the new String class.
#define REGISTER_STRING_PROPERTY(property_name, getter, setter) \
register_property( \
property_name, \
[this]() { return this->getter().to_deprecated_string(); }, \
[this](auto& value) { \
this->setter(String::from_deprecated_string(value.to_deprecated_string()).release_value_but_fixme_should_propagate_errors()); \
return true; \
#define REGISTER_STRING_PROPERTY(property_name, getter, setter) \
register_property( \
property_name, \
[this]() { return this->getter().to_byte_string(); }, \
[this](auto& value) { \
this->setter(String::from_byte_string(value.to_byte_string()).release_value_but_fixme_should_propagate_errors()); \
return true; \
});
#define REGISTER_DEPRECATED_STRING_PROPERTY(property_name, getter, setter) \
@ -98,7 +98,7 @@ private:
property_name, \
[this] { return this->getter(); }, \
[this](auto& value) { \
this->setter(value.to_deprecated_string()); \
this->setter(value.to_byte_string()); \
return true; \
});
@ -113,7 +113,7 @@ private:
property_name, \
{}, \
[this](auto& value) { \
this->setter(value.to_deprecated_string()); \
this->setter(value.to_byte_string()); \
return true; \
});
@ -187,7 +187,7 @@ private:
[this]() -> JsonValue { \
struct { \
EnumType enum_value; \
DeprecatedString string_value; \
ByteString string_value; \
} options[] = { __VA_ARGS__ }; \
auto enum_value = getter(); \
for (size_t i = 0; i < array_size(options); ++i) { \
@ -200,7 +200,7 @@ private:
[this](auto& value) { \
struct { \
EnumType enum_value; \
DeprecatedString string_value; \
ByteString string_value; \
} options[] = { __VA_ARGS__ }; \
if (!value.is_string()) \
return false; \

View file

@ -115,7 +115,7 @@ void OpacitySlider::paint_event(PaintEvent& event)
// Text label
// FIXME: better support text in vertical orientation, either by having a vertical option for draw_text, or only showing when there is enough space
auto percent_text = DeprecatedString::formatted("{}%", (int)((float)value() / (float)max() * 100.0f));
auto percent_text = ByteString::formatted("{}%", (int)((float)value() / (float)max() * 100.0f));
painter.draw_text(inner_rect.translated(1, 1), percent_text, Gfx::TextAlignment::Center, Color::Black);
painter.draw_text(inner_rect, percent_text, Gfx::TextAlignment::Center, Color::White);

View file

@ -14,7 +14,7 @@
namespace GUI {
PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString title, DeprecatedString server, DeprecatedString username)
PasswordInputDialog::PasswordInputDialog(Window* parent_window, ByteString title, ByteString server, ByteString username)
: Dialog(parent_window)
{
if (parent_window)
@ -31,10 +31,10 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
key_icon.set_bitmap(Gfx::Bitmap::load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
auto& server_label = *widget->find_descendant_of_type_named<GUI::Label>("server_label");
server_label.set_text(String::from_deprecated_string(server).release_value_but_fixme_should_propagate_errors());
server_label.set_text(String::from_byte_string(server).release_value_but_fixme_should_propagate_errors());
auto& username_label = *widget->find_descendant_of_type_named<GUI::Label>("username_label");
username_label.set_text(String::from_deprecated_string(username).release_value_but_fixme_should_propagate_errors());
username_label.set_text(String::from_byte_string(username).release_value_but_fixme_should_propagate_errors());
auto& password_box = *widget->find_descendant_of_type_named<GUI::PasswordBox>("password_box");
@ -58,7 +58,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
password_box.set_focus(true);
}
Dialog::ExecResult PasswordInputDialog::show(Window* parent_window, DeprecatedString& text_value, DeprecatedString title, DeprecatedString server, DeprecatedString username)
Dialog::ExecResult PasswordInputDialog::show(Window* parent_window, ByteString& text_value, ByteString title, ByteString server, ByteString username)
{
auto box = PasswordInputDialog::construct(parent_window, move(title), move(server), move(username));
auto result = box->exec();

View file

@ -17,12 +17,12 @@ class PasswordInputDialog : public Dialog {
public:
virtual ~PasswordInputDialog() override = default;
static ExecResult show(Window* parent_window, DeprecatedString& text_value, DeprecatedString title, DeprecatedString server, DeprecatedString username);
static ExecResult show(Window* parent_window, ByteString& text_value, ByteString title, ByteString server, ByteString username);
private:
explicit PasswordInputDialog(Window* parent_window, DeprecatedString title, DeprecatedString server, DeprecatedString username);
explicit PasswordInputDialog(Window* parent_window, ByteString title, ByteString server, ByteString username);
DeprecatedString m_password;
ByteString m_password;
};
}

View file

@ -87,7 +87,7 @@ PathBreadcrumbbar::PathBreadcrumbbar(NonnullRefPtr<GUI::TextBox> location_text_b
PathBreadcrumbbar::~PathBreadcrumbbar() = default;
void PathBreadcrumbbar::set_current_path(DeprecatedString const& new_path)
void PathBreadcrumbbar::set_current_path(ByteString const& new_path)
{
if (new_path == m_current_path)
return;

View file

@ -18,7 +18,7 @@ public:
static ErrorOr<NonnullRefPtr<PathBreadcrumbbar>> try_create();
virtual ~PathBreadcrumbbar() override;
void set_current_path(DeprecatedString const&);
void set_current_path(ByteString const&);
void show_location_text_box();
void hide_location_text_box();
@ -39,7 +39,7 @@ private:
NonnullRefPtr<GUI::TextBox> m_location_text_box;
NonnullRefPtr<GUI::Breadcrumbbar> m_breadcrumbbar;
DeprecatedString m_current_path;
ByteString m_current_path;
};
}

View file

@ -13,14 +13,14 @@ void spawn_or_show_error(GUI::Window* parent_window, StringView path, ReadonlySp
{
auto spawn_result = Core::Process::spawn(path, arguments, working_directory);
if (spawn_result.is_error())
GUI::MessageBox::show_error(parent_window, DeprecatedString::formatted("Failed to spawn {}: {}", path, spawn_result.error()));
GUI::MessageBox::show_error(parent_window, ByteString::formatted("Failed to spawn {}: {}", path, spawn_result.error()));
}
namespace GUI {
void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments, StringView working_directory)
void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<ByteString> arguments, StringView working_directory)
{
::spawn_or_show_error<DeprecatedString>(parent_window, path, arguments, working_directory);
::spawn_or_show_error<ByteString>(parent_window, path, arguments, working_directory);
}
void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments, StringView working_directory)

View file

@ -12,7 +12,7 @@
namespace GUI {
struct Process {
static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments, StringView working_directory = {});
static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<ByteString> arguments, StringView working_directory = {});
static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments, StringView working_directory = {});
static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<char const*> arguments = {}, StringView working_directory = {});
};

View file

@ -29,7 +29,7 @@ private:
pid_t m_pid { 0 };
DeprecatedString m_window_title;
ByteString m_window_title;
String m_button_label;
RefPtr<Gfx::Bitmap const> m_window_icon;
RefPtr<TableView> m_table_view;

View file

@ -56,7 +56,7 @@ void Progressbar::paint_event(PaintEvent& event)
painter.add_clip_rect(rect);
painter.add_clip_rect(event.rect());
DeprecatedString progress_text;
ByteString progress_text;
if (m_format != Format::NoText) {
// Then we draw the progress text over the gradient.
// We draw it twice, once offset (1, 1) for a drop shadow look.
@ -69,7 +69,7 @@ void Progressbar::paint_event(PaintEvent& event)
} else if (m_format == Format::ValueSlashMax) {
builder.appendff("{}/{}", m_value, m_max);
}
progress_text = builder.to_deprecated_string();
progress_text = builder.to_byte_string();
}
Gfx::StylePainter::paint_progressbar(painter, rect, palette(), m_min, m_max, m_value, progress_text, m_orientation);

View file

@ -28,8 +28,8 @@ public:
void set_orientation(Orientation value);
Orientation orientation() const { return m_orientation; }
DeprecatedString text() const { return m_text; }
void set_text(DeprecatedString text) { m_text = move(text); }
ByteString text() const { return m_text; }
void set_text(ByteString text) { m_text = move(text); }
enum Format {
NoText,
@ -51,7 +51,7 @@ private:
int m_min { 0 };
int m_max { 100 };
int m_value { 0 };
DeprecatedString m_text;
ByteString m_text;
Orientation m_orientation { Orientation::Horizontal };
};

View file

@ -9,7 +9,7 @@
namespace GUI {
Property::Property(DeprecatedString name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
Property::Property(ByteString name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
: m_name(move(name))
, m_getter(move(getter))
, m_setter(move(setter))

View file

@ -16,7 +16,7 @@ class Property {
AK_MAKE_NONCOPYABLE(Property);
public:
Property(DeprecatedString name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
Property(ByteString name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
~Property() = default;
bool set(JsonValue const& value)
@ -33,11 +33,11 @@ public:
return m_getter();
}
DeprecatedString const& name() const { return m_name; }
ByteString const& name() const { return m_name; }
bool is_readonly() const { return !m_setter; }
private:
DeprecatedString m_name;
ByteString m_name;
Function<JsonValue()> m_getter;
Function<bool(JsonValue const&)> m_setter;
};

View file

@ -52,7 +52,7 @@ void RangeSlider::paint_event(PaintEvent& event)
// Text label
if (m_show_label) {
auto range_text = DeprecatedString::formatted("{} to {}", lower_range(), upper_range());
auto range_text = ByteString::formatted("{} to {}", lower_range(), upper_range());
painter.draw_text(inner_rect.translated(1, 1), range_text, Gfx::TextAlignment::Center, Color::Black);
painter.draw_text(inner_rect, range_text, Gfx::TextAlignment::Center, Color::White);
}

View file

@ -39,7 +39,7 @@ private:
pid_t pid;
uid_t uid;
RefPtr<Gfx::Bitmap const> icon;
DeprecatedString name;
ByteString name;
};
Vector<Process> m_processes;
};

View file

@ -23,7 +23,7 @@ void SettingsWindow::set_modified(bool modified)
m_apply_button->set_enabled(modified);
}
ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString title, ShowDefaultsButton show_defaults_button)
ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(ByteString title, ShowDefaultsButton show_defaults_button)
{
auto window = TRY(SettingsWindow::try_create());

View file

@ -42,7 +42,7 @@ public:
No,
};
static ErrorOr<NonnullRefPtr<SettingsWindow>> create(DeprecatedString title, ShowDefaultsButton = ShowDefaultsButton::No);
static ErrorOr<NonnullRefPtr<SettingsWindow>> create(ByteString title, ShowDefaultsButton = ShowDefaultsButton::No);
virtual ~SettingsWindow() override = default;

View file

@ -5,16 +5,16 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibGUI/Shortcut.h>
namespace GUI {
DeprecatedString Shortcut::to_deprecated_string() const
ByteString Shortcut::to_byte_string() const
{
Vector<DeprecatedString, 8> parts;
Vector<ByteString, 8> parts;
if (m_modifiers & Mod_Ctrl)
parts.append("Ctrl");
@ -34,14 +34,14 @@ DeprecatedString Shortcut::to_deprecated_string() const
parts.append("(Invalid)");
} else {
if (m_mouse_button != MouseButton::None)
parts.append(DeprecatedString::formatted("Mouse {}", mouse_button_to_string(m_mouse_button)));
parts.append(ByteString::formatted("Mouse {}", mouse_button_to_string(m_mouse_button)));
else
parts.append("(Invalid)");
}
StringBuilder builder;
builder.join('+', parts);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
}

View file

@ -46,7 +46,7 @@ public:
Mouse,
};
DeprecatedString to_deprecated_string() const;
ByteString to_byte_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

@ -63,7 +63,7 @@ SpinBox::SpinBox()
void SpinBox::set_value(int value, AllowCallback allow_callback)
{
value = clamp(value, m_min, m_max);
m_editor->set_text(DeprecatedString::number(value));
m_editor->set_text(ByteString::number(value));
if (m_value == value)
return;
m_value = value;
@ -105,7 +105,7 @@ void SpinBox::set_range(int min, int max, AllowCallback allow_callback)
int old_value = m_value;
m_value = clamp(m_value, m_min, m_max);
if (m_value != old_value) {
m_editor->set_text(DeprecatedString::number(m_value));
m_editor->set_text(ByteString::number(m_value));
if (on_change && allow_callback == AllowCallback::Yes)
on_change(m_value);
}

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_deprecated_string());
auto alignment = Gfx::text_alignment_from_string(value.to_byte_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_deprecated_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
draw_item_text(painter, cell_index, is_selected_row, cell_rect, data.to_byte_string(), font_for_index(cell_index), text_alignment, Gfx::TextElision::Right);
}
}
@ -208,7 +208,7 @@ void TableView::keydown_event(KeyEvent& event)
m_editing_delegate->set_value(GUI::Variant {});
}
} else if (is_backspace) {
m_editing_delegate->set_value(DeprecatedString::empty());
m_editing_delegate->set_value(ByteString::empty());
} else {
m_editing_delegate->set_value(event.text(), ModelEditingDelegate::SelectionBehavior::DoNotSelect);
}

View file

@ -68,7 +68,7 @@ void TextBox::add_current_text_to_history()
m_saved_input = {};
}
void TextBox::add_input_to_history(DeprecatedString input)
void TextBox::add_input_to_history(ByteString input)
{
m_history.append(move(input));
m_history_index++;

View file

@ -32,12 +32,12 @@ private:
bool has_no_history() const { return !m_history_enabled || m_history.is_empty(); }
bool can_go_backwards_in_history() const { return m_history_index > 0; }
bool can_go_forwards_in_history() const { return m_history_index < static_cast<int>(m_history.size()) - 1; }
void add_input_to_history(DeprecatedString);
void add_input_to_history(ByteString);
bool m_history_enabled { false };
Vector<DeprecatedString> m_history;
Vector<ByteString> m_history;
int m_history_index { -1 };
DeprecatedString m_saved_input;
ByteString m_saved_input;
};
class PasswordBox : public TextBox {

View file

@ -184,7 +184,7 @@ void TextDocument::set_all_cursors(TextPosition const& position)
}
}
DeprecatedString TextDocument::text() const
ByteString TextDocument::text() const
{
StringBuilder builder;
for (size_t i = 0; i < line_count(); ++i) {
@ -193,14 +193,14 @@ DeprecatedString TextDocument::text() const
if (i != line_count() - 1)
builder.append('\n');
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString TextDocument::text_in_range(TextRange const& a_range) const
ByteString TextDocument::text_in_range(TextRange const& a_range) const
{
auto range = a_range.normalized();
if (is_empty() || line_count() < range.end().line() - range.start().line())
return DeprecatedString("");
return ByteString("");
StringBuilder builder;
for (size_t i = range.start().line(); i <= range.end().line(); ++i) {
@ -219,7 +219,7 @@ DeprecatedString TextDocument::text_in_range(TextRange const& a_range) const
builder.append('\n');
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
// This function will return the position of the previous grapheme cluster
@ -301,7 +301,7 @@ void TextDocument::update_regex_matches(StringView needle)
}
re.search(views, m_regex_result);
m_regex_needs_update = false;
m_regex_needle = DeprecatedString { needle };
m_regex_needle = ByteString { needle };
m_regex_result_match_index = -1;
m_regex_result_match_capture_group_index = -1;
}
@ -694,14 +694,14 @@ TextDocumentUndoCommand::TextDocumentUndoCommand(TextDocument& document)
{
}
InsertTextCommand::InsertTextCommand(TextDocument& document, DeprecatedString const& text, TextPosition const& position)
InsertTextCommand::InsertTextCommand(TextDocument& document, ByteString const& text, TextPosition const& position)
: TextDocumentUndoCommand(document)
, m_text(text)
, m_range({ position, position })
{
}
DeprecatedString InsertTextCommand::action_text() const
ByteString InsertTextCommand::action_text() const
{
return "Insert Text";
}
@ -723,7 +723,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_deprecated_string();
m_text = builder.to_byte_string();
m_range.set_end(typed_other.m_range.end());
m_timestamp = MonotonicTime::now();
@ -777,7 +777,7 @@ void InsertTextCommand::perform_formatting(TextDocument::Client const& client)
++column;
}
}
m_text = builder.to_deprecated_string();
m_text = builder.to_byte_string();
}
void InsertTextCommand::redo()
@ -795,7 +795,7 @@ void InsertTextCommand::undo()
m_document.set_all_cursors(m_range.start());
}
RemoveTextCommand::RemoveTextCommand(TextDocument& document, DeprecatedString const& text, TextRange const& range, TextPosition const& original_cursor_position)
RemoveTextCommand::RemoveTextCommand(TextDocument& document, ByteString const& text, TextRange const& range, TextPosition const& original_cursor_position)
: TextDocumentUndoCommand(document)
, m_text(text)
, m_range(range)
@ -803,7 +803,7 @@ RemoveTextCommand::RemoveTextCommand(TextDocument& document, DeprecatedString co
{
}
DeprecatedString RemoveTextCommand::action_text() const
ByteString RemoveTextCommand::action_text() const
{
return "Remove Text";
}
@ -824,7 +824,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_deprecated_string();
m_text = builder.to_byte_string();
m_range.set_start(typed_other.m_range.start());
m_timestamp = MonotonicTime::now();
@ -843,7 +843,7 @@ void RemoveTextCommand::undo()
m_document.set_all_cursors(m_original_cursor_position);
}
InsertLineCommand::InsertLineCommand(TextDocument& document, TextPosition cursor, DeprecatedString&& text, InsertPosition pos)
InsertLineCommand::InsertLineCommand(TextDocument& document, TextPosition cursor, ByteString&& text, InsertPosition pos)
: TextDocumentUndoCommand(document)
, m_cursor(cursor)
, m_text(move(text))
@ -876,7 +876,7 @@ size_t InsertLineCommand::compute_line_number() const
VERIFY_NOT_REACHED();
}
DeprecatedString InsertLineCommand::action_text() const
ByteString InsertLineCommand::action_text() const
{
StringBuilder action_text_builder;
action_text_builder.append("Insert Line"sv);
@ -889,10 +889,10 @@ DeprecatedString InsertLineCommand::action_text() const
VERIFY_NOT_REACHED();
}
return action_text_builder.to_deprecated_string();
return action_text_builder.to_byte_string();
}
ReplaceAllTextCommand::ReplaceAllTextCommand(GUI::TextDocument& document, DeprecatedString const& text, DeprecatedString const& action_text)
ReplaceAllTextCommand::ReplaceAllTextCommand(GUI::TextDocument& document, ByteString const& text, ByteString const& action_text)
: TextDocumentUndoCommand(document)
, m_original_text(document.text())
, m_new_text(text)
@ -917,7 +917,7 @@ bool ReplaceAllTextCommand::merge_with(GUI::Command const&)
return false;
}
DeprecatedString ReplaceAllTextCommand::action_text() const
ByteString ReplaceAllTextCommand::action_text() const
{
return m_action_text;
}
@ -931,7 +931,7 @@ IndentSelection::IndentSelection(TextDocument& document, size_t tab_width, TextR
void IndentSelection::redo()
{
auto const tab = DeprecatedString::repeated(' ', m_tab_width);
auto const tab = ByteString::repeated(' ', m_tab_width);
for (size_t i = m_range.start().line(); i <= m_range.end().line(); i++) {
m_document.insert_at({ i, 0 }, tab, m_client);
@ -970,7 +970,7 @@ void UnindentSelection::redo()
void UnindentSelection::undo()
{
auto const tab = DeprecatedString::repeated(' ', m_tab_width);
auto const tab = ByteString::repeated(' ', m_tab_width);
for (size_t i = m_range.start().line(); i <= m_range.end().line(); i++)
m_document.insert_at({ i, 0 }, tab, m_client);

View file

@ -84,8 +84,8 @@ public:
virtual void update_views(Badge<TextDocumentLine>) override;
DeprecatedString text() const;
DeprecatedString text_in_range(TextRange const&) const;
ByteString text() const;
ByteString text_in_range(TextRange const&) const;
Vector<TextRange> find_all(StringView needle, bool regmatch = false, bool match_case = true);
@ -147,7 +147,7 @@ private:
size_t m_regex_result_match_capture_group_index { 0 };
bool m_regex_needs_update { true };
DeprecatedString m_regex_needle;
ByteString m_regex_needle;
};
class TextDocumentUndoCommand : public Command {
@ -173,33 +173,33 @@ protected:
class InsertTextCommand : public TextDocumentUndoCommand {
public:
InsertTextCommand(TextDocument&, DeprecatedString const&, TextPosition const&);
InsertTextCommand(TextDocument&, ByteString const&, TextPosition const&);
virtual ~InsertTextCommand() = default;
virtual void perform_formatting(TextDocument::Client const&) override;
virtual void undo() override;
virtual void redo() override;
virtual bool merge_with(GUI::Command const&) override;
virtual DeprecatedString action_text() const override;
DeprecatedString const& text() const { return m_text; }
virtual ByteString action_text() const override;
ByteString const& text() const { return m_text; }
TextRange const& range() const { return m_range; }
private:
DeprecatedString m_text;
ByteString m_text;
TextRange m_range;
};
class RemoveTextCommand : public TextDocumentUndoCommand {
public:
RemoveTextCommand(TextDocument&, DeprecatedString const&, TextRange const&, TextPosition const&);
RemoveTextCommand(TextDocument&, ByteString const&, TextRange const&, TextPosition const&);
virtual ~RemoveTextCommand() = default;
virtual void undo() override;
virtual void redo() override;
TextRange const& range() const { return m_range; }
virtual bool merge_with(GUI::Command const&) override;
virtual DeprecatedString action_text() const override;
virtual ByteString action_text() const override;
private:
DeprecatedString m_text;
ByteString m_text;
TextRange m_range;
TextPosition m_original_cursor_position;
};
@ -211,35 +211,35 @@ public:
Below,
};
InsertLineCommand(TextDocument&, TextPosition, DeprecatedString&&, InsertPosition);
InsertLineCommand(TextDocument&, TextPosition, ByteString&&, InsertPosition);
virtual ~InsertLineCommand() = default;
virtual void undo() override;
virtual void redo() override;
virtual DeprecatedString action_text() const override;
virtual ByteString action_text() const override;
private:
size_t compute_line_number() const;
TextPosition m_cursor;
DeprecatedString m_text;
ByteString m_text;
InsertPosition m_pos;
};
class ReplaceAllTextCommand final : public GUI::TextDocumentUndoCommand {
public:
ReplaceAllTextCommand(GUI::TextDocument& document, DeprecatedString const& new_text, DeprecatedString const& action_text);
ReplaceAllTextCommand(GUI::TextDocument& document, ByteString const& new_text, ByteString const& action_text);
virtual ~ReplaceAllTextCommand() = default;
void redo() override;
void undo() override;
bool merge_with(GUI::Command const&) override;
DeprecatedString action_text() const override;
DeprecatedString const& text() const { return m_new_text; }
ByteString action_text() const override;
ByteString const& text() const { return m_new_text; }
private:
DeprecatedString m_original_text;
DeprecatedString m_new_text;
DeprecatedString m_action_text;
ByteString m_original_text;
ByteString m_new_text;
ByteString m_action_text;
};
class IndentSelection : public TextDocumentUndoCommand {

Some files were not shown because too many files have changed in this diff Show more