mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:27:36 +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:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -122,17 +122,17 @@ ClockWidget::ClockWidget()
|
|||
};
|
||||
}
|
||||
|
||||
void ClockWidget::update_format(DeprecatedString const& format)
|
||||
void ClockWidget::update_format(ByteString const& format)
|
||||
{
|
||||
m_time_format = format;
|
||||
m_time_width = font().width(Core::DateTime::create(122, 2, 22, 22, 22, 22).to_deprecated_string(format));
|
||||
m_time_width = font().width(Core::DateTime::create(122, 2, 22, 22, 22, 22).to_byte_string(format));
|
||||
set_fixed_size(m_time_width + 20, 21);
|
||||
}
|
||||
|
||||
void ClockWidget::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Frame::paint_event(event);
|
||||
auto time_text = Core::DateTime::now().to_deprecated_string(m_time_format);
|
||||
auto time_text = Core::DateTime::now().to_byte_string(m_time_format);
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(frame_inner_rect());
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class ClockWidget final : public GUI::Frame {
|
|||
public:
|
||||
virtual ~ClockWidget() override = default;
|
||||
|
||||
void update_format(DeprecatedString const&);
|
||||
void update_format(ByteString const&);
|
||||
|
||||
private:
|
||||
ClockWidget();
|
||||
|
@ -47,7 +47,7 @@ private:
|
|||
|
||||
void update_selected_calendar_button();
|
||||
|
||||
DeprecatedString m_time_format;
|
||||
ByteString m_time_format;
|
||||
RefPtr<GUI::Window> m_calendar_window;
|
||||
RefPtr<GUI::Calendar> m_calendar;
|
||||
RefPtr<GUI::Button> m_next_date;
|
||||
|
|
|
@ -27,22 +27,22 @@
|
|||
|
||||
namespace Taskbar {
|
||||
|
||||
static DeprecatedString sanitize_name(DeprecatedString const& name)
|
||||
static ByteString sanitize_name(ByteString const& name)
|
||||
{
|
||||
return name.replace(" "sv, ""sv).replace("="sv, ""sv);
|
||||
}
|
||||
|
||||
static DeprecatedString entry_to_config_string(size_t index, NonnullOwnPtr<QuickLaunchEntry> const& entry)
|
||||
static ByteString entry_to_config_string(size_t index, NonnullOwnPtr<QuickLaunchEntry> const& entry)
|
||||
{
|
||||
return DeprecatedString::formatted("{}:{}", index, entry->path());
|
||||
return ByteString::formatted("{}:{}", index, entry->path());
|
||||
}
|
||||
|
||||
OwnPtr<QuickLaunchEntry> QuickLaunchEntry::create_from_path(StringView path)
|
||||
{
|
||||
if (path.ends_with(".af"sv)) {
|
||||
auto af_path = path.to_deprecated_string();
|
||||
auto af_path = path.to_byte_string();
|
||||
if (!path.starts_with('/'))
|
||||
af_path = DeprecatedString::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, path);
|
||||
af_path = ByteString::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, path);
|
||||
|
||||
return make<QuickLaunchEntryAppFile>(Desktop::AppFile::open(af_path));
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ GUI::Icon QuickLaunchEntryExecutable::icon() const
|
|||
return GUI::FileIconProvider::icon_for_executable(m_path);
|
||||
}
|
||||
|
||||
DeprecatedString QuickLaunchEntryExecutable::name() const
|
||||
ByteString QuickLaunchEntryExecutable::name() const
|
||||
{
|
||||
return LexicalPath { m_path }.basename();
|
||||
}
|
||||
|
@ -128,11 +128,11 @@ ErrorOr<bool> QuickLaunchWidget::add_from_pid(pid_t pid_to_add)
|
|||
if (pid != pid_to_add)
|
||||
continue;
|
||||
|
||||
auto executable = process_object.get_deprecated_string("executable"sv);
|
||||
auto executable = process_object.get_byte_string("executable"sv);
|
||||
if (!executable.has_value())
|
||||
break;
|
||||
|
||||
auto maybe_name = process_object.get_deprecated_string("name"sv);
|
||||
auto maybe_name = process_object.get_byte_string("name"sv);
|
||||
if (!maybe_name.has_value())
|
||||
break;
|
||||
|
||||
|
@ -184,7 +184,7 @@ void QuickLaunchWidget::drop_event(GUI::DropEvent& event)
|
|||
if (entry) {
|
||||
auto result = update_entry(entry->name(), entry.release_nonnull());
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to add quick launch entry: {}", result.release_error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to add quick launch entry: {}", result.release_error()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ void QuickLaunchWidget::mousemove_event(GUI::MouseEvent& event)
|
|||
m_dragging = true;
|
||||
|
||||
if (entry->is_hovered())
|
||||
GUI::Application::the()->show_tooltip(String::from_deprecated_string(entry->name()).release_value_but_fixme_should_propagate_errors(), this);
|
||||
GUI::Application::the()->show_tooltip(String::from_byte_string(entry->name()).release_value_but_fixme_should_propagate_errors(), this);
|
||||
});
|
||||
|
||||
if (m_dragging)
|
||||
|
@ -228,7 +228,7 @@ void QuickLaunchWidget::mouseup_event(GUI::MouseEvent& event)
|
|||
auto result = entry->launch();
|
||||
if (result.is_error()) {
|
||||
// FIXME: This message box is displayed in a weird position
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to open quick launch entry: {}", result.release_error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to open quick launch entry: {}", result.release_error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ void QuickLaunchWidget::load_entries(bool save)
|
|||
{
|
||||
struct ConfigEntry {
|
||||
int index;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
};
|
||||
|
||||
Vector<ConfigEntry> config_entries;
|
||||
|
@ -386,7 +386,7 @@ void QuickLaunchWidget::add_entries(Vector<NonnullOwnPtr<QuickLaunchEntry>> entr
|
|||
repaint();
|
||||
}
|
||||
|
||||
ErrorOr<void> QuickLaunchWidget::update_entry(DeprecatedString const& button_name, NonnullOwnPtr<QuickLaunchEntry> entry, bool save)
|
||||
ErrorOr<void> QuickLaunchWidget::update_entry(ByteString const& button_name, NonnullOwnPtr<QuickLaunchEntry> entry, bool save)
|
||||
{
|
||||
auto file_name_to_watch = entry->file_name_to_watch();
|
||||
if (!file_name_to_watch.is_empty()) {
|
||||
|
@ -446,7 +446,7 @@ void QuickLaunchWidget::set_or_insert_entry(NonnullOwnPtr<QuickLaunchEntry> entr
|
|||
m_entries.append(move(entry));
|
||||
}
|
||||
|
||||
void QuickLaunchWidget::remove_entry(DeprecatedString const& name, bool save)
|
||||
void QuickLaunchWidget::remove_entry(ByteString const& name, bool save)
|
||||
{
|
||||
for (size_t i = 0; i < m_entries.size(); i++) {
|
||||
if (m_entries[i]->name() != name)
|
||||
|
|
|
@ -25,10 +25,10 @@ public:
|
|||
virtual ~QuickLaunchEntry() = default;
|
||||
virtual ErrorOr<void> launch() const = 0;
|
||||
virtual GUI::Icon icon() const = 0;
|
||||
virtual DeprecatedString name() const = 0;
|
||||
virtual DeprecatedString file_name_to_watch() const = 0;
|
||||
virtual ByteString name() const = 0;
|
||||
virtual ByteString file_name_to_watch() const = 0;
|
||||
|
||||
virtual DeprecatedString path() = 0;
|
||||
virtual ByteString path() = 0;
|
||||
|
||||
bool is_hovered() const { return m_hovered; }
|
||||
void set_hovered(bool hovered) { m_hovered = hovered; }
|
||||
|
@ -50,10 +50,10 @@ public:
|
|||
|
||||
virtual ErrorOr<void> launch() const override;
|
||||
virtual GUI::Icon icon() const override { return m_app_file->icon(); }
|
||||
virtual DeprecatedString name() const override { return m_app_file->name(); }
|
||||
virtual DeprecatedString file_name_to_watch() const override { return {}; }
|
||||
virtual ByteString name() const override { return m_app_file->name(); }
|
||||
virtual ByteString file_name_to_watch() const override { return {}; }
|
||||
|
||||
virtual DeprecatedString path() override { return m_app_file->filename(); }
|
||||
virtual ByteString path() override { return m_app_file->filename(); }
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Desktop::AppFile> m_app_file;
|
||||
|
@ -61,37 +61,37 @@ private:
|
|||
|
||||
class QuickLaunchEntryExecutable : public QuickLaunchEntry {
|
||||
public:
|
||||
explicit QuickLaunchEntryExecutable(DeprecatedString path)
|
||||
explicit QuickLaunchEntryExecutable(ByteString path)
|
||||
: m_path(move(path))
|
||||
{
|
||||
}
|
||||
|
||||
virtual ErrorOr<void> launch() const override;
|
||||
virtual GUI::Icon icon() const override;
|
||||
virtual DeprecatedString name() const override;
|
||||
virtual DeprecatedString file_name_to_watch() const override { return m_path; }
|
||||
virtual ByteString name() const override;
|
||||
virtual ByteString file_name_to_watch() const override { return m_path; }
|
||||
|
||||
virtual DeprecatedString path() override { return m_path; }
|
||||
virtual ByteString path() override { return m_path; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_path;
|
||||
ByteString m_path;
|
||||
};
|
||||
class QuickLaunchEntryFile : public QuickLaunchEntry {
|
||||
public:
|
||||
explicit QuickLaunchEntryFile(DeprecatedString path)
|
||||
explicit QuickLaunchEntryFile(ByteString path)
|
||||
: m_path(move(path))
|
||||
{
|
||||
}
|
||||
|
||||
virtual ErrorOr<void> launch() const override;
|
||||
virtual GUI::Icon icon() const override;
|
||||
virtual DeprecatedString name() const override { return m_path; }
|
||||
virtual DeprecatedString file_name_to_watch() const override { return m_path; }
|
||||
virtual ByteString name() const override { return m_path; }
|
||||
virtual ByteString file_name_to_watch() const override { return m_path; }
|
||||
|
||||
virtual DeprecatedString path() override { return m_path; }
|
||||
virtual ByteString path() override { return m_path; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_path;
|
||||
ByteString m_path;
|
||||
};
|
||||
|
||||
class QuickLaunchWidget : public GUI::Frame
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
ErrorOr<void> create_context_menu();
|
||||
|
||||
void load_entries(bool save = true);
|
||||
ErrorOr<void> update_entry(DeprecatedString const&, NonnullOwnPtr<QuickLaunchEntry>, bool save = true);
|
||||
ErrorOr<void> update_entry(ByteString const&, NonnullOwnPtr<QuickLaunchEntry>, bool save = true);
|
||||
void add_entries(Vector<NonnullOwnPtr<QuickLaunchEntry>> entries, bool save = true);
|
||||
|
||||
template<typename Callback>
|
||||
|
@ -142,7 +142,7 @@ private:
|
|||
void repaint();
|
||||
|
||||
void set_or_insert_entry(NonnullOwnPtr<QuickLaunchEntry>, bool save = true);
|
||||
void remove_entry(DeprecatedString const&, bool save = true);
|
||||
void remove_entry(ByteString const&, bool save = true);
|
||||
void recalculate_order();
|
||||
|
||||
bool m_dragging { false };
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
|
||||
RefPtr<GUI::Menu> m_context_menu;
|
||||
RefPtr<GUI::Action> m_context_menu_default_action;
|
||||
DeprecatedString m_context_menu_app_name;
|
||||
ByteString m_context_menu_app_name;
|
||||
RefPtr<Core::FileWatcher> m_watcher;
|
||||
|
||||
Vector<NonnullOwnPtr<QuickLaunchEntry>> m_entries;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "ShutdownDialog.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
|
@ -17,7 +17,7 @@
|
|||
#include <LibGfx/Font/FontDatabase.h>
|
||||
|
||||
struct Option {
|
||||
DeprecatedString title;
|
||||
ByteString title;
|
||||
ShutdownDialog::Command command;
|
||||
bool enabled;
|
||||
bool default_action;
|
||||
|
@ -74,7 +74,7 @@ ShutdownDialog::ShutdownDialog()
|
|||
auto action = options[i];
|
||||
auto& radio = right_container.add<GUI::RadioButton>();
|
||||
radio.set_enabled(action.enabled);
|
||||
radio.set_text(String::from_deprecated_string(action.title).release_value_but_fixme_should_propagate_errors());
|
||||
radio.set_text(String::from_byte_string(action.title).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
radio.on_checked = [this, i](auto) {
|
||||
m_selected_option = i;
|
||||
|
|
|
@ -200,8 +200,8 @@ void TaskbarWindow::update_window_button(::Window& window, bool show_as_active)
|
|||
auto* button = window.button();
|
||||
if (!button)
|
||||
return;
|
||||
button->set_text(String::from_deprecated_string(window.title()).release_value_but_fixme_should_propagate_errors());
|
||||
button->set_tooltip(String::from_deprecated_string(window.title()).release_value_but_fixme_should_propagate_errors());
|
||||
button->set_text(String::from_byte_string(window.title()).release_value_but_fixme_should_propagate_errors());
|
||||
button->set_tooltip(String::from_byte_string(window.title()).release_value_but_fixme_should_propagate_errors());
|
||||
button->set_checked(show_as_active);
|
||||
button->set_visible(is_window_on_current_workspace(window));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "WindowIdentifier.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
@ -27,8 +27,8 @@ public:
|
|||
|
||||
WindowIdentifier const& identifier() const { return m_identifier; }
|
||||
|
||||
DeprecatedString title() const { return m_title; }
|
||||
void set_title(DeprecatedString const& title) { m_title = title; }
|
||||
ByteString title() const { return m_title; }
|
||||
void set_title(ByteString const& title) { m_title = title; }
|
||||
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
void set_rect(Gfx::IntRect const& rect) { m_rect = rect; }
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
private:
|
||||
WindowIdentifier m_identifier;
|
||||
DeprecatedString m_title;
|
||||
ByteString m_title;
|
||||
Gfx::IntRect m_rect;
|
||||
RefPtr<GUI::Button> m_button;
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories();
|
||||
static ErrorOr<Vector<ByteString>> discover_apps_and_categories();
|
||||
static ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window&);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
@ -76,10 +76,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
struct AppMetadata {
|
||||
DeprecatedString executable;
|
||||
DeprecatedString name;
|
||||
DeprecatedString category;
|
||||
DeprecatedString working_directory;
|
||||
ByteString executable;
|
||||
ByteString name;
|
||||
ByteString category;
|
||||
ByteString working_directory;
|
||||
GUI::Icon icon;
|
||||
bool run_in_terminal;
|
||||
bool requires_root;
|
||||
|
@ -92,9 +92,9 @@ Vector<Gfx::SystemThemeMetaData> g_themes;
|
|||
RefPtr<GUI::Menu> g_themes_menu;
|
||||
GUI::ActionGroup g_themes_group;
|
||||
|
||||
ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories()
|
||||
ErrorOr<Vector<ByteString>> discover_apps_and_categories()
|
||||
{
|
||||
HashTable<DeprecatedString> seen_app_categories;
|
||||
HashTable<ByteString> seen_app_categories;
|
||||
Desktop::AppFile::for_each([&](auto af) {
|
||||
if (af->exclude_from_system_menu())
|
||||
return;
|
||||
|
@ -105,7 +105,7 @@ ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories()
|
|||
});
|
||||
quick_sort(g_apps, [](auto& a, auto& b) { return a.name < b.name; });
|
||||
|
||||
Vector<DeprecatedString> sorted_app_categories;
|
||||
Vector<ByteString> sorted_app_categories;
|
||||
TRY(sorted_app_categories.try_ensure_capacity(seen_app_categories.size()));
|
||||
for (auto const& category : seen_app_categories)
|
||||
sorted_app_categories.unchecked_append(category);
|
||||
|
@ -116,7 +116,7 @@ ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories()
|
|||
|
||||
ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
|
||||
{
|
||||
Vector<DeprecatedString> const sorted_app_categories = TRY(discover_apps_and_categories());
|
||||
Vector<ByteString> const sorted_app_categories = TRY(discover_apps_and_categories());
|
||||
auto system_menu = GUI::Menu::construct("\xE2\x9A\xA1"_string); // HIGH VOLTAGE SIGN
|
||||
|
||||
system_menu->add_action(GUI::Action::create("&About SerenityOS", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/ladyball.png"sv)), [&](auto&) {
|
||||
|
@ -127,13 +127,13 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
|
|||
|
||||
// First we construct all the necessary app category submenus.
|
||||
auto category_icons = TRY(Core::ConfigFile::open("/res/icons/SystemMenu.ini"));
|
||||
HashMap<DeprecatedString, NonnullRefPtr<GUI::Menu>> app_category_menus;
|
||||
HashMap<ByteString, NonnullRefPtr<GUI::Menu>> app_category_menus;
|
||||
|
||||
Function<void(DeprecatedString const&)> create_category_menu;
|
||||
create_category_menu = [&](DeprecatedString const& category) {
|
||||
Function<void(ByteString const&)> create_category_menu;
|
||||
create_category_menu = [&](ByteString const& category) {
|
||||
if (app_category_menus.contains(category))
|
||||
return;
|
||||
DeprecatedString parent_category, child_category = category;
|
||||
ByteString parent_category, child_category = category;
|
||||
for (ssize_t i = category.length() - 1; i >= 0; i--) {
|
||||
if (category[i] == '/') {
|
||||
parent_category = category.substring(0, i);
|
||||
|
@ -151,7 +151,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
|
|||
VERIFY(parent_menu);
|
||||
}
|
||||
}
|
||||
auto category_menu = parent_menu->add_submenu(String::from_deprecated_string(child_category).release_value_but_fixme_should_propagate_errors());
|
||||
auto category_menu = parent_menu->add_submenu(String::from_byte_string(child_category).release_value_but_fixme_should_propagate_errors());
|
||||
auto category_icon_path = category_icons->read_entry("16x16", category);
|
||||
if (!category_icon_path.is_empty()) {
|
||||
auto icon_or_error = Gfx::Bitmap::load_from_file(category_icon_path);
|
||||
|
@ -181,7 +181,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
|
|||
StringView executable;
|
||||
Vector<char const*, 2> arguments;
|
||||
// FIXME: These single quotes won't be enough for executables with single quotes in their name.
|
||||
auto pls_with_executable = DeprecatedString::formatted("/bin/pls '{}'", app.executable);
|
||||
auto pls_with_executable = ByteString::formatted("/bin/pls '{}'", app.executable);
|
||||
if (app.run_in_terminal && !app.requires_root) {
|
||||
executable = "/bin/Terminal"sv;
|
||||
arguments = { "-e", app.executable.characters() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue