mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:57:44 +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
|
@ -292,13 +292,13 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
|
|||
bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
if (!filename.bytes_as_string_view().ends_with(".obj"sv)) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto new_mesh = m_mesh_loader->load(filename, move(file));
|
||||
if (new_mesh.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Reading \"{}\" failed: {}", filename, new_mesh.release_error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Reading \"{}\" failed: {}", filename, new_mesh.release_error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr<Core::File
|
|||
m_mesh = new_mesh.release_value();
|
||||
dbgln("3DFileViewer: mesh has {} triangles.", m_mesh->triangle_count());
|
||||
|
||||
window()->set_title(DeprecatedString::formatted("{} - 3D File Viewer", filename));
|
||||
window()->set_title(ByteString::formatted("{} - 3D File Viewer", filename));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto file = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, filename);
|
||||
if (file.is_error()) {
|
||||
if (file.error().code() != ENOENT)
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return 1;
|
||||
}
|
||||
widget->load_file(file.value().filename(), file.value().release_stream());
|
||||
|
|
|
@ -130,7 +130,7 @@ void AnalogClock::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
void AnalogClock::update_title_date()
|
||||
{
|
||||
window()->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
|
||||
window()->set_title(Core::DateTime::now().to_byte_string("%Y-%m-%d"sv));
|
||||
}
|
||||
|
||||
void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event)
|
||||
|
|
|
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock"sv));
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
|
||||
window->set_title(Core::DateTime::now().to_byte_string("%Y-%m-%d"sv));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->resize(170, 170);
|
||||
window->set_resizable(false);
|
||||
|
|
|
@ -70,7 +70,7 @@ AppProvider::AppProvider()
|
|||
});
|
||||
}
|
||||
|
||||
void AppProvider::query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
void AppProvider::query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
{
|
||||
if (query.starts_with('=') || query.starts_with('$'))
|
||||
return;
|
||||
|
@ -80,7 +80,7 @@ void AppProvider::query(DeprecatedString const& query, Function<void(Vector<Nonn
|
|||
for (auto const& app_file : m_app_file_cache) {
|
||||
auto query_and_arguments = query.split_limit(' ', 2);
|
||||
auto app_name = query_and_arguments.is_empty() ? query : query_and_arguments[0];
|
||||
auto arguments = query_and_arguments.size() < 2 ? DeprecatedString::empty() : query_and_arguments[1];
|
||||
auto arguments = query_and_arguments.size() < 2 ? ByteString::empty() : query_and_arguments[1];
|
||||
auto score = 0;
|
||||
if (app_name.equals_ignoring_ascii_case(app_file->name()))
|
||||
score = NumericLimits<int>::max();
|
||||
|
@ -98,7 +98,7 @@ void AppProvider::query(DeprecatedString const& query, Function<void(Vector<Nonn
|
|||
on_complete(move(results));
|
||||
}
|
||||
|
||||
void CalculatorProvider::query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
void CalculatorProvider::query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
{
|
||||
if (!query.starts_with('='))
|
||||
return;
|
||||
|
@ -116,11 +116,11 @@ void CalculatorProvider::query(DeprecatedString const& query, Function<void(Vect
|
|||
return;
|
||||
|
||||
auto result = completion.release_value();
|
||||
DeprecatedString calculation;
|
||||
ByteString calculation;
|
||||
if (!result.is_number()) {
|
||||
calculation = "0";
|
||||
} else {
|
||||
calculation = result.to_string_without_side_effects().to_deprecated_string();
|
||||
calculation = result.to_string_without_side_effects().to_byte_string();
|
||||
}
|
||||
|
||||
Vector<NonnullRefPtr<Result>> results;
|
||||
|
@ -138,7 +138,7 @@ FileProvider::FileProvider()
|
|||
build_filesystem_cache();
|
||||
}
|
||||
|
||||
void FileProvider::query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
void FileProvider::query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
{
|
||||
build_filesystem_cache();
|
||||
|
||||
|
@ -147,7 +147,7 @@ void FileProvider::query(DeprecatedString const& query, Function<void(Vector<Non
|
|||
|
||||
m_fuzzy_match_work = Threading::BackgroundAction<Optional<Vector<NonnullRefPtr<Result>>>>::construct(
|
||||
[this, query](auto& task) -> Optional<Vector<NonnullRefPtr<Result>>> {
|
||||
BinaryHeap<int, DeprecatedString, MAX_SEARCH_RESULTS> sorted_results;
|
||||
BinaryHeap<int, ByteString, MAX_SEARCH_RESULTS> sorted_results;
|
||||
|
||||
for (auto& path : m_full_path_cache) {
|
||||
if (task.is_canceled())
|
||||
|
@ -204,7 +204,7 @@ void FileProvider::build_filesystem_cache()
|
|||
|
||||
(void)Threading::BackgroundAction<int>::construct(
|
||||
[this, strong_ref = NonnullRefPtr(*this)](auto&) {
|
||||
DeprecatedString slash = "/";
|
||||
ByteString slash = "/";
|
||||
auto timer = Core::ElapsedTimer::start_new();
|
||||
while (!m_work_queue.is_empty()) {
|
||||
auto base_directory = m_work_queue.dequeue();
|
||||
|
@ -241,7 +241,7 @@ void FileProvider::build_filesystem_cache()
|
|||
});
|
||||
}
|
||||
|
||||
void TerminalProvider::query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
void TerminalProvider::query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
{
|
||||
if (!query.starts_with('$'))
|
||||
return;
|
||||
|
@ -253,7 +253,7 @@ void TerminalProvider::query(DeprecatedString const& query, Function<void(Vector
|
|||
on_complete(move(results));
|
||||
}
|
||||
|
||||
void URLProvider::query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
void URLProvider::query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete)
|
||||
{
|
||||
if (query.is_empty() || query.starts_with('=') || query.starts_with('$'))
|
||||
return;
|
||||
|
@ -263,7 +263,7 @@ void URLProvider::query(DeprecatedString const& query, Function<void(Vector<Nonn
|
|||
if (url.scheme().is_empty())
|
||||
url.set_scheme("http"_string);
|
||||
if (url.host().has<Empty>() || url.host() == String {})
|
||||
url.set_host(String::from_deprecated_string(query).release_value_but_fixme_should_propagate_errors());
|
||||
url.set_host(String::from_byte_string(query).release_value_but_fixme_should_propagate_errors());
|
||||
if (url.path_segment_count() == 0)
|
||||
url.set_paths({ "" });
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
virtual Gfx::Bitmap const* bitmap() const = 0;
|
||||
|
||||
DeprecatedString const& title() const { return m_title; }
|
||||
ByteString const& title() const { return m_title; }
|
||||
String const& tooltip() const { return m_tooltip; }
|
||||
int score() const { return m_score; }
|
||||
bool equals(Result const& other) const
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
Result(DeprecatedString title, String tooltip, int score = 0)
|
||||
Result(ByteString title, String tooltip, int score = 0)
|
||||
: m_title(move(title))
|
||||
, m_tooltip(move(tooltip))
|
||||
, m_score(score)
|
||||
|
@ -46,14 +46,14 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
DeprecatedString m_title;
|
||||
ByteString m_title;
|
||||
String m_tooltip;
|
||||
int m_score { 0 };
|
||||
};
|
||||
|
||||
class AppResult final : public Result {
|
||||
public:
|
||||
AppResult(RefPtr<Gfx::Bitmap const> bitmap, DeprecatedString title, String tooltip, NonnullRefPtr<Desktop::AppFile> af, DeprecatedString arguments, int score)
|
||||
AppResult(RefPtr<Gfx::Bitmap const> bitmap, ByteString title, String tooltip, NonnullRefPtr<Desktop::AppFile> af, ByteString arguments, int score)
|
||||
: Result(move(title), move(tooltip), score)
|
||||
, m_app_file(move(af))
|
||||
, m_arguments(move(arguments))
|
||||
|
@ -67,13 +67,13 @@ public:
|
|||
|
||||
private:
|
||||
NonnullRefPtr<Desktop::AppFile> m_app_file;
|
||||
DeprecatedString m_arguments;
|
||||
ByteString m_arguments;
|
||||
RefPtr<Gfx::Bitmap const> m_bitmap;
|
||||
};
|
||||
|
||||
class CalculatorResult final : public Result {
|
||||
public:
|
||||
explicit CalculatorResult(DeprecatedString title)
|
||||
explicit CalculatorResult(ByteString title)
|
||||
: Result(move(title), "Copy to Clipboard"_string, 100)
|
||||
, m_bitmap(GUI::Icon::default_icon("app-calculator"sv).bitmap_for_size(16))
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
|
||||
class FileResult final : public Result {
|
||||
public:
|
||||
explicit FileResult(DeprecatedString title, int score)
|
||||
explicit FileResult(ByteString title, int score)
|
||||
: Result(move(title), String(), score)
|
||||
{
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
class TerminalResult final : public Result {
|
||||
public:
|
||||
explicit TerminalResult(DeprecatedString command)
|
||||
explicit TerminalResult(ByteString command)
|
||||
: Result(move(command), "Run command in Terminal"_string, 100)
|
||||
, m_bitmap(GUI::Icon::default_icon("app-terminal"sv).bitmap_for_size(16))
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
class URLResult final : public Result {
|
||||
public:
|
||||
explicit URLResult(const URL& url)
|
||||
: Result(url.to_deprecated_string(), "Open URL in Browser"_string, 50)
|
||||
: Result(url.to_byte_string(), "Open URL in Browser"_string, 50)
|
||||
, m_bitmap(GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16))
|
||||
{
|
||||
}
|
||||
|
@ -135,14 +135,14 @@ class Provider : public RefCounted<Provider> {
|
|||
public:
|
||||
virtual ~Provider() = default;
|
||||
|
||||
virtual void query(DeprecatedString const&, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) = 0;
|
||||
virtual void query(ByteString const&, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) = 0;
|
||||
};
|
||||
|
||||
class AppProvider final : public Provider {
|
||||
public:
|
||||
AppProvider();
|
||||
|
||||
void query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
|
||||
private:
|
||||
Vector<NonnullRefPtr<Desktop::AppFile>> m_app_file_cache;
|
||||
|
@ -150,31 +150,31 @@ private:
|
|||
|
||||
class CalculatorProvider final : public Provider {
|
||||
public:
|
||||
void query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
};
|
||||
|
||||
class FileProvider final : public Provider {
|
||||
public:
|
||||
FileProvider();
|
||||
|
||||
void query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void build_filesystem_cache();
|
||||
|
||||
private:
|
||||
RefPtr<Threading::BackgroundAction<Optional<Vector<NonnullRefPtr<Result>>>>> m_fuzzy_match_work;
|
||||
bool m_building_cache { false };
|
||||
Vector<DeprecatedString> m_full_path_cache;
|
||||
Queue<DeprecatedString> m_work_queue;
|
||||
Vector<ByteString> m_full_path_cache;
|
||||
Queue<ByteString> m_work_queue;
|
||||
};
|
||||
|
||||
class TerminalProvider final : public Provider {
|
||||
public:
|
||||
void query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
};
|
||||
|
||||
class URLProvider final : public Provider {
|
||||
public:
|
||||
void query(DeprecatedString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
void query(ByteString const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Providers.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
|
@ -40,7 +40,7 @@ struct AppState {
|
|||
size_t visible_result_count { 0 };
|
||||
|
||||
Threading::Mutex lock;
|
||||
DeprecatedString last_query;
|
||||
ByteString last_query;
|
||||
};
|
||||
|
||||
class ResultRow final : public GUI::Button {
|
||||
|
@ -57,7 +57,7 @@ class ResultRow final : public GUI::Button {
|
|||
if (!m_context_menu) {
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
|
||||
if (LexicalPath path { text().to_deprecated_string() }; path.is_absolute()) {
|
||||
if (LexicalPath path { text().to_byte_string() }; path.is_absolute()) {
|
||||
m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
}));
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
Function<void(Vector<NonnullRefPtr<Result const>>&&)> on_new_results;
|
||||
|
||||
void search(DeprecatedString const& query)
|
||||
void search(ByteString const& query)
|
||||
{
|
||||
auto should_display_precached_results = false;
|
||||
for (size_t i = 0; i < ProviderCount; ++i) {
|
||||
|
@ -139,7 +139,7 @@ private:
|
|||
Array<NonnullRefPtr<Provider>, ProviderCount> m_providers;
|
||||
|
||||
Threading::Mutex m_mutex;
|
||||
HashMap<DeprecatedString, Array<OwnPtr<Vector<NonnullRefPtr<Result>>>, ProviderCount>> m_result_cache;
|
||||
HashMap<ByteString, Array<OwnPtr<Vector<NonnullRefPtr<Result>>>, ProviderCount>> m_result_cache;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& result = app_state.results[i];
|
||||
auto& match = results_container.add<Assistant::ResultRow>();
|
||||
match.set_icon(result->bitmap());
|
||||
match.set_text(String::from_deprecated_string(result->title()).release_value_but_fixme_should_propagate_errors());
|
||||
match.set_text(String::from_byte_string(result->title()).release_value_but_fixme_should_propagate_errors());
|
||||
match.set_tooltip(result->tooltip());
|
||||
match.on_click = [&result](auto) {
|
||||
result->activate();
|
||||
|
|
|
@ -88,12 +88,12 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
DeprecatedString title() const
|
||||
ByteString title() const
|
||||
{
|
||||
return m_title_textbox->text();
|
||||
}
|
||||
|
||||
DeprecatedString url() const
|
||||
ByteString url() const
|
||||
{
|
||||
return m_url_textbox->text();
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled)
|
||||
BookmarksBarWidget::BookmarksBarWidget(ByteString const& bookmarks_file, bool enabled)
|
||||
{
|
||||
s_the = this;
|
||||
set_layout<GUI::HorizontalBoxLayout>(2, 0);
|
||||
|
@ -207,8 +207,8 @@ void BookmarksBarWidget::model_did_update(unsigned)
|
|||
int width = 0;
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
|
||||
auto title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||
auto url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto title = model()->index(item_index, 0).data().to_byte_string();
|
||||
auto url = model()->index(item_index, 1).data().to_byte_string();
|
||||
|
||||
Gfx::IntRect rect { width, 0, font().width_rounded_up(title) + 32, height() };
|
||||
|
||||
|
@ -216,12 +216,12 @@ void BookmarksBarWidget::model_did_update(unsigned)
|
|||
m_bookmarks.append(button);
|
||||
|
||||
button.set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||
button.set_text(String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
|
||||
button.set_text(String::from_byte_string(title).release_value_but_fixme_should_propagate_errors());
|
||||
button.set_icon(g_icon_bag.filetype_html);
|
||||
button.set_fixed_size(font().width(title) + 32, 20);
|
||||
button.set_relative_rect(rect);
|
||||
button.set_focus_policy(GUI::FocusPolicy::TabFocus);
|
||||
button.set_tooltip(MUST(String::from_deprecated_string(url)));
|
||||
button.set_tooltip(MUST(String::from_byte_string(url)));
|
||||
button.set_allowed_mouse_buttons_for_pressing(GUI::MouseButton::Primary | GUI::MouseButton::Middle);
|
||||
|
||||
button.on_click = [title, url, this](auto) {
|
||||
|
@ -275,7 +275,7 @@ void BookmarksBarWidget::update_content_size()
|
|||
for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) {
|
||||
auto& bookmark = m_bookmarks.at(i);
|
||||
bookmark->set_visible(false);
|
||||
m_additional_menu->add_action(GUI::Action::create(bookmark->text().to_deprecated_string(), g_icon_bag.filetype_html, [&](auto&) { bookmark->on_click(0); }));
|
||||
m_additional_menu->add_action(GUI::Action::create(bookmark->text().to_byte_string(), g_icon_bag.filetype_html, [&](auto&) { bookmark->on_click(0); }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ bool BookmarksBarWidget::contains_bookmark(StringView url)
|
|||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
|
||||
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto item_url = model()->index(item_index, 1).data().to_byte_string();
|
||||
if (item_url == url) {
|
||||
return true;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ ErrorOr<void> BookmarksBarWidget::remove_bookmark(StringView url)
|
|||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
|
||||
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto item_url = model()->index(item_index, 1).data().to_byte_string();
|
||||
if (item_url == url) {
|
||||
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
|
||||
|
||||
|
@ -332,7 +332,7 @@ ErrorOr<void> BookmarksBarWidget::add_bookmark(StringView url, StringView title)
|
|||
|
||||
auto model_has_updated = false;
|
||||
for (int item_index = 0; item_index < model()->row_count(); item_index++) {
|
||||
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto item_url = model()->index(item_index, 1).data().to_byte_string();
|
||||
|
||||
if (item_url == url) {
|
||||
TRY(update_model(values, [item_index](auto& model, auto&& values) {
|
||||
|
@ -355,8 +355,8 @@ ErrorOr<void> BookmarksBarWidget::add_bookmark(StringView url, StringView title)
|
|||
ErrorOr<void> BookmarksBarWidget::edit_bookmark(StringView url)
|
||||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto item_title = model()->index(item_index, 0).data().to_byte_string();
|
||||
auto item_url = model()->index(item_index, 1).data().to_byte_string();
|
||||
|
||||
if (item_url == url) {
|
||||
auto values = BookmarkEditor::edit_bookmark(window(), item_title, item_url, PerformEditOn::ExistingBookmark);
|
||||
|
|
|
@ -32,8 +32,8 @@ public:
|
|||
InNewWindow
|
||||
};
|
||||
|
||||
Function<void(DeprecatedString const& url, Open)> on_bookmark_click;
|
||||
Function<void(DeprecatedString const&, DeprecatedString const&)> on_bookmark_hover;
|
||||
Function<void(ByteString const& url, Open)> on_bookmark_click;
|
||||
Function<void(ByteString const&, ByteString const&)> on_bookmark_hover;
|
||||
Function<void()> on_bookmark_change;
|
||||
|
||||
bool contains_bookmark(StringView url);
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
BookmarksBarWidget(DeprecatedString const&, bool enabled);
|
||||
BookmarksBarWidget(ByteString const&, bool enabled);
|
||||
|
||||
// ^GUI::ModelClient
|
||||
virtual void model_did_update(unsigned) override;
|
||||
|
@ -67,7 +67,7 @@ private:
|
|||
|
||||
RefPtr<GUI::Menu> m_context_menu;
|
||||
RefPtr<GUI::Action> m_context_menu_default_action;
|
||||
DeprecatedString m_context_menu_url;
|
||||
ByteString m_context_menu_url;
|
||||
|
||||
Vector<NonnullRefPtr<GUI::Button>> m_bookmarks;
|
||||
|
||||
|
|
|
@ -6,22 +6,22 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/String.h>
|
||||
#include <Applications/Browser/IconBag.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
extern DeprecatedString g_home_url;
|
||||
extern DeprecatedString g_new_tab_url;
|
||||
extern DeprecatedString g_search_engine;
|
||||
extern ByteString g_home_url;
|
||||
extern ByteString g_new_tab_url;
|
||||
extern ByteString g_search_engine;
|
||||
extern Vector<String> g_content_filters;
|
||||
extern bool g_content_filters_enabled;
|
||||
extern Vector<String> g_autoplay_allowlist;
|
||||
extern bool g_autoplay_allowed_on_all_websites;
|
||||
extern Vector<DeprecatedString> g_proxies;
|
||||
extern HashMap<DeprecatedString, size_t> g_proxy_mappings;
|
||||
extern Vector<ByteString> g_proxies;
|
||||
extern HashMap<ByteString, size_t> g_proxy_mappings;
|
||||
extern IconBag g_icon_bag;
|
||||
extern DeprecatedString g_webdriver_content_ipc_path;
|
||||
extern ByteString g_webdriver_content_ipc_path;
|
||||
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
static DeprecatedString bookmarks_file_path()
|
||||
static ByteString bookmarks_file_path()
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(Core::StandardPaths::config_directory());
|
||||
builder.append("/bookmarks.json"sv);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
BrowserWindow::BrowserWindow(WebView::CookieJar& cookie_jar, Vector<URL> const& initial_urls)
|
||||
|
@ -275,11 +275,11 @@ void BrowserWindow::build_menus()
|
|||
|
||||
m_change_homepage_action = GUI::Action::create(
|
||||
"Set Homepage URL...", g_icon_bag.go_home, [this](auto&) {
|
||||
String homepage_url = String::from_deprecated_string(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, Browser::default_homepage_url())).release_value_but_fixme_should_propagate_errors();
|
||||
String homepage_url = String::from_byte_string(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, Browser::default_homepage_url())).release_value_but_fixme_should_propagate_errors();
|
||||
if (GUI::InputBox::show(this, homepage_url, "Enter a URL:"sv, "Change Homepage"sv) == GUI::InputBox::ExecResult::OK) {
|
||||
if (URL(homepage_url).is_valid()) {
|
||||
Config::write_string("Browser"sv, "Preferences"sv, "Home"sv, homepage_url);
|
||||
Browser::g_home_url = homepage_url.to_deprecated_string();
|
||||
Browser::g_home_url = homepage_url.to_byte_string();
|
||||
} else {
|
||||
GUI::MessageBox::show_error(this, "The URL you have entered is not valid"sv);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ void BrowserWindow::build_menus()
|
|||
m_disable_user_agent_spoofing->activate();
|
||||
return;
|
||||
}
|
||||
active_tab().view().debug_request("spoof-user-agent", user_agent.to_deprecated_string());
|
||||
active_tab().view().debug_request("spoof-user-agent", user_agent.to_byte_string());
|
||||
action.set_status_tip(user_agent);
|
||||
});
|
||||
spoof_user_agent_menu->add_action(custom_user_agent);
|
||||
|
@ -497,7 +497,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
|||
return;
|
||||
}
|
||||
|
||||
g_search_engine = search_engine.to_deprecated_string();
|
||||
g_search_engine = search_engine.to_byte_string();
|
||||
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
|
||||
action.set_status_tip(search_engine);
|
||||
});
|
||||
|
@ -506,7 +506,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
|||
|
||||
if (!search_engine_set && !g_search_engine.is_empty()) {
|
||||
custom_search_engine_action->set_checked(true);
|
||||
custom_search_engine_action->set_status_tip(TRY(String::from_deprecated_string(g_search_engine)));
|
||||
custom_search_engine_action->set_status_tip(TRY(String::from_byte_string(g_search_engine)));
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -526,7 +526,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
|
|||
{
|
||||
auto& title = tab.title();
|
||||
auto url = tab.url();
|
||||
set_title(DeprecatedString::formatted("{} - Ladybird", title.is_empty() ? url.to_deprecated_string() : title));
|
||||
set_title(ByteString::formatted("{} - Ladybird", title.is_empty() ? url.to_byte_string() : title));
|
||||
}
|
||||
|
||||
Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activate)
|
||||
|
@ -536,7 +536,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
|
|||
m_tab_widget->set_bar_visible(!is_fullscreen() && m_tab_widget->children().size() > 1);
|
||||
|
||||
new_tab.on_title_change = [this, &new_tab](auto& title) {
|
||||
m_tab_widget->set_tab_title(new_tab, String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
|
||||
m_tab_widget->set_tab_title(new_tab, String::from_byte_string(title).release_value_but_fixme_should_propagate_errors());
|
||||
if (m_tab_widget->active_widget() == &new_tab)
|
||||
set_window_title_for_tab(new_tab);
|
||||
};
|
||||
|
@ -582,7 +582,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
|
|||
return m_cookie_jar.get_named_cookie(url, name);
|
||||
};
|
||||
|
||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
|
||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> ByteString {
|
||||
return m_cookie_jar.get_cookie(url, source);
|
||||
};
|
||||
|
||||
|
@ -622,7 +622,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
|
|||
|
||||
void BrowserWindow::create_new_window(URL const& url)
|
||||
{
|
||||
GUI::Process::spawn_or_show_error(this, "/bin/Browser"sv, Array { url.to_deprecated_string() });
|
||||
GUI::Process::spawn_or_show_error(this, "/bin/Browser"sv, Array { url.to_byte_string() });
|
||||
}
|
||||
|
||||
void BrowserWindow::content_filters_changed()
|
||||
|
|
|
@ -95,7 +95,7 @@ GUI::Model::MatchResult CookiesModel::data_matches(GUI::ModelIndex const& index,
|
|||
return { TriState::True };
|
||||
|
||||
auto const& cookie = m_cookies[index.row()];
|
||||
auto haystack = DeprecatedString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
|
||||
auto haystack = ByteString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
|
||||
auto match_result = fuzzy_match(needle, haystack);
|
||||
if (match_result.score > 0)
|
||||
return { TriState::True, match_result.score };
|
||||
|
|
|
@ -35,7 +35,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
builder.append(Core::StandardPaths::downloads_directory());
|
||||
builder.append('/');
|
||||
builder.append(m_url.basename());
|
||||
m_destination_path = builder.to_deprecated_string();
|
||||
m_destination_path = builder.to_byte_string();
|
||||
}
|
||||
|
||||
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, Browser::default_close_download_widget_on_finish);
|
||||
|
@ -50,7 +50,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
{
|
||||
auto file_or_error = Core::File::open(m_destination_path, Core::File::OpenMode::Write);
|
||||
if (file_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
window()->close();
|
||||
return;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
m_progress_label->set_fixed_height(16);
|
||||
m_progress_label->set_text_wrapping(Gfx::TextWrapping::DontWrap);
|
||||
|
||||
auto destination_label_path = LexicalPath(m_destination_path).dirname().to_deprecated_string();
|
||||
auto destination_label_path = LexicalPath(m_destination_path).dirname().to_byte_string();
|
||||
|
||||
auto& destination_label = add<GUI::Label>(String::formatted("To: {}", destination_label_path).release_value_but_fixme_should_propagate_errors());
|
||||
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -145,7 +145,7 @@ void DownloadWidget::did_progress(Optional<u64> total_size, u64 downloaded_size)
|
|||
}
|
||||
builder.append(" of "sv);
|
||||
builder.append(m_url.basename());
|
||||
window()->set_title(builder.to_deprecated_string());
|
||||
window()->set_title(builder.to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ void DownloadWidget::did_finish(bool success)
|
|||
m_cancel_button->update();
|
||||
|
||||
if (!success) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
window()->close();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
void did_finish(bool success);
|
||||
|
||||
URL m_url;
|
||||
DeprecatedString m_destination_path;
|
||||
ByteString m_destination_path;
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> m_download;
|
||||
RefPtr<GUI::Progressbar> m_progressbar;
|
||||
RefPtr<GUI::Label> m_progress_label;
|
||||
|
|
|
@ -79,7 +79,7 @@ GUI::Model::MatchResult HistoryModel::data_matches(GUI::ModelIndex const& index,
|
|||
return { TriState::True };
|
||||
|
||||
auto const& history_entry = m_entries[index.row()];
|
||||
auto haystack = DeprecatedString::formatted("{} {}", history_entry.title, history_entry.url.serialize());
|
||||
auto haystack = ByteString::formatted("{} {}", history_entry.title, history_entry.url.serialize());
|
||||
auto match_result = fuzzy_match(needle, haystack);
|
||||
if (match_result.score > 0)
|
||||
return { TriState::True, match_result.score };
|
||||
|
|
|
@ -84,7 +84,7 @@ InspectorWidget::InspectorWidget(WebView::OutOfProcessWebView& content_view)
|
|||
};
|
||||
|
||||
m_inspector_client->on_requested_dom_node_tag_context_menu = [this](auto position, auto const& tag) {
|
||||
m_edit_node_action->set_text(DeprecatedString::formatted("&Edit \"{}\"", tag));
|
||||
m_edit_node_action->set_text(ByteString::formatted("&Edit \"{}\"", tag));
|
||||
m_copy_node_action->set_text("&Copy HTML");
|
||||
|
||||
m_dom_node_tag_context_menu->popup(to_widget_position(position));
|
||||
|
@ -94,9 +94,9 @@ InspectorWidget::InspectorWidget(WebView::OutOfProcessWebView& content_view)
|
|||
static constexpr size_t MAX_ATTRIBUTE_VALUE_LENGTH = 32;
|
||||
|
||||
m_copy_node_action->set_text("&Copy HTML");
|
||||
m_edit_node_action->set_text(DeprecatedString::formatted("&Edit attribute \"{}\"", attribute.name));
|
||||
m_remove_attribute_action->set_text(DeprecatedString::formatted("&Remove attribute \"{}\"", attribute.name));
|
||||
m_copy_attribute_value_action->set_text(DeprecatedString::formatted("Copy attribute &value \"{:.{}}{}\"",
|
||||
m_edit_node_action->set_text(ByteString::formatted("&Edit attribute \"{}\"", attribute.name));
|
||||
m_remove_attribute_action->set_text(ByteString::formatted("&Remove attribute \"{}\"", attribute.name));
|
||||
m_copy_attribute_value_action->set_text(ByteString::formatted("Copy attribute &value \"{:.{}}{}\"",
|
||||
attribute.value, MAX_ATTRIBUTE_VALUE_LENGTH,
|
||||
attribute.value.bytes_as_string_view().length() > MAX_ATTRIBUTE_VALUE_LENGTH ? "..."sv : ""sv));
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ GUI::Model::MatchResult StorageModel::data_matches(GUI::ModelIndex const& index,
|
|||
auto const& local_storage_key = keys[index.row()];
|
||||
auto const& local_storage_value = m_local_storage_entries.get(local_storage_key).value_or({});
|
||||
|
||||
auto haystack = DeprecatedString::formatted("{} {}", local_storage_key, local_storage_value);
|
||||
auto haystack = ByteString::formatted("{} {}", local_storage_key, local_storage_value);
|
||||
auto match_result = fuzzy_match(needle, haystack);
|
||||
if (match_result.score > 0)
|
||||
return { TriState::True, match_result.score };
|
||||
|
|
|
@ -58,13 +58,13 @@ void Tab::start_download(const URL& url)
|
|||
{
|
||||
auto window = GUI::Window::construct(&this->window());
|
||||
window->resize(300, 170);
|
||||
window->set_title(DeprecatedString::formatted("0% of {}", url.basename()));
|
||||
window->set_title(ByteString::formatted("0% of {}", url.basename()));
|
||||
window->set_resizable(false);
|
||||
(void)window->set_main_widget<DownloadWidget>(url);
|
||||
window->show();
|
||||
}
|
||||
|
||||
void Tab::view_source(const URL& url, DeprecatedString const& source)
|
||||
void Tab::view_source(const URL& url, ByteString const& source)
|
||||
{
|
||||
auto window = GUI::Window::construct(&this->window());
|
||||
auto editor = window->set_main_widget<GUI::TextEditor>();
|
||||
|
@ -74,7 +74,7 @@ void Tab::view_source(const URL& url, DeprecatedString const& source)
|
|||
editor->set_ruler_visible(true);
|
||||
editor->set_visualize_trailing_whitespace(false);
|
||||
window->resize(640, 480);
|
||||
window->set_title(url.to_deprecated_string());
|
||||
window->set_title(url.to_byte_string());
|
||||
window->set_icon(g_icon_bag.filetype_text);
|
||||
window->set_window_mode(GUI::WindowMode::Modeless);
|
||||
window->show();
|
||||
|
@ -132,7 +132,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
m_go_back_context_menu = GUI::Menu::construct();
|
||||
for (auto& url : m_history.get_back_title_history()) {
|
||||
i++;
|
||||
m_go_back_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
|
||||
m_go_back_context_menu->add_action(GUI::Action::create(url.to_byte_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
|
||||
}
|
||||
m_go_back_context_menu->popup(go_back_button.screen_relative_rect().bottom_left().moved_up(1));
|
||||
};
|
||||
|
@ -145,7 +145,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
m_go_forward_context_menu = GUI::Menu::construct();
|
||||
for (auto& url : m_history.get_forward_title_history()) {
|
||||
i++;
|
||||
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
|
||||
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_byte_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
|
||||
}
|
||||
m_go_forward_context_menu->popup(go_forward_button.screen_relative_rect().bottom_left().moved_up(1));
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
update_status();
|
||||
|
||||
m_location_box->set_icon(nullptr);
|
||||
m_location_box->set_text(url.to_deprecated_string());
|
||||
m_location_box->set_text(url.to_byte_string());
|
||||
|
||||
// don't add to history if back or forward is pressed
|
||||
if (!m_is_history_navigation)
|
||||
|
@ -228,7 +228,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
m_is_history_navigation = false;
|
||||
|
||||
update_actions();
|
||||
update_bookmark_button(url.to_deprecated_string());
|
||||
update_bookmark_button(url.to_byte_string());
|
||||
|
||||
if (m_dom_inspector_widget)
|
||||
m_dom_inspector_widget->reset();
|
||||
|
@ -353,7 +353,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
||||
}));
|
||||
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_byte_string());
|
||||
}));
|
||||
m_image_context_menu->add_separator();
|
||||
m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
||||
|
@ -397,7 +397,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
}));
|
||||
m_audio_context_menu->add_separator();
|
||||
m_audio_context_menu->add_action(GUI::Action::create("Copy Audio &URL", g_icon_bag.copy, [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_byte_string());
|
||||
}));
|
||||
m_audio_context_menu->add_separator();
|
||||
m_audio_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
||||
|
@ -420,7 +420,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
}));
|
||||
m_video_context_menu->add_separator();
|
||||
m_video_context_menu->add_action(GUI::Action::create("Copy Video &URL", g_icon_bag.copy, [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_byte_string());
|
||||
}));
|
||||
m_video_context_menu->add_separator();
|
||||
m_video_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
||||
|
@ -490,7 +490,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
return {};
|
||||
};
|
||||
|
||||
view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
|
||||
view().on_get_cookie = [this](auto& url, auto source) -> ByteString {
|
||||
if (on_get_cookie)
|
||||
return on_get_cookie(url, source);
|
||||
return {};
|
||||
|
@ -609,7 +609,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||
|
||||
view().on_link_hover = [this](auto& url) {
|
||||
update_status(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
|
||||
update_status(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
|
||||
};
|
||||
|
||||
view().on_link_unhover = [this]() {
|
||||
|
@ -631,7 +631,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
};
|
||||
|
||||
view().on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {
|
||||
GUI::Clipboard::the().set_data(data.bytes(), mime_type.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_data(data.bytes(), mime_type.to_byte_string());
|
||||
};
|
||||
|
||||
m_tab_context_menu = GUI::Menu::construct();
|
||||
|
@ -705,7 +705,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
|
||||
if (m_page_context_menu_search_text.has_value()) {
|
||||
auto action_text = WebView::format_search_query_for_display(g_search_engine, *m_page_context_menu_search_text);
|
||||
search_selected_text_action->set_text(action_text.to_deprecated_string());
|
||||
search_selected_text_action->set_text(action_text.to_byte_string());
|
||||
search_selected_text_action->set_visible(true);
|
||||
} else {
|
||||
search_selected_text_action->set_visible(false);
|
||||
|
@ -719,7 +719,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
void Tab::select_dropdown_add_item(GUI::Menu& menu, Web::HTML::SelectItem const& item)
|
||||
{
|
||||
if (item.type == Web::HTML::SelectItem::Type::OptionGroup) {
|
||||
auto subtitle = GUI::Action::create(MUST(DeprecatedString::from_utf8(item.label.value_or(""_string))), nullptr);
|
||||
auto subtitle = GUI::Action::create(MUST(ByteString::from_utf8(item.label.value_or(""_string))), nullptr);
|
||||
subtitle->set_enabled(false);
|
||||
menu.add_action(subtitle);
|
||||
|
||||
|
@ -728,7 +728,7 @@ void Tab::select_dropdown_add_item(GUI::Menu& menu, Web::HTML::SelectItem const&
|
|||
}
|
||||
}
|
||||
if (item.type == Web::HTML::SelectItem::Type::Option) {
|
||||
auto action = GUI::Action::create(MUST(DeprecatedString::from_utf8(item.label.value_or(""_string))), [this, item](GUI::Action&) {
|
||||
auto action = GUI::Action::create(MUST(ByteString::from_utf8(item.label.value_or(""_string))), [this, item](GUI::Action&) {
|
||||
m_select_dropdown_closed_by_action = true;
|
||||
view().select_dropdown_closed(item.value.value_or(""_string));
|
||||
});
|
||||
|
@ -804,7 +804,7 @@ void Tab::update_actions()
|
|||
|
||||
ErrorOr<void> Tab::bookmark_current_url()
|
||||
{
|
||||
auto url = this->url().to_deprecated_string();
|
||||
auto url = this->url().to_byte_string();
|
||||
if (BookmarksBarWidget::the().contains_bookmark(url)) {
|
||||
TRY(BookmarksBarWidget::the().remove_bookmark(url));
|
||||
} else {
|
||||
|
@ -837,11 +837,11 @@ void Tab::did_become_active()
|
|||
};
|
||||
|
||||
BookmarksBarWidget::the().on_bookmark_hover = [this](auto&, auto& url) {
|
||||
m_statusbar->set_text(String::from_deprecated_string(url).release_value_but_fixme_should_propagate_errors());
|
||||
m_statusbar->set_text(String::from_byte_string(url).release_value_but_fixme_should_propagate_errors());
|
||||
};
|
||||
|
||||
BookmarksBarWidget::the().on_bookmark_change = [this]() {
|
||||
update_bookmark_button(url().to_deprecated_string());
|
||||
update_bookmark_button(url().to_byte_string());
|
||||
};
|
||||
|
||||
BookmarksBarWidget::the().remove_from_parent();
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
void window_position_changed(Gfx::IntPoint);
|
||||
void window_size_changed(Gfx::IntSize);
|
||||
|
||||
Function<void(DeprecatedString const&)> on_title_change;
|
||||
Function<void(ByteString const&)> on_title_change;
|
||||
Function<void(const URL&)> on_tab_open_request;
|
||||
Function<void(Tab&)> on_activate_tab_request;
|
||||
Function<void(Tab&)> on_tab_close_request;
|
||||
|
@ -71,8 +71,8 @@ public:
|
|||
Function<void(const URL&)> on_window_open_request;
|
||||
Function<void(Gfx::Bitmap const&)> on_favicon_change;
|
||||
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
|
||||
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
|
||||
Function<DeprecatedString(const URL&, Web::Cookie::Source source)> on_get_cookie;
|
||||
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, ByteString const& name)> on_get_named_cookie;
|
||||
Function<ByteString(const URL&, Web::Cookie::Source source)> on_get_cookie;
|
||||
Function<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
|
||||
Function<void()> on_dump_cookies;
|
||||
Function<void(Web::Cookie::Cookie)> on_update_cookie;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
void update_reset_zoom_button();
|
||||
|
||||
DeprecatedString const& title() const { return m_title; }
|
||||
ByteString const& title() const { return m_title; }
|
||||
Gfx::Bitmap const* icon() const { return m_icon; }
|
||||
|
||||
WebView::OutOfProcessWebView& view() { return *m_web_content_view; }
|
||||
|
@ -111,7 +111,7 @@ private:
|
|||
ErrorOr<void> bookmark_current_url();
|
||||
void update_bookmark_button(StringView url);
|
||||
void start_download(const URL& url);
|
||||
void view_source(const URL& url, DeprecatedString const& source);
|
||||
void view_source(const URL& url, ByteString const& source);
|
||||
void update_status(Optional<String> text_override = {}, i32 count_waiting = 0);
|
||||
void close_sub_widgets();
|
||||
|
||||
|
@ -160,7 +160,7 @@ private:
|
|||
RefPtr<GUI::Menu> m_select_dropdown;
|
||||
bool m_select_dropdown_closed_by_action { false };
|
||||
|
||||
DeprecatedString m_title;
|
||||
ByteString m_title;
|
||||
RefPtr<Gfx::Bitmap const> m_icon;
|
||||
|
||||
Optional<URL> m_navigating_url;
|
||||
|
|
|
@ -60,7 +60,7 @@ WindowActions::WindowActions(GUI::Window& window)
|
|||
|
||||
for (auto i = 0; i <= 7; ++i) {
|
||||
m_tab_actions.append(GUI::Action::create(
|
||||
DeprecatedString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
|
||||
ByteString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
|
||||
if (on_tabs[i])
|
||||
on_tabs[i]();
|
||||
},
|
||||
|
|
|
@ -33,17 +33,17 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
DeprecatedString g_search_engine;
|
||||
DeprecatedString g_home_url;
|
||||
DeprecatedString g_new_tab_url;
|
||||
ByteString g_search_engine;
|
||||
ByteString g_home_url;
|
||||
ByteString g_new_tab_url;
|
||||
Vector<String> g_content_filters;
|
||||
bool g_content_filters_enabled { true };
|
||||
Vector<String> g_autoplay_allowlist;
|
||||
bool g_autoplay_allowed_on_all_websites { false };
|
||||
Vector<DeprecatedString> g_proxies;
|
||||
HashMap<DeprecatedString, size_t> g_proxy_mappings;
|
||||
Vector<ByteString> g_proxies;
|
||||
HashMap<ByteString, size_t> g_proxy_mappings;
|
||||
IconBag g_icon_bag;
|
||||
DeprecatedString g_webdriver_content_ipc_path;
|
||||
ByteString g_webdriver_content_ipc_path;
|
||||
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
window->content_filters_changed();
|
||||
};
|
||||
TRY(content_filters_watcher->add_watch(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
|
||||
TRY(content_filters_watcher->add_watch(ByteString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
|
||||
|
||||
auto autoplay_allowlist_watcher = TRY(Core::FileWatcher::create());
|
||||
autoplay_allowlist_watcher->on_change = [&](Core::FileWatcherEvent const&) {
|
||||
|
@ -193,7 +193,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
window->autoplay_allowlist_changed();
|
||||
};
|
||||
TRY(autoplay_allowlist_watcher->add_watch(DeprecatedString::formatted("{}/BrowserAutoplayAllowlist.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
|
||||
TRY(autoplay_allowlist_watcher->add_watch(ByteString::formatted("{}/BrowserAutoplayAllowlist.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
|
||||
|
||||
app->on_action_enter = [&](GUI::Action& action) {
|
||||
if (auto* browser_window = dynamic_cast<Browser::BrowserWindow*>(app->active_window())) {
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include <LibWebView/SearchEngine.h>
|
||||
|
||||
struct ColorScheme {
|
||||
DeprecatedString title;
|
||||
DeprecatedString setting_value;
|
||||
ByteString title;
|
||||
ByteString setting_value;
|
||||
};
|
||||
|
||||
class ColorSchemeModel final : public GUI::Model {
|
||||
|
@ -140,8 +140,8 @@ ErrorOr<void> BrowserSettingsWidget::setup()
|
|||
|
||||
m_search_engine_combobox->set_model(adopt_ref(*new SearchEngineModel()));
|
||||
m_search_engine_combobox->set_only_allow_values_from_model(true);
|
||||
m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) {
|
||||
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_deprecated_string();
|
||||
m_search_engine_combobox->on_change = [this](AK::ByteString const&, GUI::ModelIndex const& cursor_index) {
|
||||
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_byte_string();
|
||||
m_is_custom_search_engine = url_format.is_empty();
|
||||
m_custom_search_engine_group->set_enabled(m_is_custom_search_engine);
|
||||
set_modified(true);
|
||||
|
@ -159,7 +159,7 @@ void BrowserSettingsWidget::set_color_scheme(StringView color_scheme)
|
|||
{
|
||||
bool found_color_scheme = false;
|
||||
for (int item_index = 0; item_index < m_color_scheme_combobox->model()->row_count(); ++item_index) {
|
||||
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_byte_string();
|
||||
if (scheme == color_scheme) {
|
||||
m_color_scheme_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
||||
found_color_scheme = true;
|
||||
|
@ -183,7 +183,7 @@ void BrowserSettingsWidget::set_search_engine_url(StringView url)
|
|||
|
||||
bool found_url = false;
|
||||
for (int item_index = 0; item_index < m_search_engine_combobox->model()->row_count(); ++item_index) {
|
||||
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_deprecated_string();
|
||||
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_byte_string();
|
||||
if (url_format == url) {
|
||||
m_search_engine_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
||||
found_url = true;
|
||||
|
@ -226,7 +226,7 @@ void BrowserSettingsWidget::apply_settings()
|
|||
Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, m_show_bookmarks_bar_checkbox->is_checked());
|
||||
|
||||
auto color_scheme_index = m_color_scheme_combobox->selected_index();
|
||||
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_deprecated_string();
|
||||
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_byte_string();
|
||||
Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, color_scheme);
|
||||
|
||||
if (!m_enable_search_engine_checkbox->is_checked()) {
|
||||
|
@ -235,7 +235,7 @@ void BrowserSettingsWidget::apply_settings()
|
|||
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, m_custom_search_engine_textbox->text());
|
||||
} else {
|
||||
auto selected_index = m_search_engine_combobox->selected_index();
|
||||
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_deprecated_string();
|
||||
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_byte_string();
|
||||
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, url);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void CalculatorWidget::add_digit_button(GUI::Button& button, int digit)
|
|||
|
||||
String CalculatorWidget::get_entry()
|
||||
{
|
||||
return String::from_deprecated_string(m_entry->text()).release_value_but_fixme_should_propagate_errors();
|
||||
return String::from_byte_string(m_entry->text()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void CalculatorWidget::set_entry(Crypto::BigFraction value)
|
||||
|
|
|
@ -124,12 +124,12 @@ void Keypad::set_to_0()
|
|||
ErrorOr<String> Keypad::to_string() const
|
||||
{
|
||||
if (m_state == State::External || m_state == State::TypedExternal)
|
||||
return String::from_deprecated_string(m_internal_value.to_deprecated_string(m_displayed_fraction_length));
|
||||
return String::from_byte_string(m_internal_value.to_byte_string(m_displayed_fraction_length));
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
DeprecatedString const integer_value = m_int_value.to_base_deprecated(10);
|
||||
DeprecatedString const frac_value = m_frac_value.to_base_deprecated(10);
|
||||
ByteString const integer_value = m_int_value.to_base_deprecated(10);
|
||||
ByteString const frac_value = m_frac_value.to_base_deprecated(10);
|
||||
unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1);
|
||||
|
||||
builder.append(integer_value);
|
||||
|
|
|
@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Optional<unsigned> last_rounding_mode = 1;
|
||||
for (unsigned i {}; i < rounding_modes.size(); ++i) {
|
||||
auto round_action = GUI::Action::create_checkable(DeprecatedString::formatted("To &{} Digits", rounding_modes[i]),
|
||||
auto round_action = GUI::Action::create_checkable(ByteString::formatted("To &{} Digits", rounding_modes[i]),
|
||||
[&widget, rounding_mode = rounding_modes[i], &last_rounding_mode, i](auto&) {
|
||||
widget->set_rounding_length(rounding_mode);
|
||||
last_rounding_mode = i;
|
||||
|
@ -96,11 +96,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
constexpr auto format { "&Custom - {}..."sv };
|
||||
auto round_custom = GUI::Action::create_checkable(DeprecatedString::formatted(format, 0), [&](auto& action) {
|
||||
auto round_custom = GUI::Action::create_checkable(ByteString::formatted(format, 0), [&](auto& action) {
|
||||
int custom_rounding_length = widget->rounding_length();
|
||||
auto result = GUI::InputBox::show_numeric(window, custom_rounding_length, 0, 100, "Digits to Round"sv);
|
||||
if (!result.is_error() && result.value() == GUI::Dialog::ExecResult::OK) {
|
||||
action.set_text(DeprecatedString::formatted(format, custom_rounding_length));
|
||||
action.set_text(ByteString::formatted(format, custom_rounding_length));
|
||||
widget->set_rounding_length(custom_rounding_length);
|
||||
last_rounding_mode.clear();
|
||||
} else if (last_rounding_mode.has_value())
|
||||
|
@ -115,7 +115,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto result = GUI::InputBox::show_numeric(window, shrink_length, 0, 100, "Digits to Shrink"sv);
|
||||
if (!result.is_error() && result.value() == GUI::Dialog::ExecResult::OK) {
|
||||
round_custom->set_checked(true);
|
||||
round_custom->set_text(DeprecatedString::formatted(format, shrink_length));
|
||||
round_custom->set_text(ByteString::formatted(format, shrink_length));
|
||||
widget->set_rounding_length(shrink_length);
|
||||
widget->shrink(shrink_length);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void CalendarWidget::load_file(FileSystemAccessClient::File file)
|
|||
{
|
||||
auto result = m_event_calendar->event_manager().load_file(file);
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Cannot load file: {}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Cannot load file: {}", result.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -139,13 +139,13 @@ NonnullRefPtr<GUI::Action> CalendarWidget::create_save_action(GUI::Action& save_
|
|||
return;
|
||||
}
|
||||
|
||||
auto response = FileSystemAccessClient::Client::the().request_file(window(), current_filename().to_deprecated_string(), Core::File::OpenMode::Write);
|
||||
auto response = FileSystemAccessClient::Client::the().request_file(window(), current_filename().to_byte_string(), Core::File::OpenMode::Write);
|
||||
if (response.is_error())
|
||||
return;
|
||||
|
||||
auto result = m_event_calendar->event_manager().save(response.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Cannot save file: {}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Cannot save file: {}", result.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ NonnullRefPtr<GUI::Action> CalendarWidget::create_save_as_action()
|
|||
|
||||
auto result = m_event_calendar->event_manager().save(response.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Cannot save file: {}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Cannot save file: {}", result.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> CalendarWidget::create_new_calendar_action()
|
|||
|
||||
auto result = m_event_calendar->event_manager().save(response.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Cannot save file: {}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Cannot save file: {}", result.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ void CalendarWidget::update_window_title()
|
|||
builder.append(current_filename());
|
||||
builder.append("[*] - Calendar"sv);
|
||||
|
||||
window()->set_title(builder.to_deprecated_string());
|
||||
window()->set_title(builder.to_byte_string());
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<GUI::Action>> CalendarWidget::create_add_event_action()
|
||||
|
|
|
@ -36,12 +36,12 @@ void EventCalendar::paint_tile(GUI::Painter& painter, GUI::Calendar::Tile& tile,
|
|||
if (!event.has("start_date"sv) || !event.has("start_date"sv) || !event.has("summary"sv))
|
||||
return;
|
||||
|
||||
auto start_date = event.get("start_date"sv).value().to_deprecated_string();
|
||||
auto start_time = event.get("start_time"sv).value().to_deprecated_string();
|
||||
auto summary = event.get("summary"sv).value().to_deprecated_string();
|
||||
auto combined_text = DeprecatedString::formatted("{} {}", start_time, summary);
|
||||
auto start_date = event.get("start_date"sv).value().to_byte_string();
|
||||
auto start_time = event.get("start_time"sv).value().to_byte_string();
|
||||
auto summary = event.get("summary"sv).value().to_byte_string();
|
||||
auto combined_text = ByteString::formatted("{} {}", start_time, summary);
|
||||
|
||||
if (start_date == DeprecatedString::formatted("{}-{:0>2d}-{:0>2d}", tile.year, tile.month, tile.day)) {
|
||||
if (start_date == ByteString::formatted("{}-{:0>2d}-{:0>2d}", tile.year, tile.month, tile.day)) {
|
||||
|
||||
auto text_rect = tile.rect.translated(4, 4 + (font_height + 4) * ++index);
|
||||
painter.draw_text(text_rect, combined_text, Gfx::FontDatabase::default_font(), Gfx::TextAlignment::TopLeft, palette().base_text(), Gfx::TextElision::Right);
|
||||
|
|
|
@ -41,7 +41,7 @@ ErrorOr<void> EventManager::save(FileSystemAccessClient::File& file)
|
|||
set_dirty(false);
|
||||
|
||||
auto stream = file.release_stream();
|
||||
TRY(stream->write_some(m_events.to_deprecated_string().bytes()));
|
||||
TRY(stream->write_some(m_events.to_byte_string().bytes()));
|
||||
stream->close();
|
||||
|
||||
return {};
|
||||
|
|
|
@ -75,7 +75,7 @@ GUI::Variant CertificateStoreModel::data(GUI::ModelIndex const& index, GUI::Mode
|
|||
return issued_by;
|
||||
}
|
||||
case Column::Expire:
|
||||
return cert.validity.not_after.to_deprecated_string("%Y-%m-%d"sv);
|
||||
return cert.validity.not_after.to_byte_string("%Y-%m-%d"sv);
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ ErrorOr<void> CertificateStoreWidget::export_pem()
|
|||
|
||||
filename = TRY(filename.replace(" "sv, "_"sv, ReplaceMode::All));
|
||||
|
||||
auto file = FileSystemAccessClient::Client::the().save_file(window(), filename.to_deprecated_string(), "pem"sv);
|
||||
auto file = FileSystemAccessClient::Client::the().save_file(window(), filename.to_byte_string(), "pem"sv);
|
||||
if (file.is_error())
|
||||
return {};
|
||||
|
||||
|
@ -183,7 +183,7 @@ ErrorOr<void> CertificateStoreWidget::initialize()
|
|||
m_import_ca_button->on_click = [&](auto) {
|
||||
auto import_result = import_pem();
|
||||
if (import_result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", import_result.release_error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", import_result.release_error()));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -191,7 +191,7 @@ ErrorOr<void> CertificateStoreWidget::initialize()
|
|||
m_export_ca_button->on_click = [&](auto) {
|
||||
auto export_result = export_pem();
|
||||
if (export_result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", export_result.release_error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", export_result.release_error()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ CharacterMapWidget::CharacterMapWidget()
|
|||
continue;
|
||||
builder.append_code_point(code_point);
|
||||
}
|
||||
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(builder.to_byte_string());
|
||||
});
|
||||
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard"_string);
|
||||
|
||||
|
@ -139,7 +139,7 @@ CharacterMapWidget::CharacterMapWidget()
|
|||
for (auto& block : unicode_blocks)
|
||||
m_unicode_block_list.append(block.display_name);
|
||||
|
||||
m_unicode_block_model = GUI::ItemListModel<DeprecatedString>::create(m_unicode_block_list);
|
||||
m_unicode_block_model = GUI::ItemListModel<ByteString>::create(m_unicode_block_list);
|
||||
m_unicode_block_listview->set_model(*m_unicode_block_model);
|
||||
m_unicode_block_listview->set_activates_on_selection(true);
|
||||
m_unicode_block_listview->horizontal_scrollbar().set_visible(false);
|
||||
|
|
|
@ -42,6 +42,6 @@ private:
|
|||
RefPtr<GUI::Action> m_go_to_glyph_action;
|
||||
RefPtr<GUI::Action> m_find_glyphs_action;
|
||||
|
||||
Vector<DeprecatedString> m_unicode_block_list;
|
||||
Vector<ByteString> m_unicode_block_list;
|
||||
Unicode::CodePointRange m_range { 0x0000, 0x10FFFF };
|
||||
};
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
struct SearchResult {
|
||||
u32 code_point;
|
||||
DeprecatedString code_point_string;
|
||||
DeprecatedString display_text;
|
||||
ByteString code_point_string;
|
||||
ByteString display_text;
|
||||
};
|
||||
|
||||
class CharacterSearchModel final : public GUI::Model {
|
||||
|
@ -93,7 +93,7 @@ void CharacterSearchWidget::search()
|
|||
StringBuilder builder;
|
||||
builder.append_code_point(code_point);
|
||||
|
||||
model.add_result({ code_point, builder.to_deprecated_string(), move(display_name) });
|
||||
model.add_result({ code_point, builder.to_byte_string(), move(display_name) });
|
||||
|
||||
// Stop when we reach 250 results.
|
||||
// This is already too many for the search to be useful, and means we don't spend forever recalculating the column size.
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#include "SearchCharacters.h"
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
|
||||
void for_each_character_containing(StringView query, Function<IterationDecision(u32 code_point, DeprecatedString const& display_name)> callback)
|
||||
void for_each_character_containing(StringView query, Function<IterationDecision(u32 code_point, ByteString const& display_name)> callback)
|
||||
{
|
||||
DeprecatedString uppercase_query = query.to_uppercase_string();
|
||||
ByteString uppercase_query = query.to_uppercase_string();
|
||||
StringView uppercase_query_view = uppercase_query.view();
|
||||
constexpr u32 maximum_code_point = 0x10FFFF;
|
||||
// FIXME: There's probably a better way to do this than just looping, but it still only takes ~150ms to run for me!
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/IterationDecision.h>
|
||||
|
||||
void for_each_character_containing(StringView query, Function<IterationDecision(u32 code_point, DeprecatedString const& display_name)> callback);
|
||||
void for_each_character_containing(StringView query, Function<IterationDecision(u32 code_point, ByteString const& display_name)> callback);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
static void search_and_print_results(DeprecatedString const& query)
|
||||
static void search_and_print_results(ByteString const& query)
|
||||
{
|
||||
outln("Searching for '{}'", query);
|
||||
u32 result_count = 0;
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
DeprecatedString query;
|
||||
ByteString query;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(query, "Search character names using this query, and print them as a list.", "search", 's', "query");
|
||||
args_parser.parse(arguments);
|
||||
|
|
|
@ -32,5 +32,5 @@ private:
|
|||
|
||||
RefPtr<Core::Timer> m_clock_preview_update_timer;
|
||||
|
||||
DeprecatedString m_time_format;
|
||||
ByteString m_time_format;
|
||||
};
|
||||
|
|
|
@ -146,7 +146,7 @@ void TimeZoneSettingsWidget::set_time_zone_location()
|
|||
auto name = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::Long, now);
|
||||
auto offset = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::LongOffset, now);
|
||||
|
||||
m_time_zone_text = DeprecatedString::formatted("{}\n({})", name, offset);
|
||||
m_time_zone_text = ByteString::formatted("{}\n({})", name, offset);
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Mercator_projection#Derivation
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibGUI/SettingsWindow.h>
|
||||
|
@ -30,11 +30,11 @@ private:
|
|||
Optional<Gfx::FloatPoint> compute_time_zone_location() const;
|
||||
void set_time_zone();
|
||||
|
||||
DeprecatedString m_time_zone;
|
||||
ByteString m_time_zone;
|
||||
RefPtr<GUI::ComboBox> m_time_zone_combo_box;
|
||||
RefPtr<GUI::ImageWidget> m_time_zone_map;
|
||||
RefPtr<Gfx::Bitmap> m_time_zone_marker;
|
||||
|
||||
Optional<Gfx::FloatPoint> m_time_zone_location;
|
||||
DeprecatedString m_time_zone_text;
|
||||
ByteString m_time_zone_text;
|
||||
};
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
#include <unistd.h>
|
||||
|
||||
struct TitleAndText {
|
||||
DeprecatedString title;
|
||||
DeprecatedString text;
|
||||
ByteString title;
|
||||
ByteString text;
|
||||
};
|
||||
|
||||
struct ThreadBacktracesAndCpuRegisters {
|
||||
|
@ -104,17 +104,17 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
|
|||
first_entry = false;
|
||||
else
|
||||
builder.append('\n');
|
||||
builder.append(entry.to_deprecated_string());
|
||||
builder.append(entry.to_byte_string());
|
||||
}
|
||||
|
||||
dbgln("--- Backtrace for thread #{} (TID {}) ---", thread_index, thread_info.tid);
|
||||
for (auto& entry : backtrace.entries()) {
|
||||
dbgln("{}", entry.to_deprecated_string(true));
|
||||
dbgln("{}", entry.to_byte_string(true));
|
||||
}
|
||||
|
||||
return {
|
||||
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.to_deprecated_string()
|
||||
ByteString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.to_byte_string()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,8 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
|
|||
#endif
|
||||
|
||||
return {
|
||||
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.to_deprecated_string()
|
||||
ByteString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.to_byte_string()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
DeprecatedString coredump_path {};
|
||||
ByteString coredump_path {};
|
||||
bool unlink_on_exit = false;
|
||||
StringBuilder full_backtrace;
|
||||
|
||||
|
@ -184,9 +184,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> memory_regions;
|
||||
Vector<ByteString> memory_regions;
|
||||
coredump->for_each_memory_region_info([&](auto& memory_region_info) {
|
||||
memory_regions.append(DeprecatedString::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name));
|
||||
memory_regions.append(ByteString::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
|
@ -223,14 +223,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
description_label.set_text(TRY(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal)));
|
||||
|
||||
auto& executable_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("executable_link");
|
||||
executable_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(executable_path))));
|
||||
executable_link_label.set_text(TRY(String::from_byte_string(LexicalPath::canonicalized_path(executable_path))));
|
||||
executable_link_label.on_click = [&] {
|
||||
LexicalPath path { executable_path };
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
};
|
||||
|
||||
auto& coredump_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("coredump_link");
|
||||
coredump_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(coredump_path))));
|
||||
coredump_link_label.set_text(TRY(String::from_byte_string(LexicalPath::canonicalized_path(coredump_path))));
|
||||
coredump_link_label.on_click = [&] {
|
||||
LexicalPath path { coredump_path };
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
|
@ -266,7 +266,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
environment_tab.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
auto& environment_text_editor = environment_tab.add<GUI::TextEditor>();
|
||||
environment_text_editor.set_text(DeprecatedString::join('\n', environment));
|
||||
environment_text_editor.set_text(ByteString::join('\n', environment));
|
||||
environment_text_editor.set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
environment_text_editor.set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap);
|
||||
environment_text_editor.set_should_hide_unnecessary_scrollbars(true);
|
||||
|
@ -275,7 +275,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
memory_regions_tab.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
auto& memory_regions_text_editor = memory_regions_tab.add<GUI::TextEditor>();
|
||||
memory_regions_text_editor.set_text(DeprecatedString::join('\n', memory_regions));
|
||||
memory_regions_text_editor.set_text(ByteString::join('\n', memory_regions));
|
||||
memory_regions_text_editor.set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
memory_regions_text_editor.set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap);
|
||||
memory_regions_text_editor.set_should_hide_unnecessary_scrollbars(true);
|
||||
|
@ -296,23 +296,23 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& save_backtrace_button = *widget->find_descendant_of_type_named<GUI::Button>("save_backtrace_button");
|
||||
save_backtrace_button.set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv)));
|
||||
save_backtrace_button.on_click = [&](auto) {
|
||||
LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name));
|
||||
LexicalPath lexical_path(ByteString::formatted("{}_{}_backtrace.txt", pid, app_name));
|
||||
auto file_or_error = FileSystemAccessClient::Client::the().save_file(window, lexical_path.title(), lexical_path.extension());
|
||||
if (file_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Communication failed with FileSystemAccessServer: {}.", file_or_error.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Communication failed with FileSystemAccessServer: {}.", file_or_error.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
auto file = file_or_error.release_value().release_stream();
|
||||
|
||||
auto byte_buffer_or_error = full_backtrace.to_byte_buffer();
|
||||
if (byte_buffer_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't create backtrace: {}.", byte_buffer_or_error.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Couldn't create backtrace: {}.", byte_buffer_or_error.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
auto byte_buffer = byte_buffer_or_error.release_value();
|
||||
|
||||
if (auto result = file->write_until_depleted(byte_buffer); result.is_error())
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", result.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Couldn't save file: {}.", result.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
save_backtrace_button.set_enabled(false);
|
||||
|
||||
|
@ -336,7 +336,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
},
|
||||
[&](auto results) -> ErrorOr<void> {
|
||||
for (auto& backtrace : results.thread_backtraces) {
|
||||
auto& container = backtrace_tab_widget.add_tab<GUI::Widget>(TRY(String::from_deprecated_string(backtrace.title)));
|
||||
auto& container = backtrace_tab_widget.add_tab<GUI::Widget>(TRY(String::from_byte_string(backtrace.title)));
|
||||
container.template set_layout<GUI::VerticalBoxLayout>(4);
|
||||
auto& backtrace_text_editor = container.template add<GUI::TextEditor>();
|
||||
backtrace_text_editor.set_text(backtrace.text);
|
||||
|
@ -347,7 +347,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
for (auto& cpu_registers : results.thread_cpu_registers) {
|
||||
auto& container = cpu_registers_tab_widget.add_tab<GUI::Widget>(TRY(String::from_deprecated_string(cpu_registers.title)));
|
||||
auto& container = cpu_registers_tab_widget.add_tab<GUI::Widget>(TRY(String::from_byte_string(cpu_registers.title)));
|
||||
container.template set_layout<GUI::VerticalBoxLayout>(4);
|
||||
auto& cpu_registers_text_editor = container.template add<GUI::TextEditor>();
|
||||
cpu_registers_text_editor.set_text(cpu_registers.text);
|
||||
|
|
|
@ -56,7 +56,7 @@ static void handle_print_registers(PtraceRegisters const& regs)
|
|||
#endif
|
||||
}
|
||||
|
||||
static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr first_instruction)
|
||||
static bool handle_disassemble_command(ByteString const& command, FlatPtr first_instruction)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
size_t number_of_instructions_to_disassemble = 5;
|
||||
|
@ -88,7 +88,7 @@ static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr
|
|||
if (!insn.has_value())
|
||||
break;
|
||||
|
||||
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_deprecated_string(offset));
|
||||
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_byte_string(offset));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -106,7 +106,7 @@ static bool insert_breakpoint_at_address(FlatPtr address)
|
|||
return g_debug_session->insert_breakpoint(address);
|
||||
}
|
||||
|
||||
static bool insert_breakpoint_at_source_position(DeprecatedString const& file, size_t line)
|
||||
static bool insert_breakpoint_at_source_position(ByteString const& file, size_t line)
|
||||
{
|
||||
auto result = g_debug_session->insert_breakpoint(file, line);
|
||||
if (!result.has_value()) {
|
||||
|
@ -117,7 +117,7 @@ static bool insert_breakpoint_at_source_position(DeprecatedString const& file, s
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool insert_breakpoint_at_symbol(DeprecatedString const& symbol)
|
||||
static bool insert_breakpoint_at_symbol(ByteString const& symbol)
|
||||
{
|
||||
auto result = g_debug_session->insert_breakpoint(symbol);
|
||||
if (!result.has_value()) {
|
||||
|
@ -128,7 +128,7 @@ static bool insert_breakpoint_at_symbol(DeprecatedString const& symbol)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool handle_breakpoint_command(DeprecatedString const& command)
|
||||
static bool handle_breakpoint_command(ByteString const& command)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
if (parts.size() != 2)
|
||||
|
@ -155,7 +155,7 @@ static bool handle_breakpoint_command(DeprecatedString const& command)
|
|||
return insert_breakpoint_at_symbol(argument);
|
||||
}
|
||||
|
||||
static bool handle_examine_command(DeprecatedString const& command)
|
||||
static bool handle_examine_command(ByteString const& command)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
if (parts.size() != 2)
|
||||
|
|
|
@ -63,7 +63,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
|
|||
String path;
|
||||
if (!m_wallpaper_view->selection().is_empty()) {
|
||||
auto index = m_wallpaper_view->selection().first();
|
||||
auto path_or_error = String::from_deprecated_string(static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->full_path(index));
|
||||
auto path_or_error = String::from_byte_string(static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->full_path(index));
|
||||
if (path_or_error.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), "Unable to load wallpaper"sv);
|
||||
return;
|
||||
|
@ -78,7 +78,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
|
|||
m_context_menu = GUI::Menu::construct();
|
||||
auto const file_manager_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv));
|
||||
m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", file_manager_icon, [this](GUI::Action const&) {
|
||||
LexicalPath path { m_monitor_widget->wallpaper().value().to_deprecated_string() };
|
||||
LexicalPath path { m_monitor_widget->wallpaper().value().to_byte_string() };
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
});
|
||||
m_context_menu->add_action(*m_show_in_file_manager_action);
|
||||
|
@ -88,7 +88,7 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
|
|||
[this](auto&) {
|
||||
auto wallpaper = m_monitor_widget->wallpaper();
|
||||
if (wallpaper.has_value())
|
||||
GUI::Clipboard::the().set_data(URL::create_with_file_scheme(wallpaper.value().to_deprecated_string()).to_deprecated_string().bytes(), "text/uri-list");
|
||||
GUI::Clipboard::the().set_data(URL::create_with_file_scheme(wallpaper.value().to_byte_string()).to_byte_string().bytes(), "text/uri-list");
|
||||
},
|
||||
this);
|
||||
m_context_menu->add_action(*m_copy_action);
|
||||
|
@ -144,14 +144,14 @@ ErrorOr<void> BackgroundSettingsWidget::load_current_settings()
|
|||
{
|
||||
auto ws_config = TRY(Core::ConfigFile::open("/etc/WindowServer.ini"));
|
||||
|
||||
auto selected_wallpaper = TRY(String::from_deprecated_string(Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv)));
|
||||
auto selected_wallpaper = TRY(String::from_byte_string(Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv)));
|
||||
if (!selected_wallpaper.is_empty()) {
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper.to_deprecated_string(), m_wallpaper_view->model_column());
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper.to_byte_string(), m_wallpaper_view->model_column());
|
||||
m_wallpaper_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
|
||||
m_monitor_widget->set_wallpaper(selected_wallpaper);
|
||||
}
|
||||
|
||||
auto mode = TRY(String::from_deprecated_string(ws_config->read_entry("Background", "Mode", "Center")));
|
||||
auto mode = TRY(String::from_byte_string(ws_config->read_entry("Background", "Mode", "Center")));
|
||||
if (!m_modes.contains_slow(mode)) {
|
||||
warnln("Invalid background mode '{}' in WindowServer config, falling back to 'Center'", mode);
|
||||
mode = "Center"_string;
|
||||
|
|
|
@ -79,9 +79,9 @@ static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
|
|||
void FontSettingsWidget::apply_settings()
|
||||
{
|
||||
GUI::ConnectionToWindowServer::the().set_system_fonts(
|
||||
m_default_font_label->font().qualified_name().to_deprecated_string(),
|
||||
m_fixed_width_font_label->font().qualified_name().to_deprecated_string(),
|
||||
m_window_title_font_label->font().qualified_name().to_deprecated_string());
|
||||
m_default_font_label->font().qualified_name().to_byte_string(),
|
||||
m_fixed_width_font_label->font().qualified_name().to_byte_string(),
|
||||
m_window_title_font_label->font().qualified_name().to_byte_string());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ static ErrorOr<String> display_name_from_edid(EDID::Parser const& edid)
|
|||
|
||||
auto build_manufacturer_product_name = [&]() -> ErrorOr<String> {
|
||||
if (product_name.is_empty())
|
||||
return TRY(String::from_deprecated_string(manufacturer_name));
|
||||
return TRY(String::from_byte_string(manufacturer_name));
|
||||
return String::formatted("{} {}", manufacturer_name, product_name);
|
||||
};
|
||||
|
||||
|
@ -170,7 +170,7 @@ ErrorOr<void> MonitorSettingsWidget::load_current_settings()
|
|||
TRY(m_screen_edids.try_append(edid.release_value()));
|
||||
} else {
|
||||
dbgln("Error getting EDID from device {}: {}", m_screen_layout.screens[i].device.value(), edid.error());
|
||||
screen_display_name = TRY(String::from_deprecated_string(m_screen_layout.screens[i].device.value()));
|
||||
screen_display_name = TRY(String::from_byte_string(m_screen_layout.screens[i].device.value()));
|
||||
TRY(m_screen_edids.try_append({}));
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -20,8 +20,8 @@ ThemePreviewWidget::ThemePreviewWidget(Gfx::Palette const& palette)
|
|||
|
||||
ErrorOr<void> ThemePreviewWidget::set_theme(String path)
|
||||
{
|
||||
auto config_file = TRY(Core::File::open(path.to_deprecated_string(), Core::File::OpenMode::Read));
|
||||
TRY(set_theme_from_file(path.to_deprecated_string(), move(config_file)));
|
||||
auto config_file = TRY(Core::File::open(path.to_byte_string(), Core::File::OpenMode::Read));
|
||||
TRY(set_theme_from_file(path.to_byte_string(), move(config_file)));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DisplaySettings {
|
|||
|
||||
static ErrorOr<String> get_color_scheme_name_from_pathname(StringView color_scheme_path)
|
||||
{
|
||||
return TRY(String::from_deprecated_string(color_scheme_path.replace("/res/color-schemes/"sv, ""sv, ReplaceMode::FirstOnly).replace(".ini"sv, ""sv, ReplaceMode::FirstOnly)));
|
||||
return TRY(String::from_byte_string(color_scheme_path.replace("/res/color-schemes/"sv, ""sv, ReplaceMode::FirstOnly).replace(".ini"sv, ""sv, ReplaceMode::FirstOnly)));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<ThemesSettingsWidget>> ThemesSettingsWidget::try_create(bool& background_settings_changed)
|
||||
|
@ -40,7 +40,7 @@ ErrorOr<void> ThemesSettingsWidget::setup_interface()
|
|||
auto current_theme_name = GUI::ConnectionToWindowServer::the().get_system_theme();
|
||||
TRY(m_theme_names.try_ensure_capacity(m_themes.size()));
|
||||
for (auto& theme_meta : m_themes) {
|
||||
TRY(m_theme_names.try_append(TRY(String::from_deprecated_string(theme_meta.name))));
|
||||
TRY(m_theme_names.try_append(TRY(String::from_byte_string(theme_meta.name))));
|
||||
if (current_theme_name == theme_meta.name) {
|
||||
m_selected_theme = &theme_meta;
|
||||
current_theme_index = m_theme_names.size() - 1;
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<void> ThemesSettingsWidget::setup_interface()
|
|||
m_themes_combo->set_model(*GUI::ItemListModel<String>::create(m_theme_names));
|
||||
m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
m_selected_theme = &m_themes.at(index.row());
|
||||
auto selected_theme_path = String::from_deprecated_string(m_selected_theme->path);
|
||||
auto selected_theme_path = String::from_byte_string(m_selected_theme->path);
|
||||
ErrorOr<void> set_theme_result;
|
||||
if (!selected_theme_path.is_error())
|
||||
set_theme_result = m_theme_preview->set_theme(selected_theme_path.release_value());
|
||||
|
@ -98,7 +98,7 @@ ErrorOr<void> ThemesSettingsWidget::setup_interface()
|
|||
}
|
||||
}
|
||||
color_scheme_combo.on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
auto result = String::from_deprecated_string(index.data().as_string());
|
||||
auto result = String::from_byte_string(index.data().as_string());
|
||||
if (result.is_error())
|
||||
return;
|
||||
m_selected_color_scheme_name = result.release_value();
|
||||
|
@ -139,7 +139,7 @@ ErrorOr<void> ThemesSettingsWidget::setup_interface()
|
|||
if (current_theme_name == theme_meta.name) {
|
||||
m_themes_combo->set_selected_index(index, GUI::AllowCallback::No);
|
||||
m_selected_theme = &m_themes.at(index);
|
||||
auto selected_theme_path = String::from_deprecated_string(m_selected_theme->path);
|
||||
auto selected_theme_path = String::from_byte_string(m_selected_theme->path);
|
||||
ErrorOr<void> set_theme_result;
|
||||
if (!selected_theme_path.is_error())
|
||||
set_theme_result = m_theme_preview->set_theme(selected_theme_path.release_value());
|
||||
|
@ -178,7 +178,7 @@ void ThemesSettingsWidget::apply_settings()
|
|||
if (!set_theme_result)
|
||||
GUI::MessageBox::show_error(window(), "Failed to apply theme settings"sv);
|
||||
} else if (find_descendant_of_type_named<GUI::CheckBox>("custom_color_scheme_checkbox")->is_checked()) {
|
||||
auto set_theme_result = GUI::ConnectionToWindowServer::the().set_system_theme(m_selected_theme->path, m_selected_theme->name, m_background_settings_changed, color_scheme_path.to_deprecated_string());
|
||||
auto set_theme_result = GUI::ConnectionToWindowServer::the().set_system_theme(m_selected_theme->path, m_selected_theme->name, m_background_settings_changed, color_scheme_path.to_byte_string());
|
||||
if (!set_theme_result)
|
||||
GUI::MessageBox::show_error(window(), "Failed to apply theme settings"sv);
|
||||
} else {
|
||||
|
|
|
@ -56,7 +56,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
|
|||
m_ok_button->on_click = [this](auto) {
|
||||
auto result = check_password();
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Failed to execute command: {}", result.error()));
|
||||
GUI::MessageBox::show_error(this, ByteString::formatted("Failed to execute command: {}", result.error()));
|
||||
}
|
||||
close();
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
|
|||
|
||||
ErrorOr<void> EscalatorWindow::check_password()
|
||||
{
|
||||
DeprecatedString password = m_password_input->text();
|
||||
ByteString password = m_password_input->text();
|
||||
if (password.is_empty()) {
|
||||
GUI::MessageBox::show_error(this, "Please enter a password."sv);
|
||||
return {};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
#include "EscalatorWindow.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <LibCore/Account.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto executable_path = Core::System::resolve_executable_from_environment(command[0], AT_EACCESS);
|
||||
if (executable_path.is_error()) {
|
||||
GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0]));
|
||||
GUI::MessageBox::show_error(nullptr, ByteString::formatted("Could not execute command {}: Command not found.", command[0]));
|
||||
return 127;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ Vector<NonnullRefPtr<LauncherHandler>> DirectoryView::get_launch_handlers(URL co
|
|||
return handlers;
|
||||
}
|
||||
|
||||
Vector<NonnullRefPtr<LauncherHandler>> DirectoryView::get_launch_handlers(DeprecatedString const& path)
|
||||
Vector<NonnullRefPtr<LauncherHandler>> DirectoryView::get_launch_handlers(ByteString const& path)
|
||||
{
|
||||
return get_launch_handlers(URL::create_with_file_scheme(path));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void DirectoryView::handle_activation(GUI::ModelIndex const& index)
|
|||
struct stat st;
|
||||
if (stat(path.characters(), &st) < 0) {
|
||||
perror("stat");
|
||||
auto error_message = DeprecatedString::formatted("Could not stat {}: {}", path, strerror(errno));
|
||||
auto error_message = ByteString::formatted("Could not stat {}: {}", path, strerror(errno));
|
||||
GUI::MessageBox::show(window(), error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
@ -112,11 +112,11 @@ void DirectoryView::handle_activation(GUI::ModelIndex const& index)
|
|||
|
||||
if (default_launcher) {
|
||||
auto launch_origin_rect = current_view().to_widget_rect(current_view().content_rect(index)).translated(current_view().screen_relative_rect().location());
|
||||
setenv("__libgui_launch_origin_rect", DeprecatedString::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1);
|
||||
setenv("__libgui_launch_origin_rect", ByteString::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1);
|
||||
launch(url, *default_launcher);
|
||||
unsetenv("__libgui_launch_origin_rect");
|
||||
} else {
|
||||
auto error_message = DeprecatedString::formatted("Could not open {}", path);
|
||||
auto error_message = ByteString::formatted("Could not open {}", path);
|
||||
GUI::MessageBox::show(window(), error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void DirectoryView::setup_model()
|
|||
};
|
||||
|
||||
m_model->on_rename_error = [this](int, char const* error_string) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to rename file: {}", error_string));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Unable to rename file: {}", error_string));
|
||||
};
|
||||
|
||||
m_model->on_complete = [this] {
|
||||
|
@ -340,7 +340,7 @@ void DirectoryView::model_did_update(unsigned flags)
|
|||
update_statusbar();
|
||||
}
|
||||
|
||||
void DirectoryView::set_view_mode_from_string(DeprecatedString const& mode)
|
||||
void DirectoryView::set_view_mode_from_string(ByteString const& mode)
|
||||
{
|
||||
if (m_mode == Mode::Desktop)
|
||||
return;
|
||||
|
@ -389,7 +389,7 @@ void DirectoryView::set_view_mode(ViewMode mode)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void DirectoryView::add_path_to_history(DeprecatedString path)
|
||||
void DirectoryView::add_path_to_history(ByteString path)
|
||||
{
|
||||
if (m_path_history.size() && m_path_history.at(m_path_history_position) == path)
|
||||
return;
|
||||
|
@ -401,7 +401,7 @@ void DirectoryView::add_path_to_history(DeprecatedString path)
|
|||
m_path_history_position = m_path_history.size() - 1;
|
||||
}
|
||||
|
||||
bool DirectoryView::open(DeprecatedString const& path)
|
||||
bool DirectoryView::open(ByteString const& path)
|
||||
{
|
||||
auto error_or_real_path = FileSystem::real_path(path);
|
||||
if (error_or_real_path.is_error() || !FileSystem::is_directory(path))
|
||||
|
@ -413,11 +413,11 @@ bool DirectoryView::open(DeprecatedString const& path)
|
|||
warnln("Failed to open '{}': {}", real_path, result.error());
|
||||
}
|
||||
|
||||
if (model().root_path() == real_path.to_deprecated_string()) {
|
||||
if (model().root_path() == real_path.to_byte_string()) {
|
||||
refresh();
|
||||
} else {
|
||||
set_active_widget(¤t_view());
|
||||
model().set_root_path(real_path.to_deprecated_string());
|
||||
model().set_root_path(real_path.to_byte_string());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -528,15 +528,15 @@ void DirectoryView::launch(URL const&, LauncherHandler const& launcher_handler)
|
|||
}
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> DirectoryView::selected_file_paths() const
|
||||
Vector<ByteString> DirectoryView::selected_file_paths() const
|
||||
{
|
||||
Vector<DeprecatedString> paths;
|
||||
Vector<ByteString> paths;
|
||||
auto& view = current_view();
|
||||
auto& model = *view.model();
|
||||
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
||||
auto parent_index = model.parent_index(index);
|
||||
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
|
||||
auto path = name_index.data(GUI::ModelRole::Custom).to_deprecated_string();
|
||||
auto path = name_index.data(GUI::ModelRole::Custom).to_byte_string();
|
||||
paths.append(path);
|
||||
});
|
||||
return paths;
|
||||
|
@ -580,11 +580,11 @@ void DirectoryView::setup_actions()
|
|||
String value;
|
||||
auto icon = Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
if (GUI::InputBox::show(window(), value, "Enter a name:"sv, "New Directory"sv, GUI::InputType::NonemptyText, {}, move(icon)) == GUI::InputBox::ExecResult::OK) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value));
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", path(), value));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
auto saved_errno = errno;
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -593,22 +593,22 @@ void DirectoryView::setup_actions()
|
|||
String value;
|
||||
auto icon = Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
if (GUI::InputBox::show(window(), value, "Enter a name:"sv, "New File"sv, GUI::InputType::NonemptyText, {}, move(icon)) == GUI::InputBox::ExecResult::OK) {
|
||||
auto new_file_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value));
|
||||
auto new_file_path = LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", path(), value));
|
||||
struct stat st;
|
||||
int rc = stat(new_file_path.characters(), &st);
|
||||
if ((rc < 0 && errno != ENOENT)) {
|
||||
auto saved_errno = errno;
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
if (rc == 0) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
int fd = creat(new_file_path.characters(), 0666);
|
||||
if (fd < 0) {
|
||||
auto saved_errno = errno;
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
rc = close(fd);
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
virtual ~DirectoryView() override;
|
||||
|
||||
bool open(DeprecatedString const& path);
|
||||
DeprecatedString path() const { return model().root_path(); }
|
||||
bool open(ByteString const& path);
|
||||
ByteString path() const { return model().root_path(); }
|
||||
void open_parent_directory();
|
||||
void open_previous_directory();
|
||||
void open_next_directory();
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
int path_history_position() const { return m_path_history_position; }
|
||||
static RefPtr<LauncherHandler> get_default_launch_handler(Vector<NonnullRefPtr<LauncherHandler>> const& handlers);
|
||||
static Vector<NonnullRefPtr<LauncherHandler>> get_launch_handlers(URL const& url);
|
||||
static Vector<NonnullRefPtr<LauncherHandler>> get_launch_handlers(DeprecatedString const& path);
|
||||
static Vector<NonnullRefPtr<LauncherHandler>> get_launch_handlers(ByteString const& path);
|
||||
|
||||
void refresh();
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
void set_view_mode(ViewMode);
|
||||
ViewMode view_mode() const { return m_view_mode; }
|
||||
|
||||
void set_view_mode_from_string(DeprecatedString const&);
|
||||
void set_view_mode_from_string(ByteString const&);
|
||||
|
||||
GUI::AbstractView& current_view()
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
|
||||
bool is_desktop() const { return m_mode == Mode::Desktop; }
|
||||
|
||||
Vector<DeprecatedString> selected_file_paths() const;
|
||||
Vector<ByteString> selected_file_paths() const;
|
||||
|
||||
GUI::Action& mkdir_action() { return *m_mkdir_action; }
|
||||
GUI::Action& touch_action() { return *m_touch_action; }
|
||||
|
@ -166,8 +166,8 @@ private:
|
|||
NonnullRefPtr<GUI::FileSystemModel> m_model;
|
||||
NonnullRefPtr<GUI::SortingProxyModel> m_sorting_model;
|
||||
size_t m_path_history_position { 0 };
|
||||
Vector<DeprecatedString> m_path_history;
|
||||
void add_path_to_history(DeprecatedString);
|
||||
Vector<ByteString> m_path_history;
|
||||
void add_path_to_history(ByteString);
|
||||
|
||||
RefPtr<GUI::Label> m_error_label;
|
||||
|
||||
|
|
|
@ -134,11 +134,11 @@ void FileOperationProgressWidget::did_error(StringView message)
|
|||
{
|
||||
// FIXME: Communicate more with the user about errors.
|
||||
close_pipe();
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
|
||||
window()->close();
|
||||
}
|
||||
|
||||
DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
|
||||
ByteString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
|
||||
{
|
||||
i64 const elapsed_seconds = m_elapsed_timer.elapsed_time().to_seconds();
|
||||
|
||||
|
@ -149,7 +149,7 @@ DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, of
|
|||
int seconds_remaining = (bytes_left * elapsed_seconds) / bytes_done;
|
||||
|
||||
if (seconds_remaining < 30)
|
||||
return DeprecatedString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
|
||||
return ByteString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
|
||||
if (seconds_remaining < 60)
|
||||
return "About a minute";
|
||||
if (seconds_remaining < 90)
|
||||
|
@ -162,14 +162,14 @@ DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, of
|
|||
|
||||
if (minutes_remaining < 60) {
|
||||
if (seconds_remaining < 30)
|
||||
return DeprecatedString::formatted("About {} minutes", minutes_remaining);
|
||||
return DeprecatedString::formatted("Over {} minutes", minutes_remaining);
|
||||
return ByteString::formatted("About {} minutes", minutes_remaining);
|
||||
return ByteString::formatted("Over {} minutes", minutes_remaining);
|
||||
}
|
||||
|
||||
time_t hours_remaining = minutes_remaining / 60;
|
||||
minutes_remaining %= 60;
|
||||
|
||||
return DeprecatedString::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
|
||||
return ByteString::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
|
||||
}
|
||||
|
||||
void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView current_filename)
|
||||
|
@ -195,7 +195,7 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
estimated_time_label.set_text(String::from_deprecated_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors());
|
||||
estimated_time_label.set_text(String::from_byte_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
if (total_byte_count) {
|
||||
window()->set_progress(100.0f * bytes_done / total_byte_count);
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
void close_pipe();
|
||||
|
||||
DeprecatedString estimate_time(off_t bytes_done, off_t total_byte_count);
|
||||
ByteString estimate_time(off_t bytes_done, off_t total_byte_count);
|
||||
Core::ElapsedTimer m_elapsed_timer;
|
||||
|
||||
FileOperation m_operation;
|
||||
|
|
|
@ -19,13 +19,13 @@ namespace FileManager {
|
|||
|
||||
HashTable<NonnullRefPtr<GUI::Window>> file_operation_windows;
|
||||
|
||||
void delete_paths(Vector<DeprecatedString> const& paths, bool should_confirm, GUI::Window* parent_window)
|
||||
void delete_paths(Vector<ByteString> const& paths, bool should_confirm, GUI::Window* parent_window)
|
||||
{
|
||||
DeprecatedString message;
|
||||
ByteString message;
|
||||
if (paths.size() == 1) {
|
||||
message = DeprecatedString::formatted("Are you sure you want to delete \"{}\"?", LexicalPath::basename(paths[0]));
|
||||
message = ByteString::formatted("Are you sure you want to delete \"{}\"?", LexicalPath::basename(paths[0]));
|
||||
} else {
|
||||
message = DeprecatedString::formatted("Are you sure you want to delete {} files?", paths.size());
|
||||
message = ByteString::formatted("Are you sure you want to delete {} files?", paths.size());
|
||||
}
|
||||
|
||||
if (should_confirm) {
|
||||
|
@ -42,7 +42,7 @@ void delete_paths(Vector<DeprecatedString> const& paths, bool should_confirm, GU
|
|||
_exit(1);
|
||||
}
|
||||
|
||||
ErrorOr<void> run_file_operation(FileOperation operation, Vector<DeprecatedString> const& sources, DeprecatedString const& destination, GUI::Window* parent_window)
|
||||
ErrorOr<void> run_file_operation(FileOperation operation, Vector<ByteString> const& sources, ByteString const& destination, GUI::Window* parent_window)
|
||||
{
|
||||
auto pipe_fds = TRY(Core::System::pipe2(0));
|
||||
|
||||
|
@ -110,7 +110,7 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<DeprecatedStrin
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<bool> handle_drop(GUI::DropEvent const& event, DeprecatedString const& destination, GUI::Window* window)
|
||||
ErrorOr<bool> handle_drop(GUI::DropEvent const& event, ByteString const& destination, GUI::Window* window)
|
||||
{
|
||||
bool has_accepted_drop = false;
|
||||
|
||||
|
@ -127,12 +127,12 @@ ErrorOr<bool> handle_drop(GUI::DropEvent const& event, DeprecatedString const& d
|
|||
if (!FileSystem::is_directory(target))
|
||||
return has_accepted_drop;
|
||||
|
||||
Vector<DeprecatedString> paths_to_copy;
|
||||
Vector<ByteString> paths_to_copy;
|
||||
for (auto& url_to_copy : urls) {
|
||||
auto file_path = url_to_copy.serialize_path();
|
||||
if (!url_to_copy.is_valid() || file_path == target)
|
||||
continue;
|
||||
auto new_path = DeprecatedString::formatted("{}/{}", target, LexicalPath::basename(file_path));
|
||||
auto new_path = ByteString::formatted("{}/{}", target, LexicalPath::basename(file_path));
|
||||
if (file_path == new_path)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
|
||||
|
@ -19,8 +19,8 @@ enum class FileOperation {
|
|||
Delete,
|
||||
};
|
||||
|
||||
void delete_paths(Vector<DeprecatedString> const&, bool should_confirm, GUI::Window*);
|
||||
void delete_paths(Vector<ByteString> const&, bool should_confirm, GUI::Window*);
|
||||
|
||||
ErrorOr<void> run_file_operation(FileOperation, Vector<DeprecatedString> const& sources, DeprecatedString const& destination, GUI::Window*);
|
||||
ErrorOr<bool> handle_drop(GUI::DropEvent const& event, DeprecatedString const& destination, GUI::Window* window);
|
||||
ErrorOr<void> run_file_operation(FileOperation, Vector<ByteString> const& sources, ByteString const& destination, GUI::Window*);
|
||||
ErrorOr<bool> handle_drop(GUI::DropEvent const& event, ByteString const& destination, GUI::Window* window);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ErrorOr<NonnullRefPtr<PropertiesWindow>> PropertiesWindow::try_create(DeprecatedString const& path, bool disable_rename, Window* parent)
|
||||
ErrorOr<NonnullRefPtr<PropertiesWindow>> PropertiesWindow::try_create(ByteString const& path, bool disable_rename, Window* parent)
|
||||
{
|
||||
auto window = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) PropertiesWindow(path, parent)));
|
||||
window->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv)));
|
||||
|
@ -55,7 +55,7 @@ ErrorOr<NonnullRefPtr<PropertiesWindow>> PropertiesWindow::try_create(Deprecated
|
|||
return window;
|
||||
}
|
||||
|
||||
PropertiesWindow::PropertiesWindow(DeprecatedString const& path, Window* parent_window)
|
||||
PropertiesWindow::PropertiesWindow(ByteString const& path, Window* parent_window)
|
||||
: Window(parent_window)
|
||||
{
|
||||
auto lexical_path = LexicalPath(path);
|
||||
|
@ -134,15 +134,15 @@ ErrorOr<void> PropertiesWindow::create_general_tab(GUI::TabWidget& tab_widget, b
|
|||
};
|
||||
|
||||
auto* location = general_tab.find_descendant_of_type_named<GUI::LinkLabel>("location");
|
||||
location->set_text(TRY(String::from_deprecated_string(m_path)));
|
||||
location->set_text(TRY(String::from_byte_string(m_path)));
|
||||
location->on_click = [this] {
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(m_parent_path, m_name));
|
||||
};
|
||||
|
||||
auto st = TRY(Core::System::lstat(m_path));
|
||||
|
||||
DeprecatedString owner_name;
|
||||
DeprecatedString group_name;
|
||||
ByteString owner_name;
|
||||
ByteString group_name;
|
||||
|
||||
if (auto* pw = getpwuid(st.st_uid)) {
|
||||
owner_name = pw->pw_name;
|
||||
|
@ -171,7 +171,7 @@ ErrorOr<void> PropertiesWindow::create_general_tab(GUI::TabWidget& tab_widget, b
|
|||
auto* link_location = general_tab.find_descendant_of_type_named<GUI::LinkLabel>("link_location");
|
||||
link_location->set_text(link_destination);
|
||||
link_location->on_click = [link_destination] {
|
||||
auto link_directory = LexicalPath(link_destination.to_deprecated_string());
|
||||
auto link_directory = LexicalPath(link_destination.to_byte_string());
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(link_directory.dirname(), link_directory.basename()));
|
||||
};
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ ErrorOr<void> PropertiesWindow::create_general_tab(GUI::TabWidget& tab_widget, b
|
|||
m_size_label = general_tab.find_descendant_of_type_named<GUI::Label>("size");
|
||||
m_size_label->set_text(S_ISDIR(st.st_mode)
|
||||
? "Calculating..."_string
|
||||
: TRY(String::from_deprecated_string(human_readable_size_long(st.st_size, UseThousandsSeparator::Yes))));
|
||||
: TRY(String::from_byte_string(human_readable_size_long(st.st_size, UseThousandsSeparator::Yes))));
|
||||
|
||||
auto* owner = general_tab.find_descendant_of_type_named<GUI::Label>("owner");
|
||||
owner->set_text(String::formatted("{} ({})", owner_name, st.st_uid).release_value_but_fixme_should_propagate_errors());
|
||||
|
@ -192,10 +192,10 @@ ErrorOr<void> PropertiesWindow::create_general_tab(GUI::TabWidget& tab_widget, b
|
|||
group->set_text(String::formatted("{} ({})", group_name, st.st_gid).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto* created_at = general_tab.find_descendant_of_type_named<GUI::Label>("created_at");
|
||||
created_at->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_ctime)).release_value_but_fixme_should_propagate_errors());
|
||||
created_at->set_text(String::from_byte_string(GUI::FileSystemModel::timestamp_string(st.st_ctime)).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto* last_modified = general_tab.find_descendant_of_type_named<GUI::Label>("last_modified");
|
||||
last_modified->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_mtime)).release_value_but_fixme_should_propagate_errors());
|
||||
last_modified->set_text(String::from_byte_string(GUI::FileSystemModel::timestamp_string(st.st_mtime)).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto* owner_read = general_tab.find_descendant_of_type_named<GUI::CheckBox>("owner_read");
|
||||
auto* owner_write = general_tab.find_descendant_of_type_named<GUI::CheckBox>("owner_write");
|
||||
|
@ -263,7 +263,7 @@ ErrorOr<void> PropertiesWindow::create_archive_tab(GUI::TabWidget& tab_widget, N
|
|||
tab.find_descendant_of_type_named<GUI::Label>("archive_file_count")->set_text(TRY(String::number(statistics.file_count())));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("archive_format")->set_text("ZIP"_string);
|
||||
tab.find_descendant_of_type_named<GUI::Label>("archive_directory_count")->set_text(TRY(String::number(statistics.directory_count())));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("archive_uncompressed_size")->set_text(TRY(String::from_deprecated_string(AK::human_readable_size(statistics.total_uncompressed_bytes()))));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("archive_uncompressed_size")->set_text(TRY(String::from_byte_string(AK::human_readable_size(statistics.total_uncompressed_bytes()))));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -280,9 +280,9 @@ ErrorOr<void> PropertiesWindow::create_audio_tab(GUI::TabWidget& tab_widget, Non
|
|||
auto& tab = tab_widget.add_tab<GUI::Widget>("Audio"_string);
|
||||
TRY(tab.load_from_gml(properties_window_audio_tab_gml));
|
||||
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_type")->set_text(TRY(String::from_deprecated_string(loader->format_name())));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_type")->set_text(TRY(String::from_byte_string(loader->format_name())));
|
||||
auto duration_seconds = loader->total_samples() / loader->sample_rate();
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_duration")->set_text(TRY(String::from_deprecated_string(human_readable_digital_time(duration_seconds))));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_duration")->set_text(TRY(String::from_byte_string(human_readable_digital_time(duration_seconds))));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_sample_rate")->set_text(TRY(String::formatted("{} Hz", loader->sample_rate())));
|
||||
tab.find_descendant_of_type_named<GUI::Label>("audio_format")->set_text(TRY(String::formatted("{}-bit", loader->bits_per_sample())));
|
||||
|
||||
|
@ -487,12 +487,12 @@ ErrorOr<void> PropertiesWindow::create_pdf_tab(GUI::TabWidget& tab_widget, Nonnu
|
|||
if (maybe_info_dict.is_error()) {
|
||||
warnln("Failed to read InfoDict from '{}': {}", m_path, maybe_info_dict.error().message());
|
||||
} else if (maybe_info_dict.value().has_value()) {
|
||||
auto get_info_string = [](PDF::PDFErrorOr<Optional<DeprecatedString>> input) -> ErrorOr<String> {
|
||||
auto get_info_string = [](PDF::PDFErrorOr<Optional<ByteString>> input) -> ErrorOr<String> {
|
||||
if (input.is_error())
|
||||
return String {};
|
||||
if (!input.value().has_value())
|
||||
return String {};
|
||||
return String::from_deprecated_string(input.value().value());
|
||||
return String::from_byte_string(input.value().value());
|
||||
};
|
||||
|
||||
auto info_dict = maybe_info_dict.release_value().release_value();
|
||||
|
@ -512,7 +512,7 @@ ErrorOr<void> PropertiesWindow::create_pdf_tab(GUI::TabWidget& tab_widget, Nonnu
|
|||
void PropertiesWindow::update()
|
||||
{
|
||||
m_icon->set_bitmap(GUI::FileIconProvider::icon_for_path(make_full_path(m_name), m_mode).bitmap_for_size(32));
|
||||
set_title(DeprecatedString::formatted("{} - Properties", m_name));
|
||||
set_title(ByteString::formatted("{} - Properties", m_name));
|
||||
}
|
||||
|
||||
void PropertiesWindow::permission_changed(mode_t mask, bool set)
|
||||
|
@ -527,24 +527,24 @@ void PropertiesWindow::permission_changed(mode_t mask, bool set)
|
|||
m_apply_button->set_enabled(m_name_dirty || m_permissions_dirty);
|
||||
}
|
||||
|
||||
DeprecatedString PropertiesWindow::make_full_path(DeprecatedString const& name)
|
||||
ByteString PropertiesWindow::make_full_path(ByteString const& name)
|
||||
{
|
||||
return DeprecatedString::formatted("{}/{}", m_parent_path, name);
|
||||
return ByteString::formatted("{}/{}", m_parent_path, name);
|
||||
}
|
||||
|
||||
bool PropertiesWindow::apply_changes()
|
||||
{
|
||||
if (m_name_dirty) {
|
||||
DeprecatedString new_name = m_name_box->text();
|
||||
DeprecatedString new_file = make_full_path(new_name).characters();
|
||||
ByteString new_name = m_name_box->text();
|
||||
ByteString new_file = make_full_path(new_name).characters();
|
||||
|
||||
if (FileSystem::exists(new_file)) {
|
||||
GUI::MessageBox::show(this, DeprecatedString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, ByteString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rename(make_full_path(m_name).characters(), new_file.characters())) {
|
||||
GUI::MessageBox::show(this, DeprecatedString::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, ByteString::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ bool PropertiesWindow::apply_changes()
|
|||
|
||||
if (m_permissions_dirty) {
|
||||
if (chmod(make_full_path(m_name).characters(), m_mode)) {
|
||||
GUI::MessageBox::show(this, DeprecatedString::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, ByteString::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -606,7 +606,7 @@ void PropertiesWindow::close()
|
|||
m_directory_statistics_calculator->stop();
|
||||
}
|
||||
|
||||
PropertiesWindow::DirectoryStatisticsCalculator::DirectoryStatisticsCalculator(DeprecatedString path)
|
||||
PropertiesWindow::DirectoryStatisticsCalculator::DirectoryStatisticsCalculator(ByteString path)
|
||||
{
|
||||
m_work_queue.enqueue(path);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ class PropertiesWindow final : public GUI::Window {
|
|||
C_OBJECT(PropertiesWindow);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<PropertiesWindow>> try_create(DeprecatedString const& path, bool disable_rename, Window* parent = nullptr);
|
||||
static ErrorOr<NonnullRefPtr<PropertiesWindow>> try_create(ByteString const& path, bool disable_rename, Window* parent = nullptr);
|
||||
virtual ~PropertiesWindow() override = default;
|
||||
|
||||
virtual void close() final;
|
||||
|
||||
private:
|
||||
PropertiesWindow(DeprecatedString const& path, Window* parent = nullptr);
|
||||
PropertiesWindow(ByteString const& path, Window* parent = nullptr);
|
||||
ErrorOr<void> create_widgets(bool disable_rename);
|
||||
ErrorOr<void> create_general_tab(GUI::TabWidget&, bool disable_rename);
|
||||
ErrorOr<void> create_file_type_specific_tabs(GUI::TabWidget&);
|
||||
|
@ -44,7 +44,7 @@ private:
|
|||
|
||||
class DirectoryStatisticsCalculator final : public RefCounted<DirectoryStatisticsCalculator> {
|
||||
public:
|
||||
DirectoryStatisticsCalculator(DeprecatedString path);
|
||||
DirectoryStatisticsCalculator(ByteString path);
|
||||
void start();
|
||||
void stop();
|
||||
Function<void(off_t total_size_in_bytes, size_t file_count, size_t directory_count)> on_update;
|
||||
|
@ -54,7 +54,7 @@ private:
|
|||
size_t m_file_count { 0 };
|
||||
size_t m_directory_count { 0 };
|
||||
RefPtr<Threading::BackgroundAction<int>> m_background_action;
|
||||
Queue<DeprecatedString> m_work_queue;
|
||||
Queue<ByteString> m_work_queue;
|
||||
};
|
||||
|
||||
static StringView const get_description(mode_t const mode)
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
void permission_changed(mode_t mask, bool set);
|
||||
bool apply_changes();
|
||||
void update();
|
||||
DeprecatedString make_full_path(DeprecatedString const& name);
|
||||
ByteString make_full_path(ByteString const& name);
|
||||
|
||||
RefPtr<GUI::Button> m_apply_button;
|
||||
RefPtr<GUI::TextBox> m_name_box;
|
||||
|
@ -92,9 +92,9 @@ private:
|
|||
RefPtr<GUI::Label> m_size_label;
|
||||
RefPtr<DirectoryStatisticsCalculator> m_directory_statistics_calculator;
|
||||
RefPtr<GUI::Action> m_on_escape;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_parent_path;
|
||||
DeprecatedString m_path;
|
||||
ByteString m_name;
|
||||
ByteString m_parent_path;
|
||||
ByteString m_path;
|
||||
mode_t m_mode { 0 };
|
||||
mode_t m_old_mode { 0 };
|
||||
bool m_permissions_dirty { false };
|
||||
|
|
|
@ -59,15 +59,15 @@
|
|||
using namespace FileManager;
|
||||
|
||||
static ErrorOr<int> run_in_desktop_mode();
|
||||
static ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, DeprecatedString const& entry_focused_on_init);
|
||||
static void do_copy(Vector<DeprecatedString> const& selected_file_paths, FileOperation file_operation);
|
||||
static void do_paste(DeprecatedString const& target_directory, GUI::Window* window);
|
||||
static void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window);
|
||||
static void do_unzip_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window);
|
||||
static void show_properties(DeprecatedString const& container_dir_path, DeprecatedString const& path, Vector<DeprecatedString> const& selected, GUI::Window* window);
|
||||
static bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, DeprecatedString const& full_path, RefPtr<GUI::Action>& default_action, Vector<NonnullRefPtr<LauncherHandler>>& current_file_launch_handlers);
|
||||
static ErrorOr<int> run_in_windowed_mode(ByteString const& initial_location, ByteString const& entry_focused_on_init);
|
||||
static void do_copy(Vector<ByteString> const& selected_file_paths, FileOperation file_operation);
|
||||
static void do_paste(ByteString const& target_directory, GUI::Window* window);
|
||||
static void do_create_link(Vector<ByteString> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_create_archive(Vector<ByteString> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_set_wallpaper(ByteString const& file_path, GUI::Window* window);
|
||||
static void do_unzip_archive(Vector<ByteString> const& selected_file_paths, GUI::Window* window);
|
||||
static void show_properties(ByteString const& container_dir_path, ByteString const& path, Vector<ByteString> const& selected, GUI::Window* window);
|
||||
static bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, ByteString const& full_path, RefPtr<GUI::Action>& default_action, Vector<NonnullRefPtr<LauncherHandler>>& current_file_launch_handlers);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool is_desktop_mode { false };
|
||||
bool is_selection_mode { false };
|
||||
bool ignore_path_resolution { false };
|
||||
DeprecatedString initial_location;
|
||||
ByteString initial_location;
|
||||
args_parser.add_option(is_desktop_mode, "Run in desktop mode", "desktop", 'd');
|
||||
args_parser.add_option(is_selection_mode, "Show entry in parent folder", "select", 's');
|
||||
args_parser.add_option(ignore_path_resolution, "Use raw path, do not resolve real path", "raw", 'r');
|
||||
|
@ -109,7 +109,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
LexicalPath path(initial_location);
|
||||
if (!initial_location.is_empty()) {
|
||||
if (auto error_or_path = FileSystem::real_path(initial_location); !ignore_path_resolution && !error_or_path.is_error())
|
||||
initial_location = error_or_path.release_value().to_deprecated_string();
|
||||
initial_location = error_or_path.release_value().to_byte_string();
|
||||
|
||||
if (!FileSystem::is_directory(initial_location)) {
|
||||
// We want to extract zips to a temporary directory when FileManager is launched with a .zip file as its first argument
|
||||
|
@ -134,7 +134,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return run_in_windowed_mode(temp_directory_path.to_deprecated_string(), path.basename());
|
||||
return run_in_windowed_mode(temp_directory_path.to_byte_string(), path.basename());
|
||||
}
|
||||
|
||||
is_selection_mode = true;
|
||||
|
@ -142,7 +142,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (auto error_or_cwd = FileSystem::current_working_directory(); initial_location.is_empty() && !error_or_cwd.is_error())
|
||||
initial_location = error_or_cwd.release_value().to_deprecated_string();
|
||||
initial_location = error_or_cwd.release_value().to_byte_string();
|
||||
|
||||
if (initial_location.is_empty())
|
||||
initial_location = Core::StandardPaths::home_directory();
|
||||
|
@ -150,7 +150,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (initial_location.is_empty())
|
||||
initial_location = "/";
|
||||
|
||||
DeprecatedString focused_entry;
|
||||
ByteString focused_entry;
|
||||
if (is_selection_mode) {
|
||||
initial_location = path.dirname();
|
||||
focused_entry = path.basename();
|
||||
|
@ -159,7 +159,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return run_in_windowed_mode(initial_location, focused_entry);
|
||||
}
|
||||
|
||||
void do_copy(Vector<DeprecatedString> const& selected_file_paths, FileOperation file_operation)
|
||||
void do_copy(Vector<ByteString> const& selected_file_paths, FileOperation file_operation)
|
||||
{
|
||||
VERIFY(!selected_file_paths.is_empty());
|
||||
|
||||
|
@ -171,17 +171,17 @@ void do_copy(Vector<DeprecatedString> const& selected_file_paths, FileOperation
|
|||
auto url = URL::create_with_file_scheme(path);
|
||||
copy_text.appendff("{}\n", url);
|
||||
}
|
||||
GUI::Clipboard::the().set_data(copy_text.to_deprecated_string().bytes(), "text/uri-list");
|
||||
GUI::Clipboard::the().set_data(copy_text.to_byte_string().bytes(), "text/uri-list");
|
||||
}
|
||||
|
||||
void do_paste(DeprecatedString const& target_directory, GUI::Window* window)
|
||||
void do_paste(ByteString const& target_directory, GUI::Window* window)
|
||||
{
|
||||
auto data_and_type = GUI::Clipboard::the().fetch_data_and_type();
|
||||
if (data_and_type.mime_type != "text/uri-list") {
|
||||
dbgln("Cannot paste clipboard type {}", data_and_type.mime_type);
|
||||
return;
|
||||
}
|
||||
auto copied_lines = DeprecatedString::copy(data_and_type.data).split('\n');
|
||||
auto copied_lines = ByteString::copy(data_and_type.data).split('\n');
|
||||
if (copied_lines.is_empty()) {
|
||||
dbgln("No files to paste");
|
||||
return;
|
||||
|
@ -193,7 +193,7 @@ void do_paste(DeprecatedString const& target_directory, GUI::Window* window)
|
|||
copied_lines.remove(0);
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> source_paths;
|
||||
Vector<ByteString> source_paths;
|
||||
for (auto& uri_as_string : copied_lines) {
|
||||
if (uri_as_string.is_empty())
|
||||
continue;
|
||||
|
@ -211,17 +211,17 @@ void do_paste(DeprecatedString const& target_directory, GUI::Window* window)
|
|||
}
|
||||
}
|
||||
|
||||
void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
void do_create_link(Vector<ByteString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
auto path = selected_file_paths.first();
|
||||
auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
|
||||
auto destination = ByteString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
|
||||
if (auto result = FileSystem::link_file(destination, path); result.is_error()) {
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
||||
void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
void do_create_archive(Vector<ByteString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
String archive_name;
|
||||
if (GUI::InputBox::show(window, archive_name, "Enter name:"sv, "Create Archive"sv) != GUI::InputBox::ExecResult::OK)
|
||||
|
@ -240,7 +240,7 @@ void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI:
|
|||
if (!AK::StringUtils::ends_with(archive_name, ".zip"sv, CaseSensitivity::CaseSensitive))
|
||||
path_builder.append(".zip"sv);
|
||||
}
|
||||
auto output_path = path_builder.to_deprecated_string();
|
||||
auto output_path = path_builder.to_byte_string();
|
||||
|
||||
pid_t zip_pid = fork();
|
||||
if (zip_pid < 0) {
|
||||
|
@ -249,7 +249,7 @@ void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI:
|
|||
}
|
||||
|
||||
if (!zip_pid) {
|
||||
Vector<DeprecatedString> relative_paths;
|
||||
Vector<ByteString> relative_paths;
|
||||
Vector<char const*> arg_list;
|
||||
arg_list.append("/bin/zip");
|
||||
arg_list.append("-r");
|
||||
|
@ -273,10 +273,10 @@ void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI:
|
|||
}
|
||||
}
|
||||
|
||||
void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window)
|
||||
void do_set_wallpaper(ByteString const& file_path, GUI::Window* window)
|
||||
{
|
||||
auto show_error = [&] {
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, ByteString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
|
||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(file_path);
|
||||
|
@ -289,10 +289,10 @@ void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window)
|
|||
show_error();
|
||||
}
|
||||
|
||||
void do_unzip_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
void do_unzip_archive(Vector<ByteString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
DeprecatedString archive_file_path = selected_file_paths.first();
|
||||
DeprecatedString output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4);
|
||||
ByteString archive_file_path = selected_file_paths.first();
|
||||
ByteString output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4);
|
||||
|
||||
pid_t unzip_pid = fork();
|
||||
if (unzip_pid < 0) {
|
||||
|
@ -315,7 +315,7 @@ void do_unzip_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::
|
|||
}
|
||||
}
|
||||
|
||||
void show_properties(DeprecatedString const& container_dir_path, DeprecatedString const& path, Vector<DeprecatedString> const& selected, GUI::Window* window)
|
||||
void show_properties(ByteString const& container_dir_path, ByteString const& path, Vector<ByteString> const& selected, GUI::Window* window)
|
||||
{
|
||||
ErrorOr<RefPtr<PropertiesWindow>> properties_or_error = nullptr;
|
||||
if (selected.is_empty()) {
|
||||
|
@ -337,7 +337,7 @@ void show_properties(DeprecatedString const& container_dir_path, DeprecatedStrin
|
|||
properties->show();
|
||||
}
|
||||
|
||||
bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, DeprecatedString const& full_path, RefPtr<GUI::Action>& default_action, Vector<NonnullRefPtr<LauncherHandler>>& current_file_launch_handlers)
|
||||
bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, ByteString const& full_path, RefPtr<GUI::Action>& default_action, Vector<NonnullRefPtr<LauncherHandler>>& current_file_launch_handlers)
|
||||
{
|
||||
current_file_launch_handlers = directory_view.get_launch_handlers(full_path);
|
||||
|
||||
|
@ -348,9 +348,9 @@ bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView c
|
|||
directory_view.launch(URL::create_with_file_scheme(full_path), launcher_handler);
|
||||
});
|
||||
if (default_file_handler->details().launcher_type == Desktop::Launcher::LauncherType::Application)
|
||||
file_open_action->set_text(DeprecatedString::formatted("Run {}", file_open_action->text()));
|
||||
file_open_action->set_text(ByteString::formatted("Run {}", file_open_action->text()));
|
||||
else
|
||||
file_open_action->set_text(DeprecatedString::formatted("Open in {}", file_open_action->text()));
|
||||
file_open_action->set_text(ByteString::formatted("Open in {}", file_open_action->text()));
|
||||
|
||||
default_action = file_open_action;
|
||||
|
||||
|
@ -458,8 +458,8 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
|
||||
auto properties_action = GUI::CommonActions::make_properties_action(
|
||||
[&](auto&) {
|
||||
DeprecatedString path = directory_view->path();
|
||||
Vector<DeprecatedString> selected = directory_view->selected_file_paths();
|
||||
ByteString path = directory_view->path();
|
||||
Vector<ByteString> selected = directory_view->selected_file_paths();
|
||||
|
||||
show_properties(path, path, selected, directory_view->window());
|
||||
},
|
||||
|
@ -472,7 +472,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
window);
|
||||
paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type() == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0);
|
||||
|
||||
GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [&](ByteString const& data_type) {
|
||||
paste_action->set_enabled(data_type == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0);
|
||||
};
|
||||
|
||||
|
@ -604,7 +604,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
return GUI::Application::the()->exec();
|
||||
}
|
||||
|
||||
ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, DeprecatedString const& entry_focused_on_init)
|
||||
ErrorOr<int> run_in_windowed_mode(ByteString const& initial_location, ByteString const& entry_focused_on_init)
|
||||
{
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("File Manager");
|
||||
|
@ -762,7 +762,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
view_type_action_group->add_action(directory_view->view_as_columns_action());
|
||||
|
||||
auto tree_view_selected_file_paths = [&] {
|
||||
Vector<DeprecatedString> paths;
|
||||
Vector<ByteString> paths;
|
||||
auto& view = tree_view;
|
||||
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
||||
paths.append(directories_model->full_path(index));
|
||||
|
@ -802,7 +802,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|
||||
auto copy_path_action = GUI::Action::create(
|
||||
"Copy Path", [&](GUI::Action const&) {
|
||||
Vector<DeprecatedString> selected_paths;
|
||||
Vector<ByteString> selected_paths;
|
||||
if (directory_view->active_widget()->is_focused()) {
|
||||
selected_paths = directory_view->selected_file_paths();
|
||||
} else if (tree_view.is_focused()) {
|
||||
|
@ -822,7 +822,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
{},
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<DeprecatedString> paths;
|
||||
Vector<ByteString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
paths = tree_view_selected_file_paths();
|
||||
else
|
||||
|
@ -841,7 +841,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
{},
|
||||
TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<DeprecatedString> paths;
|
||||
Vector<ByteString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
paths = tree_view_selected_file_paths();
|
||||
else
|
||||
|
@ -911,9 +911,9 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|
||||
auto properties_action = GUI::CommonActions::make_properties_action(
|
||||
[&](auto& action) {
|
||||
DeprecatedString container_dir_path;
|
||||
DeprecatedString path;
|
||||
Vector<DeprecatedString> selected;
|
||||
ByteString container_dir_path;
|
||||
ByteString path;
|
||||
Vector<ByteString> selected;
|
||||
if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) {
|
||||
path = directory_view->path();
|
||||
container_dir_path = path;
|
||||
|
@ -930,7 +930,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|
||||
auto paste_action = GUI::CommonActions::make_paste_action(
|
||||
[&](GUI::Action const& action) {
|
||||
DeprecatedString target_directory;
|
||||
ByteString target_directory;
|
||||
if (action.activator() == directory_context_menu)
|
||||
target_directory = directory_view->selected_file_paths()[0];
|
||||
else
|
||||
|
@ -942,7 +942,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|
||||
auto folder_specific_paste_action = GUI::CommonActions::make_paste_action(
|
||||
[&](GUI::Action const& action) {
|
||||
DeprecatedString target_directory;
|
||||
ByteString target_directory;
|
||||
if (action.activator() == directory_context_menu)
|
||||
target_directory = directory_view->selected_file_paths()[0];
|
||||
else
|
||||
|
@ -970,7 +970,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
},
|
||||
window);
|
||||
|
||||
GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [&](ByteString const& data_type) {
|
||||
auto current_location = directory_view->path();
|
||||
paste_action->set_enabled(data_type == "text/uri-list" && access(current_location.characters(), W_OK) == 0);
|
||||
};
|
||||
|
@ -1108,12 +1108,12 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
}
|
||||
};
|
||||
|
||||
directory_view->on_path_change = [&](DeprecatedString const& new_path, bool can_read_in_path, bool can_write_in_path) {
|
||||
directory_view->on_path_change = [&](ByteString const& new_path, bool can_read_in_path, bool can_write_in_path) {
|
||||
auto icon = GUI::FileIconProvider::icon_for_path(new_path);
|
||||
auto* bitmap = icon.bitmap_for_size(16);
|
||||
window->set_icon(bitmap);
|
||||
|
||||
window->set_title(DeprecatedString::formatted("{} - File Manager", new_path));
|
||||
window->set_title(ByteString::formatted("{} - File Manager", new_path));
|
||||
|
||||
breadcrumbbar.set_current_path(new_path);
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window()
|
|||
|
||||
m_preview_textbox = find_descendant_of_type_named<GUI::TextBox>("preview_textbox");
|
||||
m_preview_textbox->on_change = [this] {
|
||||
auto maybe_preview = [](DeprecatedString const& deprecated_text) -> ErrorOr<String> {
|
||||
auto text = TRY(String::from_deprecated_string(deprecated_text));
|
||||
auto maybe_preview = [](ByteString const& deprecated_text) -> ErrorOr<String> {
|
||||
auto text = TRY(String::from_byte_string(deprecated_text));
|
||||
return TRY(String::formatted("{}\n{}", text, TRY(text.to_uppercase())));
|
||||
}(m_preview_textbox->text());
|
||||
if (maybe_preview.is_error())
|
||||
|
@ -150,7 +150,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
m_save_action = GUI::CommonActions::make_save_action([this](auto&) {
|
||||
if (m_path.is_empty())
|
||||
return m_save_as_action->activate();
|
||||
auto response = FileSystemAccessClient::Client::the().request_file(window(), m_path.to_deprecated_string(), Core::File::OpenMode::Truncate | Core::File::OpenMode::Write);
|
||||
auto response = FileSystemAccessClient::Client::the().request_file(window(), m_path.to_byte_string(), Core::File::OpenMode::Truncate | Core::File::OpenMode::Write);
|
||||
if (response.is_error())
|
||||
return;
|
||||
auto file = response.release_value();
|
||||
|
@ -185,7 +185,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
});
|
||||
m_paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type() == "glyph/x-fonteditor");
|
||||
|
||||
GUI::Clipboard::the().on_change = [this](DeprecatedString const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [this](ByteString const& data_type) {
|
||||
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
|
||||
};
|
||||
|
||||
|
@ -369,7 +369,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
continue;
|
||||
builder.append_code_point(code_point);
|
||||
}
|
||||
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(builder.to_byte_string());
|
||||
});
|
||||
m_copy_text_action->set_status_tip("Copy to clipboard as text"_string);
|
||||
|
||||
|
@ -478,9 +478,9 @@ void MainWidget::update_action_text()
|
|||
};
|
||||
|
||||
if (auto maybe_text = text_or_error("&Undo"sv, m_undo_stack->undo_action_text()); !maybe_text.is_error())
|
||||
m_undo_action->set_text(maybe_text.release_value().to_deprecated_string());
|
||||
m_undo_action->set_text(maybe_text.release_value().to_byte_string());
|
||||
if (auto maybe_text = text_or_error("&Redo"sv, m_undo_stack->redo_action_text()); !maybe_text.is_error())
|
||||
m_redo_action->set_text(maybe_text.release_value().to_deprecated_string());
|
||||
m_redo_action->set_text(maybe_text.release_value().to_byte_string());
|
||||
}
|
||||
|
||||
ErrorOr<void> MainWidget::create_widgets()
|
||||
|
@ -533,13 +533,13 @@ ErrorOr<void> MainWidget::create_widgets()
|
|||
|
||||
m_name_textbox = find_descendant_of_type_named<GUI::TextBox>("name_textbox");
|
||||
m_name_textbox->on_change = [this] {
|
||||
m_font->set_name(MUST(String::from_deprecated_string(m_name_textbox->text())));
|
||||
m_font->set_name(MUST(String::from_byte_string(m_name_textbox->text())));
|
||||
did_modify_font();
|
||||
};
|
||||
|
||||
m_family_textbox = find_descendant_of_type_named<GUI::TextBox>("family_textbox");
|
||||
m_family_textbox->on_change = [this] {
|
||||
m_font->set_family(MUST(String::from_deprecated_string(m_family_textbox->text())));
|
||||
m_font->set_family(MUST(String::from_byte_string(m_family_textbox->text())));
|
||||
did_modify_font();
|
||||
};
|
||||
|
||||
|
@ -918,7 +918,7 @@ void MainWidget::update_title()
|
|||
else
|
||||
title.append(m_path);
|
||||
title.append("[*] - Font Editor"sv);
|
||||
window()->set_title(title.to_deprecated_string());
|
||||
window()->set_title(title.to_byte_string());
|
||||
}
|
||||
|
||||
void MainWidget::did_modify_font()
|
||||
|
@ -1034,11 +1034,11 @@ ErrorOr<void> MainWidget::copy_selected_glyphs()
|
|||
TRY(buffer.try_append(rows));
|
||||
TRY(buffer.try_append(widths));
|
||||
|
||||
HashMap<DeprecatedString, DeprecatedString> metadata;
|
||||
metadata.set("start", DeprecatedString::number(selection.start()));
|
||||
metadata.set("count", DeprecatedString::number(selection.size()));
|
||||
metadata.set("width", DeprecatedString::number(m_font->max_glyph_width()));
|
||||
metadata.set("height", DeprecatedString::number(m_font->glyph_height()));
|
||||
HashMap<ByteString, ByteString> metadata;
|
||||
metadata.set("start", ByteString::number(selection.start()));
|
||||
metadata.set("count", ByteString::number(selection.size()));
|
||||
metadata.set("width", ByteString::number(m_font->max_glyph_width()));
|
||||
metadata.set("height", ByteString::number(m_font->glyph_height()));
|
||||
GUI::Clipboard::the().set_data(buffer.bytes(), "glyph/x-fonteditor", metadata);
|
||||
|
||||
return {};
|
||||
|
|
|
@ -218,8 +218,8 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window)
|
|||
|
||||
void NewFontDialog::save_metadata()
|
||||
{
|
||||
m_new_font_metadata.name = MUST(String::from_deprecated_string(m_name_textbox->text()));
|
||||
m_new_font_metadata.family = MUST(String::from_deprecated_string(m_family_textbox->text()));
|
||||
m_new_font_metadata.name = MUST(String::from_byte_string(m_name_textbox->text()));
|
||||
m_new_font_metadata.family = MUST(String::from_byte_string(m_family_textbox->text()));
|
||||
m_new_font_metadata.weight = Gfx::name_to_weight(m_weight_combobox->text());
|
||||
m_new_font_metadata.slope = Gfx::name_to_slope(m_slope_combobox->text());
|
||||
m_new_font_metadata.presentation_size = m_presentation_spinbox->value();
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
else
|
||||
warnln("Restoring state failed");
|
||||
}
|
||||
virtual DeprecatedString action_text() const override { return m_action_text.to_deprecated_string(); }
|
||||
virtual ByteString action_text() const override { return m_action_text.to_byte_string(); }
|
||||
|
||||
private:
|
||||
NonnullRefPtr<UndoSelection> m_undo_state;
|
||||
|
|
|
@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
window->show();
|
||||
|
||||
auto default_path = TRY(String::from_deprecated_string(Config::read_string("FontEditor"sv, "Defaults"sv, "Font"sv, {})));
|
||||
auto default_path = TRY(String::from_byte_string(Config::read_string("FontEditor"sv, "Defaults"sv, "Font"sv, {})));
|
||||
auto path_to_load = path.is_empty() ? default_path : path;
|
||||
if (!path_to_load.is_empty()) {
|
||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, path_to_load);
|
||||
|
|
|
@ -88,7 +88,7 @@ ErrorOr<void> CardSettingsWidget::initialize()
|
|||
TRY(m_card_front_sets.try_append(entry.name));
|
||||
return IterationDecision::Continue;
|
||||
}));
|
||||
auto piece_set_model = GUI::ItemListModel<DeprecatedString>::create(m_card_front_sets);
|
||||
auto piece_set_model = GUI::ItemListModel<ByteString>::create(m_card_front_sets);
|
||||
m_card_front_images_combo_box->set_model(piece_set_model);
|
||||
auto card_front_set = Config::read_string("Games"sv, "Cards"sv, "CardFrontImages"sv, default_card_front_image_set);
|
||||
if (card_front_set.is_empty())
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<void> CardSettingsWidget::initialize()
|
|||
m_card_back_image_view = find_descendant_of_type_named<GUI::IconView>("cards_back_image");
|
||||
m_card_back_image_view->set_model(GUI::FileSystemModel::create("/res/graphics/cards/backs"));
|
||||
m_card_back_image_view->set_model_column(GUI::FileSystemModel::Column::Name);
|
||||
if (!set_card_back_image_path(TRY(String::from_deprecated_string(Config::read_string("Games"sv, "Cards"sv, "CardBackImage"sv)))))
|
||||
if (!set_card_back_image_path(TRY(String::from_byte_string(Config::read_string("Games"sv, "Cards"sv, "CardBackImage"sv)))))
|
||||
set_card_back_image_path(default_card_back_image_path);
|
||||
m_card_back_image_view->on_selection_change = [&]() {
|
||||
auto& card_back_selection = m_card_back_image_view->selection();
|
||||
|
@ -140,7 +140,7 @@ void CardSettingsWidget::reset_default_values()
|
|||
|
||||
bool CardSettingsWidget::set_card_back_image_path(StringView path)
|
||||
{
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_card_back_image_view->model())->index(path.to_deprecated_string(), m_card_back_image_view->model_column());
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_card_back_image_view->model())->index(path.to_byte_string(), m_card_back_image_view->model_column());
|
||||
if (index.is_valid()) {
|
||||
m_card_back_image_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
|
||||
Cards::CardPainter::the().set_back_image_path(path);
|
||||
|
@ -156,7 +156,7 @@ String CardSettingsWidget::card_back_image_path() const
|
|||
GUI::ModelIndex card_back_image_index = m_last_selected_card_back;
|
||||
if (!card_back_selection.is_empty())
|
||||
card_back_image_index = card_back_selection.first();
|
||||
return String::from_deprecated_string(static_cast<GUI::FileSystemModel const*>(m_card_back_image_view->model())->full_path(card_back_image_index)).release_value_but_fixme_should_propagate_errors();
|
||||
return String::from_byte_string(static_cast<GUI::FileSystemModel const*>(m_card_back_image_view->model())->full_path(card_back_image_index)).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
String CardSettingsWidget::card_front_images_set_name() const
|
||||
|
@ -164,7 +164,7 @@ String CardSettingsWidget::card_front_images_set_name() const
|
|||
auto selected_set_name = m_card_front_images_combo_box->text();
|
||||
if (selected_set_name == "None")
|
||||
return {};
|
||||
return MUST(String::from_deprecated_string(selected_set_name));
|
||||
return MUST(String::from_byte_string(selected_set_name));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
String card_back_image_path() const;
|
||||
String card_front_images_set_name() const;
|
||||
|
||||
Vector<DeprecatedString> m_card_front_sets;
|
||||
Vector<ByteString> m_card_front_sets;
|
||||
|
||||
RefPtr<CardGamePreview> m_preview_frame;
|
||||
RefPtr<GUI::ColorInput> m_background_color_input;
|
||||
|
|
|
@ -251,12 +251,12 @@ ErrorOr<void> ChessSettingsWidget::initialize()
|
|||
TRY(m_piece_sets.try_append(entry.name));
|
||||
return IterationDecision::Continue;
|
||||
}));
|
||||
auto piece_set_model = GUI::ItemListModel<DeprecatedString>::create(m_piece_sets);
|
||||
auto piece_set_model = GUI::ItemListModel<ByteString>::create(m_piece_sets);
|
||||
m_piece_set_combobox->set_model(piece_set_model);
|
||||
m_piece_set_combobox->set_text(piece_set_name, GUI::AllowCallback::No);
|
||||
m_piece_set_combobox->on_change = [&](auto& value, auto&) {
|
||||
set_modified(true);
|
||||
m_preview->set_piece_set_name(MUST(String::from_deprecated_string(value)));
|
||||
m_preview->set_piece_set_name(MUST(String::from_byte_string(value)));
|
||||
};
|
||||
|
||||
m_board_theme_combobox = find_descendant_of_type_named<GUI::ComboBox>("board_theme");
|
||||
|
@ -283,7 +283,7 @@ ErrorOr<void> ChessSettingsWidget::initialize()
|
|||
set_modified(true);
|
||||
};
|
||||
|
||||
m_preview->set_piece_set_name(TRY(String::from_deprecated_string(piece_set_name)));
|
||||
m_preview->set_piece_set_name(TRY(String::from_byte_string(piece_set_name)));
|
||||
m_preview->set_dark_square_color(board_theme.dark_square_color);
|
||||
m_preview->set_light_square_color(board_theme.light_square_color);
|
||||
m_preview->set_show_coordinates(show_coordinates);
|
||||
|
|
|
@ -28,7 +28,7 @@ private:
|
|||
ChessSettingsWidget() = default;
|
||||
ErrorOr<void> initialize();
|
||||
|
||||
Vector<DeprecatedString> m_piece_sets;
|
||||
Vector<ByteString> m_piece_sets;
|
||||
|
||||
RefPtr<GamesSettings::ChessGamePreview> m_preview;
|
||||
RefPtr<GUI::ComboBox> m_piece_set_combobox;
|
||||
|
|
|
@ -16,7 +16,7 @@ void History::push(StringView history_item)
|
|||
m_current_history_item++;
|
||||
}
|
||||
|
||||
DeprecatedString History::current()
|
||||
ByteString History::current()
|
||||
{
|
||||
if (m_current_history_item == -1)
|
||||
return {};
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
class History final {
|
||||
public:
|
||||
void push(StringView history_item);
|
||||
DeprecatedString current();
|
||||
ByteString current();
|
||||
|
||||
void go_back();
|
||||
void go_forward();
|
||||
|
@ -23,6 +23,6 @@ public:
|
|||
void clear();
|
||||
|
||||
private:
|
||||
Vector<DeprecatedString> m_items;
|
||||
Vector<ByteString> m_items;
|
||||
int m_current_history_item { -1 };
|
||||
};
|
||||
|
|
|
@ -132,7 +132,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
|
|||
return;
|
||||
}
|
||||
m_history.push(path.string());
|
||||
auto string_path = String::from_deprecated_string(path.string());
|
||||
auto string_path = String::from_byte_string(path.string());
|
||||
if (string_path.is_error())
|
||||
return;
|
||||
open_page(string_path.value());
|
||||
|
@ -156,7 +156,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
|
|||
};
|
||||
m_web_view->on_link_hover = [this](URL const& url) {
|
||||
if (url.is_valid())
|
||||
m_statusbar->set_text(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
|
||||
m_statusbar->set_text(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
m_statusbar->set_text({});
|
||||
};
|
||||
|
@ -166,12 +166,12 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
|
|||
|
||||
m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) {
|
||||
m_history.go_back();
|
||||
open_page(MUST(String::from_deprecated_string(m_history.current())));
|
||||
open_page(MUST(String::from_byte_string(m_history.current())));
|
||||
});
|
||||
|
||||
m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) {
|
||||
m_history.go_forward();
|
||||
open_page(MUST(String::from_deprecated_string(m_history.current())));
|
||||
open_page(MUST(String::from_byte_string(m_history.current())));
|
||||
});
|
||||
|
||||
m_go_back_action->set_enabled(false);
|
||||
|
@ -261,7 +261,7 @@ void MainWidget::open_url(URL const& url)
|
|||
return;
|
||||
auto title = String::formatted("{} - Help", page_and_section.value());
|
||||
if (!title.is_error())
|
||||
window()->set_title(title.release_value().to_deprecated_string());
|
||||
window()->set_title(title.release_value().to_byte_string());
|
||||
} else {
|
||||
window()->set_title("Help");
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void MainWidget::open_url(URL const& url)
|
|||
void MainWidget::open_external(URL const& url)
|
||||
{
|
||||
if (!Desktop::Launcher::open(url))
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
||||
void MainWidget::open_page(Optional<String> const& path)
|
||||
|
@ -285,7 +285,7 @@ void MainWidget::open_page(Optional<String> const& path)
|
|||
return;
|
||||
}
|
||||
dbgln("open page: {}", path.value());
|
||||
open_url(URL::create_with_url_or_path(path.value().to_deprecated_string()));
|
||||
open_url(URL::create_with_url_or_path(path.value().to_byte_string()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -183,8 +183,8 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role
|
|||
return {};
|
||||
if (auto path = page_path(index); path.has_value())
|
||||
if (auto page = page_view(path.release_value()); !page.is_error())
|
||||
// FIXME: We already provide String, but GUI::Variant still needs DeprecatedString.
|
||||
return DeprecatedString(page.release_value());
|
||||
// FIXME: We already provide String, but GUI::Variant still needs ByteString.
|
||||
return ByteString(page.release_value());
|
||||
return {};
|
||||
case GUI::ModelRole::Display:
|
||||
if (auto name = node->name(); !name.is_error())
|
||||
|
|
|
@ -31,8 +31,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
DeprecatedString first_query_parameter;
|
||||
DeprecatedString second_query_parameter;
|
||||
ByteString first_query_parameter;
|
||||
ByteString second_query_parameter;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
// The actual "page query" parsing happens when we set the main widget's start page.
|
||||
|
|
|
@ -142,7 +142,7 @@ FindDialog::FindDialog(NonnullRefPtr<HexEditor::FindWidget> find_widget)
|
|||
};
|
||||
|
||||
m_find_button->on_click = [this](auto) {
|
||||
auto text = String::from_deprecated_string(m_text_editor->text()).release_value_but_fixme_should_propagate_errors();
|
||||
auto text = String::from_byte_string(m_text_editor->text()).release_value_but_fixme_should_propagate_errors();
|
||||
if (!text.is_empty()) {
|
||||
m_text_value = text;
|
||||
done(ExecResult::OK);
|
||||
|
|
|
@ -51,14 +51,14 @@ GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int&
|
|||
|
||||
int GoToOffsetDialog::process_input()
|
||||
{
|
||||
auto input_offset = String::from_deprecated_string(m_text_editor->text().trim_whitespace()).release_value_but_fixme_should_propagate_errors();
|
||||
auto input_offset = String::from_byte_string(m_text_editor->text().trim_whitespace()).release_value_but_fixme_should_propagate_errors();
|
||||
int offset;
|
||||
auto type = m_offset_type_box->text().trim_whitespace();
|
||||
if (type == "Decimal") {
|
||||
offset = input_offset.to_number<int>().value_or(0);
|
||||
} else if (type == "Hexadecimal") {
|
||||
// FIXME: Find a better way of parsing hex to a number that doesn't require a zero terminated string
|
||||
offset = strtol(input_offset.to_deprecated_string().characters(), nullptr, 16);
|
||||
offset = strtol(input_offset.to_byte_string().characters(), nullptr, 16);
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
virtual DeprecatedString action_text() const override { return "Update cell"; }
|
||||
virtual ByteString action_text() const override { return "Update cell"; }
|
||||
|
||||
virtual bool merge_with(GUI::Command const& other) override;
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include "HexEditor.h"
|
||||
#include "SearchResultsModel.h"
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
@ -180,7 +180,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
|
|||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||
output_string_builder.appendff("{:02X} ", m_document->get(i).value);
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
|
|||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||
output_string_builder.append(isprint(m_document->get(i).value) ? m_document->get(i).value : '.');
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code()
|
|||
}
|
||||
output_string_builder.append("\n};\n"sv);
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ void HexEditor::keydown_event(GUI::KeyEvent& event)
|
|||
result = text_mode_keydown_event(event);
|
||||
}
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", result.error()));
|
||||
}
|
||||
|
||||
event.ignore();
|
||||
|
|
|
@ -112,7 +112,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
}
|
||||
|
||||
if (auto error = m_editor->open_new_file(file_size.value()); error.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
return m_save_as_action->activate();
|
||||
|
||||
if (auto result = m_editor->save(); result.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
window()->set_modified(false);
|
||||
m_editor->update();
|
||||
|
@ -151,7 +151,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
return;
|
||||
auto file = response.release_value();
|
||||
if (auto result = m_editor->save_as(file.release_stream()); result.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -180,11 +180,11 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
m_search_results->update();
|
||||
|
||||
if (matches.is_empty()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), DeprecatedString::formatted("{} Matches", matches.size()), GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), ByteString::formatted("{} Matches", matches.size()), GUI::MessageBox::Type::Warning);
|
||||
set_search_results_visible(true);
|
||||
} else {
|
||||
bool same_buffers = false;
|
||||
|
@ -196,7 +196,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
auto result = m_editor->find_and_highlight(m_search_buffer, same_buffers ? last_found_index() : 0);
|
||||
|
||||
if (!result.has_value()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
auto fill_byte = strtol(value.bytes_as_string_view().characters_without_null_termination(), nullptr, 16);
|
||||
auto result = m_editor->fill_selection(fill_byte);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", result.error()));
|
||||
}
|
||||
});
|
||||
m_fill_selection_action->set_enabled(false);
|
||||
|
@ -464,7 +464,7 @@ ErrorOr<void> HexEditorWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto result = m_editor->find_and_highlight(m_search_buffer, last_found_index());
|
||||
if (!result.has_value()) {
|
||||
GUI::MessageBox::show(&window, DeprecatedString::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(&window, ByteString::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
m_editor->update();
|
||||
|
@ -512,7 +512,7 @@ ErrorOr<void> HexEditorWidget::initialize_menubar(GUI::Window& window)
|
|||
m_bytes_per_row_actions.set_exclusive(true);
|
||||
auto bytes_per_row_menu = view_menu->add_submenu("Bytes per &Row"_string);
|
||||
for (int i = 8; i <= 32; i += 8) {
|
||||
auto action = GUI::Action::create_checkable(DeprecatedString::number(i), [this, i](auto&) {
|
||||
auto action = GUI::Action::create_checkable(ByteString::number(i), [this, i](auto&) {
|
||||
m_editor->set_bytes_per_row(i);
|
||||
m_editor->update();
|
||||
Config::write_i32("HexEditor"sv, "Layout"sv, "BytesPerRow"sv, i);
|
||||
|
@ -582,14 +582,14 @@ void HexEditorWidget::update_title()
|
|||
else
|
||||
builder.append(m_path);
|
||||
builder.append("[*] - Hex Editor"sv);
|
||||
window()->set_title(builder.to_deprecated_string());
|
||||
window()->set_title(builder.to_byte_string());
|
||||
}
|
||||
|
||||
void HexEditorWidget::open_file(String const& filename, NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
window()->set_modified(false);
|
||||
m_editor->open_file(move(file));
|
||||
set_path(filename.to_deprecated_string());
|
||||
set_path(filename.to_byte_string());
|
||||
GUI::Application::the()->set_most_recently_open_file(filename);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ private:
|
|||
virtual void drop_event(GUI::DropEvent&) override;
|
||||
|
||||
RefPtr<HexEditor> m_editor;
|
||||
DeprecatedString m_path;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_extension;
|
||||
ByteString m_path;
|
||||
ByteString m_name;
|
||||
ByteString m_extension;
|
||||
|
||||
int m_goto_history { 0 };
|
||||
String m_search_text;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
auto& match = m_matches.at(index.row());
|
||||
switch (index.column()) {
|
||||
case Column::Offset:
|
||||
return DeprecatedString::formatted("{:#08X}", match.offset);
|
||||
return ByteString::formatted("{:#08X}", match.offset);
|
||||
case Column::Value: {
|
||||
Utf8View utf8_view(match.value);
|
||||
if (!utf8_view.validate())
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
if (role == GUI::ModelRole::Display) {
|
||||
switch (index.column()) {
|
||||
case Column::Type:
|
||||
return inspector_value_type_to_string(static_cast<ValueType>(index.row())).to_deprecated_string();
|
||||
return inspector_value_type_to_string(static_cast<ValueType>(index.row())).to_byte_string();
|
||||
case Column::Value:
|
||||
return m_values.at(index.row());
|
||||
}
|
||||
|
|
|
@ -118,14 +118,14 @@ bool ViewWidget::is_previous_available() const
|
|||
|
||||
// FIXME: Convert to `String` & use LibFileSystemAccessClient + `Core::System::unveil(nullptr, nullptr)`
|
||||
// - Converting to String is not super-trivial due to the LexicalPath usage, while we can do a bunch of
|
||||
// String::from_deprecated_string() and String.to_deprecated_string(), it is quite ugly to read and
|
||||
// String::from_byte_string() and String.to_byte_string(), it is quite ugly to read and
|
||||
// probably not the best approach.
|
||||
//
|
||||
// - If we go full-unveil (`Core::System::unveil(nullptr, nullptr)`) this functionality does not work,
|
||||
// we can not access the list of contents of a directory through LibFileSystemAccessClient at the moment.
|
||||
Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString const& path) const
|
||||
Vector<ByteString> ViewWidget::load_files_from_directory(ByteString const& path) const
|
||||
{
|
||||
Vector<DeprecatedString> files_in_directory;
|
||||
Vector<ByteString> files_in_directory;
|
||||
|
||||
auto current_dir = LexicalPath(path).parent().string();
|
||||
// FIXME: Propagate errors
|
||||
|
@ -141,8 +141,8 @@ Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString
|
|||
void ViewWidget::set_path(String const& path)
|
||||
{
|
||||
m_path = path;
|
||||
m_files_in_same_dir = load_files_from_directory(path.to_deprecated_string());
|
||||
m_current_index = m_files_in_same_dir.find_first_index(path.to_deprecated_string());
|
||||
m_files_in_same_dir = load_files_from_directory(path.to_byte_string());
|
||||
m_current_index = m_files_in_same_dir.find_first_index(path.to_byte_string());
|
||||
}
|
||||
|
||||
void ViewWidget::navigate(Directions direction)
|
||||
|
|
|
@ -138,7 +138,7 @@ private:
|
|||
|
||||
void set_image(Image const* image);
|
||||
void animate();
|
||||
Vector<DeprecatedString> load_files_from_directory(DeprecatedString const& path) const;
|
||||
Vector<ByteString> load_files_from_directory(ByteString const& path) const;
|
||||
ErrorOr<void> try_open_file(String const&, Core::File&);
|
||||
|
||||
String m_path;
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
|
||||
int m_toolbar_height { 28 };
|
||||
bool m_scaled_for_first_image { false };
|
||||
Vector<DeprecatedString> m_files_in_same_dir;
|
||||
Vector<ByteString> m_files_in_same_dir;
|
||||
Optional<size_t> m_current_index;
|
||||
Gfx::Painter::ScalingMode m_scaling_mode { Gfx::Painter::ScalingMode::NearestNeighbor };
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return;
|
||||
}
|
||||
|
||||
window->set_title(DeprecatedString::formatted("{} {} {}% - Image Viewer", widget.path(), widget.image()->size().to_deprecated_string(), (int)(scale * 100)));
|
||||
window->set_title(ByteString::formatted("{} {} {}% - Image Viewer", widget.path(), widget.image()->size().to_byte_string(), (int)(scale * 100)));
|
||||
|
||||
if (!widget.scaled_for_first_image()) {
|
||||
widget.set_scaled_for_first_image(true);
|
||||
|
@ -140,7 +140,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return;
|
||||
|
||||
auto msgbox_result = GUI::MessageBox::show(window,
|
||||
DeprecatedString::formatted("Are you sure you want to delete {}?", path),
|
||||
ByteString::formatted("Are you sure you want to delete {}?", path),
|
||||
"Confirm Deletion"sv,
|
||||
GUI::MessageBox::Type::Warning,
|
||||
GUI::MessageBox::InputType::OKCancel);
|
||||
|
@ -151,7 +151,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto unlinked_or_error = Core::System::unlink(widget.path());
|
||||
if (unlinked_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window,
|
||||
DeprecatedString::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()),
|
||||
ByteString::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()),
|
||||
"Delete Failed"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
|
||||
|
@ -188,7 +188,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
[&](auto&) {
|
||||
if (!GUI::Desktop::the().set_wallpaper(widget.image()->bitmap(GUI::Desktop::the().rect().size()).release_value_but_fixme_should_propagate_errors(), widget.path())) {
|
||||
GUI::MessageBox::show(window,
|
||||
DeprecatedString::formatted("set_wallpaper({}) failed", widget.path()),
|
||||
ByteString::formatted("set_wallpaper({}) failed", widget.path()),
|
||||
"Could not set wallpaper"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
|
||||
struct KeyPosition {
|
||||
u32 scancode;
|
||||
|
@ -16,7 +16,7 @@ struct KeyPosition {
|
|||
int height;
|
||||
bool enabled;
|
||||
int map_index;
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
};
|
||||
|
||||
#define KEY_COUNT 63
|
||||
|
|
|
@ -51,7 +51,7 @@ void KeyboardMapperWidget::create_frame()
|
|||
|
||||
auto& tmp_button = main_widget.add<KeyButton>();
|
||||
tmp_button.set_relative_rect(rect);
|
||||
tmp_button.set_text(String::from_deprecated_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
|
||||
tmp_button.set_text(String::from_byte_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
|
||||
tmp_button.set_enabled(keys[i].enabled);
|
||||
|
||||
tmp_button.on_click = [this, &tmp_button]() {
|
||||
|
@ -125,7 +125,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name)
|
|||
return map;
|
||||
}
|
||||
|
||||
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(DeprecatedString const& filename)
|
||||
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(ByteString const& filename)
|
||||
{
|
||||
auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename));
|
||||
|
||||
|
@ -147,7 +147,7 @@ ErrorOr<void> KeyboardMapperWidget::load_map_from_system()
|
|||
{
|
||||
auto character_map = TRY(Keyboard::CharacterMap::fetch_system_map());
|
||||
|
||||
m_filename = DeprecatedString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
|
||||
m_filename = ByteString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
|
||||
m_character_map = character_map.character_map_data();
|
||||
set_current_map("map");
|
||||
|
||||
|
@ -169,14 +169,14 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
{
|
||||
JsonObject map_json;
|
||||
|
||||
auto add_array = [&](DeprecatedString name, u32* values) {
|
||||
auto add_array = [&](ByteString name, u32* values) {
|
||||
JsonArray items;
|
||||
for (int i = 0; i < 90; i++) {
|
||||
StringBuilder sb;
|
||||
if (values[i])
|
||||
sb.append_code_point(values[i]);
|
||||
|
||||
JsonValue val(sb.to_deprecated_string());
|
||||
JsonValue val(sb.to_byte_string());
|
||||
items.must_append(move(val));
|
||||
}
|
||||
map_json.set(name, move(items));
|
||||
|
@ -189,7 +189,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
|
||||
|
||||
// Write to file.
|
||||
DeprecatedString file_content = map_json.to_deprecated_string();
|
||||
ByteString file_content = map_json.to_byte_string();
|
||||
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Write));
|
||||
TRY(file->write_until_depleted(file_content.bytes()));
|
||||
file->close();
|
||||
|
@ -234,7 +234,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
|
||||
void KeyboardMapperWidget::set_current_map(const ByteString current_map)
|
||||
{
|
||||
m_current_map_name = current_map;
|
||||
u32* map = map_from_name(m_current_map_name);
|
||||
|
@ -259,7 +259,7 @@ void KeyboardMapperWidget::update_window_title()
|
|||
sb.append(m_filename);
|
||||
sb.append("[*] - Keyboard Mapper"sv);
|
||||
|
||||
window()->set_title(sb.to_deprecated_string());
|
||||
window()->set_title(sb.to_byte_string());
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::show_error_to_user(Error error)
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual ~KeyboardMapperWidget() override = default;
|
||||
|
||||
void create_frame();
|
||||
ErrorOr<void> load_map_from_file(DeprecatedString const&);
|
||||
ErrorOr<void> load_map_from_file(ByteString const&);
|
||||
ErrorOr<void> load_map_from_system();
|
||||
ErrorOr<void> save();
|
||||
ErrorOr<void> save_to_file(StringView);
|
||||
|
@ -31,7 +31,7 @@ protected:
|
|||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
virtual void keyup_event(GUI::KeyEvent&) override;
|
||||
|
||||
void set_current_map(const DeprecatedString);
|
||||
void set_current_map(const ByteString);
|
||||
void update_window_title();
|
||||
|
||||
private:
|
||||
|
@ -43,8 +43,8 @@ private:
|
|||
u32* map_from_name(const StringView map_name);
|
||||
void update_modifier_radio_buttons(GUI::KeyEvent&);
|
||||
|
||||
DeprecatedString m_filename;
|
||||
ByteString m_filename;
|
||||
Keyboard::CharacterMapData m_character_map;
|
||||
DeprecatedString m_current_map_name;
|
||||
ByteString m_current_map_name;
|
||||
bool m_automatic_modifier { false };
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!keyboard_mapper_widget->request_close())
|
||||
return;
|
||||
|
||||
Optional<DeprecatedString> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
|
||||
Optional<ByteString> path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv);
|
||||
if (!path.has_value())
|
||||
return;
|
||||
|
||||
|
@ -63,8 +63,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
});
|
||||
|
||||
auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
DeprecatedString name = "Unnamed";
|
||||
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
|
||||
ByteString name = "Unnamed";
|
||||
Optional<ByteString> save_path = GUI::FilePicker::get_save_filepath(window, name, "json");
|
||||
if (!save_path.has_value())
|
||||
return;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class KeymapSelectionDialog final : public GUI::Dialog {
|
|||
public:
|
||||
virtual ~KeymapSelectionDialog() override = default;
|
||||
|
||||
static DeprecatedString select_keymap(Window* parent_window, Vector<DeprecatedString> const& selected_keymaps)
|
||||
static ByteString select_keymap(Window* parent_window, Vector<ByteString> const& selected_keymaps)
|
||||
{
|
||||
auto dialog = KeymapSelectionDialog::construct(parent_window, selected_keymaps);
|
||||
dialog->set_title("Add a keymap");
|
||||
|
@ -43,13 +43,13 @@ public:
|
|||
return dialog->selected_keymap();
|
||||
}
|
||||
|
||||
return DeprecatedString::empty();
|
||||
return ByteString::empty();
|
||||
}
|
||||
|
||||
DeprecatedString selected_keymap() { return m_selected_keymap; }
|
||||
ByteString selected_keymap() { return m_selected_keymap; }
|
||||
|
||||
private:
|
||||
KeymapSelectionDialog(Window* parent_window, Vector<DeprecatedString> const& selected_keymaps)
|
||||
KeymapSelectionDialog(Window* parent_window, Vector<ByteString> const& selected_keymaps)
|
||||
: Dialog(parent_window)
|
||||
{
|
||||
auto widget = set_main_widget<GUI::Widget>();
|
||||
|
@ -68,7 +68,7 @@ private:
|
|||
});
|
||||
|
||||
if (iterator_result.is_error()) {
|
||||
GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Error on reading mapping file list: {}", iterator_result.error()), "Keyboard settings"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(nullptr, ByteString::formatted("Error on reading mapping file list: {}", iterator_result.error()), "Keyboard settings"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::Application::the()->quit(-1);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
m_keymaps_combobox = *widget->find_descendant_of_type_named<GUI::ComboBox>("keymaps_combobox");
|
||||
m_keymaps_combobox->set_only_allow_values_from_model(true);
|
||||
m_keymaps_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_character_map_files));
|
||||
m_keymaps_combobox->set_model(*GUI::ItemListModel<ByteString>::create(m_character_map_files));
|
||||
m_keymaps_combobox->set_selected_index(0);
|
||||
|
||||
m_keymaps_combobox->on_change = [&](auto& keymap, auto) {
|
||||
|
@ -97,8 +97,8 @@ private:
|
|||
}
|
||||
|
||||
RefPtr<GUI::ComboBox> m_keymaps_combobox;
|
||||
Vector<DeprecatedString> m_character_map_files;
|
||||
DeprecatedString m_selected_keymap;
|
||||
Vector<ByteString> m_character_map_files;
|
||||
ByteString m_selected_keymap;
|
||||
};
|
||||
|
||||
class KeymapModel final : public GUI::Model {
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role) const override
|
||||
{
|
||||
DeprecatedString const& data = m_data.at(index.row());
|
||||
ByteString const& data = m_data.at(index.row());
|
||||
if (role == GUI::ModelRole::Font && data == m_active_keymap)
|
||||
return Gfx::FontDatabase::default_font().bold_variant();
|
||||
|
||||
|
@ -123,30 +123,30 @@ public:
|
|||
invalidate();
|
||||
}
|
||||
|
||||
void add_keymap(DeprecatedString const& keymap)
|
||||
void add_keymap(ByteString const& keymap)
|
||||
{
|
||||
m_data.append(keymap);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void set_active_keymap(DeprecatedString const& keymap)
|
||||
void set_active_keymap(ByteString const& keymap)
|
||||
{
|
||||
m_active_keymap = keymap;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
DeprecatedString const& active_keymap() { return m_active_keymap; }
|
||||
ByteString const& active_keymap() { return m_active_keymap; }
|
||||
|
||||
DeprecatedString const& keymap_at(size_t index)
|
||||
ByteString const& keymap_at(size_t index)
|
||||
{
|
||||
return m_data[index];
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> const& keymaps() const { return m_data; }
|
||||
Vector<ByteString> const& keymaps() const { return m_data; }
|
||||
|
||||
private:
|
||||
Vector<DeprecatedString> m_data;
|
||||
DeprecatedString m_active_keymap;
|
||||
Vector<ByteString> m_data;
|
||||
ByteString m_active_keymap;
|
||||
};
|
||||
|
||||
ErrorOr<NonnullRefPtr<KeyboardSettingsWidget>> KeyboardSettingsWidget::try_create()
|
||||
|
@ -165,7 +165,7 @@ ErrorOr<void> KeyboardSettingsWidget::setup()
|
|||
auto json = TRY(JsonValue::from_string(keymap));
|
||||
auto const& keymap_object = json.as_object();
|
||||
VERIFY(keymap_object.has("keymap"sv));
|
||||
m_initial_active_keymap = keymap_object.get_deprecated_string("keymap"sv).value();
|
||||
m_initial_active_keymap = keymap_object.get_byte_string("keymap"sv).value();
|
||||
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
|
||||
|
||||
auto mapper_config(TRY(Core::ConfigFile::open("/etc/Keyboard.ini")));
|
||||
|
@ -265,7 +265,7 @@ ErrorOr<void> KeyboardSettingsWidget::setup()
|
|||
m_caps_lock_checkbox = find_descendant_of_type_named<GUI::CheckBox>("caps_lock_remapped_to_ctrl_checkbox");
|
||||
auto caps_lock_is_remapped = read_caps_lock_to_ctrl_sys_variable();
|
||||
if (caps_lock_is_remapped.is_error()) {
|
||||
auto error_message = DeprecatedString::formatted("Could not determine if Caps Lock is remapped to Ctrl: {}", caps_lock_is_remapped.error());
|
||||
auto error_message = ByteString::formatted("Could not determine if Caps Lock is remapped to Ctrl: {}", caps_lock_is_remapped.error());
|
||||
GUI::MessageBox::show_error(window(), error_message);
|
||||
} else {
|
||||
m_caps_lock_checkbox->set_checked(caps_lock_is_remapped.value());
|
||||
|
@ -305,9 +305,9 @@ void KeyboardSettingsWidget::apply_settings()
|
|||
write_caps_lock_to_ctrl_sys_variable(m_caps_lock_checkbox->is_checked());
|
||||
}
|
||||
|
||||
void KeyboardSettingsWidget::set_keymaps(Vector<DeprecatedString> const& keymaps, DeprecatedString const& active_keymap)
|
||||
void KeyboardSettingsWidget::set_keymaps(Vector<ByteString> const& keymaps, ByteString const& active_keymap)
|
||||
{
|
||||
auto keymaps_string = DeprecatedString::join(',', keymaps);
|
||||
auto keymaps_string = ByteString::join(',', keymaps);
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/keymap"sv, Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() });
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void KeyboardSettingsWidget::write_caps_lock_to_ctrl_sys_variable(bool caps_lock
|
|||
if (getuid() != 0)
|
||||
return;
|
||||
|
||||
auto write_command = DeprecatedString::formatted("caps_lock_to_ctrl={}", caps_lock_to_ctrl ? "1" : "0");
|
||||
auto write_command = ByteString::formatted("caps_lock_to_ctrl={}", caps_lock_to_ctrl ? "1" : "0");
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/sysctl"sv, Array { "-w", write_command.characters() });
|
||||
}
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ private:
|
|||
KeyboardSettingsWidget() = default;
|
||||
ErrorOr<void> setup();
|
||||
|
||||
void set_keymaps(Vector<DeprecatedString> const& keymaps, DeprecatedString const& active_keymap);
|
||||
void set_keymaps(Vector<ByteString> const& keymaps, ByteString const& active_keymap);
|
||||
|
||||
void write_caps_lock_to_ctrl_sys_variable(bool);
|
||||
ErrorOr<bool> read_caps_lock_to_ctrl_sys_variable();
|
||||
|
||||
Vector<DeprecatedString> m_initial_keymap_list;
|
||||
Vector<ByteString> m_initial_keymap_list;
|
||||
|
||||
DeprecatedString m_initial_active_keymap;
|
||||
ByteString m_initial_active_keymap;
|
||||
|
||||
RefPtr<GUI::ListView> m_selected_keymaps_listview;
|
||||
RefPtr<GUI::Label> m_active_keymap_label;
|
||||
|
|
|
@ -63,13 +63,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file_menu = window->add_menu("&File"_string);
|
||||
file_menu->add_action(GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
AK::DeprecatedString filename = "file for saving";
|
||||
AK::ByteString filename = "file for saving";
|
||||
auto do_save = [&]() -> ErrorOr<void> {
|
||||
auto response = FileSystemAccessClient::Client::the().save_file(window, "Capture", "png");
|
||||
if (response.is_error())
|
||||
return {};
|
||||
auto file = response.value().release_stream();
|
||||
auto path = AK::LexicalPath(response.value().filename().to_deprecated_string());
|
||||
auto path = AK::LexicalPath(response.value().filename().to_byte_string());
|
||||
filename = path.basename();
|
||||
auto encoded = TRY(dump_bitmap(magnifier->current_bitmap(), path.extension()));
|
||||
|
||||
|
@ -128,7 +128,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
dialog->set_color_has_alpha_channel(true);
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
Config::write_string("Magnifier"sv, "Grid"sv, "Color"sv, dialog->color().to_deprecated_string());
|
||||
Config::write_string("Magnifier"sv, "Grid"sv, "Color"sv, dialog->color().to_byte_string());
|
||||
}
|
||||
});
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ AccountHolder::AccountHolder()
|
|||
m_mailbox_tree_model = MailboxTreeModel::create(*this);
|
||||
}
|
||||
|
||||
void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, Vector<IMAP::ListItem> const& mailboxes)
|
||||
void AccountHolder::add_account_with_name_and_mailboxes(ByteString name, Vector<IMAP::ListItem> const& mailboxes)
|
||||
{
|
||||
auto account = AccountNode::create(move(name));
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "MailboxTreeModel.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibIMAP/Objects.h>
|
||||
|
||||
|
@ -21,7 +21,7 @@ class MailboxNode;
|
|||
|
||||
class AccountNode final : public BaseNode {
|
||||
public:
|
||||
static NonnullRefPtr<AccountNode> create(DeprecatedString name)
|
||||
static NonnullRefPtr<AccountNode> create(ByteString name)
|
||||
{
|
||||
return adopt_ref(*new AccountNode(move(name)));
|
||||
}
|
||||
|
@ -34,21 +34,21 @@ public:
|
|||
}
|
||||
|
||||
Vector<NonnullRefPtr<MailboxNode>> const& mailboxes() const { return m_mailboxes; }
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
ByteString const& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
explicit AccountNode(DeprecatedString name)
|
||||
explicit AccountNode(ByteString name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
DeprecatedString m_name;
|
||||
ByteString m_name;
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_mailboxes;
|
||||
};
|
||||
|
||||
class MailboxNode final : public BaseNode {
|
||||
public:
|
||||
static NonnullRefPtr<MailboxNode> create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name)
|
||||
static NonnullRefPtr<MailboxNode> create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, ByteString display_name)
|
||||
{
|
||||
return adopt_ref(*new MailboxNode(associated_account, mailbox, move(display_name)));
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
virtual ~MailboxNode() override = default;
|
||||
|
||||
AccountNode const& associated_account() const { return m_associated_account; }
|
||||
DeprecatedString const& select_name() const { return m_mailbox.name; }
|
||||
DeprecatedString const& display_name() const { return m_display_name; }
|
||||
ByteString const& select_name() const { return m_mailbox.name; }
|
||||
ByteString const& display_name() const { return m_display_name; }
|
||||
IMAP::ListItem const& mailbox() const { return m_mailbox; }
|
||||
|
||||
bool has_parent() const { return m_parent; }
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
void add_child(NonnullRefPtr<MailboxNode> child) { m_children.append(child); }
|
||||
|
||||
private:
|
||||
MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name)
|
||||
MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, ByteString display_name)
|
||||
: m_associated_account(associated_account)
|
||||
, m_mailbox(mailbox)
|
||||
, m_display_name(move(display_name))
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
AccountNode const& m_associated_account;
|
||||
IMAP::ListItem m_mailbox;
|
||||
DeprecatedString m_display_name;
|
||||
ByteString m_display_name;
|
||||
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_children;
|
||||
RefPtr<MailboxNode> m_parent;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
return adopt_own(*new AccountHolder());
|
||||
}
|
||||
|
||||
void add_account_with_name_and_mailboxes(DeprecatedString, Vector<IMAP::ListItem> const&);
|
||||
void add_account_with_name_and_mailboxes(ByteString, Vector<IMAP::ListItem> const&);
|
||||
|
||||
Vector<NonnullRefPtr<AccountNode>> const& accounts() const { return m_accounts; }
|
||||
MailboxTreeModel& mailbox_tree_model() { return *m_mailbox_tree_model; }
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
struct InboxEntry {
|
||||
u32 sequence_number;
|
||||
DeprecatedString date;
|
||||
DeprecatedString from;
|
||||
DeprecatedString subject;
|
||||
ByteString date;
|
||||
ByteString from;
|
||||
ByteString subject;
|
||||
bool seen;
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ MailWidget::MailWidget()
|
|||
if (!Desktop::Launcher::open(url)) {
|
||||
GUI::MessageBox::show(
|
||||
window(),
|
||||
DeprecatedString::formatted("The link to '{}' could not be opened.", url),
|
||||
ByteString::formatted("The link to '{}' could not be opened.", url),
|
||||
"Failed to open link"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ MailWidget::MailWidget()
|
|||
|
||||
m_web_view->on_link_hover = [this](auto& url) {
|
||||
if (url.is_valid())
|
||||
m_statusbar->set_text(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
|
||||
m_statusbar->set_text(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
m_statusbar->set_text({});
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ MailWidget::MailWidget()
|
|||
m_link_context_menu_default_action = link_default_action;
|
||||
m_link_context_menu->add_separator();
|
||||
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_byte_string());
|
||||
}));
|
||||
|
||||
m_web_view->on_link_context_menu_request = [this](auto& url, auto screen_position) {
|
||||
|
@ -86,7 +86,7 @@ MailWidget::MailWidget()
|
|||
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
||||
}));
|
||||
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_byte_string());
|
||||
}));
|
||||
m_image_context_menu->add_separator();
|
||||
m_image_context_menu->add_action(GUI::Action::create("&Open Image in Browser", [this](auto&) {
|
||||
|
@ -131,7 +131,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
m_statusbar->set_text(String::formatted("Connecting to {}:{}...", server, port).release_value_but_fixme_should_propagate_errors());
|
||||
auto maybe_imap_client = tls ? IMAP::Client::connect_tls(server, port) : IMAP::Client::connect_plaintext(server, port);
|
||||
if (maybe_imap_client.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error()));
|
||||
return false;
|
||||
}
|
||||
m_imap_client = maybe_imap_client.release_value();
|
||||
|
@ -144,7 +144,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to login. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to login. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to login. The server says: '{}'", response.response_text()));
|
||||
m_statusbar->set_text("Failed to log in"_string);
|
||||
return false;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to select mailbox. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to select mailbox. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to select mailbox. The server says: '{}'", response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve subject/from for e-mails. The server says: '{}'", response.response_text());
|
||||
m_statusbar->set_text(String::formatted("[{}]: Failed to fetch messages :^(", mailbox.name).release_value_but_fixme_should_propagate_errors());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,8 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
|
||||
auto seen = !response_data.flags().find_if([](StringView value) { return value.equals_ignoring_ascii_case("\\Seen"sv); }).is_end();
|
||||
|
||||
DeprecatedString date = internal_date.to_deprecated_string();
|
||||
DeprecatedString subject = envelope.subject.is_empty() ? "(No subject)" : envelope.subject;
|
||||
ByteString date = internal_date.to_byte_string();
|
||||
ByteString subject = envelope.subject.is_empty() ? "(No subject)" : envelope.subject;
|
||||
if (subject.contains("=?"sv) && subject.contains("?="sv)) {
|
||||
subject = MUST(IMAP::decode_rfc2047_encoded_words(subject)).span();
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
}
|
||||
}
|
||||
}
|
||||
DeprecatedString from = sender_builder.to_deprecated_string();
|
||||
ByteString from = sender_builder.to_byte_string();
|
||||
|
||||
InboxEntry inbox_entry { sequence_number, date, from, subject, seen };
|
||||
m_statusbar->set_text(String::formatted("[{}]: Loading entry {}", mailbox.name, ++i).release_value_but_fixme_should_propagate_errors());
|
||||
|
@ -385,12 +385,12 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body structure of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<u32> selected_alternative_position;
|
||||
DeprecatedString selected_alternative_encoding;
|
||||
ByteString selected_alternative_encoding;
|
||||
|
||||
auto& response_data = fetch_response.data().fetch_data().last().get<IMAP::FetchResponseData>();
|
||||
|
||||
|
@ -449,7 +449,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
}
|
||||
|
||||
auto& body_data = fetch_response_data.body_data();
|
||||
auto body_text_part_iterator = body_data.find_if([](Tuple<IMAP::FetchCommand::DataItem, DeprecatedString>& data) {
|
||||
auto body_text_part_iterator = body_data.find_if([](Tuple<IMAP::FetchCommand::DataItem, ByteString>& data) {
|
||||
const auto data_item = data.get<0>();
|
||||
return data_item.section.has_value() && data_item.section->type == IMAP::FetchCommand::DataItem::SectionType::Parts;
|
||||
});
|
||||
|
@ -482,7 +482,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
auto& encoded_data = body_text_part_iterator->get<1>();
|
||||
|
||||
DeprecatedString decoded_data;
|
||||
ByteString decoded_data;
|
||||
|
||||
// FIXME: String uses char internally, so 8bit shouldn't be stored in it.
|
||||
// However, it works for now.
|
||||
|
@ -496,7 +496,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
decoded_data = IMAP::decode_quoted_printable(encoded_data).release_value_but_fixme_should_propagate_errors().span();
|
||||
} else {
|
||||
dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ ErrorOr<void> MailSettingsWidget::setup()
|
|||
m_port_combobox = *find_descendant_of_type_named<GUI::ComboBox>("port_input");
|
||||
m_port_combobox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Port"sv, "993"sv));
|
||||
m_port_combobox->set_only_allow_values_from_model(false);
|
||||
m_port_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_common_ports));
|
||||
m_port_combobox->set_model(*GUI::ItemListModel<ByteString>::create(m_common_ports));
|
||||
m_port_combobox->on_change = [&](auto, auto) {
|
||||
set_modified(true);
|
||||
};
|
||||
|
|
|
@ -24,11 +24,11 @@ private:
|
|||
MailSettingsWidget() = default;
|
||||
ErrorOr<void> setup();
|
||||
|
||||
DeprecatedString m_server;
|
||||
DeprecatedString m_port;
|
||||
ByteString m_server;
|
||||
ByteString m_port;
|
||||
bool m_tls { false };
|
||||
DeprecatedString m_email;
|
||||
Vector<DeprecatedString> m_common_ports;
|
||||
ByteString m_email;
|
||||
Vector<ByteString> m_common_ports;
|
||||
|
||||
RefPtr<GUI::TextBox> m_server_inputbox;
|
||||
RefPtr<GUI::ComboBox> m_port_combobox;
|
||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<void> FavoritesPanel::setup()
|
|||
if (!index.is_valid())
|
||||
return;
|
||||
auto& model = *m_favorites_list->model();
|
||||
on_selected_favorite_change({ MUST(String::from_deprecated_string(model.index(index.row(), 0).data().to_deprecated_string())),
|
||||
on_selected_favorite_change({ MUST(String::from_byte_string(model.index(index.row(), 0).data().to_byte_string())),
|
||||
{ model.index(index.row(), 1).data().as_double(),
|
||||
model.index(index.row(), 2).data().as_double() },
|
||||
model.index(index.row(), 3).data().to_i32() });
|
||||
|
@ -63,15 +63,15 @@ void FavoritesPanel::load_favorites()
|
|||
{
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> favorites_fields;
|
||||
favorites_fields.empend("name", "Name"_string, Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) -> GUI::Variant {
|
||||
DeprecatedString name = object.get_deprecated_string("name"sv).release_value();
|
||||
ByteString name = object.get_byte_string("name"sv).release_value();
|
||||
double latitude = object.get_double_with_precision_loss("latitude"sv).release_value();
|
||||
double longitude = object.get_double_with_precision_loss("longitude"sv).release_value();
|
||||
return DeprecatedString::formatted("{}\n{:.5}, {:.5}", name, latitude, longitude);
|
||||
return ByteString::formatted("{}\n{:.5}, {:.5}", name, latitude, longitude);
|
||||
});
|
||||
favorites_fields.empend("latitude", "Latitude"_string, Gfx::TextAlignment::CenterLeft);
|
||||
favorites_fields.empend("longitude", "Longitude"_string, Gfx::TextAlignment::CenterLeft);
|
||||
favorites_fields.empend("zoom", "Zoom"_string, Gfx::TextAlignment::CenterLeft);
|
||||
m_favorites_list->set_model(*GUI::JsonArrayModel::create(DeprecatedString::formatted("{}/MapsFavorites.json", Core::StandardPaths::config_directory()), move(favorites_fields)));
|
||||
m_favorites_list->set_model(*GUI::JsonArrayModel::create(ByteString::formatted("{}/MapsFavorites.json", Core::StandardPaths::config_directory()), move(favorites_fields)));
|
||||
m_favorites_list->model()->invalidate();
|
||||
favorites_changed();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ ErrorOr<void> FavoritesPanel::add_favorite(Favorite const& favorite)
|
|||
{
|
||||
auto& model = *static_cast<GUI::JsonArrayModel*>(m_favorites_list->model());
|
||||
Vector<JsonValue> favorite_json;
|
||||
favorite_json.append(favorite.name.to_deprecated_string());
|
||||
favorite_json.append(favorite.name.to_byte_string());
|
||||
favorite_json.append(favorite.latlng.latitude);
|
||||
favorite_json.append(favorite.latlng.longitude);
|
||||
favorite_json.append(favorite.zoom);
|
||||
|
@ -109,7 +109,7 @@ ErrorOr<void> FavoritesPanel::edit_favorite(int row)
|
|||
edit_dialog->set_main_widget(widget);
|
||||
|
||||
auto& name_textbox = *widget->find_descendant_of_type_named<GUI::TextBox>("name_textbox");
|
||||
name_textbox.set_text(model.index(row, 0).data().to_deprecated_string().split('\n').at(0));
|
||||
name_textbox.set_text(model.index(row, 0).data().to_byte_string().split('\n').at(0));
|
||||
name_textbox.set_focus(true);
|
||||
name_textbox.select_all();
|
||||
|
||||
|
@ -144,7 +144,7 @@ void FavoritesPanel::favorites_changed()
|
|||
|
||||
Vector<Favorite> favorites;
|
||||
for (int index = 0; index < model.row_count(); index++)
|
||||
favorites.append({ MUST(String::from_deprecated_string(model.index(index, 0).data().to_deprecated_string())),
|
||||
favorites.append({ MUST(String::from_byte_string(model.index(index, 0).data().to_byte_string())),
|
||||
{ model.index(index, 1).data().as_double(),
|
||||
model.index(index, 2).data().as_double() },
|
||||
model.index(index, 3).data().to_i32() });
|
||||
|
|
|
@ -73,12 +73,12 @@ MapWidget::MapWidget(Options const& options)
|
|||
{
|
||||
m_request_client = Protocol::RequestClient::try_create().release_value_but_fixme_should_propagate_errors();
|
||||
if (options.attribution_enabled) {
|
||||
auto attribution_text = options.attribution_text.value_or(MUST(String::from_deprecated_string(Config::read_string("Maps"sv, "MapWidget"sv, "TileProviderAttributionText"sv, Maps::default_tile_provider_attribution_text))));
|
||||
auto attribution_text = options.attribution_text.value_or(MUST(String::from_byte_string(Config::read_string("Maps"sv, "MapWidget"sv, "TileProviderAttributionText"sv, Maps::default_tile_provider_attribution_text))));
|
||||
URL attribution_url = options.attribution_url.value_or(URL(Config::read_string("Maps"sv, "MapWidget"sv, "TileProviderAttributionUrl"sv, Maps::default_tile_provider_attribution_url)));
|
||||
add_panel({ attribution_text, Panel::Position::BottomRight, attribution_url, "attribution"_string });
|
||||
}
|
||||
m_marker_image = Gfx::Bitmap::load_from_file("/res/graphics/maps/marker-blue.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_tile_provider = MUST(String::from_deprecated_string(Config::read_string("Maps"sv, "MapWidget"sv, "TileProviderUrlFormat"sv, Maps::default_tile_provider_url_format)));
|
||||
m_default_tile_provider = MUST(String::from_byte_string(Config::read_string("Maps"sv, "MapWidget"sv, "TileProviderUrlFormat"sv, Maps::default_tile_provider_url_format)));
|
||||
}
|
||||
|
||||
void MapWidget::set_zoom(int zoom)
|
||||
|
@ -315,7 +315,7 @@ void MapWidget::process_tile_queue()
|
|||
auto tile_key = m_tile_queue.dequeue();
|
||||
|
||||
// Start HTTP GET request to load image
|
||||
HashMap<DeprecatedString, DeprecatedString> headers;
|
||||
HashMap<ByteString, ByteString> headers;
|
||||
headers.set("User-Agent", "SerenityOS Maps");
|
||||
headers.set("Accept", "image/png");
|
||||
URL url(MUST(String::formatted(m_tile_provider.value_or(m_default_tile_provider), tile_key.zoom, tile_key.x, tile_key.y)));
|
||||
|
|
|
@ -30,10 +30,10 @@ ErrorOr<void> SearchPanel::setup()
|
|||
m_places_list->set_visible(false);
|
||||
|
||||
m_search_textbox->on_return_pressed = [this]() {
|
||||
search(MUST(String::from_deprecated_string(m_search_textbox->text())));
|
||||
search(MUST(String::from_byte_string(m_search_textbox->text())));
|
||||
};
|
||||
m_search_button->on_click = [this](unsigned) {
|
||||
search(MUST(String::from_deprecated_string(m_search_textbox->text())));
|
||||
search(MUST(String::from_byte_string(m_search_textbox->text())));
|
||||
};
|
||||
|
||||
m_places_list->set_item_height(m_places_list->font().preferred_line_height() * 2 + m_places_list->vertical_padding());
|
||||
|
@ -59,7 +59,7 @@ void SearchPanel::search(StringView query)
|
|||
m_start_container->set_visible(false);
|
||||
|
||||
// Start HTTP GET request to load people.json
|
||||
HashMap<DeprecatedString, DeprecatedString> headers;
|
||||
HashMap<ByteString, ByteString> headers;
|
||||
headers.set("User-Agent", "SerenityOS Maps");
|
||||
headers.set("Accept", "application/json");
|
||||
URL url(MUST(String::formatted("https://nominatim.openstreetmap.org/search?q={}&format=json", AK::URL::percent_encode(query, AK::URL::PercentEncodeSet::Query))));
|
||||
|
@ -96,9 +96,9 @@ void SearchPanel::search(StringView query)
|
|||
// FIXME: Handle JSON parsing errors
|
||||
auto const& json_place = json_places.at(i).as_object();
|
||||
|
||||
MapWidget::LatLng latlng = { json_place.get_deprecated_string("lat"sv).release_value().to_double().release_value(),
|
||||
json_place.get_deprecated_string("lon"sv).release_value().to_double().release_value() };
|
||||
String name = MUST(String::formatted("{}\n{:.5}, {:.5}", json_place.get_deprecated_string("display_name"sv).release_value(), latlng.latitude, latlng.longitude));
|
||||
MapWidget::LatLng latlng = { json_place.get_byte_string("lat"sv).release_value().to_double().release_value(),
|
||||
json_place.get_byte_string("lon"sv).release_value().to_double().release_value() };
|
||||
String name = MUST(String::formatted("{}\n{:.5}, {:.5}", json_place.get_byte_string("display_name"sv).release_value(), latlng.latitude, latlng.longitude));
|
||||
|
||||
// Calculate the right zoom level for bounding box
|
||||
auto const& json_boundingbox = json_place.get_array("boundingbox"sv);
|
||||
|
|
|
@ -19,7 +19,7 @@ UsersMapWidget::UsersMapWidget(Options const& options)
|
|||
void UsersMapWidget::get_users()
|
||||
{
|
||||
// Start HTTP GET request to load people.json
|
||||
HashMap<DeprecatedString, DeprecatedString> headers;
|
||||
HashMap<ByteString, ByteString> headers;
|
||||
headers.set("User-Agent", "SerenityOS Maps");
|
||||
headers.set("Accept", "application/json");
|
||||
URL url("https://usermap.serenityos.org/people.json");
|
||||
|
@ -48,7 +48,7 @@ void UsersMapWidget::get_users()
|
|||
for (size_t i = 0; i < json_users.size(); i++) {
|
||||
auto const& json_user = json_users.at(i).as_object();
|
||||
User user {
|
||||
MUST(String::from_deprecated_string(json_user.get_deprecated_string("nick"sv).release_value())),
|
||||
MUST(String::from_byte_string(json_user.get_byte_string("nick"sv).release_value())),
|
||||
{ json_user.get_array("coordinates"sv).release_value().at(0).to_double(),
|
||||
json_user.get_array("coordinates"sv).release_value().at(1).to_double() },
|
||||
json_user.has_bool("contributor"sv),
|
||||
|
|
|
@ -68,7 +68,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
map_widget.set_show_users(Config::read_bool("Maps"sv, "MapView"sv, "ShowUsers"sv, false));
|
||||
|
||||
// Panels
|
||||
String init_panel_open_name = TRY(String::from_deprecated_string(Config::read_string("Maps"sv, "Panel"sv, "OpenName"sv, ""sv)));
|
||||
String init_panel_open_name = TRY(String::from_byte_string(Config::read_string("Maps"sv, "Panel"sv, "OpenName"sv, ""sv)));
|
||||
int panel_width = Config::read_i32("Maps"sv, "Panel"sv, "Width"sv, INT_MIN);
|
||||
|
||||
// Search panel
|
||||
|
|
|
@ -29,11 +29,11 @@ void MapsSettingsWidget::apply_settings()
|
|||
Config::remove_key("Maps"sv, "MapWidget"sv, "TileProviderAttributionText"sv);
|
||||
Config::remove_key("Maps"sv, "MapWidget"sv, "TileProviderAttributionUrl"sv);
|
||||
} else {
|
||||
auto tile_provider_url_format = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 1).data().to_deprecated_string();
|
||||
auto tile_provider_url_format = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 1).data().to_byte_string();
|
||||
Config::write_string("Maps"sv, "MapWidget"sv, "TileProviderUrlFormat"sv, tile_provider_url_format);
|
||||
auto tile_provider_attribution_text = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 2).data().to_deprecated_string();
|
||||
auto tile_provider_attribution_text = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 2).data().to_byte_string();
|
||||
Config::write_string("Maps"sv, "MapWidget"sv, "TileProviderAttributionText"sv, tile_provider_attribution_text);
|
||||
auto tile_provider_attribution_url = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 3).data().to_deprecated_string();
|
||||
auto tile_provider_attribution_url = m_tile_provider_combobox->model()->index(m_tile_provider_combobox->selected_index(), 3).data().to_byte_string();
|
||||
Config::write_string("Maps"sv, "MapWidget"sv, "TileProviderAttributionUrl"sv, tile_provider_attribution_url);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ ErrorOr<void> MapsSettingsWidget::setup()
|
|||
tile_provider_fields.empend("url_format", "URL format"_string, Gfx::TextAlignment::CenterLeft);
|
||||
tile_provider_fields.empend("attribution_text", "Attribution text"_string, Gfx::TextAlignment::CenterLeft);
|
||||
tile_provider_fields.empend("attribution_url", "Attribution URL"_string, Gfx::TextAlignment::CenterLeft);
|
||||
auto tile_providers = GUI::JsonArrayModel::create(DeprecatedString::formatted("{}/MapsTileProviders.json", Core::StandardPaths::config_directory()), move(tile_provider_fields));
|
||||
auto tile_providers = GUI::JsonArrayModel::create(ByteString::formatted("{}/MapsTileProviders.json", Core::StandardPaths::config_directory()), move(tile_provider_fields));
|
||||
tile_providers->invalidate();
|
||||
|
||||
Vector<JsonValue> custom_tile_provider;
|
||||
|
@ -71,8 +71,8 @@ ErrorOr<void> MapsSettingsWidget::setup()
|
|||
m_custom_tile_provider_textbox->set_placeholder(Maps::default_tile_provider_url_format);
|
||||
m_custom_tile_provider_textbox->on_change = [&]() { set_modified(true); };
|
||||
|
||||
m_tile_provider_combobox->on_change = [&](DeprecatedString const&, GUI::ModelIndex const& index) {
|
||||
auto tile_provider_url_format = m_tile_provider_combobox->model()->index(index.row(), 1).data().to_deprecated_string();
|
||||
m_tile_provider_combobox->on_change = [&](ByteString const&, GUI::ModelIndex const& index) {
|
||||
auto tile_provider_url_format = m_tile_provider_combobox->model()->index(index.row(), 1).data().to_byte_string();
|
||||
m_is_custom_tile_provider = tile_provider_url_format.is_empty();
|
||||
m_custom_tile_provider_group->set_enabled(m_is_custom_tile_provider);
|
||||
set_modified(true);
|
||||
|
@ -86,7 +86,7 @@ void MapsSettingsWidget::set_tile_provider(StringView tile_provider_url_format)
|
|||
{
|
||||
bool found = false;
|
||||
for (int index = 0; index < m_tile_provider_combobox->model()->row_count(); index++) {
|
||||
auto url_format = m_tile_provider_combobox->model()->index(index, 1).data().to_deprecated_string();
|
||||
auto url_format = m_tile_provider_combobox->model()->index(index, 1).data().to_byte_string();
|
||||
if (url_format == tile_provider_url_format) {
|
||||
m_tile_provider_combobox->set_selected_index(index, GUI::AllowCallback::No);
|
||||
found = true;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "HighlightPreviewWidget.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -22,7 +22,7 @@ HighlightPreviewWidget::HighlightPreviewWidget(Gfx::Palette const& palette)
|
|||
ErrorOr<void> HighlightPreviewWidget::reload_cursor()
|
||||
{
|
||||
auto cursor_theme = GUI::ConnectionToWindowServer::the().get_cursor_theme();
|
||||
auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini");
|
||||
auto theme_path = ByteString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini");
|
||||
auto cursor_theme_config = TRY(Core::ConfigFile::open(theme_path));
|
||||
auto load_bitmap = [](StringView path, StringView default_path) {
|
||||
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
|
||||
|
@ -31,7 +31,7 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
|
|||
return Gfx::Bitmap::load_from_file(default_path);
|
||||
};
|
||||
constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv;
|
||||
auto cursor_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}",
|
||||
auto cursor_path = ByteString::formatted("/res/cursor-themes/{}/{}",
|
||||
cursor_theme, cursor_theme_config->read_entry("Cursor", "Arrow"));
|
||||
m_cursor_bitmap = TRY(load_bitmap(cursor_path, default_cursor_path));
|
||||
m_cursor_params = Gfx::CursorParams::parse_from_filename(cursor_path, m_cursor_bitmap->rect().center()).constrained(*m_cursor_bitmap);
|
||||
|
|
|
@ -51,7 +51,7 @@ void MouseCursorModel::invalidate()
|
|||
|
||||
m_cursors.clear();
|
||||
// FIXME: Propagate errors.
|
||||
(void)Core::Directory::for_each_entry(DeprecatedString::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
|
||||
(void)Core::Directory::for_each_entry(ByteString::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
|
||||
auto path = LexicalPath::join(directory.path().string(), entry.name);
|
||||
if (path.has_extension(".ini"sv))
|
||||
return IterationDecision::Continue;
|
||||
|
@ -89,7 +89,7 @@ void ThemeModel::invalidate()
|
|||
|
||||
// FIXME: Propagate errors.
|
||||
(void)Core::Directory::for_each_entry("/res/cursor-themes"sv, Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto&) -> ErrorOr<IterationDecision> {
|
||||
if (access(DeprecatedString::formatted("/res/cursor-themes/{}/Config.ini", entry.name).characters(), R_OK) == 0)
|
||||
if (access(ByteString::formatted("/res/cursor-themes/{}/Config.ini", entry.name).characters(), R_OK) == 0)
|
||||
m_themes.append(entry.name);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -127,7 +127,7 @@ ErrorOr<void> ThemeWidget::setup()
|
|||
m_mouse_cursor_model->change_theme(theme_name);
|
||||
|
||||
m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box");
|
||||
m_theme_name_box->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const&) {
|
||||
m_theme_name_box->on_change = [this](ByteString const& value, GUI::ModelIndex const&) {
|
||||
m_mouse_cursor_model->change_theme(value);
|
||||
set_modified(true);
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue