diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-05-13 13:10:27 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-13 16:27:43 +0200 |
commit | cdffe556c8fcca034b10cf91f0b05c17d835bc7b (patch) | |
tree | 189cbd59652eee1b2783a8323a7194100c78fd07 /Userland/DevTools/HackStudio | |
parent | 1f82beded3ae3664265f1ddf6075f64ca5a08cde (diff) | |
download | serenity-cdffe556c8fcca034b10cf91f0b05c17d835bc7b.zip |
LibGUI+Userland: Make Dialog::ExecResult an enum class
Diffstat (limited to 'Userland/DevTools/HackStudio')
6 files changed, 16 insertions, 16 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index a6e1c7aab0..e1c59113ff 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -106,7 +106,7 @@ RefPtr<GUI::Menu> DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode if (does_variable_support_writing(variable)) { context_menu->add_action(GUI::Action::create("Change value", [&](auto&) { String value; - if (GUI::InputBox::show(window(), value, "Enter new value:", "Set variable value") == GUI::InputBox::ExecOK) { + if (GUI::InputBox::show(window(), value, "Enter new value:", "Set variable value") == 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/Dialogs/Git/GitCommitDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp index 4423440952..04905caea8 100644 --- a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp @@ -39,11 +39,11 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent) m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit); m_commit_button->on_click = [this](auto) { on_commit(m_message_editor->text()); - done(ExecResult::ExecOK); + done(ExecResult::OK); }; m_cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index d2664248a0..e349204e01 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -28,7 +28,7 @@ namespace HackStudio { static Regex<PosixExtended> const s_project_name_validity_regex("^([A-Za-z0-9_-])*$"); -int NewProjectDialog::show(GUI::Window* parent_window) +GUI::Dialog::ExecResult NewProjectDialog::show(GUI::Window* parent_window) { auto dialog = NewProjectDialog::construct(parent_window); @@ -92,7 +92,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent) m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); m_cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; m_browse_button = *find_descendant_of_type_named<GUI::Button>("browse_button"); @@ -198,7 +198,7 @@ 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", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - if (result != GUI::MessageBox::ExecResult::ExecYes) + if (result != GUI::MessageBox::ExecResult::Yes) return; auto created = Core::Directory::create(maybe_project_full_path.value(), Core::Directory::CreateDirectories::Yes); @@ -212,7 +212,7 @@ void NewProjectDialog::do_create_project() if (!creation_result.is_error()) { // Successfully created, attempt to open the new project m_created_project_path = maybe_project_full_path.value(); - done(ExecResult::ExecOK); + done(ExecResult::OK); } else { GUI::MessageBox::show_error(this, String::formatted("Could not create project: {}", creation_result.error())); } diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h index 1503e36186..1158ce0737 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h @@ -22,7 +22,7 @@ class NewProjectDialog : public GUI::Dialog { C_OBJECT(NewProjectDialog); public: - static int show(GUI::Window* parent_window); + static ExecResult show(GUI::Window* parent_window); Optional<String> created_project_path() const { return m_created_project_path; } diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp index a6e6e0465a..3723bcbf20 100644 --- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp +++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp @@ -86,7 +86,7 @@ bool GitWidget::initialize() return false; case GitRepo::CreateResult::Type::NoGitRepo: { auto decision = GUI::MessageBox::show(window(), "Create git repository?", "Git", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - if (decision != GUI::Dialog::ExecResult::ExecYes) + if (decision != GUI::Dialog::ExecResult::Yes) return false; m_git_repo = GitRepo::initialize_repository(m_repo_root); return true; diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 7a3741aebb..c1dfe48626 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -502,7 +502,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action(String const { return GUI::Action::create(label, Gfx::Bitmap::try_load_from_file(icon).release_value_but_fixme_should_propagate_errors(), [this, extension](const GUI::Action&) { String filename; - if (GUI::InputBox::show(window(), filename, "Enter name of new file:", "Add new file to project") != GUI::InputBox::ExecOK) + if (GUI::InputBox::show(window(), filename, "Enter name of new file:", "Add new file to project") != GUI::InputBox::ExecResult::OK) return; if (!extension.is_empty() && !filename.ends_with(String::formatted(".{}", extension))) { @@ -543,7 +543,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_directory_action() { return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { String directory_name; - if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:", "Add new folder to project") != GUI::InputBox::ExecOK) + if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:", "Add new folder to project") != GUI::InputBox::ExecResult::OK) return; auto path_to_selected = selected_file_paths(); @@ -615,7 +615,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action() "Confirm deletion", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); - if (result == GUI::MessageBox::ExecCancel) + if (result == GUI::MessageBox::ExecResult::Cancel) return; for (auto& file : files) { @@ -657,7 +657,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_project_action() dialog->set_icon(window()->icon()); auto result = dialog->exec(); - if (result == GUI::Dialog::ExecResult::ExecOK && dialog->created_project_path().has_value()) + if (result == GUI::Dialog::ExecResult::OK && dialog->created_project_path().has_value()) open_project(dialog->created_project_path().value()); }); } @@ -1436,7 +1436,7 @@ void HackStudioWidget::create_view_menu(GUI::Window& window) m_editor_font_action = GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto picker = GUI::FontPicker::construct(&window, m_editor_font, false); - if (picker->exec() == GUI::Dialog::ExecOK) { + if (picker->exec() == GUI::Dialog::ExecResult::OK) { change_editor_font(picker->font()); } }); @@ -1550,10 +1550,10 @@ HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(String auto result = GUI::MessageBox::show(window(), prompt, "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel); - if (result == GUI::MessageBox::ExecCancel) + if (result == GUI::MessageBox::ExecResult::Cancel) return ContinueDecision::No; - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { for (auto& editor_wrapper : m_all_editor_wrappers) { if (editor_wrapper.editor().document().is_modified()) { editor_wrapper.save(); |