mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:37:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/File.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
|
|
@ -38,8 +38,8 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
tex_coords.append({ static_cast<GLfloat>(atof(String(tex_coord_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(String(tex_coord_line.at(2)).characters())) });
|
||||
tex_coords.append({ static_cast<GLfloat>(atof(DeprecatedString(tex_coord_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(DeprecatedString(tex_coord_line.at(2)).characters())) });
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
normals.append({ static_cast<GLfloat>(atof(String(normal_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(String(normal_line.at(2)).characters())),
|
||||
static_cast<GLfloat>(atof(String(normal_line.at(3)).characters())) });
|
||||
normals.append({ static_cast<GLfloat>(atof(DeprecatedString(normal_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(DeprecatedString(normal_line.at(2)).characters())),
|
||||
static_cast<GLfloat>(atof(DeprecatedString(normal_line.at(3)).characters())) });
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
vertices.append({ static_cast<GLfloat>(atof(String(vertex_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(String(vertex_line.at(2)).characters())),
|
||||
static_cast<GLfloat>(atof(String(vertex_line.at(3)).characters())) });
|
||||
vertices.append({ static_cast<GLfloat>(atof(DeprecatedString(vertex_line.at(1)).characters())),
|
||||
static_cast<GLfloat>(atof(DeprecatedString(vertex_line.at(2)).characters())),
|
||||
static_cast<GLfloat>(atof(DeprecatedString(vertex_line.at(3)).characters())) });
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class GLContextWidget final : public GUI::Frame {
|
|||
C_OBJECT(GLContextWidget);
|
||||
|
||||
public:
|
||||
bool load_path(String const& fname);
|
||||
bool load_path(DeprecatedString const& fname);
|
||||
bool load_file(Core::File& file);
|
||||
void toggle_rotate_x() { m_rotate_x = !m_rotate_x; }
|
||||
void toggle_rotate_y() { m_rotate_y = !m_rotate_y; }
|
||||
|
@ -267,7 +267,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
|
|||
if ((m_cycles % 30) == 0) {
|
||||
auto render_time = m_accumulated_time / 30.0;
|
||||
auto frame_rate = render_time > 0 ? 1000 / render_time : 0;
|
||||
m_stats->set_text(String::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time));
|
||||
m_stats->set_text(DeprecatedString::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time));
|
||||
m_accumulated_time = 0;
|
||||
|
||||
glEnable(GL_LIGHT0);
|
||||
|
@ -289,12 +289,12 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
|
|||
m_cycles++;
|
||||
}
|
||||
|
||||
bool GLContextWidget::load_path(String const& filename)
|
||||
bool GLContextWidget::load_path(DeprecatedString const& filename)
|
||||
{
|
||||
auto file = Core::File::construct(filename);
|
||||
|
||||
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -305,23 +305,23 @@ bool GLContextWidget::load_file(Core::File& file)
|
|||
{
|
||||
auto const& filename = file.filename();
|
||||
if (!filename.ends_with(".obj"sv)) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.is_device()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.is_directory()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto new_mesh = m_mesh_loader->load(file);
|
||||
if (new_mesh.is_null()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Reading \"{}\" failed.", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Reading \"{}\" failed.", filename), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ bool GLContextWidget::load_file(Core::File& file)
|
|||
builder.append(filename.split('.').at(0));
|
||||
builder.append(".bmp"sv);
|
||||
|
||||
String texture_path = Core::File::absolute_path(builder.string_view());
|
||||
DeprecatedString texture_path = Core::File::absolute_path(builder.string_view());
|
||||
|
||||
// Attempt to open the texture file from disk
|
||||
RefPtr<Gfx::Bitmap> texture_image;
|
||||
|
@ -405,7 +405,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto file = response.value();
|
||||
if (widget->load_file(*file)) {
|
||||
auto canonical_path = Core::File::absolute_path(file->filename());
|
||||
window->set_title(String::formatted("{} - 3D File Viewer", canonical_path));
|
||||
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
|
||||
}
|
||||
}));
|
||||
file_menu.add_separator();
|
||||
|
@ -594,7 +594,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj";
|
||||
if (widget->load_path(filename)) {
|
||||
auto canonical_path = Core::File::absolute_path(filename);
|
||||
window->set_title(String::formatted("{} - 3D File Viewer", canonical_path));
|
||||
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
|
||||
}
|
||||
|
||||
return app->exec();
|
||||
|
|
|
@ -60,7 +60,7 @@ void URLResult::activate() const
|
|||
Desktop::Launcher::open(URL::create_with_url_or_path(title()));
|
||||
}
|
||||
|
||||
void AppProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
void AppProvider::query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (query.starts_with('=') || query.starts_with('$'))
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ void AppProvider::query(String const& query, Function<void(NonnullRefPtrVector<R
|
|||
on_complete(move(results));
|
||||
}
|
||||
|
||||
void CalculatorProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
void CalculatorProvider::query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (!query.starts_with('='))
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ void CalculatorProvider::query(String const& query, Function<void(NonnullRefPtrV
|
|||
return;
|
||||
|
||||
auto result = completion.release_value();
|
||||
String calculation;
|
||||
DeprecatedString calculation;
|
||||
if (!result.is_number()) {
|
||||
calculation = "0";
|
||||
} else {
|
||||
|
@ -119,7 +119,7 @@ FileProvider::FileProvider()
|
|||
build_filesystem_cache();
|
||||
}
|
||||
|
||||
void FileProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
void FileProvider::query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
build_filesystem_cache();
|
||||
|
||||
|
@ -159,7 +159,7 @@ void FileProvider::build_filesystem_cache()
|
|||
|
||||
(void)Threading::BackgroundAction<int>::construct(
|
||||
[this, strong_ref = NonnullRefPtr(*this)](auto&) {
|
||||
String slash = "/";
|
||||
DeprecatedString slash = "/";
|
||||
auto timer = Core::ElapsedTimer::start_new();
|
||||
while (!m_work_queue.is_empty()) {
|
||||
auto base_directory = m_work_queue.dequeue();
|
||||
|
@ -197,7 +197,7 @@ void FileProvider::build_filesystem_cache()
|
|||
});
|
||||
}
|
||||
|
||||
void TerminalProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
void TerminalProvider::query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (!query.starts_with('$'))
|
||||
return;
|
||||
|
@ -209,7 +209,7 @@ void TerminalProvider::query(String const& query, Function<void(NonnullRefPtrVec
|
|||
on_complete(move(results));
|
||||
}
|
||||
|
||||
void URLProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
void URLProvider::query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (query.is_empty() || query.starts_with('=') || query.starts_with('$'))
|
||||
return;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
|
@ -26,8 +26,8 @@ public:
|
|||
|
||||
virtual Gfx::Bitmap const* bitmap() const = 0;
|
||||
|
||||
String const& title() const { return m_title; }
|
||||
String const& tooltip() const { return m_tooltip; }
|
||||
DeprecatedString const& title() const { return m_title; }
|
||||
DeprecatedString const& tooltip() const { return m_tooltip; }
|
||||
int score() const { return m_score; }
|
||||
bool equals(Result const& other) const
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
Result(String title, String tooltip, int score = 0)
|
||||
Result(DeprecatedString title, DeprecatedString tooltip, int score = 0)
|
||||
: m_title(move(title))
|
||||
, m_tooltip(move(tooltip))
|
||||
, m_score(score)
|
||||
|
@ -45,14 +45,14 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
String m_tooltip;
|
||||
DeprecatedString m_title;
|
||||
DeprecatedString m_tooltip;
|
||||
int m_score { 0 };
|
||||
};
|
||||
|
||||
class AppResult final : public Result {
|
||||
public:
|
||||
AppResult(RefPtr<Gfx::Bitmap> bitmap, String title, String tooltip, NonnullRefPtr<Desktop::AppFile> af, int score)
|
||||
AppResult(RefPtr<Gfx::Bitmap> bitmap, DeprecatedString title, DeprecatedString tooltip, NonnullRefPtr<Desktop::AppFile> af, int score)
|
||||
: Result(move(title), move(tooltip), score)
|
||||
, m_app_file(move(af))
|
||||
, m_bitmap(move(bitmap))
|
||||
|
@ -70,7 +70,7 @@ private:
|
|||
|
||||
class CalculatorResult final : public Result {
|
||||
public:
|
||||
explicit CalculatorResult(String title)
|
||||
explicit CalculatorResult(DeprecatedString title)
|
||||
: Result(move(title), "Copy to Clipboard"sv, 100)
|
||||
, m_bitmap(GUI::Icon::default_icon("app-calculator"sv).bitmap_for_size(16))
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
|
||||
class FileResult final : public Result {
|
||||
public:
|
||||
explicit FileResult(String title, int score)
|
||||
explicit FileResult(DeprecatedString title, int score)
|
||||
: Result(move(title), "", score)
|
||||
{
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
class TerminalResult final : public Result {
|
||||
public:
|
||||
explicit TerminalResult(String command)
|
||||
explicit TerminalResult(DeprecatedString command)
|
||||
: Result(move(command), "Run command in Terminal"sv, 100)
|
||||
, m_bitmap(GUI::Icon::default_icon("app-terminal"sv).bitmap_for_size(16))
|
||||
{
|
||||
|
@ -132,41 +132,41 @@ class Provider : public RefCounted<Provider> {
|
|||
public:
|
||||
virtual ~Provider() = default;
|
||||
|
||||
virtual void query(String const&, Function<void(NonnullRefPtrVector<Result>)> on_complete) = 0;
|
||||
virtual void query(DeprecatedString const&, Function<void(NonnullRefPtrVector<Result>)> on_complete) = 0;
|
||||
};
|
||||
|
||||
class AppProvider final : public Provider {
|
||||
public:
|
||||
void query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
};
|
||||
|
||||
class CalculatorProvider final : public Provider {
|
||||
public:
|
||||
void query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
};
|
||||
|
||||
class FileProvider final : public Provider {
|
||||
public:
|
||||
FileProvider();
|
||||
|
||||
void query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void build_filesystem_cache();
|
||||
|
||||
private:
|
||||
RefPtr<Threading::BackgroundAction<NonnullRefPtrVector<Result>>> m_fuzzy_match_work;
|
||||
bool m_building_cache { false };
|
||||
Vector<String> m_full_path_cache;
|
||||
Queue<String> m_work_queue;
|
||||
Vector<DeprecatedString> m_full_path_cache;
|
||||
Queue<DeprecatedString> m_work_queue;
|
||||
};
|
||||
|
||||
class TerminalProvider final : public Provider {
|
||||
public:
|
||||
void query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
};
|
||||
|
||||
class URLProvider final : public Provider {
|
||||
public:
|
||||
void query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
void query(DeprecatedString const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
#include "Providers.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibCore/LockFile.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -38,7 +38,7 @@ struct AppState {
|
|||
size_t visible_result_count { 0 };
|
||||
|
||||
Threading::Mutex lock;
|
||||
String last_query;
|
||||
DeprecatedString last_query;
|
||||
};
|
||||
|
||||
class ResultRow final : public GUI::Button {
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
Function<void(NonnullRefPtrVector<Result>)> on_new_results;
|
||||
|
||||
void search(String const& query)
|
||||
void search(DeprecatedString const& query)
|
||||
{
|
||||
for (auto& provider : m_providers) {
|
||||
provider.query(query, [=, this](auto results) {
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void did_receive_results(String const& query, NonnullRefPtrVector<Result> const& results)
|
||||
void did_receive_results(DeprecatedString const& query, NonnullRefPtrVector<Result> const& results)
|
||||
{
|
||||
{
|
||||
Threading::MutexLocker db_locker(m_mutex);
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
NonnullRefPtrVector<Provider> m_providers;
|
||||
|
||||
Threading::Mutex m_mutex;
|
||||
HashMap<String, NonnullRefPtrVector<Result>> m_result_cache;
|
||||
HashMap<DeprecatedString, NonnullRefPtrVector<Result>> m_result_cache;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -74,12 +74,12 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
String title() const
|
||||
DeprecatedString title() const
|
||||
{
|
||||
return m_title_textbox->text();
|
||||
}
|
||||
|
||||
String url() const
|
||||
DeprecatedString url() const
|
||||
{
|
||||
return m_url_textbox->text();
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enabled)
|
||||
BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled)
|
||||
{
|
||||
s_the = this;
|
||||
set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
@ -259,7 +259,7 @@ void BookmarksBarWidget::update_content_size()
|
|||
}
|
||||
}
|
||||
|
||||
bool BookmarksBarWidget::contains_bookmark(String const& url)
|
||||
bool BookmarksBarWidget::contains_bookmark(DeprecatedString const& url)
|
||||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
|
||||
|
@ -272,7 +272,7 @@ bool BookmarksBarWidget::contains_bookmark(String const& url)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool BookmarksBarWidget::remove_bookmark(String const& url)
|
||||
bool BookmarksBarWidget::remove_bookmark(DeprecatedString const& url)
|
||||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
|
||||
|
@ -292,7 +292,7 @@ bool BookmarksBarWidget::remove_bookmark(String const& url)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool BookmarksBarWidget::add_bookmark(String const& url, String const& title)
|
||||
bool BookmarksBarWidget::add_bookmark(DeprecatedString const& url, DeprecatedString const& title)
|
||||
{
|
||||
Vector<JsonValue> values;
|
||||
values.append(title);
|
||||
|
@ -306,7 +306,7 @@ bool BookmarksBarWidget::add_bookmark(String const& url, String const& title)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool BookmarksBarWidget::edit_bookmark(String const& url)
|
||||
bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url)
|
||||
{
|
||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||
auto item_title = model()->index(item_index, 0).data().to_string();
|
||||
|
|
|
@ -31,13 +31,13 @@ public:
|
|||
No
|
||||
};
|
||||
|
||||
Function<void(String const& url, OpenInNewTab)> on_bookmark_click;
|
||||
Function<void(String const&, String const&)> on_bookmark_hover;
|
||||
Function<void(DeprecatedString const& url, OpenInNewTab)> on_bookmark_click;
|
||||
Function<void(DeprecatedString const&, DeprecatedString const&)> on_bookmark_hover;
|
||||
|
||||
bool contains_bookmark(String const& url);
|
||||
bool remove_bookmark(String const& url);
|
||||
bool add_bookmark(String const& url, String const& title);
|
||||
bool edit_bookmark(String const& url);
|
||||
bool contains_bookmark(DeprecatedString const& url);
|
||||
bool remove_bookmark(DeprecatedString const& url);
|
||||
bool add_bookmark(DeprecatedString const& url, DeprecatedString const& title);
|
||||
bool edit_bookmark(DeprecatedString const& url);
|
||||
|
||||
virtual Optional<GUI::UISize> calculated_min_size() const override
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
BookmarksBarWidget(String const&, bool enabled);
|
||||
BookmarksBarWidget(DeprecatedString const&, bool enabled);
|
||||
|
||||
// ^GUI::ModelClient
|
||||
virtual void model_did_update(unsigned) override;
|
||||
|
@ -63,7 +63,7 @@ private:
|
|||
|
||||
RefPtr<GUI::Menu> m_context_menu;
|
||||
RefPtr<GUI::Action> m_context_menu_default_action;
|
||||
String m_context_menu_url;
|
||||
DeprecatedString m_context_menu_url;
|
||||
|
||||
NonnullRefPtrVector<GUI::Button> m_bookmarks;
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <Applications/Browser/IconBag.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
extern String g_home_url;
|
||||
extern String g_new_tab_url;
|
||||
extern String g_search_engine;
|
||||
extern Vector<String> g_content_filters;
|
||||
extern Vector<String> g_proxies;
|
||||
extern HashMap<String, size_t> g_proxy_mappings;
|
||||
extern DeprecatedString g_home_url;
|
||||
extern DeprecatedString g_new_tab_url;
|
||||
extern DeprecatedString g_search_engine;
|
||||
extern Vector<DeprecatedString> g_content_filters;
|
||||
extern Vector<DeprecatedString> g_proxies;
|
||||
extern HashMap<DeprecatedString, size_t> g_proxy_mappings;
|
||||
extern bool g_content_filters_enabled;
|
||||
extern IconBag g_icon_bag;
|
||||
extern String g_webdriver_content_ipc_path;
|
||||
extern DeprecatedString g_webdriver_content_ipc_path;
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
static String bookmarks_file_path()
|
||||
static DeprecatedString bookmarks_file_path()
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(Core::StandardPaths::config_directory());
|
||||
|
@ -54,7 +54,7 @@ static String bookmarks_file_path()
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
static String search_engines_file_path()
|
||||
static DeprecatedString search_engines_file_path()
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(Core::StandardPaths::config_directory());
|
||||
|
@ -247,7 +247,7 @@ void BrowserWindow::build_menus()
|
|||
m_take_visible_screenshot_action = GUI::Action::create(
|
||||
"Take &Visible Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) {
|
||||
if (auto result = take_screenshot(ScreenshotType::Visible); result.is_error())
|
||||
GUI::MessageBox::show_error(this, String::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error()));
|
||||
},
|
||||
this);
|
||||
m_take_visible_screenshot_action->set_status_tip("Save a screenshot of the visible portion of the current tab to the Downloads directory"sv);
|
||||
|
@ -255,7 +255,7 @@ void BrowserWindow::build_menus()
|
|||
m_take_full_screenshot_action = GUI::Action::create(
|
||||
"Take &Full Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) {
|
||||
if (auto result = take_screenshot(ScreenshotType::Full); result.is_error())
|
||||
GUI::MessageBox::show_error(this, String::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error()));
|
||||
},
|
||||
this);
|
||||
m_take_full_screenshot_action->set_status_tip("Save a screenshot of the entirety of the current tab to the Downloads directory"sv);
|
||||
|
@ -410,7 +410,7 @@ void BrowserWindow::build_menus()
|
|||
add_user_agent("Safari iOS Mobile", "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1");
|
||||
|
||||
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
|
||||
String user_agent;
|
||||
DeprecatedString user_agent;
|
||||
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv) != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
|
||||
m_disable_user_agent_spoofing->activate();
|
||||
return;
|
||||
|
@ -501,7 +501,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
|||
}
|
||||
|
||||
auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) {
|
||||
String search_engine;
|
||||
DeprecatedString search_engine;
|
||||
if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
|
||||
m_disable_search_engine_action->activate();
|
||||
return;
|
||||
|
@ -543,7 +543,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
|
|||
{
|
||||
auto& title = tab.title();
|
||||
auto url = tab.url();
|
||||
set_title(String::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
|
||||
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
|
||||
}
|
||||
|
||||
void BrowserWindow::create_new_tab(URL url, bool activate)
|
||||
|
@ -591,7 +591,7 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
|
|||
return m_cookie_jar.get_named_cookie(url, name);
|
||||
};
|
||||
|
||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> String {
|
||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
|
||||
return m_cookie_jar.get_cookie(url, source);
|
||||
};
|
||||
|
||||
|
@ -647,7 +647,7 @@ void BrowserWindow::proxy_mappings_changed()
|
|||
});
|
||||
}
|
||||
|
||||
void BrowserWindow::config_string_did_change(String const& domain, String const& group, String const& key, String const& value)
|
||||
void BrowserWindow::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value)
|
||||
{
|
||||
if (domain != "Browser")
|
||||
return;
|
||||
|
@ -673,7 +673,7 @@ void BrowserWindow::config_string_did_change(String const& domain, String const&
|
|||
// TODO: ColorScheme
|
||||
}
|
||||
|
||||
void BrowserWindow::config_bool_did_change(String const& domain, String const& group, String const& key, bool value)
|
||||
void BrowserWindow::config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value)
|
||||
{
|
||||
dbgln("{} {} {} {}", domain, group, key, value);
|
||||
if (domain != "Browser" || group != "Preferences")
|
||||
|
|
|
@ -55,8 +55,8 @@ private:
|
|||
ErrorOr<void> load_search_engines(GUI::Menu& settings_menu);
|
||||
void set_window_title_for_tab(Tab const&);
|
||||
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
||||
virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value) override;
|
||||
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
|
||||
virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override;
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index)
|
|||
request_console_messages();
|
||||
}
|
||||
|
||||
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
|
||||
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
|
||||
{
|
||||
i32 end_index = start_index + message_types.size() - 1;
|
||||
if (end_index <= m_highest_received_message_index) {
|
||||
|
|
|
@ -21,12 +21,12 @@ public:
|
|||
virtual ~ConsoleWidget() = default;
|
||||
|
||||
void notify_about_new_console_message(i32 message_index);
|
||||
void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
|
||||
void handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages);
|
||||
void print_source_line(StringView);
|
||||
void print_html(StringView);
|
||||
void reset();
|
||||
|
||||
Function<void(String const&)> on_js_input;
|
||||
Function<void(DeprecatedString const&)> on_js_input;
|
||||
Function<void(i32)> on_request_messages;
|
||||
|
||||
private:
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
|
||||
struct Group {
|
||||
int id { 0 };
|
||||
String label;
|
||||
DeprecatedString label;
|
||||
};
|
||||
Vector<Group> m_group_stack;
|
||||
int m_next_group_id { 1 };
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
|
||||
DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
|
||||
{
|
||||
purge_expired_cookies();
|
||||
|
||||
|
@ -134,7 +134,7 @@ Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies(URL const& url)
|
|||
return cookies;
|
||||
}
|
||||
|
||||
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, String const& name)
|
||||
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, DeprecatedString const& name)
|
||||
{
|
||||
auto domain = canonicalize_domain(url);
|
||||
if (!domain.has_value())
|
||||
|
@ -150,7 +150,7 @@ Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, String
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<String> CookieJar::canonicalize_domain(const URL& url)
|
||||
Optional<DeprecatedString> CookieJar::canonicalize_domain(const URL& url)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.1.2
|
||||
if (!url.is_valid())
|
||||
|
@ -160,7 +160,7 @@ Optional<String> CookieJar::canonicalize_domain(const URL& url)
|
|||
return url.host().to_lowercase();
|
||||
}
|
||||
|
||||
bool CookieJar::domain_matches(String const& string, String const& domain_string)
|
||||
bool CookieJar::domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.1.3
|
||||
|
||||
|
@ -184,7 +184,7 @@ bool CookieJar::domain_matches(String const& string, String const& domain_string
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CookieJar::path_matches(String const& request_path, String const& cookie_path)
|
||||
bool CookieJar::path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.1.4
|
||||
|
||||
|
@ -207,12 +207,12 @@ bool CookieJar::path_matches(String const& request_path, String const& cookie_pa
|
|||
return false;
|
||||
}
|
||||
|
||||
String CookieJar::default_path(const URL& url)
|
||||
DeprecatedString CookieJar::default_path(const URL& url)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.1.4
|
||||
|
||||
// 1. Let uri-path be the path portion of the request-uri if such a portion exists (and empty otherwise).
|
||||
String uri_path = url.path();
|
||||
DeprecatedString uri_path = url.path();
|
||||
|
||||
// 2. If the uri-path is empty or if the first character of the uri-path is not a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
|
||||
if (uri_path.is_empty() || (uri_path[0] != '/'))
|
||||
|
@ -229,7 +229,7 @@ String CookieJar::default_path(const URL& url)
|
|||
return uri_path.substring(0, last_separator);
|
||||
}
|
||||
|
||||
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source)
|
||||
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.3
|
||||
|
||||
|
@ -315,7 +315,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
|
|||
m_cookies.set(key, move(cookie));
|
||||
}
|
||||
|
||||
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
|
||||
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.4
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibWeb/Cookie/Cookie.h>
|
||||
|
@ -19,34 +19,34 @@ namespace Browser {
|
|||
struct CookieStorageKey {
|
||||
bool operator==(CookieStorageKey const&) const = default;
|
||||
|
||||
String name;
|
||||
String domain;
|
||||
String path;
|
||||
DeprecatedString name;
|
||||
DeprecatedString domain;
|
||||
DeprecatedString path;
|
||||
};
|
||||
|
||||
class CookieJar {
|
||||
public:
|
||||
String get_cookie(const URL& url, Web::Cookie::Source source);
|
||||
DeprecatedString get_cookie(const URL& url, Web::Cookie::Source source);
|
||||
void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source);
|
||||
void update_cookie(URL const&, Web::Cookie::Cookie);
|
||||
void dump_cookies() const;
|
||||
Vector<Web::Cookie::Cookie> get_all_cookies() const;
|
||||
Vector<Web::Cookie::Cookie> get_all_cookies(URL const& url);
|
||||
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, String const& name);
|
||||
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, DeprecatedString const& name);
|
||||
|
||||
private:
|
||||
static Optional<String> canonicalize_domain(const URL& url);
|
||||
static bool domain_matches(String const& string, String const& domain_string);
|
||||
static bool path_matches(String const& request_path, String const& cookie_path);
|
||||
static String default_path(const URL& url);
|
||||
static Optional<DeprecatedString> canonicalize_domain(const URL& url);
|
||||
static bool domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string);
|
||||
static bool path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path);
|
||||
static DeprecatedString default_path(const URL& url);
|
||||
|
||||
enum class MatchingCookiesSpecMode {
|
||||
RFC6265,
|
||||
WebDriver,
|
||||
};
|
||||
|
||||
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source);
|
||||
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
|
||||
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source);
|
||||
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
|
||||
void purge_expired_cookies();
|
||||
|
||||
HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies;
|
||||
|
|
|
@ -34,7 +34,7 @@ int CookiesModel::row_count(GUI::ModelIndex const& index) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
String CookiesModel::column_name(int column) const
|
||||
DeprecatedString CookiesModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Domain:
|
||||
|
@ -95,7 +95,7 @@ TriState CookiesModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c
|
|||
return TriState::True;
|
||||
|
||||
auto const& cookie = m_cookies[index.row()];
|
||||
auto haystack = String::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
|
||||
auto haystack = DeprecatedString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
|
||||
if (fuzzy_match(needle, haystack).score > 0)
|
||||
return TriState::True;
|
||||
return TriState::False;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void clear_items();
|
||||
virtual int row_count(GUI::ModelIndex const&) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int column) const override;
|
||||
virtual DeprecatedString column_name(int column) const override;
|
||||
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
|
||||
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;
|
||||
|
|
|
@ -49,7 +49,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
{
|
||||
auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write);
|
||||
if (file_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
window()->close();
|
||||
return;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv);
|
||||
animation_layout.add_spacer();
|
||||
|
||||
auto& source_label = add<GUI::Label>(String::formatted("From: {}", url));
|
||||
auto& source_label = add<GUI::Label>(DeprecatedString::formatted("From: {}", url));
|
||||
source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
source_label.set_fixed_height(16);
|
||||
|
||||
|
@ -82,7 +82,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
m_progress_label->set_fixed_height(16);
|
||||
|
||||
auto& destination_label = add<GUI::Label>(String::formatted("To: {}", m_destination_path));
|
||||
auto& destination_label = add<GUI::Label>(DeprecatedString::formatted("To: {}", m_destination_path));
|
||||
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
destination_label.set_fixed_height(16);
|
||||
|
||||
|
@ -161,7 +161,7 @@ void DownloadWidget::did_finish(bool success)
|
|||
m_cancel_button->update();
|
||||
|
||||
if (!success) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
|
||||
window()->close();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ private:
|
|||
void did_finish(bool success);
|
||||
|
||||
URL m_url;
|
||||
String m_destination_path;
|
||||
DeprecatedString m_destination_path;
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> m_download;
|
||||
RefPtr<GUI::Progressbar> m_progressbar;
|
||||
RefPtr<GUI::Label> m_progress_label;
|
||||
|
|
|
@ -21,13 +21,13 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
|
|||
int content_width_padding = 8;
|
||||
int content_height_padding = 8;
|
||||
|
||||
auto content_size_text = String::formatted("{}x{}", m_node_content_width, m_node_content_height);
|
||||
auto content_size_text = DeprecatedString::formatted("{}x{}", m_node_content_width, m_node_content_height);
|
||||
|
||||
int inner_content_width = max(100, font().width(content_size_text) + 2 * content_width_padding);
|
||||
int inner_content_height = max(15, font().glyph_height() + 2 * content_height_padding);
|
||||
|
||||
auto format_size_text = [&](float size) {
|
||||
return String::formatted("{:.4f}", size);
|
||||
return DeprecatedString::formatted("{:.4f}", size);
|
||||
};
|
||||
|
||||
auto compute_text_string_width = [&](float size) {
|
||||
|
|
|
@ -18,7 +18,7 @@ void History::dump() const
|
|||
}
|
||||
}
|
||||
|
||||
void History::push(const URL& url, String const& title)
|
||||
void History::push(const URL& url, DeprecatedString const& title)
|
||||
{
|
||||
if (!m_items.is_empty() && m_items[m_current].url == url)
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ void History::push(const URL& url, String const& title)
|
|||
m_current++;
|
||||
}
|
||||
|
||||
void History::replace_current(const URL& url, String const& title)
|
||||
void History::replace_current(const URL& url, DeprecatedString const& title)
|
||||
{
|
||||
if (m_current == -1)
|
||||
return;
|
||||
|
@ -65,7 +65,7 @@ void History::clear()
|
|||
m_current = -1;
|
||||
}
|
||||
|
||||
void History::update_title(String const& title)
|
||||
void History::update_title(DeprecatedString const& title)
|
||||
{
|
||||
if (m_current == -1)
|
||||
return;
|
||||
|
|
|
@ -15,13 +15,13 @@ class History {
|
|||
public:
|
||||
struct URLTitlePair {
|
||||
URL url;
|
||||
String title;
|
||||
DeprecatedString title;
|
||||
};
|
||||
void dump() const;
|
||||
|
||||
void push(const URL& url, String const& title);
|
||||
void replace_current(const URL& url, String const& title);
|
||||
void update_title(String const& title);
|
||||
void push(const URL& url, DeprecatedString const& title);
|
||||
void replace_current(const URL& url, DeprecatedString const& title);
|
||||
void update_title(DeprecatedString const& title);
|
||||
URLTitlePair current() const;
|
||||
|
||||
Vector<StringView> const get_back_title_history();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <Applications/Browser/IconBag.h>
|
||||
|
||||
namespace Browser {
|
||||
|
|
|
@ -126,7 +126,7 @@ void InspectorWidget::select_default_node()
|
|||
m_dom_tree_view->set_cursor({}, GUI::AbstractView::SelectionUpdate::ClearIfNotSelected);
|
||||
}
|
||||
|
||||
void InspectorWidget::set_dom_json(String json)
|
||||
void InspectorWidget::set_dom_json(DeprecatedString json)
|
||||
{
|
||||
if (m_dom_json.has_value() && m_dom_json.value() == json)
|
||||
return;
|
||||
|
@ -148,7 +148,7 @@ void InspectorWidget::clear_dom_json()
|
|||
clear_style_json();
|
||||
}
|
||||
|
||||
void InspectorWidget::set_dom_node_properties_json(Selection selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json)
|
||||
void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json)
|
||||
{
|
||||
if (selection != m_selection) {
|
||||
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_string(), selection.to_string());
|
||||
|
@ -159,7 +159,7 @@ void InspectorWidget::set_dom_node_properties_json(Selection selection, String s
|
|||
update_node_box_model(node_box_sizing_json);
|
||||
}
|
||||
|
||||
void InspectorWidget::load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json)
|
||||
void InspectorWidget::load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json)
|
||||
{
|
||||
m_selection_specified_values_json = specified_values_json;
|
||||
m_computed_style_table_view->set_model(WebView::StylePropertiesModel::create(m_selection_specified_values_json.value().view()));
|
||||
|
@ -174,7 +174,7 @@ void InspectorWidget::load_style_json(String specified_values_json, String compu
|
|||
m_custom_properties_table_view->set_searchable(true);
|
||||
}
|
||||
|
||||
void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_json)
|
||||
void InspectorWidget::update_node_box_model(Optional<DeprecatedString> node_box_sizing_json)
|
||||
{
|
||||
if (!node_box_sizing_json.has_value()) {
|
||||
return;
|
||||
|
|
|
@ -29,20 +29,20 @@ public:
|
|||
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
|
||||
}
|
||||
|
||||
String to_string() const
|
||||
DeprecatedString to_string() const
|
||||
{
|
||||
if (pseudo_element.has_value())
|
||||
return String::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||
return String::formatted("id: {}", dom_node_id);
|
||||
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||
return DeprecatedString::formatted("id: {}", dom_node_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual ~InspectorWidget() = default;
|
||||
|
||||
void set_web_view(NonnullRefPtr<WebView::OutOfProcessWebView> web_view) { m_web_view = web_view; }
|
||||
void set_dom_json(String);
|
||||
void set_dom_json(DeprecatedString);
|
||||
void clear_dom_json();
|
||||
void set_dom_node_properties_json(Selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json);
|
||||
void set_dom_node_properties_json(Selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json);
|
||||
|
||||
void set_selection(Selection);
|
||||
void select_default_node();
|
||||
|
@ -51,8 +51,8 @@ private:
|
|||
InspectorWidget();
|
||||
|
||||
void set_selection(GUI::ModelIndex);
|
||||
void load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json);
|
||||
void update_node_box_model(Optional<String> node_box_sizing_json);
|
||||
void load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json);
|
||||
void update_node_box_model(Optional<DeprecatedString> node_box_sizing_json);
|
||||
void clear_style_json();
|
||||
void clear_node_box_model();
|
||||
|
||||
|
@ -66,12 +66,12 @@ private:
|
|||
|
||||
Web::Layout::BoxModelMetrics m_node_box_sizing;
|
||||
|
||||
Optional<String> m_dom_json;
|
||||
Optional<DeprecatedString> m_dom_json;
|
||||
Optional<Selection> m_pending_selection;
|
||||
Selection m_selection;
|
||||
Optional<String> m_selection_specified_values_json;
|
||||
Optional<String> m_selection_computed_values_json;
|
||||
Optional<String> m_selection_custom_properties_json;
|
||||
Optional<DeprecatedString> m_selection_specified_values_json;
|
||||
Optional<DeprecatedString> m_selection_computed_values_json;
|
||||
Optional<DeprecatedString> m_selection_custom_properties_json;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
void StorageModel::set_items(OrderedHashMap<String, String> map)
|
||||
void StorageModel::set_items(OrderedHashMap<DeprecatedString, DeprecatedString> map)
|
||||
{
|
||||
begin_insert_rows({}, m_local_storage_entries.size(), m_local_storage_entries.size());
|
||||
m_local_storage_entries = map;
|
||||
|
@ -35,7 +35,7 @@ int StorageModel::row_count(GUI::ModelIndex const& index) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
String StorageModel::column_name(int column) const
|
||||
DeprecatedString StorageModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Key:
|
||||
|
@ -85,7 +85,7 @@ TriState StorageModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c
|
|||
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 = String::formatted("{} {}", local_storage_key, local_storage_value);
|
||||
auto haystack = DeprecatedString::formatted("{} {}", local_storage_key, local_storage_value);
|
||||
if (fuzzy_match(needle, haystack).score > 0)
|
||||
return TriState::True;
|
||||
return TriState::False;
|
||||
|
|
|
@ -18,17 +18,17 @@ public:
|
|||
__Count,
|
||||
};
|
||||
|
||||
void set_items(OrderedHashMap<String, String> map);
|
||||
void set_items(OrderedHashMap<DeprecatedString, DeprecatedString> map);
|
||||
void clear_items();
|
||||
virtual int row_count(GUI::ModelIndex const&) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int column) const override;
|
||||
virtual DeprecatedString column_name(int column) const override;
|
||||
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
|
||||
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;
|
||||
|
||||
private:
|
||||
OrderedHashMap<String, String> m_local_storage_entries;
|
||||
OrderedHashMap<DeprecatedString, DeprecatedString> m_local_storage_entries;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ void StorageWidget::clear_cookies()
|
|||
m_cookies_model->clear_items();
|
||||
}
|
||||
|
||||
void StorageWidget::set_local_storage_entries(OrderedHashMap<String, String> entries)
|
||||
void StorageWidget::set_local_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries)
|
||||
{
|
||||
m_local_storage_model->set_items(entries);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void StorageWidget::clear_local_storage_entries()
|
|||
m_local_storage_model->clear_items();
|
||||
}
|
||||
|
||||
void StorageWidget::set_session_storage_entries(OrderedHashMap<String, String> entries)
|
||||
void StorageWidget::set_session_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries)
|
||||
{
|
||||
m_session_storage_model->set_items(entries);
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ public:
|
|||
|
||||
Function<void(Web::Cookie::Cookie)> on_update_cookie;
|
||||
|
||||
void set_local_storage_entries(OrderedHashMap<String, String> entries);
|
||||
void set_local_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries);
|
||||
void clear_local_storage_entries();
|
||||
|
||||
void set_session_storage_entries(OrderedHashMap<String, String> entries);
|
||||
void set_session_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries);
|
||||
void clear_session_storage_entries();
|
||||
|
||||
private:
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
URL url_from_user_input(String const& input)
|
||||
URL url_from_user_input(DeprecatedString const& input)
|
||||
{
|
||||
if (input.starts_with('?') && !g_search_engine.is_empty())
|
||||
return URL(g_search_engine.replace("{}"sv, URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly));
|
||||
|
||||
URL url_with_http_schema = URL(String::formatted("http://{}", input));
|
||||
URL url_with_http_schema = URL(DeprecatedString::formatted("http://{}", input));
|
||||
if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value())
|
||||
return url_with_http_schema;
|
||||
|
||||
|
@ -62,13 +62,13 @@ void Tab::start_download(const URL& url)
|
|||
{
|
||||
auto window = GUI::Window::construct(&this->window());
|
||||
window->resize(300, 170);
|
||||
window->set_title(String::formatted("0% of {}", url.basename()));
|
||||
window->set_title(DeprecatedString::formatted("0% of {}", url.basename()));
|
||||
window->set_resizable(false);
|
||||
window->set_main_widget<DownloadWidget>(url);
|
||||
window->show();
|
||||
}
|
||||
|
||||
void Tab::view_source(const URL& url, String const& source)
|
||||
void Tab::view_source(const URL& url, DeprecatedString const& source)
|
||||
{
|
||||
auto window = GUI::Window::construct(&this->window());
|
||||
auto& editor = window->set_main_widget<GUI::TextEditor>();
|
||||
|
@ -83,7 +83,7 @@ void Tab::view_source(const URL& url, String const& source)
|
|||
window->show();
|
||||
}
|
||||
|
||||
void Tab::update_status(Optional<String> text_override, i32 count_waiting)
|
||||
void Tab::update_status(Optional<DeprecatedString> text_override, i32 count_waiting)
|
||||
{
|
||||
if (text_override.has_value()) {
|
||||
m_statusbar->set_text(*text_override);
|
||||
|
@ -99,10 +99,10 @@ void Tab::update_status(Optional<String> text_override, i32 count_waiting)
|
|||
|
||||
if (count_waiting == 0) {
|
||||
// ex: "Loading google.com"
|
||||
m_statusbar->set_text(String::formatted("Loading {}", m_navigating_url->host()));
|
||||
m_statusbar->set_text(DeprecatedString::formatted("Loading {}", m_navigating_url->host()));
|
||||
} else {
|
||||
// ex: "google.com is waiting on 5 resources"
|
||||
m_statusbar->set_text(String::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv));
|
||||
m_statusbar->set_text(DeprecatedString::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ Tab::Tab(BrowserWindow& window)
|
|||
return {};
|
||||
};
|
||||
|
||||
view().on_get_cookie = [this](auto& url, auto source) -> String {
|
||||
view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
|
||||
if (on_get_cookie)
|
||||
return on_get_cookie(url, source);
|
||||
return {};
|
||||
|
@ -485,7 +485,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
|
|||
return {};
|
||||
}
|
||||
|
||||
String text = m_location_box->text();
|
||||
DeprecatedString text = m_location_box->text();
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(text);
|
||||
|
@ -495,7 +495,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
|
|||
builder.append(".com"sv);
|
||||
}
|
||||
}
|
||||
String final_text = builder.to_string();
|
||||
DeprecatedString final_text = builder.to_string();
|
||||
|
||||
auto url = url_from_user_input(final_text);
|
||||
return url;
|
||||
|
@ -552,7 +552,7 @@ void Tab::bookmark_current_url()
|
|||
update_bookmark_button(url);
|
||||
}
|
||||
|
||||
void Tab::update_bookmark_button(String const& url)
|
||||
void Tab::update_bookmark_button(DeprecatedString const& url)
|
||||
{
|
||||
if (BookmarksBarWidget::the().contains_bookmark(url)) {
|
||||
m_bookmark_button->set_icon(g_icon_bag.bookmark_filled);
|
||||
|
@ -672,7 +672,7 @@ void Tab::show_console_window()
|
|||
console_window->set_title("JS Console");
|
||||
console_window->set_icon(g_icon_bag.filetype_javascript);
|
||||
m_console_widget = console_window->set_main_widget<ConsoleWidget>();
|
||||
m_console_widget->on_js_input = [this](String const& js_source) {
|
||||
m_console_widget->on_js_input = [this](DeprecatedString const& js_source) {
|
||||
m_web_content_view->js_console_input(js_source);
|
||||
};
|
||||
m_console_widget->on_request_messages = [this](i32 start_index) {
|
||||
|
|
|
@ -59,20 +59,20 @@ public:
|
|||
void window_position_changed(Gfx::IntPoint const&);
|
||||
void window_size_changed(Gfx::IntSize const&);
|
||||
|
||||
Function<void(String const&)> on_title_change;
|
||||
Function<void(DeprecatedString const&)> on_title_change;
|
||||
Function<void(const URL&)> on_tab_open_request;
|
||||
Function<void(Tab&)> on_tab_close_request;
|
||||
Function<void(Tab&)> on_tab_close_other_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, String const& name)> on_get_named_cookie;
|
||||
Function<String(const URL&, Web::Cookie::Source source)> on_get_cookie;
|
||||
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<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
|
||||
Function<void()> on_dump_cookies;
|
||||
Function<void(URL const&, Web::Cookie::Cookie)> on_update_cookie;
|
||||
Function<Vector<Web::Cookie::Cookie>()> on_get_cookies_entries;
|
||||
Function<OrderedHashMap<String, String>()> on_get_local_storage_entries;
|
||||
Function<OrderedHashMap<String, String>()> on_get_session_storage_entries;
|
||||
Function<OrderedHashMap<DeprecatedString, DeprecatedString>()> on_get_local_storage_entries;
|
||||
Function<OrderedHashMap<DeprecatedString, DeprecatedString>()> on_get_session_storage_entries;
|
||||
Function<Gfx::ShareableBitmap()> on_take_screenshot;
|
||||
|
||||
void enable_webdriver_mode();
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
void show_console_window();
|
||||
void show_storage_inspector();
|
||||
|
||||
String const& title() const { return m_title; }
|
||||
DeprecatedString const& title() const { return m_title; }
|
||||
Gfx::Bitmap const* icon() const { return m_icon; }
|
||||
|
||||
WebView::OutOfProcessWebView& view() { return *m_web_content_view; }
|
||||
|
@ -102,10 +102,10 @@ private:
|
|||
|
||||
void update_actions();
|
||||
void bookmark_current_url();
|
||||
void update_bookmark_button(String const& url);
|
||||
void update_bookmark_button(DeprecatedString const& url);
|
||||
void start_download(const URL& url);
|
||||
void view_source(const URL& url, String const& source);
|
||||
void update_status(Optional<String> text_override = {}, i32 count_waiting = 0);
|
||||
void view_source(const URL& url, DeprecatedString const& source);
|
||||
void update_status(Optional<DeprecatedString> text_override = {}, i32 count_waiting = 0);
|
||||
|
||||
enum class MayAppendTLD {
|
||||
No,
|
||||
|
@ -138,7 +138,7 @@ private:
|
|||
RefPtr<GUI::Menu> m_page_context_menu;
|
||||
RefPtr<GUI::Menu> m_go_back_context_menu;
|
||||
RefPtr<GUI::Menu> m_go_forward_context_menu;
|
||||
String m_title;
|
||||
DeprecatedString m_title;
|
||||
RefPtr<const Gfx::Bitmap> m_icon;
|
||||
|
||||
Optional<URL> m_navigating_url;
|
||||
|
@ -147,6 +147,6 @@ private:
|
|||
bool m_is_history_navigation { false };
|
||||
};
|
||||
|
||||
URL url_from_user_input(String const& input);
|
||||
URL url_from_user_input(DeprecatedString const& input);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ WindowActions::WindowActions(GUI::Window& window)
|
|||
|
||||
for (auto i = 0; i <= 7; ++i) {
|
||||
m_tab_actions.append(GUI::Action::create(
|
||||
String::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
|
||||
DeprecatedString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
|
||||
if (on_tabs[i])
|
||||
on_tabs[i]();
|
||||
},
|
||||
&window));
|
||||
m_tab_actions.last().set_status_tip(String::formatted("Switch to tab {}", i + 1));
|
||||
m_tab_actions.last().set_status_tip(DeprecatedString::formatted("Switch to tab {}", i + 1));
|
||||
}
|
||||
m_tab_actions.append(GUI::Action::create(
|
||||
"Last tab", { Mod_Ctrl, Key_9 }, [this](auto&) {
|
||||
|
|
|
@ -31,21 +31,21 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
String g_search_engine;
|
||||
String g_home_url;
|
||||
String g_new_tab_url;
|
||||
Vector<String> g_content_filters;
|
||||
DeprecatedString g_search_engine;
|
||||
DeprecatedString g_home_url;
|
||||
DeprecatedString g_new_tab_url;
|
||||
Vector<DeprecatedString> g_content_filters;
|
||||
bool g_content_filters_enabled { true };
|
||||
Vector<String> g_proxies;
|
||||
HashMap<String, size_t> g_proxy_mappings;
|
||||
Vector<DeprecatedString> g_proxies;
|
||||
HashMap<DeprecatedString, size_t> g_proxy_mappings;
|
||||
IconBag g_icon_bag;
|
||||
String g_webdriver_content_ipc_path;
|
||||
DeprecatedString g_webdriver_content_ipc_path;
|
||||
|
||||
}
|
||||
|
||||
static ErrorOr<void> load_content_filters()
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read));
|
||||
auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read));
|
||||
auto ad_filter_list = TRY(Core::Stream::BufferedFile::create(move(file)));
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
while (TRY(ad_filter_list->can_read_line())) {
|
||||
|
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd unix fattr cpath rpath wpath proc exec"));
|
||||
|
||||
Vector<String> specified_urls;
|
||||
Vector<DeprecatedString> specified_urls;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(specified_urls, "URLs to open", "url", Core::ArgsParser::Required::No);
|
||||
|
@ -129,7 +129,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto url_from_argument_string = [](String const& string) -> URL {
|
||||
auto url_from_argument_string = [](DeprecatedString const& string) -> URL {
|
||||
if (Core::File::exists(string)) {
|
||||
return URL::create_with_file_scheme(Core::File::real_path_for(string));
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
window->content_filters_changed();
|
||||
};
|
||||
TRY(content_filters_watcher->add_watch(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
|
||||
TRY(content_filters_watcher->add_watch(DeprecatedString::formatted("{}/BrowserContentFilters.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())) {
|
||||
|
|
|
@ -12,16 +12,16 @@
|
|||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
||||
static String default_homepage_url = "file:///res/html/misc/welcome.html";
|
||||
static String default_new_tab_url = "file:///res/html/misc/new-tab.html";
|
||||
static String default_search_engine = "";
|
||||
static String default_color_scheme = "auto";
|
||||
static DeprecatedString default_homepage_url = "file:///res/html/misc/welcome.html";
|
||||
static DeprecatedString default_new_tab_url = "file:///res/html/misc/new-tab.html";
|
||||
static DeprecatedString default_search_engine = "";
|
||||
static DeprecatedString default_color_scheme = "auto";
|
||||
static bool default_show_bookmarks_bar = true;
|
||||
static bool default_auto_close_download_windows = false;
|
||||
|
||||
struct ColorScheme {
|
||||
String title;
|
||||
String setting_value;
|
||||
DeprecatedString title;
|
||||
DeprecatedString setting_value;
|
||||
};
|
||||
|
||||
class ColorSchemeModel final : public GUI::Model {
|
||||
|
@ -96,7 +96,7 @@ BrowserSettingsWidget::BrowserSettingsWidget()
|
|||
Vector<GUI::JsonArrayModel::FieldSpec> search_engine_fields;
|
||||
search_engine_fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
|
||||
search_engine_fields.empend("url_format", "Url format", Gfx::TextAlignment::CenterLeft);
|
||||
auto search_engines_model = GUI::JsonArrayModel::create(String::formatted("{}/SearchEngines.json", Core::StandardPaths::config_directory()), move(search_engine_fields));
|
||||
auto search_engines_model = GUI::JsonArrayModel::create(DeprecatedString::formatted("{}/SearchEngines.json", Core::StandardPaths::config_directory()), move(search_engine_fields));
|
||||
search_engines_model->invalidate();
|
||||
Vector<JsonValue> custom_search_engine;
|
||||
custom_search_engine.append("Custom...");
|
||||
|
@ -105,7 +105,7 @@ BrowserSettingsWidget::BrowserSettingsWidget()
|
|||
|
||||
m_search_engine_combobox->set_model(move(search_engines_model));
|
||||
m_search_engine_combobox->set_only_allow_values_from_model(true);
|
||||
m_search_engine_combobox->on_change = [this](AK::String const&, GUI::ModelIndex const& cursor_index) {
|
||||
m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) {
|
||||
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_string();
|
||||
m_is_custom_search_engine = url_format.is_empty();
|
||||
m_custom_search_engine_group->set_enabled(m_is_custom_search_engine);
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
static constexpr bool s_default_enable_content_filtering = true;
|
||||
|
||||
static String filter_list_file_path()
|
||||
static DeprecatedString filter_list_file_path()
|
||||
{
|
||||
return String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory());
|
||||
return DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory());
|
||||
}
|
||||
|
||||
ErrorOr<void> DomainListModel::load()
|
||||
|
@ -55,7 +55,7 @@ ErrorOr<void> DomainListModel::save()
|
|||
return {};
|
||||
}
|
||||
|
||||
void DomainListModel::add_domain(String name)
|
||||
void DomainListModel::add_domain(DeprecatedString name)
|
||||
{
|
||||
begin_insert_rows({}, m_domain_list.size(), m_domain_list.size());
|
||||
m_domain_list.append(move(name));
|
||||
|
@ -117,7 +117,7 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget()
|
|||
m_enable_content_filtering_checkbox->on_checked = [&](auto) { set_modified(true); };
|
||||
|
||||
m_add_new_domain_button->on_click = [&](unsigned) {
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
|
||||
if (GUI::InputBox::show(window(), text, "Enter domain name"sv, "Add domain to Content Filter"sv) == GUI::Dialog::ExecResult::OK
|
||||
&& !text.is_empty()) {
|
||||
|
|
|
@ -21,12 +21,12 @@ public:
|
|||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return 1; }
|
||||
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole = GUI::ModelRole::Display) const override { return m_domain_list[index.row()]; }
|
||||
|
||||
void add_domain(String name);
|
||||
void add_domain(DeprecatedString name);
|
||||
void delete_domain(size_t index);
|
||||
|
||||
private:
|
||||
bool m_was_modified { false };
|
||||
Vector<String> m_domain_list;
|
||||
Vector<DeprecatedString> m_domain_list;
|
||||
};
|
||||
|
||||
class ContentFilterSettingsWidget : public GUI::SettingsWindow::Tab {
|
||||
|
|
|
@ -31,7 +31,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_label->set_frame_thickness(2);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(String::formatted("{}_button", i));
|
||||
m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(DeprecatedString::formatted("{}_button", i));
|
||||
add_digit_button(*m_digit_button[i], i);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void CalculatorWidget::add_digit_button(GUI::Button& button, int digit)
|
|||
};
|
||||
}
|
||||
|
||||
String CalculatorWidget::get_entry()
|
||||
DeprecatedString CalculatorWidget::get_entry()
|
||||
{
|
||||
return m_entry->text();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class CalculatorWidget final : public GUI::Widget {
|
|||
C_OBJECT(CalculatorWidget)
|
||||
public:
|
||||
virtual ~CalculatorWidget() override = default;
|
||||
String get_entry();
|
||||
DeprecatedString get_entry();
|
||||
void set_entry(Crypto::BigFraction);
|
||||
|
||||
void shrink(unsigned);
|
||||
|
|
|
@ -112,15 +112,15 @@ void Keypad::set_to_0()
|
|||
m_state = State::External;
|
||||
}
|
||||
|
||||
String Keypad::to_string() const
|
||||
DeprecatedString Keypad::to_string() const
|
||||
{
|
||||
if (m_state == State::External)
|
||||
return m_internal_value.to_string(m_displayed_fraction_length);
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
String const integer_value = m_int_value.to_base(10);
|
||||
String const frac_value = m_frac_value.to_base(10);
|
||||
DeprecatedString const integer_value = m_int_value.to_base(10);
|
||||
DeprecatedString const frac_value = m_frac_value.to_base(10);
|
||||
unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1);
|
||||
|
||||
builder.append(integer_value);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCrypto/BigFraction/BigFraction.h>
|
||||
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
void set_rounding_length(unsigned);
|
||||
unsigned rounding_length() const;
|
||||
|
||||
String to_string() const;
|
||||
DeprecatedString to_string() const;
|
||||
|
||||
private:
|
||||
// Internal representation of the current decimal value.
|
||||
|
|
|
@ -78,7 +78,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(String::formatted("To &{} digits", rounding_modes[i]),
|
||||
auto round_action = GUI::Action::create_checkable(DeprecatedString::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;
|
||||
|
@ -89,11 +89,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
constexpr auto format { "&Custom - {} ..."sv };
|
||||
auto round_custom = GUI::Action::create_checkable(String::formatted(format, 0), [&](auto& action) {
|
||||
auto round_custom = GUI::Action::create_checkable(DeprecatedString::formatted(format, 0), [&](auto& action) {
|
||||
unsigned custom_rounding_length = widget->rounding_length();
|
||||
|
||||
if (RoundingDialog::show(window, "Choose custom rounding"sv, custom_rounding_length) == GUI::Dialog::ExecResult::OK) {
|
||||
action.set_text(String::formatted(format, custom_rounding_length));
|
||||
action.set_text(DeprecatedString::formatted(format, custom_rounding_length));
|
||||
widget->set_rounding_length(custom_rounding_length);
|
||||
last_rounding_mode.clear();
|
||||
} else if (last_rounding_mode.has_value())
|
||||
|
@ -107,7 +107,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (RoundingDialog::show(window, "Choose shrinking length"sv, shrink_length) == GUI::Dialog::ExecResult::OK) {
|
||||
round_custom->set_checked(true);
|
||||
round_custom->set_text(String::formatted(format, shrink_length));
|
||||
round_custom->set_text(DeprecatedString::formatted(format, shrink_length));
|
||||
widget->set_rounding_length(shrink_length);
|
||||
widget->shrink(shrink_length);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const
|
|||
return 2;
|
||||
}
|
||||
|
||||
String AddEventDialog::MonthListModel::column_name(int column) const
|
||||
DeprecatedString AddEventDialog::MonthListModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Month:
|
||||
|
@ -133,7 +133,7 @@ String AddEventDialog::MonthListModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
String AddEventDialog::MeridiemListModel::column_name(int column) const
|
||||
DeprecatedString AddEventDialog::MeridiemListModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Meridiem:
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
||||
|
||||
private:
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -69,7 +69,7 @@ CharacterMapWidget::CharacterMapWidget()
|
|||
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
|
||||
|
||||
m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
String input;
|
||||
DeprecatedString input;
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
|
||||
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
|
||||
if (!maybe_code_point.has_value())
|
||||
|
@ -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<String>::create(m_unicode_block_list);
|
||||
m_unicode_block_model = GUI::ItemListModel<DeprecatedString>::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<String> m_unicode_block_list;
|
||||
Vector<DeprecatedString> m_unicode_block_list;
|
||||
Unicode::CodePointRange m_range { 0x0000, 0x10FFFF };
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
struct SearchResult {
|
||||
u32 code_point;
|
||||
String code_point_string;
|
||||
String display_text;
|
||||
DeprecatedString code_point_string;
|
||||
DeprecatedString display_text;
|
||||
};
|
||||
|
||||
class CharacterSearchModel final : public GUI::Model {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_character_containing(StringView query, Callback callback)
|
||||
{
|
||||
String uppercase_query = query.to_uppercase_string();
|
||||
DeprecatedString 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!
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
static void search_and_print_results(String const& query)
|
||||
static void search_and_print_results(DeprecatedString const& query)
|
||||
{
|
||||
outln("Searching for '{}'", query);
|
||||
u32 result_count = 0;
|
||||
|
@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
String query;
|
||||
DeprecatedString 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);
|
||||
|
|
|
@ -28,5 +28,5 @@ private:
|
|||
|
||||
RefPtr<Core::Timer> m_clock_preview_update_timer;
|
||||
|
||||
String m_time_format;
|
||||
DeprecatedString m_time_format;
|
||||
};
|
||||
|
|
|
@ -131,7 +131,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 = String::formatted("{}\n({})", name, offset);
|
||||
m_time_zone_text = DeprecatedString::formatted("{}\n({})", name, offset);
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Mercator_projection#Derivation
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/SettingsWindow.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -28,11 +28,11 @@ private:
|
|||
Optional<Gfx::FloatPoint> compute_time_zone_location() const;
|
||||
void set_time_zone();
|
||||
|
||||
String m_time_zone;
|
||||
DeprecatedString 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;
|
||||
String m_time_zone_text;
|
||||
DeprecatedString m_time_zone_text;
|
||||
};
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#include <unistd.h>
|
||||
|
||||
struct TitleAndText {
|
||||
String title;
|
||||
String text;
|
||||
DeprecatedString title;
|
||||
DeprecatedString text;
|
||||
};
|
||||
|
||||
struct ThreadBacktracesAndCpuRegisters {
|
||||
|
@ -99,7 +99,7 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
|
|||
}
|
||||
|
||||
return {
|
||||
String::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.build()
|
||||
};
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
|
|||
#endif
|
||||
|
||||
return {
|
||||
String::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
|
||||
builder.build()
|
||||
};
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
String coredump_path {};
|
||||
DeprecatedString coredump_path {};
|
||||
bool unlink_on_exit = false;
|
||||
StringBuilder full_backtrace;
|
||||
|
||||
|
@ -161,9 +161,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
Vector<String> memory_regions;
|
||||
Vector<DeprecatedString> memory_regions;
|
||||
coredump->for_each_memory_region_info([&](auto& memory_region_info) {
|
||||
memory_regions.append(String::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name));
|
||||
memory_regions.append(DeprecatedString::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
|
@ -197,7 +197,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
app_name = af->name();
|
||||
|
||||
auto& description_label = *widget->find_descendant_of_type_named<GUI::Label>("description");
|
||||
description_label.set_text(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal));
|
||||
description_label.set_text(DeprecatedString::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(LexicalPath::canonicalized_path(executable_path));
|
||||
|
@ -214,7 +214,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
auto& arguments_label = *widget->find_descendant_of_type_named<GUI::Label>("arguments_label");
|
||||
arguments_label.set_text(String::join(' ', crashed_process_arguments));
|
||||
arguments_label.set_text(DeprecatedString::join(' ', crashed_process_arguments));
|
||||
|
||||
auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
|
||||
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||
|
@ -246,7 +246,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
environment_tab->layout()->set_margins(4);
|
||||
|
||||
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
|
||||
environment_text_editor->set_text(String::join('\n', environment));
|
||||
environment_text_editor->set_text(DeprecatedString::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);
|
||||
|
@ -256,7 +256,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
memory_regions_tab->layout()->set_margins(4);
|
||||
|
||||
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());
|
||||
memory_regions_text_editor->set_text(String::join('\n', memory_regions));
|
||||
memory_regions_text_editor->set_text(DeprecatedString::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);
|
||||
|
@ -284,14 +284,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return;
|
||||
}
|
||||
|
||||
LexicalPath lexical_path(String::formatted("{}_{}_backtrace.txt", pid, app_name));
|
||||
LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name));
|
||||
auto file_or_error = FileSystemAccessClient::Client::the().try_save_file(window, lexical_path.title(), lexical_path.extension());
|
||||
if (file_or_error.is_error())
|
||||
return;
|
||||
|
||||
auto file = file_or_error.value();
|
||||
if (!file->write(full_backtrace.to_string()))
|
||||
GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
|
||||
(void)Threading::BackgroundAction<ThreadBacktracesAndCpuRegisters>::construct(
|
||||
|
|
|
@ -57,7 +57,7 @@ static void handle_print_registers(PtraceRegisters const& regs)
|
|||
#endif
|
||||
}
|
||||
|
||||
static bool handle_disassemble_command(String const& command, FlatPtr first_instruction)
|
||||
static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr first_instruction)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
size_t number_of_instructions_to_disassemble = 5;
|
||||
|
@ -104,7 +104,7 @@ static bool handle_backtrace_command(PtraceRegisters const& regs)
|
|||
while (g_debug_session->peek(eip_val).has_value() && g_debug_session->peek(ebp_val).has_value()) {
|
||||
auto eip_symbol = g_debug_session->symbolicate(eip_val);
|
||||
auto source_position = g_debug_session->get_source_position(eip_val);
|
||||
String symbol_location = (eip_symbol.has_value() && eip_symbol->symbol != "") ? eip_symbol->symbol : "???";
|
||||
DeprecatedString symbol_location = (eip_symbol.has_value() && eip_symbol->symbol != "") ? eip_symbol->symbol : "???";
|
||||
if (source_position.has_value()) {
|
||||
outln("{:p} in {} ({}:{})", eip_val, symbol_location, source_position->file_path, source_position->line_number);
|
||||
} else {
|
||||
|
@ -127,7 +127,7 @@ static bool insert_breakpoint_at_address(FlatPtr address)
|
|||
return g_debug_session->insert_breakpoint(address);
|
||||
}
|
||||
|
||||
static bool insert_breakpoint_at_source_position(String const& file, size_t line)
|
||||
static bool insert_breakpoint_at_source_position(DeprecatedString const& file, size_t line)
|
||||
{
|
||||
auto result = g_debug_session->insert_breakpoint(file, line);
|
||||
if (!result.has_value()) {
|
||||
|
@ -138,7 +138,7 @@ static bool insert_breakpoint_at_source_position(String const& file, size_t line
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool insert_breakpoint_at_symbol(String const& symbol)
|
||||
static bool insert_breakpoint_at_symbol(DeprecatedString const& symbol)
|
||||
{
|
||||
auto result = g_debug_session->insert_breakpoint(symbol);
|
||||
if (!result.has_value()) {
|
||||
|
@ -149,7 +149,7 @@ static bool insert_breakpoint_at_symbol(String const& symbol)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool handle_breakpoint_command(String const& command)
|
||||
static bool handle_breakpoint_command(DeprecatedString const& command)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
if (parts.size() != 2)
|
||||
|
@ -176,7 +176,7 @@ static bool handle_breakpoint_command(String const& command)
|
|||
return insert_breakpoint_at_symbol(argument);
|
||||
}
|
||||
|
||||
static bool handle_examine_command(String const& command)
|
||||
static bool handle_examine_command(DeprecatedString const& command)
|
||||
{
|
||||
auto parts = command.split(' ');
|
||||
if (parts.size() != 2)
|
||||
|
|
|
@ -50,7 +50,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
m_wallpaper_view->set_model(GUI::FileSystemModel::create("/res/wallpapers"));
|
||||
m_wallpaper_view->set_model_column(GUI::FileSystemModel::Column::Name);
|
||||
m_wallpaper_view->on_selection_change = [this] {
|
||||
String path;
|
||||
DeprecatedString path;
|
||||
if (m_wallpaper_view->selection().is_empty()) {
|
||||
path = "";
|
||||
} else {
|
||||
|
@ -97,7 +97,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
|
||||
m_mode_combo = *find_descendant_of_type_named<GUI::ComboBox>("mode_combo");
|
||||
m_mode_combo->set_only_allow_values_from_model(true);
|
||||
m_mode_combo->set_model(*GUI::ItemListModel<String>::create(m_modes));
|
||||
m_mode_combo->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_modes));
|
||||
bool first_mode_change = true;
|
||||
m_mode_combo->on_change = [this, first_mode_change](auto&, const GUI::ModelIndex& index) mutable {
|
||||
m_monitor_widget->set_wallpaper_mode(m_modes.at(index.row()));
|
||||
|
@ -154,7 +154,7 @@ void BackgroundSettingsWidget::load_current_settings()
|
|||
void BackgroundSettingsWidget::apply_settings()
|
||||
{
|
||||
if (!GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper_bitmap(), m_monitor_widget->wallpaper()))
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper()));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper()));
|
||||
|
||||
GUI::Desktop::the().set_background_color(m_color_input->text());
|
||||
GUI::Desktop::the().set_wallpaper_mode(m_monitor_widget->wallpaper_mode());
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
void create_frame();
|
||||
void load_current_settings();
|
||||
|
||||
Vector<String> m_modes;
|
||||
Vector<DeprecatedString> m_modes;
|
||||
|
||||
bool& m_background_settings_changed;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void DesktopSettingsWidget::apply_settings()
|
|||
auto& desktop = GUI::Desktop::the();
|
||||
if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) {
|
||||
if (!GUI::ConnectionToWindowServer::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"),
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Error applying workspace settings"),
|
||||
"Workspace settings"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ ErrorOr<void> EffectsSettingsWidget::load_settings()
|
|||
};
|
||||
for (size_t i = 0; i < list.size(); ++i)
|
||||
TRY(m_geometry_list.try_append(list[i]));
|
||||
m_geometry_combobox->set_model(ItemListModel<String>::create(m_geometry_list));
|
||||
m_geometry_combobox->set_model(ItemListModel<DeprecatedString>::create(m_geometry_list));
|
||||
m_geometry_combobox->set_selected_index(m_system_effects.geometry());
|
||||
|
||||
return {};
|
||||
|
|
|
@ -27,7 +27,7 @@ private:
|
|||
ErrorOr<void> load_settings();
|
||||
|
||||
SystemEffects m_system_effects;
|
||||
Vector<String> m_geometry_list;
|
||||
Vector<DeprecatedString> m_geometry_list;
|
||||
RefPtr<ComboBox> m_geometry_combobox;
|
||||
};
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void MonitorSettingsWidget::create_resolution_list()
|
|||
|
||||
i32 aspect_width = resolution.width() / gcf;
|
||||
i32 aspect_height = resolution.height() / gcf;
|
||||
m_resolution_strings.append(String::formatted("{}x{} ({}:{})", resolution.width(), resolution.height(), aspect_width, aspect_height));
|
||||
m_resolution_strings.append(DeprecatedString::formatted("{}x{} ({}:{})", resolution.width(), resolution.height(), aspect_width, aspect_height));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ void MonitorSettingsWidget::create_frame()
|
|||
|
||||
m_screen_combo = *find_descendant_of_type_named<GUI::ComboBox>("screen_combo");
|
||||
m_screen_combo->set_only_allow_values_from_model(true);
|
||||
m_screen_combo->set_model(*GUI::ItemListModel<String>::create(m_screens));
|
||||
m_screen_combo->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_screens));
|
||||
m_screen_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
m_selected_screen_index = index.row();
|
||||
selected_screen_index_or_resolution_changed();
|
||||
|
@ -85,7 +85,7 @@ void MonitorSettingsWidget::create_frame()
|
|||
|
||||
m_resolution_combo = *find_descendant_of_type_named<GUI::ComboBox>("resolution_combo");
|
||||
m_resolution_combo->set_only_allow_values_from_model(true);
|
||||
m_resolution_combo->set_model(*GUI::ItemListModel<String>::create(m_resolution_strings));
|
||||
m_resolution_combo->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_resolution_strings));
|
||||
m_resolution_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
auto& selected_screen = m_screen_layout.screens[m_selected_screen_index];
|
||||
selected_screen.resolution = m_resolutions.at(index.row());
|
||||
|
@ -123,7 +123,7 @@ void MonitorSettingsWidget::create_frame()
|
|||
m_dpi_label = *find_descendant_of_type_named<GUI::Label>("display_dpi");
|
||||
}
|
||||
|
||||
static String display_name_from_edid(EDID::Parser const& edid)
|
||||
static DeprecatedString display_name_from_edid(EDID::Parser const& edid)
|
||||
{
|
||||
auto manufacturer_name = edid.manufacturer_name();
|
||||
auto product_name = edid.display_product_name();
|
||||
|
@ -131,12 +131,12 @@ static String display_name_from_edid(EDID::Parser const& edid)
|
|||
auto build_manufacturer_product_name = [&]() {
|
||||
if (product_name.is_null() || product_name.is_empty())
|
||||
return manufacturer_name;
|
||||
return String::formatted("{} {}", manufacturer_name, product_name);
|
||||
return DeprecatedString::formatted("{} {}", manufacturer_name, product_name);
|
||||
};
|
||||
|
||||
if (auto screen_size = edid.screen_size(); screen_size.has_value()) {
|
||||
auto diagonal_inch = hypot(screen_size.value().horizontal_cm(), screen_size.value().vertical_cm()) / 2.54;
|
||||
return String::formatted("{} {}\"", build_manufacturer_product_name(), roundf(diagonal_inch));
|
||||
return DeprecatedString::formatted("{} {}\"", build_manufacturer_product_name(), roundf(diagonal_inch));
|
||||
}
|
||||
|
||||
return build_manufacturer_product_name();
|
||||
|
@ -151,7 +151,7 @@ void MonitorSettingsWidget::load_current_settings()
|
|||
|
||||
size_t virtual_screen_count = 0;
|
||||
for (size_t i = 0; i < m_screen_layout.screens.size(); i++) {
|
||||
String screen_display_name;
|
||||
DeprecatedString screen_display_name;
|
||||
if (m_screen_layout.screens[i].mode == WindowServer::ScreenLayout::Screen::Mode::Device) {
|
||||
if (auto edid = EDID::Parser::from_display_connector_device(m_screen_layout.screens[i].device.value()); !edid.is_error()) { // TODO: multihead
|
||||
screen_display_name = display_name_from_edid(edid.value());
|
||||
|
@ -163,13 +163,13 @@ void MonitorSettingsWidget::load_current_settings()
|
|||
}
|
||||
} else {
|
||||
dbgln("Frame buffer {} is virtual.", i);
|
||||
screen_display_name = String::formatted("Virtual screen {}", virtual_screen_count++);
|
||||
screen_display_name = DeprecatedString::formatted("Virtual screen {}", virtual_screen_count++);
|
||||
m_screen_edids.append({});
|
||||
}
|
||||
if (i == m_screen_layout.main_screen_index)
|
||||
m_screens.append(String::formatted("{}: {} (main screen)", i + 1, screen_display_name));
|
||||
m_screens.append(DeprecatedString::formatted("{}: {} (main screen)", i + 1, screen_display_name));
|
||||
else
|
||||
m_screens.append(String::formatted("{}: {}", i + 1, screen_display_name));
|
||||
m_screens.append(DeprecatedString::formatted("{}: {}", i + 1, screen_display_name));
|
||||
}
|
||||
m_selected_screen_index = m_screen_layout.main_screen_index;
|
||||
m_screen_combo->set_selected_index(m_selected_screen_index);
|
||||
|
@ -185,7 +185,7 @@ void MonitorSettingsWidget::selected_screen_index_or_resolution_changed()
|
|||
Gfx::IntSize current_resolution = m_resolutions.at(index);
|
||||
|
||||
Optional<unsigned> screen_dpi;
|
||||
String screen_dpi_tooltip;
|
||||
DeprecatedString screen_dpi_tooltip;
|
||||
if (m_screen_edids[m_selected_screen_index].has_value()) {
|
||||
auto& edid = m_screen_edids[m_selected_screen_index];
|
||||
if (auto screen_size = edid.value().screen_size(); screen_size.has_value()) {
|
||||
|
@ -195,14 +195,14 @@ void MonitorSettingsWidget::selected_screen_index_or_resolution_changed()
|
|||
auto diagonal_pixels = hypot(current_resolution.width(), current_resolution.height());
|
||||
if (diagonal_pixels != 0.0) {
|
||||
screen_dpi = diagonal_pixels / diagonal_inch;
|
||||
screen_dpi_tooltip = String::formatted("{} inch display ({}cm x {}cm)", roundf(diagonal_inch), x_cm, y_cm);
|
||||
screen_dpi_tooltip = DeprecatedString::formatted("{} inch display ({}cm x {}cm)", roundf(diagonal_inch), x_cm, y_cm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (screen_dpi.has_value()) {
|
||||
m_dpi_label->set_tooltip(screen_dpi_tooltip);
|
||||
m_dpi_label->set_text(String::formatted("{} dpi", screen_dpi.value()));
|
||||
m_dpi_label->set_text(DeprecatedString::formatted("{} dpi", screen_dpi.value()));
|
||||
m_dpi_label->set_visible(true);
|
||||
} else {
|
||||
m_dpi_label->set_visible(false);
|
||||
|
@ -235,7 +235,7 @@ void MonitorSettingsWidget::apply_settings()
|
|||
auto seconds_until_revert = 10;
|
||||
|
||||
auto box_text = [&seconds_until_revert] {
|
||||
return String::formatted("Do you want to keep the new settings? They will be reverted after {} {}.",
|
||||
return DeprecatedString::formatted("Do you want to keep the new settings? They will be reverted after {} {}.",
|
||||
seconds_until_revert, seconds_until_revert == 1 ? "second" : "seconds");
|
||||
};
|
||||
|
||||
|
@ -257,20 +257,20 @@ void MonitorSettingsWidget::apply_settings()
|
|||
if (box->exec() == GUI::MessageBox::ExecResult::Yes) {
|
||||
auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout();
|
||||
if (!save_result.success()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Error saving settings: {}", save_result.error_msg()),
|
||||
"Unable to save setting"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
} else {
|
||||
auto restore_result = GUI::ConnectionToWindowServer::the().set_screen_layout(current_layout, false);
|
||||
if (!restore_result.success()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()),
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Error restoring settings: {}", restore_result.error_msg()),
|
||||
"Unable to restore setting"sv, GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
load_current_settings();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()),
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Error setting screen layout: {}", result.error_msg()),
|
||||
"Unable to apply changes"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@ private:
|
|||
size_t m_selected_screen_index { 0 };
|
||||
|
||||
WindowServer::ScreenLayout m_screen_layout;
|
||||
Vector<String> m_screens;
|
||||
Vector<DeprecatedString> m_screens;
|
||||
Vector<Optional<EDID::Parser>> m_screen_edids;
|
||||
Vector<Gfx::IntSize> m_resolutions;
|
||||
Vector<String> m_resolution_strings;
|
||||
Vector<DeprecatedString> m_resolution_strings;
|
||||
|
||||
RefPtr<DisplaySettings::MonitorWidget> m_monitor_widget;
|
||||
RefPtr<GUI::ComboBox> m_screen_combo;
|
||||
|
|
|
@ -25,7 +25,7 @@ MonitorWidget::MonitorWidget()
|
|||
set_fixed_size(304, 201);
|
||||
}
|
||||
|
||||
bool MonitorWidget::set_wallpaper(String path)
|
||||
bool MonitorWidget::set_wallpaper(DeprecatedString path)
|
||||
{
|
||||
if (!is_different_to_current_wallpaper_path(path))
|
||||
return false;
|
||||
|
@ -63,7 +63,7 @@ StringView MonitorWidget::wallpaper() const
|
|||
return m_desktop_wallpaper_path;
|
||||
}
|
||||
|
||||
void MonitorWidget::set_wallpaper_mode(String mode)
|
||||
void MonitorWidget::set_wallpaper_mode(DeprecatedString mode)
|
||||
{
|
||||
if (m_desktop_wallpaper_mode == mode)
|
||||
return;
|
||||
|
|
|
@ -14,10 +14,10 @@ class MonitorWidget final : public GUI::Widget {
|
|||
C_OBJECT(MonitorWidget);
|
||||
|
||||
public:
|
||||
bool set_wallpaper(String path);
|
||||
bool set_wallpaper(DeprecatedString path);
|
||||
StringView wallpaper() const;
|
||||
|
||||
void set_wallpaper_mode(String mode);
|
||||
void set_wallpaper_mode(DeprecatedString mode);
|
||||
StringView wallpaper_mode() const;
|
||||
|
||||
RefPtr<Gfx::Bitmap> wallpaper_bitmap() const { return m_wallpaper_bitmap; }
|
||||
|
@ -43,14 +43,14 @@ private:
|
|||
RefPtr<Gfx::Bitmap> m_desktop_bitmap;
|
||||
bool m_desktop_dirty { true };
|
||||
|
||||
String m_desktop_wallpaper_path;
|
||||
DeprecatedString m_desktop_wallpaper_path;
|
||||
RefPtr<Gfx::Bitmap> m_wallpaper_bitmap;
|
||||
String m_desktop_wallpaper_mode;
|
||||
DeprecatedString m_desktop_wallpaper_mode;
|
||||
Gfx::IntSize m_desktop_resolution;
|
||||
int m_desktop_scale_factor { 1 };
|
||||
Gfx::Color m_desktop_color;
|
||||
|
||||
bool is_different_to_current_wallpaper_path(String const& path)
|
||||
bool is_different_to_current_wallpaper_path(DeprecatedString const& path)
|
||||
{
|
||||
return (!path.is_empty() && path != m_desktop_wallpaper_path) || (path.is_empty() && m_desktop_wallpaper_path != nullptr);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ ThemePreviewWidget::ThemePreviewWidget(Gfx::Palette const& palette)
|
|||
set_fixed_size(304, 201);
|
||||
}
|
||||
|
||||
void ThemePreviewWidget::set_theme(String path)
|
||||
void ThemePreviewWidget::set_theme(DeprecatedString path)
|
||||
{
|
||||
set_theme_from_file(*Core::File::open(path, Core::OpenMode::ReadOnly).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class ThemePreviewWidget final : public GUI::AbstractThemePreview {
|
|||
C_OBJECT(ThemePreviewWidget);
|
||||
|
||||
public:
|
||||
void set_theme(String path);
|
||||
void set_theme(DeprecatedString path);
|
||||
|
||||
private:
|
||||
explicit ThemePreviewWidget(Gfx::Palette const& palette);
|
||||
|
|
|
@ -36,7 +36,7 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
|||
m_theme_preview = find_descendant_of_type_named<GUI::Frame>("preview_frame")->add<ThemePreviewWidget>(palette());
|
||||
m_themes_combo = *find_descendant_of_type_named<GUI::ComboBox>("themes_combo");
|
||||
m_themes_combo->set_only_allow_values_from_model(true);
|
||||
m_themes_combo->set_model(*GUI::ItemListModel<String>::create(m_theme_names));
|
||||
m_themes_combo->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_theme_names));
|
||||
m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
m_selected_theme = &m_themes.at(index.row());
|
||||
m_theme_preview->set_theme(m_selected_theme->path);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/ComboBox.h>
|
||||
#include <LibGUI/SettingsWindow.h>
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
private:
|
||||
Vector<Gfx::SystemThemeMetaData> m_themes;
|
||||
Vector<String> m_theme_names;
|
||||
Vector<DeprecatedString> m_theme_names;
|
||||
|
||||
RefPtr<GUI::ComboBox> m_themes_combo;
|
||||
RefPtr<ThemePreviewWidget> m_theme_preview;
|
||||
|
|
|
@ -36,9 +36,9 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
|
|||
|
||||
RefPtr<GUI::Label> app_label = *main_widget.find_descendant_of_type_named<GUI::Label>("description");
|
||||
|
||||
String prompt;
|
||||
DeprecatedString prompt;
|
||||
if (options.description.is_empty())
|
||||
prompt = String::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username());
|
||||
prompt = DeprecatedString::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username());
|
||||
else
|
||||
prompt = options.description;
|
||||
|
||||
|
@ -51,7 +51,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, String::formatted("Failed to execute command: {}", result.error()));
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Failed to execute command: {}", result.error()));
|
||||
close();
|
||||
}
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum
|
|||
|
||||
ErrorOr<void> EscalatorWindow::check_password()
|
||||
{
|
||||
String password = m_password_input->text();
|
||||
DeprecatedString password = m_password_input->text();
|
||||
if (password.is_empty()) {
|
||||
GUI::MessageBox::show_error(this, "Please enter a password."sv);
|
||||
return {};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/Account.h>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "EscalatorWindow.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/Account.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto executable_path = Core::File::resolve_executable_from_environment(command[0]);
|
||||
if (!executable_path.has_value()) {
|
||||
GUI::MessageBox::show_error(nullptr, String::formatted("Could not execute command {}: Command not found.", command[0]));
|
||||
GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0]));
|
||||
return 127;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace FileManager {
|
||||
|
||||
void spawn_terminal(String const& directory)
|
||||
void spawn_terminal(DeprecatedString const& directory)
|
||||
{
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
|
@ -86,7 +86,7 @@ NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(URL cons
|
|||
return handlers;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(String const& path)
|
||||
NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(DeprecatedString const& path)
|
||||
{
|
||||
return get_launch_handlers(URL::create_with_file_scheme(path));
|
||||
}
|
||||
|
@ -120,11 +120,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", String::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1);
|
||||
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);
|
||||
launch(url, *default_launcher);
|
||||
unsetenv("__libgui_launch_origin_rect");
|
||||
} else {
|
||||
auto error_message = String::formatted("Could not open {}", path);
|
||||
auto error_message = DeprecatedString::formatted("Could not open {}", path);
|
||||
GUI::MessageBox::show(window(), error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void DirectoryView::setup_model()
|
|||
{
|
||||
m_model->on_directory_change_error = [this](int, char const* error_string) {
|
||||
auto failed_path = m_model->root_path();
|
||||
auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string);
|
||||
auto error_message = DeprecatedString::formatted("Could not read {}:\n{}", failed_path, error_string);
|
||||
m_error_label->set_text(error_message);
|
||||
set_active_widget(m_error_label);
|
||||
|
||||
|
@ -176,7 +176,7 @@ void DirectoryView::setup_model()
|
|||
};
|
||||
|
||||
m_model->on_rename_error = [this](int, char const* error_string) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Unable to rename file: {}", error_string));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::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(String const& mode)
|
||||
void DirectoryView::set_view_mode_from_string(DeprecatedString const& mode)
|
||||
{
|
||||
if (m_mode == Mode::Desktop)
|
||||
return;
|
||||
|
@ -357,7 +357,7 @@ void DirectoryView::set_view_mode_from_string(String const& mode)
|
|||
}
|
||||
}
|
||||
|
||||
void DirectoryView::config_string_did_change(String const& domain, String const& group, String const& key, String const& value)
|
||||
void DirectoryView::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value)
|
||||
{
|
||||
if (domain != "FileManager" || group != "DirectoryView")
|
||||
return;
|
||||
|
@ -389,7 +389,7 @@ void DirectoryView::set_view_mode(ViewMode mode)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void DirectoryView::add_path_to_history(String path)
|
||||
void DirectoryView::add_path_to_history(DeprecatedString 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(String path)
|
|||
m_path_history_position = m_path_history.size() - 1;
|
||||
}
|
||||
|
||||
bool DirectoryView::open(String const& path)
|
||||
bool DirectoryView::open(DeprecatedString const& path)
|
||||
{
|
||||
auto real_path = Core::File::real_path_for(path);
|
||||
if (real_path.is_null() || !Core::File::is_directory(path))
|
||||
|
@ -525,9 +525,9 @@ void DirectoryView::launch(URL const&, LauncherHandler const& launcher_handler)
|
|||
}
|
||||
}
|
||||
|
||||
Vector<String> DirectoryView::selected_file_paths() const
|
||||
Vector<DeprecatedString> DirectoryView::selected_file_paths() const
|
||||
{
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
auto& view = current_view();
|
||||
auto& model = *view.model();
|
||||
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
||||
|
@ -567,36 +567,36 @@ void DirectoryView::handle_selection_change()
|
|||
void DirectoryView::setup_actions()
|
||||
{
|
||||
m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value));
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
auto saved_errno = errno;
|
||||
GUI::MessageBox::show(window(), String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value));
|
||||
auto new_file_path = LexicalPath::canonicalized_path(DeprecatedString::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(), String::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
if (rc == 0) {
|
||||
GUI::MessageBox::show(window(), String::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::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(), String::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
rc = close(fd);
|
||||
|
@ -663,11 +663,11 @@ void DirectoryView::handle_drop(GUI::ModelIndex const& index, GUI::DropEvent con
|
|||
return;
|
||||
|
||||
bool had_accepted_drop = false;
|
||||
Vector<String> paths_to_copy;
|
||||
Vector<DeprecatedString> paths_to_copy;
|
||||
for (auto& url_to_copy : urls) {
|
||||
if (!url_to_copy.is_valid() || url_to_copy.path() == target_node.full_path())
|
||||
continue;
|
||||
auto new_path = String::formatted("{}/{}", target_node.full_path(), LexicalPath::basename(url_to_copy.path()));
|
||||
auto new_path = DeprecatedString::formatted("{}/{}", target_node.full_path(), LexicalPath::basename(url_to_copy.path()));
|
||||
if (url_to_copy.path() == new_path)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace FileManager {
|
||||
|
||||
void spawn_terminal(String const& directory);
|
||||
void spawn_terminal(DeprecatedString const& directory);
|
||||
|
||||
class LauncherHandler : public RefCounted<LauncherHandler> {
|
||||
public:
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
virtual ~DirectoryView() override;
|
||||
|
||||
bool open(String const& path);
|
||||
String path() const { return model().root_path(); }
|
||||
bool open(DeprecatedString const& path);
|
||||
DeprecatedString 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(NonnullRefPtrVector<LauncherHandler> const& handlers);
|
||||
static NonnullRefPtrVector<LauncherHandler> get_launch_handlers(URL const& url);
|
||||
static NonnullRefPtrVector<LauncherHandler> get_launch_handlers(String const& path);
|
||||
static NonnullRefPtrVector<LauncherHandler> get_launch_handlers(DeprecatedString 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(String const&);
|
||||
void set_view_mode_from_string(DeprecatedString const&);
|
||||
|
||||
GUI::AbstractView& current_view()
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
|
||||
bool is_desktop() const { return m_mode == Mode::Desktop; }
|
||||
|
||||
Vector<String> selected_file_paths() const;
|
||||
Vector<DeprecatedString> selected_file_paths() const;
|
||||
|
||||
GUI::Action& mkdir_action() { return *m_mkdir_action; }
|
||||
GUI::Action& touch_action() { return *m_touch_action; }
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
GUI::Action& view_as_columns_action() { return *m_view_as_columns_action; }
|
||||
|
||||
// ^Config::Listener
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
||||
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
|
||||
|
||||
private:
|
||||
explicit DirectoryView(Mode);
|
||||
|
@ -166,8 +166,8 @@ private:
|
|||
NonnullRefPtr<GUI::FileSystemModel> m_model;
|
||||
NonnullRefPtr<GUI::SortingProxyModel> m_sorting_model;
|
||||
size_t m_path_history_position { 0 };
|
||||
Vector<String> m_path_history;
|
||||
void add_path_to_history(String);
|
||||
Vector<DeprecatedString> m_path_history;
|
||||
void add_path_to_history(DeprecatedString);
|
||||
|
||||
RefPtr<GUI::Label> m_error_label;
|
||||
|
||||
|
|
|
@ -129,11 +129,11 @@ void FileOperationProgressWidget::did_error(StringView message)
|
|||
{
|
||||
// FIXME: Communicate more with the user about errors.
|
||||
close_pipe();
|
||||
GUI::MessageBox::show(window(), String::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
|
||||
window()->close();
|
||||
}
|
||||
|
||||
String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
|
||||
DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
|
||||
{
|
||||
int elapsed = m_elapsed_timer.elapsed() / 1000;
|
||||
|
||||
|
@ -144,7 +144,7 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_
|
|||
int seconds_remaining = (bytes_left * elapsed) / bytes_done;
|
||||
|
||||
if (seconds_remaining < 30)
|
||||
return String::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
|
||||
return DeprecatedString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
|
||||
if (seconds_remaining < 60)
|
||||
return "About a minute";
|
||||
if (seconds_remaining < 90)
|
||||
|
@ -157,14 +157,14 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_
|
|||
|
||||
if (minutes_remaining < 60) {
|
||||
if (seconds_remaining < 30)
|
||||
return String::formatted("About {} minutes", minutes_remaining);
|
||||
return String::formatted("Over {} minutes", minutes_remaining);
|
||||
return DeprecatedString::formatted("About {} minutes", minutes_remaining);
|
||||
return DeprecatedString::formatted("Over {} minutes", minutes_remaining);
|
||||
}
|
||||
|
||||
time_t hours_remaining = minutes_remaining / 60;
|
||||
minutes_remaining %= 60;
|
||||
|
||||
return String::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
|
||||
return DeprecatedString::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)
|
||||
|
@ -178,13 +178,13 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt
|
|||
|
||||
switch (m_operation) {
|
||||
case FileOperation::Copy:
|
||||
files_copied_label.set_text(String::formatted("Copying file {} of {}", files_done, total_file_count));
|
||||
files_copied_label.set_text(DeprecatedString::formatted("Copying file {} of {}", files_done, total_file_count));
|
||||
break;
|
||||
case FileOperation::Move:
|
||||
files_copied_label.set_text(String::formatted("Moving file {} of {}", files_done, total_file_count));
|
||||
files_copied_label.set_text(DeprecatedString::formatted("Moving file {} of {}", files_done, total_file_count));
|
||||
break;
|
||||
case FileOperation::Delete:
|
||||
files_copied_label.set_text(String::formatted("Deleting file {} of {}", files_done, total_file_count));
|
||||
files_copied_label.set_text(DeprecatedString::formatted("Deleting file {} of {}", files_done, total_file_count));
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
void close_pipe();
|
||||
|
||||
String estimate_time(off_t bytes_done, off_t total_byte_count);
|
||||
DeprecatedString estimate_time(off_t bytes_done, off_t total_byte_count);
|
||||
Core::ElapsedTimer m_elapsed_timer;
|
||||
|
||||
FileOperation m_operation;
|
||||
|
|
|
@ -17,13 +17,13 @@ namespace FileManager {
|
|||
|
||||
HashTable<NonnullRefPtr<GUI::Window>> file_operation_windows;
|
||||
|
||||
void delete_paths(Vector<String> const& paths, bool should_confirm, GUI::Window* parent_window)
|
||||
void delete_paths(Vector<DeprecatedString> const& paths, bool should_confirm, GUI::Window* parent_window)
|
||||
{
|
||||
String message;
|
||||
DeprecatedString message;
|
||||
if (paths.size() == 1) {
|
||||
message = String::formatted("Are you sure you want to delete {}?", LexicalPath::basename(paths[0]));
|
||||
message = DeprecatedString::formatted("Are you sure you want to delete {}?", LexicalPath::basename(paths[0]));
|
||||
} else {
|
||||
message = String::formatted("Are you sure you want to delete {} files?", paths.size());
|
||||
message = DeprecatedString::formatted("Are you sure you want to delete {} files?", paths.size());
|
||||
}
|
||||
|
||||
if (should_confirm) {
|
||||
|
@ -40,7 +40,7 @@ void delete_paths(Vector<String> const& paths, bool should_confirm, GUI::Window*
|
|||
_exit(1);
|
||||
}
|
||||
|
||||
ErrorOr<void> run_file_operation(FileOperation operation, Vector<String> const& sources, String const& destination, GUI::Window* parent_window)
|
||||
ErrorOr<void> run_file_operation(FileOperation operation, Vector<DeprecatedString> const& sources, DeprecatedString const& destination, GUI::Window* parent_window)
|
||||
{
|
||||
auto pipe_fds = TRY(Core::System::pipe2(0));
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@ enum class FileOperation {
|
|||
Delete,
|
||||
};
|
||||
|
||||
void delete_paths(Vector<String> const&, bool should_confirm, GUI::Window*);
|
||||
void delete_paths(Vector<DeprecatedString> const&, bool should_confirm, GUI::Window*);
|
||||
|
||||
ErrorOr<void> run_file_operation(FileOperation, Vector<String> const& sources, String const& destination, GUI::Window*);
|
||||
ErrorOr<void> run_file_operation(FileOperation, Vector<DeprecatedString> const& sources, DeprecatedString const& destination, GUI::Window*);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Window* parent_window)
|
||||
PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_rename, Window* parent_window)
|
||||
: Window(parent_window)
|
||||
{
|
||||
auto lexical_path = LexicalPath(path);
|
||||
|
@ -67,8 +67,8 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
return;
|
||||
}
|
||||
|
||||
String owner_name;
|
||||
String group_name;
|
||||
DeprecatedString owner_name;
|
||||
DeprecatedString group_name;
|
||||
|
||||
if (auto* pw = getpwuid(st.st_uid)) {
|
||||
owner_name = pw->pw_name;
|
||||
|
@ -116,10 +116,10 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
size->set_text(human_readable_size_long(st.st_size));
|
||||
|
||||
auto owner = general_tab.find_descendant_of_type_named<GUI::Label>("owner");
|
||||
owner->set_text(String::formatted("{} ({})", owner_name, st.st_uid));
|
||||
owner->set_text(DeprecatedString::formatted("{} ({})", owner_name, st.st_uid));
|
||||
|
||||
auto group = general_tab.find_descendant_of_type_named<GUI::Label>("group");
|
||||
group->set_text(String::formatted("{} ({})", group_name, st.st_gid));
|
||||
group->set_text(DeprecatedString::formatted("{} ({})", group_name, st.st_gid));
|
||||
|
||||
auto created_at = general_tab.find_descendant_of_type_named<GUI::Label>("created_at");
|
||||
created_at->set_text(GUI::FileSystemModel::timestamp_string(st.st_ctime));
|
||||
|
@ -167,7 +167,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
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(String::formatted("{} - Properties", m_name));
|
||||
set_title(DeprecatedString::formatted("{} - Properties", m_name));
|
||||
}
|
||||
|
||||
void PropertiesWindow::permission_changed(mode_t mask, bool set)
|
||||
|
@ -182,24 +182,24 @@ void PropertiesWindow::permission_changed(mode_t mask, bool set)
|
|||
m_apply_button->set_enabled(m_name_dirty || m_permissions_dirty);
|
||||
}
|
||||
|
||||
String PropertiesWindow::make_full_path(String const& name)
|
||||
DeprecatedString PropertiesWindow::make_full_path(DeprecatedString const& name)
|
||||
{
|
||||
return String::formatted("{}/{}", m_parent_path, name);
|
||||
return DeprecatedString::formatted("{}/{}", m_parent_path, name);
|
||||
}
|
||||
|
||||
bool PropertiesWindow::apply_changes()
|
||||
{
|
||||
if (m_name_dirty) {
|
||||
String new_name = m_name_box->text();
|
||||
String new_file = make_full_path(new_name).characters();
|
||||
DeprecatedString new_name = m_name_box->text();
|
||||
DeprecatedString new_file = make_full_path(new_name).characters();
|
||||
|
||||
if (Core::File::exists(new_file)) {
|
||||
GUI::MessageBox::show(this, String::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, DeprecatedString::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, String::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, DeprecatedString::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ bool PropertiesWindow::apply_changes()
|
|||
|
||||
if (m_permissions_dirty) {
|
||||
if (chmod(make_full_path(m_name).characters(), m_mode)) {
|
||||
GUI::MessageBox::show(this, String::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(this, DeprecatedString::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ void PropertiesWindow::setup_permission_checkboxes(GUI::CheckBox& box_read, GUI:
|
|||
box_execute.set_enabled(can_edit_checkboxes);
|
||||
}
|
||||
|
||||
GUI::Button& PropertiesWindow::make_button(String text, GUI::Widget& parent)
|
||||
GUI::Button& PropertiesWindow::make_button(DeprecatedString text, GUI::Widget& parent)
|
||||
{
|
||||
auto& button = parent.add<GUI::Button>(text);
|
||||
button.set_fixed_size(70, 22);
|
||||
|
|
|
@ -22,11 +22,11 @@ public:
|
|||
virtual ~PropertiesWindow() override = default;
|
||||
|
||||
private:
|
||||
PropertiesWindow(String const& path, bool disable_rename, Window* parent = nullptr);
|
||||
PropertiesWindow(DeprecatedString const& path, bool disable_rename, Window* parent = nullptr);
|
||||
|
||||
struct PropertyValuePair {
|
||||
String property;
|
||||
String value;
|
||||
DeprecatedString property;
|
||||
DeprecatedString value;
|
||||
Optional<URL> link = {};
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ private:
|
|||
mode_t execute;
|
||||
};
|
||||
|
||||
static String const get_description(mode_t const mode)
|
||||
static DeprecatedString const get_description(mode_t const mode)
|
||||
{
|
||||
if (S_ISREG(mode))
|
||||
return "File";
|
||||
|
@ -58,19 +58,19 @@ private:
|
|||
return "Unknown";
|
||||
}
|
||||
|
||||
GUI::Button& make_button(String, GUI::Widget& parent);
|
||||
GUI::Button& make_button(DeprecatedString, GUI::Widget& parent);
|
||||
void setup_permission_checkboxes(GUI::CheckBox& box_read, GUI::CheckBox& box_write, GUI::CheckBox& box_execute, PermissionMasks masks, mode_t mode);
|
||||
void permission_changed(mode_t mask, bool set);
|
||||
bool apply_changes();
|
||||
void update();
|
||||
String make_full_path(String const& name);
|
||||
DeprecatedString make_full_path(DeprecatedString const& name);
|
||||
|
||||
RefPtr<GUI::Button> m_apply_button;
|
||||
RefPtr<GUI::TextBox> m_name_box;
|
||||
RefPtr<GUI::ImageWidget> m_icon;
|
||||
String m_name;
|
||||
String m_parent_path;
|
||||
String m_path;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_parent_path;
|
||||
DeprecatedString m_path;
|
||||
mode_t m_mode { 0 };
|
||||
mode_t m_old_mode { 0 };
|
||||
bool m_permissions_dirty { false };
|
||||
|
|
|
@ -56,15 +56,15 @@
|
|||
using namespace FileManager;
|
||||
|
||||
static ErrorOr<int> run_in_desktop_mode();
|
||||
static ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& entry_focused_on_init);
|
||||
static void do_copy(Vector<String> const& selected_file_paths, FileOperation file_operation);
|
||||
static void do_paste(String const& target_directory, GUI::Window* window);
|
||||
static void do_create_link(Vector<String> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* window);
|
||||
static void do_set_wallpaper(String const& file_path, GUI::Window* window);
|
||||
static void do_unzip_archive(Vector<String> const& selected_file_paths, GUI::Window* window);
|
||||
static void show_properties(String const& container_dir_path, String const& path, Vector<String> const& selected, GUI::Window* window);
|
||||
static bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, String const& full_path, RefPtr<GUI::Action>& default_action, NonnullRefPtrVector<LauncherHandler>& current_file_launch_handlers);
|
||||
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, NonnullRefPtrVector<LauncherHandler>& current_file_launch_handlers);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool is_desktop_mode { false };
|
||||
bool is_selection_mode { false };
|
||||
bool ignore_path_resolution { false };
|
||||
String initial_location;
|
||||
DeprecatedString 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');
|
||||
|
@ -120,7 +120,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (initial_location.is_empty())
|
||||
initial_location = "/";
|
||||
|
||||
String focused_entry;
|
||||
DeprecatedString focused_entry;
|
||||
if (is_selection_mode) {
|
||||
LexicalPath path(initial_location);
|
||||
initial_location = path.dirname();
|
||||
|
@ -130,7 +130,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return run_in_windowed_mode(initial_location, focused_entry);
|
||||
}
|
||||
|
||||
void do_copy(Vector<String> const& selected_file_paths, FileOperation file_operation)
|
||||
void do_copy(Vector<DeprecatedString> const& selected_file_paths, FileOperation file_operation)
|
||||
{
|
||||
VERIFY(!selected_file_paths.is_empty());
|
||||
|
||||
|
@ -145,14 +145,14 @@ void do_copy(Vector<String> const& selected_file_paths, FileOperation file_opera
|
|||
GUI::Clipboard::the().set_data(copy_text.build().bytes(), "text/uri-list");
|
||||
}
|
||||
|
||||
void do_paste(String const& target_directory, GUI::Window* window)
|
||||
void do_paste(DeprecatedString 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 = String::copy(data_and_type.data).split('\n');
|
||||
auto copied_lines = DeprecatedString::copy(data_and_type.data).split('\n');
|
||||
if (copied_lines.is_empty()) {
|
||||
dbgln("No files to paste");
|
||||
return;
|
||||
|
@ -164,7 +164,7 @@ void do_paste(String const& target_directory, GUI::Window* window)
|
|||
copied_lines.remove(0);
|
||||
}
|
||||
|
||||
Vector<String> source_paths;
|
||||
Vector<DeprecatedString> source_paths;
|
||||
for (auto& uri_as_string : copied_lines) {
|
||||
if (uri_as_string.is_empty())
|
||||
continue;
|
||||
|
@ -182,19 +182,19 @@ void do_paste(String const& target_directory, GUI::Window* window)
|
|||
}
|
||||
}
|
||||
|
||||
void do_create_link(Vector<String> const& selected_file_paths, GUI::Window* window)
|
||||
void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
auto path = selected_file_paths.first();
|
||||
auto destination = String::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
|
||||
auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
|
||||
if (auto result = Core::File::link_file(destination, path); result.is_error()) {
|
||||
GUI::MessageBox::show(window, String::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
|
||||
void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* window)
|
||||
void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
String archive_name;
|
||||
DeprecatedString archive_name;
|
||||
if (GUI::InputBox::show(window, archive_name, "Enter name:"sv, "Create Archive"sv) != GUI::InputBox::ExecResult::OK)
|
||||
return;
|
||||
|
||||
|
@ -220,7 +220,7 @@ void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* w
|
|||
}
|
||||
|
||||
if (!zip_pid) {
|
||||
Vector<String> relative_paths;
|
||||
Vector<DeprecatedString> relative_paths;
|
||||
Vector<char const*> arg_list;
|
||||
arg_list.append("/bin/zip");
|
||||
arg_list.append("-r");
|
||||
|
@ -244,10 +244,10 @@ void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* w
|
|||
}
|
||||
}
|
||||
|
||||
void do_set_wallpaper(String const& file_path, GUI::Window* window)
|
||||
void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window)
|
||||
{
|
||||
auto show_error = [&] {
|
||||
GUI::MessageBox::show(window, String::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(file_path);
|
||||
|
@ -260,10 +260,10 @@ void do_set_wallpaper(String const& file_path, GUI::Window* window)
|
|||
show_error();
|
||||
}
|
||||
|
||||
void do_unzip_archive(Vector<String> const& selected_file_paths, GUI::Window* window)
|
||||
void do_unzip_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
String archive_file_path = selected_file_paths.first();
|
||||
String output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4);
|
||||
DeprecatedString archive_file_path = selected_file_paths.first();
|
||||
DeprecatedString output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4);
|
||||
|
||||
pid_t unzip_pid = fork();
|
||||
if (unzip_pid < 0) {
|
||||
|
@ -286,7 +286,7 @@ void do_unzip_archive(Vector<String> const& selected_file_paths, GUI::Window* wi
|
|||
}
|
||||
}
|
||||
|
||||
void show_properties(String const& container_dir_path, String const& path, Vector<String> const& selected, GUI::Window* window)
|
||||
void show_properties(DeprecatedString const& container_dir_path, DeprecatedString const& path, Vector<DeprecatedString> const& selected, GUI::Window* window)
|
||||
{
|
||||
RefPtr<PropertiesWindow> properties;
|
||||
if (selected.is_empty()) {
|
||||
|
@ -301,7 +301,7 @@ void show_properties(String const& container_dir_path, String const& path, Vecto
|
|||
properties->show();
|
||||
}
|
||||
|
||||
bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, String const& full_path, RefPtr<GUI::Action>& default_action, NonnullRefPtrVector<LauncherHandler>& current_file_launch_handlers)
|
||||
bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView const& directory_view, DeprecatedString const& full_path, RefPtr<GUI::Action>& default_action, NonnullRefPtrVector<LauncherHandler>& current_file_launch_handlers)
|
||||
{
|
||||
current_file_launch_handlers = directory_view.get_launch_handlers(full_path);
|
||||
|
||||
|
@ -312,9 +312,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(String::formatted("Run {}", file_open_action->text()));
|
||||
file_open_action->set_text(DeprecatedString::formatted("Run {}", file_open_action->text()));
|
||||
else
|
||||
file_open_action->set_text(String::formatted("Open in {}", file_open_action->text()));
|
||||
file_open_action->set_text(DeprecatedString::formatted("Open in {}", file_open_action->text()));
|
||||
|
||||
default_action = file_open_action;
|
||||
|
||||
|
@ -421,8 +421,8 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
|
||||
auto properties_action = GUI::CommonActions::make_properties_action(
|
||||
[&](auto&) {
|
||||
String path = directory_view->path();
|
||||
Vector<String> selected = directory_view->selected_file_paths();
|
||||
DeprecatedString path = directory_view->path();
|
||||
Vector<DeprecatedString> selected = directory_view->selected_file_paths();
|
||||
|
||||
show_properties(path, path, selected, directory_view->window());
|
||||
},
|
||||
|
@ -435,7 +435,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 = [&](String const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) {
|
||||
paste_action->set_enabled(data_type == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0);
|
||||
};
|
||||
|
||||
|
@ -537,7 +537,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
};
|
||||
|
||||
struct BackgroundWallpaperListener : Config::Listener {
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override
|
||||
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override
|
||||
{
|
||||
if (domain == "WindowManager" && group == "Background" && key == "Wallpaper") {
|
||||
auto wallpaper_bitmap_or_error = Gfx::Bitmap::try_load_from_file(value);
|
||||
|
@ -563,7 +563,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
return GUI::Application::the()->exec();
|
||||
}
|
||||
|
||||
ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& entry_focused_on_init)
|
||||
ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, DeprecatedString const& entry_focused_on_init)
|
||||
{
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
window->set_title("File Manager");
|
||||
|
@ -753,7 +753,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
view_type_action_group->add_action(directory_view->view_as_columns_action());
|
||||
|
||||
auto tree_view_selected_file_paths = [&] {
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
auto& view = tree_view;
|
||||
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
||||
paths.append(directories_model->full_path(index));
|
||||
|
@ -797,7 +797,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
{},
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
paths = tree_view_selected_file_paths();
|
||||
else
|
||||
|
@ -816,7 +816,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
{},
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(),
|
||||
[&](GUI::Action const& action) {
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
if (action.activator() == tree_view_directory_context_menu)
|
||||
paths = tree_view_selected_file_paths();
|
||||
else
|
||||
|
@ -886,9 +886,9 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
|
||||
auto properties_action = GUI::CommonActions::make_properties_action(
|
||||
[&](auto& action) {
|
||||
String container_dir_path;
|
||||
String path;
|
||||
Vector<String> selected;
|
||||
DeprecatedString container_dir_path;
|
||||
DeprecatedString path;
|
||||
Vector<DeprecatedString> selected;
|
||||
if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) {
|
||||
path = directory_view->path();
|
||||
container_dir_path = path;
|
||||
|
@ -905,7 +905,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
|
||||
auto paste_action = GUI::CommonActions::make_paste_action(
|
||||
[&](GUI::Action const& action) {
|
||||
String target_directory;
|
||||
DeprecatedString target_directory;
|
||||
if (action.activator() == directory_context_menu)
|
||||
target_directory = directory_view->selected_file_paths()[0];
|
||||
else
|
||||
|
@ -917,7 +917,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
|
||||
auto folder_specific_paste_action = GUI::CommonActions::make_paste_action(
|
||||
[&](GUI::Action const& action) {
|
||||
String target_directory;
|
||||
DeprecatedString target_directory;
|
||||
if (action.activator() == directory_context_menu)
|
||||
target_directory = directory_view->selected_file_paths()[0];
|
||||
else
|
||||
|
@ -945,7 +945,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
},
|
||||
window);
|
||||
|
||||
GUI::Clipboard::the().on_change = [&](String const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [&](DeprecatedString 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);
|
||||
};
|
||||
|
@ -1090,13 +1090,13 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
}
|
||||
};
|
||||
|
||||
directory_view->on_path_change = [&](String const& new_path, bool can_read_in_path, bool can_write_in_path) {
|
||||
directory_view->on_path_change = [&](DeprecatedString 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);
|
||||
location_textbox.set_icon(bitmap);
|
||||
|
||||
window->set_title(String::formatted("{} - File Manager", new_path));
|
||||
window->set_title(DeprecatedString::formatted("{} - File Manager", new_path));
|
||||
location_textbox.set_text(new_path);
|
||||
|
||||
{
|
||||
|
@ -1298,7 +1298,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
}
|
||||
};
|
||||
|
||||
auto copy_urls_to_directory = [&](Vector<URL> const& urls, String const& directory) {
|
||||
auto copy_urls_to_directory = [&](Vector<URL> const& urls, DeprecatedString const& directory) {
|
||||
if (urls.is_empty()) {
|
||||
dbgln("No files to copy");
|
||||
return;
|
||||
|
@ -1307,12 +1307,12 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
for (auto& url_to_copy : urls) {
|
||||
if (!url_to_copy.is_valid() || url_to_copy.path() == directory)
|
||||
continue;
|
||||
auto new_path = String::formatted("{}/{}", directory, LexicalPath::basename(url_to_copy.path()));
|
||||
auto new_path = DeprecatedString::formatted("{}/{}", directory, LexicalPath::basename(url_to_copy.path()));
|
||||
if (url_to_copy.path() == new_path)
|
||||
continue;
|
||||
|
||||
if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) {
|
||||
auto error_message = String::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast<Error const&>(result.error()));
|
||||
auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast<Error const&>(result.error()));
|
||||
GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
had_accepted_copy = true;
|
||||
|
|
|
@ -73,7 +73,7 @@ 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 = [&] {
|
||||
auto preview = String::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()));
|
||||
auto preview = DeprecatedString::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()));
|
||||
m_preview_label->set_text(preview);
|
||||
};
|
||||
m_preview_textbox->set_text(pangrams[0]);
|
||||
|
@ -110,7 +110,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
m_open_action = GUI::CommonActions::make_open_action([&](auto&) {
|
||||
if (!request_close())
|
||||
return;
|
||||
Optional<String> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"sv);
|
||||
Optional<DeprecatedString> open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"sv);
|
||||
if (!open_path.has_value())
|
||||
return;
|
||||
if (auto result = open_file(open_path.value()); result.is_error())
|
||||
|
@ -126,7 +126,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
|
||||
m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
LexicalPath lexical_path(m_path.is_empty() ? "Untitled.font" : m_path);
|
||||
Optional<String> save_path = GUI::FilePicker::get_save_filepath(window(), lexical_path.title(), lexical_path.extension());
|
||||
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window(), lexical_path.title(), lexical_path.extension());
|
||||
if (!save_path.has_value())
|
||||
return;
|
||||
if (auto result = save_file(save_path.value()); result.is_error())
|
||||
|
@ -148,7 +148,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 = [&](String const& data_type) {
|
||||
GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) {
|
||||
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
|
||||
};
|
||||
|
||||
|
@ -241,7 +241,7 @@ ErrorOr<void> MainWidget::create_actions()
|
|||
m_show_system_emoji_action->set_status_tip("Show or hide system emoji");
|
||||
|
||||
m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
|
||||
String input;
|
||||
DeprecatedString input;
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
|
||||
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
|
||||
if (!maybe_code_point.has_value())
|
||||
|
@ -370,18 +370,18 @@ ErrorOr<void> MainWidget::create_models()
|
|||
{
|
||||
for (auto& it : Gfx::font_slope_names)
|
||||
TRY(m_font_slope_list.try_append(it.name));
|
||||
m_slope_combobox->set_model(GUI::ItemListModel<String>::create(m_font_slope_list));
|
||||
m_slope_combobox->set_model(GUI::ItemListModel<DeprecatedString>::create(m_font_slope_list));
|
||||
|
||||
for (auto& it : Gfx::font_weight_names)
|
||||
TRY(m_font_weight_list.try_append(it.name));
|
||||
m_weight_combobox->set_model(GUI::ItemListModel<String>::create(m_font_weight_list));
|
||||
m_weight_combobox->set_model(GUI::ItemListModel<DeprecatedString>::create(m_font_weight_list));
|
||||
|
||||
auto unicode_blocks = Unicode::block_display_names();
|
||||
TRY(m_unicode_block_list.try_append("Show All"));
|
||||
for (auto& block : unicode_blocks)
|
||||
TRY(m_unicode_block_list.try_append(block.display_name));
|
||||
|
||||
m_unicode_block_model = GUI::ItemListModel<String>::create(m_unicode_block_list);
|
||||
m_unicode_block_model = GUI::ItemListModel<DeprecatedString>::create(m_unicode_block_list);
|
||||
m_filter_model = TRY(GUI::FilteringProxyModel::create(*m_unicode_block_model));
|
||||
m_filter_model->set_filter_term(""sv);
|
||||
|
||||
|
@ -578,7 +578,7 @@ MainWidget::MainWidget()
|
|||
};
|
||||
}
|
||||
|
||||
ErrorOr<void> MainWidget::initialize(String const& path, RefPtr<Gfx::BitmapFont>&& edited_font)
|
||||
ErrorOr<void> MainWidget::initialize(DeprecatedString const& path, RefPtr<Gfx::BitmapFont>&& edited_font)
|
||||
{
|
||||
if (m_edited_font == edited_font)
|
||||
return {};
|
||||
|
@ -711,7 +711,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> MainWidget::save_file(String const& path)
|
||||
ErrorOr<void> MainWidget::save_file(DeprecatedString const& path)
|
||||
{
|
||||
auto masked_font = TRY(m_edited_font->masked_character_set());
|
||||
TRY(masked_font->write_to_file(path));
|
||||
|
@ -764,7 +764,7 @@ void MainWidget::set_show_system_emoji(bool show)
|
|||
m_glyph_map_widget->set_show_system_emoji(show);
|
||||
}
|
||||
|
||||
ErrorOr<void> MainWidget::open_file(String const& path)
|
||||
ErrorOr<void> MainWidget::open_file(DeprecatedString const& path)
|
||||
{
|
||||
auto unmasked_font = TRY(TRY(Gfx::BitmapFont::try_load_from_file(path))->unmasked_character_set());
|
||||
TRY(initialize(path, move(unmasked_font)));
|
||||
|
@ -972,11 +972,11 @@ ErrorOr<void> MainWidget::copy_selected_glyphs()
|
|||
TRY(buffer.try_append(rows, bytes_per_glyph * selection.size()));
|
||||
TRY(buffer.try_append(widths, selection.size()));
|
||||
|
||||
HashMap<String, String> metadata;
|
||||
metadata.set("start", String::number(selection.start()));
|
||||
metadata.set("count", String::number(selection.size()));
|
||||
metadata.set("width", String::number(edited_font().max_glyph_width()));
|
||||
metadata.set("height", String::number(edited_font().glyph_height()));
|
||||
HashMap<DeprecatedString, DeprecatedString> metadata;
|
||||
metadata.set("start", DeprecatedString::number(selection.start()));
|
||||
metadata.set("count", DeprecatedString::number(selection.size()));
|
||||
metadata.set("width", DeprecatedString::number(edited_font().max_glyph_width()));
|
||||
metadata.set("height", DeprecatedString::number(edited_font().glyph_height()));
|
||||
GUI::Clipboard::the().set_data(buffer.bytes(), "glyph/x-fonteditor", metadata);
|
||||
|
||||
return {};
|
||||
|
@ -1058,11 +1058,11 @@ void MainWidget::delete_selected_glyphs()
|
|||
|
||||
void MainWidget::show_error(Error error, StringView preface, StringView basename)
|
||||
{
|
||||
String formatted_error;
|
||||
DeprecatedString formatted_error;
|
||||
if (basename.is_empty())
|
||||
formatted_error = String::formatted("{}: {}", preface, error);
|
||||
formatted_error = DeprecatedString::formatted("{}: {}", preface, error);
|
||||
else
|
||||
formatted_error = String::formatted("{} \"{}\" failed: {}", preface, basename, error);
|
||||
formatted_error = DeprecatedString::formatted("{} \"{}\" failed: {}", preface, basename, error);
|
||||
GUI::MessageBox::show_error(window(), formatted_error);
|
||||
warnln(formatted_error);
|
||||
}
|
||||
|
|
|
@ -34,15 +34,15 @@ public:
|
|||
|
||||
virtual ~MainWidget() override = default;
|
||||
|
||||
ErrorOr<void> initialize(String const& path, RefPtr<Gfx::BitmapFont>&&);
|
||||
ErrorOr<void> initialize(DeprecatedString const& path, RefPtr<Gfx::BitmapFont>&&);
|
||||
ErrorOr<void> initialize_menubar(GUI::Window&);
|
||||
|
||||
ErrorOr<void> open_file(String const&);
|
||||
ErrorOr<void> save_file(String const&);
|
||||
ErrorOr<void> open_file(DeprecatedString const&);
|
||||
ErrorOr<void> save_file(DeprecatedString const&);
|
||||
bool request_close();
|
||||
void update_title();
|
||||
|
||||
String const& path() { return m_path; }
|
||||
DeprecatedString const& path() { return m_path; }
|
||||
Gfx::BitmapFont const& edited_font() { return *m_edited_font; }
|
||||
|
||||
bool is_showing_font_metadata() { return m_font_metadata; }
|
||||
|
@ -160,10 +160,10 @@ private:
|
|||
RefPtr<GUI::TextBox> m_preview_textbox;
|
||||
RefPtr<GUI::Window> m_font_preview_window;
|
||||
|
||||
String m_path;
|
||||
Vector<String> m_font_weight_list;
|
||||
Vector<String> m_font_slope_list;
|
||||
Vector<String> m_unicode_block_list;
|
||||
DeprecatedString m_path;
|
||||
Vector<DeprecatedString> m_font_weight_list;
|
||||
Vector<DeprecatedString> m_font_slope_list;
|
||||
Vector<DeprecatedString> m_unicode_block_list;
|
||||
bool m_font_metadata { true };
|
||||
bool m_unicode_blocks { true };
|
||||
Unicode::CodePointRange m_range { 0x0000, 0x10FFFF };
|
||||
|
|
|
@ -138,12 +138,12 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window)
|
|||
|
||||
for (auto& it : Gfx::font_weight_names)
|
||||
m_font_weight_list.append(it.name);
|
||||
m_weight_combobox->set_model(*GUI::ItemListModel<String>::create(m_font_weight_list));
|
||||
m_weight_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_font_weight_list));
|
||||
m_weight_combobox->set_selected_index(3);
|
||||
|
||||
for (auto& it : Gfx::font_slope_names)
|
||||
m_font_slope_list.append(it.name);
|
||||
m_slope_combobox->set_model(*GUI::ItemListModel<String>::create(m_font_slope_list));
|
||||
m_slope_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_font_slope_list));
|
||||
m_slope_combobox->set_selected_index(0);
|
||||
|
||||
m_presentation_spinbox->set_value(12);
|
||||
|
|
|
@ -31,8 +31,8 @@ private:
|
|||
u8 presentation_size;
|
||||
u16 weight;
|
||||
u8 slope;
|
||||
String name;
|
||||
String family;
|
||||
DeprecatedString name;
|
||||
DeprecatedString family;
|
||||
bool is_fixed_width;
|
||||
} m_new_font_metadata;
|
||||
|
||||
|
@ -51,6 +51,6 @@ private:
|
|||
RefPtr<GUI::SpinBox> m_spacing_spinbox;
|
||||
RefPtr<GUI::CheckBox> m_fixed_width_checkbox;
|
||||
|
||||
Vector<String> m_font_weight_list;
|
||||
Vector<String> m_font_slope_list;
|
||||
Vector<DeprecatedString> m_font_weight_list;
|
||||
Vector<DeprecatedString> m_font_slope_list;
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ void CardSettingsWidget::set_cards_background_color(Gfx::Color color)
|
|||
m_preview_frame->set_palette(new_palette);
|
||||
}
|
||||
|
||||
bool CardSettingsWidget::set_card_back_image_path(String const& path)
|
||||
bool CardSettingsWidget::set_card_back_image_path(DeprecatedString const& path)
|
||||
{
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_card_back_image_view->model())->index(path, m_card_back_image_view->model_column());
|
||||
if (index.is_valid()) {
|
||||
|
@ -86,7 +86,7 @@ bool CardSettingsWidget::set_card_back_image_path(String const& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
String CardSettingsWidget::card_back_image_path() const
|
||||
DeprecatedString CardSettingsWidget::card_back_image_path() const
|
||||
{
|
||||
auto& card_back_selection = m_card_back_image_view->selection();
|
||||
GUI::ModelIndex card_back_image_index = m_last_selected_card_back;
|
||||
|
|
|
@ -25,8 +25,8 @@ private:
|
|||
CardSettingsWidget();
|
||||
|
||||
void set_cards_background_color(Gfx::Color);
|
||||
bool set_card_back_image_path(String const&);
|
||||
String card_back_image_path() const;
|
||||
bool set_card_back_image_path(DeprecatedString const&);
|
||||
DeprecatedString card_back_image_path() const;
|
||||
|
||||
RefPtr<GUI::Frame> m_preview_frame;
|
||||
RefPtr<GUI::ImageWidget> m_preview_card_back;
|
||||
|
|
|
@ -16,7 +16,7 @@ void History::push(StringView history_item)
|
|||
m_current_history_item++;
|
||||
}
|
||||
|
||||
String History::current()
|
||||
DeprecatedString History::current()
|
||||
{
|
||||
if (m_current_history_item == -1)
|
||||
return {};
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
class History final {
|
||||
public:
|
||||
void push(StringView history_item);
|
||||
String current();
|
||||
DeprecatedString current();
|
||||
|
||||
void go_back();
|
||||
void go_forward();
|
||||
|
@ -23,6 +23,6 @@ public:
|
|||
void clear();
|
||||
|
||||
private:
|
||||
Vector<String> m_items;
|
||||
Vector<DeprecatedString> m_items;
|
||||
int m_current_history_item { -1 };
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "MainWidget.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/URL.h>
|
||||
#include <Applications/Help/HelpWindowGML.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -66,7 +66,7 @@ MainWidget::MainWidget()
|
|||
}
|
||||
auto& search_model = *static_cast<GUI::FilteringProxyModel*>(view_model);
|
||||
auto const& mapped_index = search_model.map(index);
|
||||
String path = m_manual_model->page_path(mapped_index);
|
||||
DeprecatedString path = m_manual_model->page_path(mapped_index);
|
||||
if (path.is_null()) {
|
||||
m_web_view->load_empty_document();
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ MainWidget::MainWidget()
|
|||
|
||||
m_browse_view = find_descendant_of_type_named<GUI::TreeView>("browse_view");
|
||||
m_browse_view->on_selection_change = [this] {
|
||||
String path = m_manual_model->page_path(m_browse_view->selection().first());
|
||||
DeprecatedString path = m_manual_model->page_path(m_browse_view->selection().first());
|
||||
if (path.is_null())
|
||||
return;
|
||||
|
||||
|
@ -114,7 +114,7 @@ MainWidget::MainWidget()
|
|||
}
|
||||
auto const section = url.paths()[0];
|
||||
auto const page = url.paths()[1];
|
||||
auto const path = String::formatted("/usr/share/man/man{}/{}.md", section, page);
|
||||
auto const path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", section, page);
|
||||
|
||||
m_history.push(path);
|
||||
open_url(URL::create_with_file_scheme(path, url.fragment()));
|
||||
|
@ -150,7 +150,7 @@ MainWidget::MainWidget()
|
|||
m_go_forward_action->set_enabled(false);
|
||||
|
||||
m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) {
|
||||
String path = "/usr/share/man/man7/Help-index.md";
|
||||
DeprecatedString path = "/usr/share/man/man7/Help-index.md";
|
||||
m_history.push(path);
|
||||
open_page(path);
|
||||
});
|
||||
|
@ -180,7 +180,7 @@ void MainWidget::set_start_page(StringView start_page, u32 section)
|
|||
if (!start_page.is_null()) {
|
||||
if (section != 0) {
|
||||
// > Help [section] [name]
|
||||
String path = String::formatted("/usr/share/man/man{}/{}.md", section, start_page);
|
||||
DeprecatedString path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", section, start_page);
|
||||
m_history.push(path);
|
||||
open_page(path);
|
||||
set_start_page = true;
|
||||
|
@ -204,7 +204,7 @@ void MainWidget::set_start_page(StringView start_page, u32 section)
|
|||
"8"
|
||||
};
|
||||
for (auto s : sections) {
|
||||
String path = String::formatted("/usr/share/man/man{}/{}.md", s, start_page);
|
||||
DeprecatedString path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", s, start_page);
|
||||
if (Core::File::exists(path)) {
|
||||
m_history.push(path);
|
||||
open_page(path);
|
||||
|
@ -246,7 +246,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
|
|||
auto help_menu = TRY(window.try_add_menu("&Help"));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window)));
|
||||
TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [&](auto&) {
|
||||
String path = "/usr/share/man/man1/Help.md";
|
||||
DeprecatedString path = "/usr/share/man/man1/Help.md";
|
||||
open_page(path);
|
||||
})));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Help", TRY(GUI::Icon::try_create_default_icon("app-help"sv)), &window)));
|
||||
|
@ -282,8 +282,8 @@ void MainWidget::open_url(URL const& url)
|
|||
if (browse_view_index.has_value()) {
|
||||
m_browse_view->expand_tree(browse_view_index.value().parent());
|
||||
|
||||
String page_and_section = m_manual_model->page_and_section(browse_view_index.value());
|
||||
window()->set_title(String::formatted("{} - Help", page_and_section));
|
||||
DeprecatedString page_and_section = m_manual_model->page_and_section(browse_view_index.value());
|
||||
window()->set_title(DeprecatedString::formatted("{} - Help", page_and_section));
|
||||
} else {
|
||||
window()->set_title("Help");
|
||||
}
|
||||
|
@ -294,10 +294,10 @@ void MainWidget::open_url(URL const& url)
|
|||
void MainWidget::open_external(URL const& url)
|
||||
{
|
||||
if (!Desktop::Launcher::open(url))
|
||||
GUI::MessageBox::show(window(), String::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
||||
void MainWidget::open_page(String const& path)
|
||||
void MainWidget::open_page(DeprecatedString const& path)
|
||||
{
|
||||
m_go_back_action->set_enabled(m_history.can_go_back());
|
||||
m_go_forward_action->set_enabled(m_history.can_go_forward());
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
MainWidget();
|
||||
|
||||
void open_url(URL const&);
|
||||
void open_page(String const& path);
|
||||
void open_page(DeprecatedString const& path);
|
||||
void open_external(URL const&);
|
||||
|
||||
History m_history;
|
||||
|
|
|
@ -46,7 +46,7 @@ Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const
|
|||
return {};
|
||||
}
|
||||
|
||||
String ManualModel::page_name(const GUI::ModelIndex& index) const
|
||||
DeprecatedString ManualModel::page_name(const GUI::ModelIndex& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
@ -57,7 +57,7 @@ String ManualModel::page_name(const GUI::ModelIndex& index) const
|
|||
return page->name();
|
||||
}
|
||||
|
||||
String ManualModel::page_path(const GUI::ModelIndex& index) const
|
||||
DeprecatedString ManualModel::page_path(const GUI::ModelIndex& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
@ -68,7 +68,7 @@ String ManualModel::page_path(const GUI::ModelIndex& index) const
|
|||
return page->path();
|
||||
}
|
||||
|
||||
ErrorOr<StringView> ManualModel::page_view(String const& path) const
|
||||
ErrorOr<StringView> ManualModel::page_view(DeprecatedString const& path) const
|
||||
{
|
||||
if (path.is_empty())
|
||||
return StringView {};
|
||||
|
@ -87,7 +87,7 @@ ErrorOr<StringView> ManualModel::page_view(String const& path) const
|
|||
return view;
|
||||
}
|
||||
|
||||
String ManualModel::page_and_section(const GUI::ModelIndex& index) const
|
||||
DeprecatedString ManualModel::page_and_section(const GUI::ModelIndex& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
@ -96,7 +96,7 @@ String ManualModel::page_and_section(const GUI::ModelIndex& index) const
|
|||
return {};
|
||||
auto* page = static_cast<ManualPageNode const*>(node);
|
||||
auto* section = static_cast<ManualSectionNode const*>(page->parent());
|
||||
return String::formatted("{}({})", page->name(), section->section_name());
|
||||
return DeprecatedString::formatted("{}({})", page->name(), section->section_name());
|
||||
}
|
||||
|
||||
GUI::ModelIndex ManualModel::index(int row, int column, const GUI::ModelIndex& parent_index) const
|
||||
|
@ -151,7 +151,7 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role
|
|||
case GUI::ModelRole::Search:
|
||||
if (!node->is_page())
|
||||
return {};
|
||||
return String(page_view(page_path(index)).value());
|
||||
return DeprecatedString(page_view(page_path(index)).value());
|
||||
case GUI::ModelRole::Display:
|
||||
return node->name();
|
||||
case GUI::ModelRole::Icon:
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Result.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
||||
class ManualModel final : public GUI::Model {
|
||||
|
@ -23,10 +23,10 @@ public:
|
|||
|
||||
Optional<GUI::ModelIndex> index_from_path(StringView) const;
|
||||
|
||||
String page_name(const GUI::ModelIndex&) const;
|
||||
String page_path(const GUI::ModelIndex&) const;
|
||||
String page_and_section(const GUI::ModelIndex&) const;
|
||||
ErrorOr<StringView> page_view(String const& path) const;
|
||||
DeprecatedString page_name(const GUI::ModelIndex&) const;
|
||||
DeprecatedString page_path(const GUI::ModelIndex&) const;
|
||||
DeprecatedString page_and_section(const GUI::ModelIndex&) const;
|
||||
ErrorOr<StringView> page_view(DeprecatedString const& path) const;
|
||||
|
||||
void update_section_node_on_toggle(const GUI::ModelIndex&, bool const);
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
|
@ -42,5 +42,5 @@ private:
|
|||
GUI::Icon m_section_open_icon;
|
||||
GUI::Icon m_section_icon;
|
||||
GUI::Icon m_page_icon;
|
||||
mutable HashMap<String, NonnullRefPtr<Core::MappedFile>> m_mapped_files;
|
||||
mutable HashMap<DeprecatedString, NonnullRefPtr<Core::MappedFile>> m_mapped_files;
|
||||
};
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
class ManualNode {
|
||||
public:
|
||||
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
virtual NonnullOwnPtrVector<ManualNode>& children() const = 0;
|
||||
virtual ManualNode const* parent() const = 0;
|
||||
virtual String name() const = 0;
|
||||
virtual DeprecatedString name() const = 0;
|
||||
virtual bool is_page() const { return false; }
|
||||
virtual bool is_open() const { return false; }
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ NonnullOwnPtrVector<ManualNode>& ManualPageNode::children() const
|
|||
return empty_vector;
|
||||
}
|
||||
|
||||
String ManualPageNode::path() const
|
||||
DeprecatedString ManualPageNode::path() const
|
||||
{
|
||||
return String::formatted("{}/{}.md", m_section.path(), m_page);
|
||||
return DeprecatedString::formatted("{}/{}.md", m_section.path(), m_page);
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@ public:
|
|||
|
||||
virtual NonnullOwnPtrVector<ManualNode>& children() const override;
|
||||
virtual ManualNode const* parent() const override;
|
||||
virtual String name() const override { return m_page; };
|
||||
virtual DeprecatedString name() const override { return m_page; };
|
||||
virtual bool is_page() const override { return true; }
|
||||
|
||||
String path() const;
|
||||
DeprecatedString path() const;
|
||||
|
||||
private:
|
||||
ManualSectionNode const& m_section;
|
||||
String m_page;
|
||||
DeprecatedString m_page;
|
||||
};
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
#include "ManualSectionNode.h"
|
||||
#include "ManualPageNode.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
||||
String ManualSectionNode::path() const
|
||||
DeprecatedString ManualSectionNode::path() const
|
||||
{
|
||||
return String::formatted("/usr/share/man/man{}", m_section);
|
||||
return DeprecatedString::formatted("/usr/share/man/man{}", m_section);
|
||||
}
|
||||
|
||||
void ManualSectionNode::reify_if_needed() const
|
||||
|
@ -24,7 +24,7 @@ void ManualSectionNode::reify_if_needed() const
|
|||
|
||||
Core::DirIterator dir_iter { path(), Core::DirIterator::Flags::SkipDots };
|
||||
|
||||
Vector<String> page_names;
|
||||
Vector<DeprecatedString> page_names;
|
||||
while (dir_iter.has_next()) {
|
||||
LexicalPath lexical_path(dir_iter.next_path());
|
||||
if (lexical_path.extension() != "md")
|
||||
|
|
|
@ -13,9 +13,9 @@ class ManualSectionNode : public ManualNode {
|
|||
public:
|
||||
virtual ~ManualSectionNode() override = default;
|
||||
|
||||
ManualSectionNode(String section, String name)
|
||||
ManualSectionNode(DeprecatedString section, DeprecatedString name)
|
||||
: m_section(section)
|
||||
, m_full_name(String::formatted("{}. {}", section, name))
|
||||
, m_full_name(DeprecatedString::formatted("{}. {}", section, name))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,18 +26,18 @@ public:
|
|||
}
|
||||
|
||||
virtual ManualNode const* parent() const override { return nullptr; }
|
||||
virtual String name() const override { return m_full_name; }
|
||||
virtual DeprecatedString name() const override { return m_full_name; }
|
||||
virtual bool is_open() const override { return m_open; }
|
||||
void set_open(bool open);
|
||||
|
||||
String const& section_name() const { return m_section; }
|
||||
String path() const;
|
||||
DeprecatedString const& section_name() const { return m_section; }
|
||||
DeprecatedString path() const;
|
||||
|
||||
private:
|
||||
void reify_if_needed() const;
|
||||
|
||||
String m_section;
|
||||
String m_full_name;
|
||||
DeprecatedString m_section;
|
||||
DeprecatedString m_full_name;
|
||||
mutable NonnullOwnPtrVector<ManualNode> m_children;
|
||||
mutable bool m_reified { false };
|
||||
bool m_open { false };
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
using namespace Help;
|
||||
|
||||
static String parse_input(StringView input)
|
||||
static DeprecatedString parse_input(StringView input)
|
||||
{
|
||||
AK::URL url(input);
|
||||
if (url.is_valid())
|
||||
|
@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
String start_page;
|
||||
DeprecatedString start_page;
|
||||
u32 section = 0;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include "FindDialog.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Applications/HexEditor/FindDialogGML.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -31,7 +31,7 @@ static constexpr Array<Option, 2> options = {
|
|||
}
|
||||
};
|
||||
|
||||
GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||
GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, DeprecatedString& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||
{
|
||||
auto dialog = FindDialog::construct();
|
||||
|
||||
|
@ -67,13 +67,13 @@ GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out
|
|||
return result;
|
||||
}
|
||||
|
||||
Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId opt)
|
||||
Result<ByteBuffer, DeprecatedString> FindDialog::process_input(DeprecatedString text_value, OptionId opt)
|
||||
{
|
||||
dbgln("process_input opt={}", (int)opt);
|
||||
switch (opt) {
|
||||
case OPTION_ASCII_STRING: {
|
||||
if (text_value.is_empty())
|
||||
return String("Input is empty");
|
||||
return DeprecatedString("Input is empty");
|
||||
|
||||
return text_value.to_byte_buffer();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
|
|||
case OPTION_HEX_VALUE: {
|
||||
auto decoded = decode_hex(text_value.replace(" "sv, ""sv, ReplaceMode::All));
|
||||
if (decoded.is_error())
|
||||
return String::formatted("Input is invalid: {}", decoded.error().string_literal());
|
||||
return DeprecatedString::formatted("Input is invalid: {}", decoded.error().string_literal());
|
||||
|
||||
return decoded.value();
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ class FindDialog : public GUI::Dialog {
|
|||
C_OBJECT(FindDialog);
|
||||
|
||||
public:
|
||||
static ExecResult show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all);
|
||||
static ExecResult show(GUI::Window* parent_window, DeprecatedString& out_tex, ByteBuffer& out_buffer, bool& find_all);
|
||||
|
||||
private:
|
||||
Result<ByteBuffer, String> process_input(String text_value, OptionId opt);
|
||||
Result<ByteBuffer, DeprecatedString> process_input(DeprecatedString text_value, OptionId opt);
|
||||
|
||||
String text_value() const { return m_text_value; }
|
||||
DeprecatedString text_value() const { return m_text_value; }
|
||||
OptionId selected_option() const { return m_selected_option; }
|
||||
bool find_all() const { return m_find_all; }
|
||||
|
||||
|
@ -37,6 +37,6 @@ private:
|
|||
RefPtr<GUI::Button> m_cancel_button;
|
||||
|
||||
bool m_find_all { false };
|
||||
String m_text_value;
|
||||
DeprecatedString m_text_value;
|
||||
OptionId m_selected_option { OPTION_INVALID };
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "GoToOffsetDialog.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <Applications/HexEditor/GoToOffsetDialogGML.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
|
@ -27,7 +27,7 @@ GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int&
|
|||
dialog->set_icon(parent_window->icon());
|
||||
|
||||
if (history_offset)
|
||||
dialog->m_text_editor->set_text(String::formatted("{}", history_offset));
|
||||
dialog->m_text_editor->set_text(DeprecatedString::formatted("{}", history_offset));
|
||||
|
||||
auto result = dialog->exec();
|
||||
|
||||
|
@ -50,9 +50,9 @@ int GoToOffsetDialog::process_input()
|
|||
int offset;
|
||||
auto type = m_offset_type_box->text().trim_whitespace();
|
||||
if (type == "Decimal") {
|
||||
offset = String::formatted("{}", input_offset).to_int().value_or(0);
|
||||
offset = DeprecatedString::formatted("{}", input_offset).to_int().value_or(0);
|
||||
} else if (type == "Hexadecimal") {
|
||||
offset = strtol(String::formatted("{}", input_offset).characters(), nullptr, 16);
|
||||
offset = strtol(DeprecatedString::formatted("{}", input_offset).characters(), nullptr, 16);
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ int GoToOffsetDialog::calculate_new_offset(int input_offset)
|
|||
void GoToOffsetDialog::update_statusbar()
|
||||
{
|
||||
auto new_offset = calculate_new_offset(process_input());
|
||||
m_statusbar->set_text(0, String::formatted("HEX: {:#08X}", new_offset));
|
||||
m_statusbar->set_text(1, String::formatted("DEC: {}", new_offset));
|
||||
m_statusbar->set_text(0, DeprecatedString::formatted("HEX: {:#08X}", new_offset));
|
||||
m_statusbar->set_text(1, DeprecatedString::formatted("DEC: {}", new_offset));
|
||||
}
|
||||
|
||||
GoToOffsetDialog::GoToOffsetDialog()
|
||||
|
@ -108,14 +108,14 @@ GoToOffsetDialog::GoToOffsetDialog()
|
|||
|
||||
m_offset_type.append("Decimal");
|
||||
m_offset_type.append("Hexadecimal");
|
||||
m_offset_type_box->set_model(GUI::ItemListModel<String>::create(m_offset_type));
|
||||
m_offset_type_box->set_model(GUI::ItemListModel<DeprecatedString>::create(m_offset_type));
|
||||
m_offset_type_box->set_selected_index(0);
|
||||
m_offset_type_box->set_only_allow_values_from_model(true);
|
||||
|
||||
m_offset_from.append("Start");
|
||||
m_offset_from.append("Here");
|
||||
m_offset_from.append("End");
|
||||
m_offset_from_box->set_model(GUI::ItemListModel<String>::create(m_offset_from));
|
||||
m_offset_from_box->set_model(GUI::ItemListModel<DeprecatedString>::create(m_offset_from));
|
||||
m_offset_from_box->set_selected_index(0);
|
||||
m_offset_from_box->set_only_allow_values_from_model(true);
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ private:
|
|||
int calculate_new_offset(int offset);
|
||||
int m_selection_offset { 0 };
|
||||
int m_buffer_size { 0 };
|
||||
Vector<String> m_offset_type;
|
||||
Vector<String> m_offset_from;
|
||||
Vector<DeprecatedString> m_offset_type;
|
||||
Vector<DeprecatedString> m_offset_from;
|
||||
|
||||
RefPtr<GUI::TextEditor> m_text_editor;
|
||||
RefPtr<GUI::Button> m_go_button;
|
||||
|
|
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