mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27: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
|
@ -32,7 +32,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
|
|||
auto line = m_message_editor->cursor().line() + 1;
|
||||
auto col = m_message_editor->cursor().column();
|
||||
|
||||
m_line_and_col_label->set_text(String::formatted("Line: {}, Col: {}", line, col));
|
||||
m_line_and_col_label->set_text(DeprecatedString::formatted("Line: {}, Col: {}", line, col));
|
||||
};
|
||||
|
||||
m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace HackStudio {
|
||||
|
||||
using OnCommitCallback = Function<void(String const& message)>;
|
||||
using OnCommitCallback = Function<void(DeprecatedString const& message)>;
|
||||
|
||||
class GitCommitDialog final : public GUI::Dialog {
|
||||
C_OBJECT(GitCommitDialog);
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <DevTools/HackStudio/Dialogs/NewProjectDialogGML.h>
|
||||
#include <DevTools/HackStudio/ProjectTemplate.h>
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -89,7 +89,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
|
|||
|
||||
m_browse_button = *find_descendant_of_type_named<GUI::Button>("browse_button");
|
||||
m_browse_button->on_click = [this](auto) {
|
||||
Optional<String> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), true);
|
||||
Optional<DeprecatedString> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), true);
|
||||
if (path.has_value())
|
||||
m_create_in_input->set_text(path.value().view());
|
||||
};
|
||||
|
@ -131,7 +131,7 @@ void NewProjectDialog::update_dialog()
|
|||
m_ok_button->set_enabled(m_input_valid);
|
||||
}
|
||||
|
||||
Optional<String> NewProjectDialog::get_available_project_name()
|
||||
Optional<DeprecatedString> NewProjectDialog::get_available_project_name()
|
||||
{
|
||||
auto create_in = m_create_in_input->text();
|
||||
auto chosen_name = m_name_input->text();
|
||||
|
@ -148,16 +148,16 @@ Optional<String> NewProjectDialog::get_available_project_name()
|
|||
for (int i = 0; i < 1000; i++) {
|
||||
auto candidate = (i == 0)
|
||||
? chosen_name
|
||||
: String::formatted("{}-{}", chosen_name, i);
|
||||
: DeprecatedString::formatted("{}-{}", chosen_name, i);
|
||||
|
||||
if (!Core::File::exists(String::formatted("{}/{}", create_in, candidate)))
|
||||
if (!Core::File::exists(DeprecatedString::formatted("{}/{}", create_in, candidate)))
|
||||
return candidate;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<String> NewProjectDialog::get_project_full_path()
|
||||
Optional<DeprecatedString> NewProjectDialog::get_project_full_path()
|
||||
{
|
||||
// Do not permit forward-slashes in project names
|
||||
if (m_name_input->text().contains('/'))
|
||||
|
@ -189,13 +189,13 @@ void NewProjectDialog::do_create_project()
|
|||
|
||||
auto create_in = m_create_in_input->text();
|
||||
if (!Core::File::exists(create_in) || !Core::File::is_directory(create_in)) {
|
||||
auto result = GUI::MessageBox::show(this, String::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = GUI::MessageBox::show(this, DeprecatedString::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
if (result != GUI::MessageBox::ExecResult::Yes)
|
||||
return;
|
||||
|
||||
auto created = Core::Directory::create(maybe_project_full_path.value(), Core::Directory::CreateDirectories::Yes);
|
||||
if (created.is_error()) {
|
||||
GUI::MessageBox::show_error(this, String::formatted("Could not create directory {}", create_in));
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Could not create directory {}", create_in));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ void NewProjectDialog::do_create_project()
|
|||
m_created_project_path = maybe_project_full_path.value();
|
||||
done(ExecResult::OK);
|
||||
} else {
|
||||
GUI::MessageBox::show_error(this, String::formatted("Could not create project: {}", creation_result.error()));
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Could not create project: {}", creation_result.error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,15 +24,15 @@ class NewProjectDialog : public GUI::Dialog {
|
|||
public:
|
||||
static ExecResult show(GUI::Window* parent_window);
|
||||
|
||||
Optional<String> created_project_path() const { return m_created_project_path; }
|
||||
Optional<DeprecatedString> created_project_path() const { return m_created_project_path; }
|
||||
|
||||
private:
|
||||
NewProjectDialog(GUI::Window* parent);
|
||||
virtual ~NewProjectDialog() override = default;
|
||||
|
||||
void update_dialog();
|
||||
Optional<String> get_available_project_name();
|
||||
Optional<String> get_project_full_path();
|
||||
Optional<DeprecatedString> get_available_project_name();
|
||||
Optional<DeprecatedString> get_project_full_path();
|
||||
|
||||
void do_create_project();
|
||||
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
RefPtr<GUI::Button> m_cancel_button;
|
||||
RefPtr<GUI::Button> m_browse_button;
|
||||
|
||||
Optional<String> m_created_project_path;
|
||||
Optional<DeprecatedString> m_created_project_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ int ProjectTemplatesModel::column_count(const GUI::ModelIndex&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String ProjectTemplatesModel::column_name(int column) const
|
||||
DeprecatedString ProjectTemplatesModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Icon:
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
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;
|
||||
|
||||
void update();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue