summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2023-04-16 16:02:07 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-18 10:05:21 +0200
commit02a9e5d3f681bbf3c6157d368e95ad3183b200be (patch)
treee8c1d278cd1863fbeff9900500a040370140b728 /Userland/DevTools
parent9c2bcffe83ae92c8c710e7ed34dd4ee82710a76a (diff)
downloadserenity-02a9e5d3f681bbf3c6157d368e95ad3183b200be.zip
LibGUI+Userland: Improve error and font handling for InputBox
Adds fallible factories, ports DeprecatedString, and rebuilds the layout to accomodate system font changes.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp2
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
index 7c615635d0..c4ff1ebe16 100644
--- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
@@ -121,7 +121,7 @@ RefPtr<GUI::Menu> DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode
auto* variable = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data());
if (does_variable_support_writing(variable)) {
context_menu->add_action(GUI::Action::create("Change value", [&](auto&) {
- DeprecatedString value;
+ String value;
if (GUI::InputBox::show(window(), value, "Enter new value:"sv, "Set variable value"sv) == GUI::InputBox::ExecResult::OK) {
auto& model = static_cast<VariablesModel&>(*m_variables_view->model());
model.set_variable_value(index, value, window());
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index a46350dbe4..6d6cceaa25 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -522,12 +522,12 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(Dep
{
auto icon_no_shadow = TRY(Gfx::Bitmap::load_from_file(icon));
return GUI::Action::create(label, icon_no_shadow, [this, extension](const GUI::Action&) {
- DeprecatedString filename;
+ String filename;
if (GUI::InputBox::show(window(), filename, "Enter name of new file:"sv, "Add new file to project"sv) != GUI::InputBox::ExecResult::OK)
return;
- if (!extension.is_empty() && !filename.ends_with(DeprecatedString::formatted(".{}", extension))) {
- filename = DeprecatedString::formatted("{}.{}", filename, extension);
+ if (!extension.is_empty() && !AK::StringUtils::ends_with(filename, DeprecatedString::formatted(".{}", extension), CaseSensitivity::CaseSensitive)) {
+ filename = String::formatted("{}.{}", filename, extension).release_value_but_fixme_should_propagate_errors();
}
auto path_to_selected = selected_file_paths();
@@ -564,7 +564,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio
{
auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv));
return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, icon, [this](const GUI::Action&) {
- DeprecatedString directory_name;
+ String directory_name;
if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:"sv, "Add new folder to project"sv) != GUI::InputBox::ExecResult::OK)
return;
@@ -580,7 +580,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio
else
dir_path = selected.dirname();
- directory_name = DeprecatedString::formatted("{}/{}", dir_path, directory_name);
+ directory_name = String::formatted("{}/{}", dir_path, directory_name).release_value_but_fixme_should_propagate_errors();
}
auto formatted_dir_name = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_project->model().root_path(), directory_name));