diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 15bd03cd28d..c7567255205 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -35,7 +35,7 @@ public: editor->set_title("Edit Bookmark"); editor->set_icon(g_icon_bag.bookmark_filled); - if (editor->exec() == Dialog::ExecOK) { + if (editor->exec() == ExecResult::OK) { return Vector { editor->title(), editor->url() }; } @@ -58,23 +58,23 @@ private: m_title_textbox->set_focus(true); m_title_textbox->select_all(); m_title_textbox->on_return_pressed = [this] { - done(Dialog::ExecOK); + done(ExecResult::OK); }; m_url_textbox = *widget.find_descendant_of_type_named("url_textbox"); m_url_textbox->set_text(url); m_url_textbox->on_return_pressed = [this] { - done(Dialog::ExecOK); + done(ExecResult::OK); }; auto& ok_button = *widget.find_descendant_of_type_named("ok_button"); ok_button.on_click = [this](auto) { - done(Dialog::ExecOK); + done(ExecResult::OK); }; auto& cancel_button = *widget.find_descendant_of_type_named("cancel_button"); cancel_button.on_click = [this](auto) { - done(Dialog::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 5ec448c3a52..47806aea860 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -247,7 +247,7 @@ void BrowserWindow::build_menus() m_change_homepage_action = GUI::Action::create( "Set Homepage URL...", g_icon_bag.go_home, [this](auto&) { auto homepage_url = Config::read_string("Browser", "Preferences", "Home", "about:blank"); - if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecOK) { + if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecResult::OK) { if (URL(homepage_url).is_valid()) { Config::write_string("Browser", "Preferences", "Home", homepage_url); Browser::g_home_url = homepage_url; @@ -373,7 +373,7 @@ void BrowserWindow::build_menus() auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) { String user_agent; - if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecOK || user_agent.is_empty() || user_agent.is_null()) { + if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) { m_disable_user_agent_spoofing->activate(); return; } @@ -455,7 +455,7 @@ ErrorOr BrowserWindow::load_search_engines(GUI::Menu& settings_menu) auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) { String search_engine; - if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecOK || search_engine.is_empty()) { + if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) { m_disable_search_engine_action->activate(); return; } diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp index c277da6e11a..89059ad28cd 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp @@ -119,7 +119,7 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget() m_add_new_domain_button->on_click = [&](unsigned) { String text; - if (GUI::InputBox::show(window(), text, "Enter domain name", "Add domain to Content Filter") == GUI::Dialog::ExecOK) { + if (GUI::InputBox::show(window(), text, "Enter domain name", "Add domain to Content Filter") == GUI::Dialog::ExecResult::OK) { m_domain_list_model->add_domain(std::move(text)); set_modified(true); } diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 904f4f22544..6c092cc3e07 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -76,7 +76,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) ok_button.set_fixed_size(80, 20); ok_button.on_click = [this](auto) { dbgln("TODO: Add event icon on specific tile"); - done(Dialog::ExecOK); + done(ExecResult::OK); }; event_title_textbox.set_focus(true); diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index 6563b2e2d8a..da03b59645f 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -39,7 +39,7 @@ CharacterMapWidget::CharacterMapWidget() m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) { auto font_picker = GUI::FontPicker::construct(window(), &font(), false); - if (font_picker->exec() == GUI::Dialog::ExecOK) { + if (font_picker->exec() == GUI::Dialog::ExecResult::OK) { auto& font = *font_picker->font(); Config::write_string("CharacterMap", "History", "Font", font.qualified_name()); set_font(font); @@ -70,7 +70,7 @@ CharacterMapWidget::CharacterMapWidget() 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").release_value_but_fixme_should_propagate_errors(), [&](auto&) { String input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecOK && !input.is_empty()) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == 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()) return; diff --git a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp index 00016ecb5c1..7a683a4dce7 100644 --- a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp @@ -28,7 +28,7 @@ FontSettingsWidget::FontSettingsWidget() auto& default_font_button = *find_descendant_of_type_named("default_font_button"); default_font_button.on_click = [this](auto) { auto font_picker = GUI::FontPicker::construct(window(), &m_default_font_label->font(), false); - if (font_picker->exec() == GUI::Dialog::ExecOK) { + if (font_picker->exec() == GUI::Dialog::ExecResult::OK) { update_label_with_font(*m_default_font_label, *font_picker->font()); set_modified(true); } @@ -41,7 +41,7 @@ FontSettingsWidget::FontSettingsWidget() auto& fixed_width_font_button = *find_descendant_of_type_named("fixed_width_font_button"); fixed_width_font_button.on_click = [this](auto) { auto font_picker = GUI::FontPicker::construct(window(), &m_fixed_width_font_label->font(), true); - if (font_picker->exec() == GUI::Dialog::ExecOK) { + if (font_picker->exec() == GUI::Dialog::ExecResult::OK) { update_label_with_font(*m_fixed_width_font_label, *font_picker->font()); set_modified(true); } diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp index ac0d5950f61..d5049e4084e 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp @@ -254,7 +254,7 @@ void MonitorSettingsWidget::apply_settings() revert_timer->start(); // If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes. - if (box->exec() == GUI::MessageBox::ExecYes) { + 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()), diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index e4f3d4c7dce..1c4427a33ab 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -542,7 +542,7 @@ 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").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; - if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecOK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { @@ -554,7 +554,7 @@ void DirectoryView::setup_actions() 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").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { String value; - if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecOK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); struct stat st; int rc = stat(new_file_path.characters(), &st); diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp index ef6aa1043fa..fdcc66b7dc8 100644 --- a/Userland/Applications/FileManager/FileUtils.cpp +++ b/Userland/Applications/FileManager/FileUtils.cpp @@ -32,7 +32,7 @@ void delete_paths(Vector const& paths, bool should_confirm, GUI::Window* "Confirm deletion", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); - if (result == GUI::MessageBox::ExecCancel) + if (result == GUI::MessageBox::ExecResult::Cancel) return; } diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 00e649e1960..a9c0b52378a 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -194,7 +194,7 @@ void do_create_link(Vector const& selected_file_paths, GUI::Window* wind void do_create_archive(Vector const& selected_file_paths, GUI::Window* window) { String archive_name; - if (GUI::InputBox::show(window, archive_name, "Enter name:", "Create Archive") != GUI::InputBox::ExecOK) + if (GUI::InputBox::show(window, archive_name, "Enter name:", "Create Archive") != GUI::InputBox::ExecResult::OK) return; auto output_directory_path = LexicalPath(selected_file_paths.first()); diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index 4aa7ecd4e74..5ae381154ec 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -146,7 +146,7 @@ FontEditorWidget::FontEditorWidget() if (!request_close()) return; auto new_font_wizard = NewFontDialog::construct(window()); - if (new_font_wizard->exec() == GUI::Dialog::ExecOK) { + if (new_font_wizard->exec() == GUI::Dialog::ExecResult::OK) { auto metadata = new_font_wizard->new_font_metadata(); auto new_font = Gfx::BitmapFont::create(metadata.glyph_height, metadata.glyph_width, metadata.is_fixed_width, 0x110000); new_font->set_name(metadata.name); @@ -241,7 +241,7 @@ FontEditorWidget::FontEditorWidget() 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").release_value_but_fixme_should_propagate_errors(), [&](auto&) { String input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecOK && !input.is_empty()) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == 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()) return; @@ -782,12 +782,12 @@ bool FontEditorWidget::request_close() if (!window()->is_modified()) return true; auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, m_undo_stack->last_unmodified_timestamp()); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { m_save_action->activate(); if (!window()->is_modified()) return true; } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return true; return false; } diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index fd4728dbd74..0925e993270 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -31,7 +31,7 @@ static constexpr Array options = { } }; -int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all) +GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all) { auto dialog = FindDialog::construct(); @@ -46,7 +46,7 @@ int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& o auto result = dialog->exec(); - if (result != GUI::Dialog::ExecOK) + if (result != ExecResult::OK) return result; auto selected_option = dialog->selected_option(); @@ -56,7 +56,7 @@ int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& o if (processed.is_error()) { GUI::MessageBox::show_error(parent_window, processed.error()); - result = GUI::Dialog::ExecAborted; + result = ExecResult::Aborted; } else { out_buffer = move(processed.value()); } @@ -138,7 +138,7 @@ FindDialog::FindDialog() auto text = m_text_editor->text(); if (!text.is_empty()) { m_text_value = text; - done(ExecResult::ExecOK); + done(ExecResult::OK); } }; @@ -148,6 +148,6 @@ FindDialog::FindDialog() }; m_cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/Applications/HexEditor/FindDialog.h b/Userland/Applications/HexEditor/FindDialog.h index 89063c5360f..73d41a3b8fa 100644 --- a/Userland/Applications/HexEditor/FindDialog.h +++ b/Userland/Applications/HexEditor/FindDialog.h @@ -19,7 +19,7 @@ class FindDialog : public GUI::Dialog { C_OBJECT(FindDialog); public: - static int show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all); + static ExecResult show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all); private: Result process_input(String text_value, OptionId opt); diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp index 99b2aedff28..5af68549c03 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp @@ -17,7 +17,7 @@ #include #include -int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int buffer_size) +GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int buffer_size) { auto dialog = GoToOffsetDialog::construct(); dialog->m_selection_offset = selection_offset; @@ -31,7 +31,7 @@ int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& auto result = dialog->exec(); - if (result != GUI::Dialog::ExecOK) + if (result != ExecResult::OK) return result; auto input_offset = dialog->process_input(); @@ -41,7 +41,7 @@ int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& dbgln("Go to offset: value={}", new_offset); out_offset = move(new_offset); - return GUI::Dialog::ExecOK; + return ExecResult::OK; } int GoToOffsetDialog::process_input() @@ -124,7 +124,7 @@ GoToOffsetDialog::GoToOffsetDialog() }; m_go_button->on_click = [this](auto) { - done(ExecResult::ExecOK); + done(ExecResult::OK); }; m_text_editor->on_change = [this]() { diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.h b/Userland/Applications/HexEditor/GoToOffsetDialog.h index fc118b28f41..0312bc58a70 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.h +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.h @@ -14,7 +14,7 @@ class GoToOffsetDialog : public GUI::Dialog { C_OBJECT(GoToOffsetDialog); public: - static int show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int end); + static ExecResult show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int end); private: GoToOffsetDialog(); diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 1c9fbb9adcd..72077951f66 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -94,7 +94,7 @@ HexEditorWidget::HexEditorWidget() m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { String value; - if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecOK && !value.is_empty()) { + if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto file_size = value.to_int(); if (file_size.has_value() && file_size.value() > 0) { window()->set_modified(false); @@ -151,7 +151,7 @@ HexEditorWidget::HexEditorWidget() m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) { auto old_buffer = m_search_buffer; bool find_all = false; - if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecOK) { + if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecResult::OK) { if (find_all) { auto matches = m_editor->find_all(m_search_buffer, 0); m_search_results->set_model(*new SearchResultsModel(move(matches))); @@ -193,7 +193,7 @@ HexEditorWidget::HexEditorWidget() new_offset, m_editor->selection_start_offset(), m_editor->buffer_size()); - if (result == GUI::InputBox::ExecOK) { + if (result == GUI::InputBox::ExecResult::OK) { m_editor->highlight(new_offset, new_offset); m_editor->update(); } @@ -225,7 +225,7 @@ HexEditorWidget::HexEditorWidget() m_fill_selection_action = GUI::Action::create("Fill &Selection...", { Mod_Ctrl, Key_B }, [&](const GUI::Action&) { String value; - if (GUI::InputBox::show(window(), value, "Fill byte (hex):", "Fill Selection") == GUI::InputBox::ExecOK && !value.is_empty()) { + if (GUI::InputBox::show(window(), value, "Fill byte (hex):", "Fill Selection") == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto fill_byte = strtol(value.characters(), nullptr, 16); m_editor->fill_selection(fill_byte); } @@ -508,11 +508,11 @@ bool HexEditorWidget::request_close() return true; auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { m_save_action->activate(); return !window()->is_modified(); } - return result == GUI::MessageBox::ExecNo; + return result == GUI::MessageBox::ExecResult::No; } void HexEditorWidget::set_search_results_visible(bool visible) diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 6a5bcf99aa3..43b303b2972 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -128,7 +128,7 @@ ErrorOr serenity_main(Main::Arguments arguments) GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); - if (msgbox_result == GUI::MessageBox::ExecCancel) + if (msgbox_result == GUI::MessageBox::ExecResult::Cancel) return; auto unlinked_or_error = Core::System::unlink(widget->path()); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 62598ff9c7b..7b17e604e8a 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -26,7 +26,7 @@ bool KeyboardMapperWidget::request_close() if (!window()->is_modified()) return true; auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_filename); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { ErrorOr error_or = save(); if (error_or.is_error()) show_error_to_user(error_or.error()); @@ -34,7 +34,7 @@ bool KeyboardMapperWidget::request_close() if (!window()->is_modified()) return true; } - return result == GUI::MessageBox::ExecNo; + return result == GUI::MessageBox::ExecResult::No; } void KeyboardMapperWidget::create_frame() @@ -58,7 +58,7 @@ void KeyboardMapperWidget::create_frame() tmp_button.on_click = [this, &tmp_button]() { String value; - if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecOK) { + if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecResult::OK) { int i = m_keys.find_first_index(&tmp_button).value_or(0); VERIFY(i > 0); diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 6a66500d862..27bccb2b6f3 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -37,7 +37,7 @@ public: auto dialog = KeymapSelectionDialog::construct(parent_window, selected_keymaps); dialog->set_title("Add a keymap"); - if (dialog->exec() == GUI::Dialog::ExecOK) { + if (dialog->exec() == ExecResult::OK) { return dialog->selected_keymap(); } @@ -87,12 +87,12 @@ private: auto& ok_button = *widget.find_descendant_of_type_named("ok_button"); ok_button.on_click = [this](auto) { - done(Dialog::ExecOK); + done(ExecResult::OK); }; auto& cancel_button = *widget.find_descendant_of_type_named("cancel_button"); cancel_button.on_click = [this](auto) { - done(Dialog::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 50fe6aad45d..865a1f6497c 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -101,8 +101,8 @@ bool MailWidget::connect_and_login() auto server = Config::read_string("Mail", "Connection", "Server", {}); if (server.is_empty()) { - int result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); - if (result == GUI::MessageBox::ExecResult::ExecYes) + auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); + if (result == GUI::MessageBox::ExecResult::Yes) Desktop::Launcher::open(URL::create_with_file_protocol("/bin/MailSettings"), "/bin/MailSettings"); return false; } @@ -119,7 +119,7 @@ bool MailWidget::connect_and_login() auto password = Config::read_string("Mail", "User", "Password", {}); while (password.is_empty()) { - if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecOK) + if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecResult::OK) return false; } diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index 85b77d4c841..42bb5a3bd22 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -49,12 +49,12 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) auto& ok_button = button_container.add("OK"); ok_button.on_click = [this](auto) { - done(ExecOK); + done(ExecResult::OK); }; auto& cancel_button = button_container.add("Cancel"); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; width_spinbox.on_change = [this](int value) { @@ -66,7 +66,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) }; m_name_textbox->on_return_pressed = [this] { - done(ExecOK); + done(ExecResult::OK); }; width_spinbox.set_range(1, 16384); diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index 14e76964e04..4b46a982716 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -51,12 +51,12 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G auto& ok_button = button_container.add("OK"); ok_button.on_click = [this](auto) { - done(ExecOK); + done(ExecResult::OK); }; auto& cancel_button = button_container.add("Cancel"); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; width_spinbox.on_change = [this](int value) { @@ -68,7 +68,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G }; m_name_textbox->on_return_pressed = [this] { - done(ExecOK); + done(ExecResult::OK); }; width_spinbox.set_range(1, 16384); diff --git a/Userland/Applications/PixelPaint/EditGuideDialog.cpp b/Userland/Applications/PixelPaint/EditGuideDialog.cpp index b9c8f799500..a0ea15ded9c 100644 --- a/Userland/Applications/PixelPaint/EditGuideDialog.cpp +++ b/Userland/Applications/PixelPaint/EditGuideDialog.cpp @@ -59,20 +59,20 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offse } else if (m_is_horizontal_checked) { m_orientation = Guide::Orientation::Horizontal; } else { - done(ExecResult::ExecAborted); + done(ExecResult::Aborted); return; } if (m_offset_text_box->text().is_empty()) - done(ExecResult::ExecAborted); + done(ExecResult::Aborted); m_offset = m_offset_text_box->text(); - done(ExecResult::ExecOK); + done(ExecResult::OK); }; cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/Applications/PixelPaint/FilterGallery.cpp b/Userland/Applications/PixelPaint/FilterGallery.cpp index 13757c347ea..2ad6c8b3d9d 100644 --- a/Userland/Applications/PixelPaint/FilterGallery.cpp +++ b/Userland/Applications/PixelPaint/FilterGallery.cpp @@ -69,16 +69,16 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor) apply_button->on_click = [this](auto) { if (!m_selected_filter) { - done(ExecResult::ExecAborted); + done(ExecResult::Aborted); return; } m_selected_filter->apply(); - done(ExecResult::ExecOK); + done(ExecResult::OK); }; cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; } diff --git a/Userland/Applications/PixelPaint/FilterParams.h b/Userland/Applications/PixelPaint/FilterParams.h index 189e11a19b9..4d7a9c63d56 100644 --- a/Userland/Applications/PixelPaint/FilterParams.h +++ b/Userland/Applications/PixelPaint/FilterParams.h @@ -91,7 +91,7 @@ private: m_should_wrap = wrap_checkbox.is_checked(); if (norm_checkbox.is_checked()) normalize(m_matrix); - done(ExecOK); + done(ExecResult::OK); }; } @@ -146,7 +146,7 @@ struct FilterParameters> { { auto input = GenericConvolutionFilterInputDialog::construct(parent_window); input->exec(); - if (input->result() == GUI::Dialog::ExecOK) + if (input->result() == GUI::Dialog::ExecResult::OK) return make::Parameters>(input->matrix(), input->should_wrap()); return {}; diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 490271105cd..a6daa02075f 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -565,12 +565,12 @@ bool ImageEditor::request_close() auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), path(), undo_stack().last_unmodified_timestamp()); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { save_project(); return true; } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return true; return false; diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 004a8813581..18b2c5f5044 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -115,7 +115,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_new_image_action = GUI::Action::create( "&New Image...", { Mod_Ctrl, Key_N }, g_icon_bag.filetype_pixelpaint, [&](auto&) { auto dialog = PixelPaint::CreateNewImageDialog::construct(&window); - if (dialog->exec() == GUI::Dialog::ExecOK) { + if (dialog->exec() == GUI::Dialog::ExecResult::OK) { auto image = PixelPaint::Image::try_create_with_size(dialog->image_size()).release_value_but_fixme_should_propagate_errors(); auto bg_layer = PixelPaint::Layer::try_create_with_size(*image, image->size(), "Background").release_value_but_fixme_should_propagate_errors(); image->add_layer(*bg_layer); @@ -173,7 +173,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) if (response.is_error()) return; auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes); + auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) GUI::MessageBox::show_error(&window, String::formatted("Export to BMP failed: {}", result.error())); })); @@ -188,7 +188,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) if (response.is_error()) return; auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes); + auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) GUI::MessageBox::show_error(&window, String::formatted("Export to PNG failed: {}", result.error())); })); @@ -392,7 +392,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_add_guide_action = GUI::Action::create( "&Add Guide", g_icon_bag.add_guide, [&](auto&) { auto dialog = PixelPaint::EditGuideDialog::construct(&window); - if (dialog->exec() != GUI::Dialog::ExecOK) + if (dialog->exec() != GUI::Dialog::ExecResult::OK) return; auto* editor = current_image_editor(); VERIFY(editor); @@ -517,7 +517,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto* editor = current_image_editor(); VERIFY(editor); auto dialog = PixelPaint::CreateNewLayerDialog::construct(editor->image().size(), &window); - if (dialog->exec() == GUI::Dialog::ExecOK) { + if (dialog->exec() == GUI::Dialog::ExecResult::OK) { auto layer_or_error = PixelPaint::Layer::try_create_with_size(editor->image(), dialog->layer_size(), dialog->layer_name()); if (layer_or_error.is_error()) { GUI::MessageBox::show_error(&window, String::formatted("Unable to create layer with size {}", dialog->size())); @@ -671,7 +671,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto* editor = current_image_editor(); VERIFY(editor); auto dialog = PixelPaint::FilterGallery::construct(&window, editor); - if (dialog->exec() != GUI::Dialog::ExecOK) + if (dialog->exec() != GUI::Dialog::ExecResult::OK) return; })); diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp index 7595c30cafe..bb5a7702df1 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.cpp +++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp @@ -34,7 +34,7 @@ public: { if (event.modifiers() & KeyModifier::Mod_Ctrl) { auto dialog = GUI::ColorPicker::construct(m_color, window()); - if (dialog->exec() == GUI::Dialog::ExecOK) { + if (dialog->exec() == GUI::Dialog::ExecResult::OK) { m_color = dialog->color(); auto pal = palette(); pal.set_color(ColorRole::Background, m_color); @@ -73,7 +73,7 @@ public: return; auto dialog = GUI::ColorPicker::construct(m_color, window()); - if (dialog->exec() == GUI::Dialog::ExecOK) + if (dialog->exec() == GUI::Dialog::ExecResult::OK) on_color_change(dialog->color()); } diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index bbe4efeb700..daa86434c46 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -142,7 +142,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) editor()->window(), String::formatted("{}", m_context_menu_guide->offset()), m_context_menu_guide->orientation()); - if (dialog->exec() != GUI::Dialog::ExecOK) + if (dialog->exec() != GUI::Dialog::ExecResult::OK) return; auto offset = dialog->offset_as_pixel(*editor()); if (!offset.has_value()) diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 04864c2265f..67615db99e9 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -360,7 +360,7 @@ ErrorOr serenity_main(Main::Arguments arguments) "Deletion failed", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo); - if (retry_message_result == GUI::MessageBox::ExecYes) { + if (retry_message_result == GUI::MessageBox::ExecResult::Yes) { try_again = true; } } else { diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 346dc72c06d..a450db47586 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -59,7 +59,7 @@ CellTypeDialog::CellTypeDialog(Vector const& positions, Sheet& sheet, button_layout.add_spacer(); auto& ok_button = buttonbox.add("OK"); ok_button.set_fixed_width(80); - ok_button.on_click = [&](auto) { done(ExecOK); }; + ok_button.on_click = [&](auto) { done(ExecResult::OK); }; } Vector const g_horizontal_alignments { "Left", "Center", "Right" }; diff --git a/Userland/Applications/Spreadsheet/ExportDialog.cpp b/Userland/Applications/Spreadsheet/ExportDialog.cpp index 31dc703b986..61390609043 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ExportDialog.cpp @@ -257,7 +257,7 @@ Result ExportDialog::make_and_run_for(StringView mime, Core::File& wizard->replace_page(page.page()); auto result = wizard->exec(); - if (result == GUI::Dialog::ExecResult::ExecOK) { + if (result == GUI::Dialog::ExecResult::OK) { auto& writer = page.writer(); if (!writer.has_value()) return String { "CSV Export failed" }; @@ -312,7 +312,7 @@ Result ExportDialog::make_and_run_for(StringView mime, Core::File& wizard->push_page(page); - if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK) + if (wizard->exec() != GUI::Dialog::ExecResult::OK) return String { "Export was cancelled" }; if (format_combo_box->selected_index() == 0) diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp index aa6558c9f70..50d74c7089a 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp @@ -187,7 +187,7 @@ Result, String> ImportDialog::make_and_run_for(GUI::W wizard->replace_page(page.page()); auto result = wizard->exec(); - if (result == GUI::Dialog::ExecResult::ExecOK) { + if (result == GUI::Dialog::ExecResult::OK) { auto& reader = page.reader(); NonnullRefPtrVector sheets; @@ -265,7 +265,7 @@ Result, String> ImportDialog::make_and_run_for(GUI::W wizard->push_page(page); - if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK) + if (wizard->exec() != GUI::Dialog::ExecResult::OK) return String { "Import was cancelled" }; if (format_combo_box->selected_index() == 0) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index 105fdf0036e..24620bf4691 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -392,7 +392,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) } auto dialog = CellTypeDialog::construct(positions, *m_sheet, window()); - if (dialog->exec() == GUI::Dialog::ExecOK) { + if (dialog->exec() == GUI::Dialog::ExecResult::OK) { for (auto& position : positions) { auto& cell = m_sheet->ensure(position); cell.set_type(dialog->type()); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index d67897ef0d8..c3fa95fbff6 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -99,7 +99,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe VERIFY(sheet_ptr); // How did we get here without a sheet? auto& sheet = *sheet_ptr; String new_name; - if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecOK) { + if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecResult::OK) { sheet.set_name(new_name); sheet.update(); m_tab_widget->set_tab_title(static_cast(*m_tab_context_menu_sheet_view), new_name); @@ -108,7 +108,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_tab_context_menu->add_action(*m_rename_action); m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { String name; - if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecOK) { + if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecResult::OK) { NonnullRefPtrVector new_sheets; new_sheets.append(m_workbook->add_sheet(name)); setup_tabs(move(new_sheets)); @@ -456,12 +456,12 @@ bool SpreadsheetWidget::request_close() return true; auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), current_filename()); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { m_save_action->activate(); return !m_workbook->dirty(); } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return true; return false; diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index c7d64d6f07d..43fd12ebd58 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -442,7 +442,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (pid == -1) return; auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - if (rc == GUI::Dialog::ExecYes) + if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGKILL); }, &process_table_view); @@ -453,7 +453,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (pid == -1) return; auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - if (rc == GUI::Dialog::ExecYes) + if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGSTOP); }, &process_table_view); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index e9d5635129e..e133f3c00c5 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -357,9 +357,9 @@ ErrorOr serenity_main(Main::Arguments arguments) return background_process_count; }; - auto check_terminal_quit = [&]() -> int { + auto check_terminal_quit = [&]() -> GUI::Dialog::ExecResult { if (!should_confirm_close) - return GUI::MessageBox::ExecOK; + return GUI::MessageBox::ExecResult::OK; Optional close_message; if (tty_has_foreground_process()) { close_message = "There is still a process running in this terminal. Closing the terminal will kill it."; @@ -372,12 +372,12 @@ ErrorOr serenity_main(Main::Arguments arguments) } if (close_message.has_value()) return GUI::MessageBox::show(window, *close_message, "Close this terminal?", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); - return GUI::MessageBox::ExecOK; + return GUI::MessageBox::ExecResult::OK; }; TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { dbgln("Terminal: Quit menu activated!"); - if (check_terminal_quit() == GUI::MessageBox::ExecOK) + if (check_terminal_quit() == GUI::MessageBox::ExecResult::OK) GUI::Application::the()->quit(); }))); @@ -408,7 +408,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }; window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision { - if (check_terminal_quit() == GUI::MessageBox::ExecOK) + if (check_terminal_quit() == GUI::MessageBox::ExecResult::OK) return GUI::Window::CloseRequestDecision::Close; return GUI::Window::CloseRequestDecision::StayOpen; }; diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp index f95cd3ca007..f72c445b1f7 100644 --- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp +++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp @@ -150,7 +150,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() font_text.set_font(m_font); font_button.on_click = [&](auto) { auto picker = GUI::FontPicker::construct(window(), m_font.ptr(), true); - if (picker->exec() == GUI::Dialog::ExecOK) { + if (picker->exec() == GUI::Dialog::ExecResult::OK) { m_font = picker->font(); font_text.set_text(m_font->human_readable_name()); font_text.set_font(m_font); diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 12bff03f616..fd924d8e882 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -239,9 +239,9 @@ MainWidget::MainWidget() m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) { if (editor().document().is_modified()) { auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp()); - if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes) + if (save_document_first_result == GUI::Dialog::ExecResult::Yes) m_save_action->activate(); - if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified()) + if (save_document_first_result != GUI::Dialog::ExecResult::No && editor().document().is_modified()) return; } @@ -253,9 +253,9 @@ MainWidget::MainWidget() m_open_action = GUI::CommonActions::make_open_action([this](auto&) { if (editor().document().is_modified()) { auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp()); - if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes) + if (save_document_first_result == GUI::Dialog::ExecResult::Yes) m_save_action->activate(); - if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified()) + if (save_document_first_result != GUI::Dialog::ExecResult::No && editor().document().is_modified()) return; } @@ -423,7 +423,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) view_menu.add_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) { dbgln("setting font {}", picker->font()->qualified_name()); m_editor->set_font(picker->font()); } @@ -719,14 +719,14 @@ bool MainWidget::request_close() return true; auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp()); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { m_save_action->activate(); if (editor().document().is_modified()) return false; return true; } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return true; return false; diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 537f5f56e13..d020a43c73f 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -432,14 +432,14 @@ ErrorOr serenity_main(Main::Arguments arguments) return GUI::Window::CloseRequestDecision::Close; auto result = GUI::MessageBox::ask_about_unsaved_changes(window, path.value_or(""), last_modified_time); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { save_action->activate(); if (window->is_modified()) return GUI::Window::CloseRequestDecision::StayOpen; return GUI::Window::CloseRequestDecision::Close; } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return GUI::Window::CloseRequestDecision::Close; return GUI::Window::CloseRequestDecision::StayOpen; diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp index 69350adbee8..0fc9aa0ded3 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp +++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp @@ -98,7 +98,7 @@ GalleryWidget::GalleryWidget() m_font_button->on_click = [&](auto) { auto picker = GUI::FontPicker::try_create(window(), &m_text_editor->font(), false).release_value_but_fixme_should_propagate_errors(); - if (picker->exec() == GUI::Dialog::ExecOK) { + if (picker->exec() == GUI::Dialog::ExecResult::OK) { m_text_editor->set_font(picker->font()); } }; @@ -118,7 +118,7 @@ GalleryWidget::GalleryWidget() m_input_button->on_click = [&](auto) { String value; - if (GUI::InputBox::show(window(), value, "Enter input:", "Input") == GUI::InputBox::ExecOK && !value.is_empty()) + if (GUI::InputBox::show(window(), value, "Enter input:", "Input") == GUI::InputBox::ExecResult::OK && !value.is_empty()) m_text_editor->set_text(value); }; @@ -277,11 +277,11 @@ GalleryWidget::GalleryWidget() m_wizard_output->set_text(sb.to_string()); auto wizard = DemoWizardDialog::try_create(window()).release_value_but_fixme_should_propagate_errors(); - int result = wizard->exec(); + auto result = wizard->exec(); - sb.append(String::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", result)); - if (result == GUI::Dialog::ExecResult::ExecOK) - sb.append(String::formatted(" (ExecOK)\n'Installation' location: \"{}\"", wizard->page_1_location())); + sb.append(String::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result))); + if (result == GUI::Dialog::ExecResult::OK) + sb.append(String::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location())); m_wizard_output->set_text(sb.string_view()); }; diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index a6e1c7aab0f..e1c59113ff5 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -106,7 +106,7 @@ RefPtr 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(*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 44234409523..04905caea89 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 d2664248a00..e349204e015 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -28,7 +28,7 @@ namespace HackStudio { static Regex 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("cancel_button"); m_cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; m_browse_button = *find_descendant_of_type_named("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 1503e36186c..1158ce0737e 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 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 a6e6e0465a2..3723bcbf202 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 7a3741aebb8..c1dfe48626b 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -502,7 +502,7 @@ NonnullRefPtr 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 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 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 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(); diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index ac32571ac7b..512cb7bfdf1 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -52,7 +52,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (gui_mode) { choose_pid: auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector", "Inspect", app_icon.bitmap_for_size(16))); - if (process_chooser->exec() == GUI::Dialog::ExecCancel) + if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel) return 0; pid = process_chooser->pid(); } else { diff --git a/Userland/DevTools/Playground/main.cpp b/Userland/DevTools/Playground/main.cpp index 57e374fe353..bd09bd5f399 100644 --- a/Userland/DevTools/Playground/main.cpp +++ b/Userland/DevTools/Playground/main.cpp @@ -177,9 +177,9 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(file_menu->try_add_action(GUI::CommonActions::make_open_action([&](auto&) { if (window->is_modified()) { auto result = GUI::MessageBox::ask_about_unsaved_changes(window, file_path, editor->document().undo_stack().last_unmodified_timestamp()); - if (result == GUI::MessageBox::ExecYes) + if (result == GUI::MessageBox::ExecResult::Yes) save_action->activate(); - if (result != GUI::MessageBox::ExecNo && window->is_modified()) + if (result != GUI::MessageBox::ExecResult::No && window->is_modified()) return; } @@ -257,14 +257,14 @@ ErrorOr serenity_main(Main::Arguments arguments) return GUI::Window::CloseRequestDecision::Close; auto result = GUI::MessageBox::ask_about_unsaved_changes(window, file_path, editor->document().undo_stack().last_unmodified_timestamp()); - if (result == GUI::MessageBox::ExecYes) { + if (result == GUI::MessageBox::ExecResult::Yes) { save_action->activate(); if (window->is_modified()) return GUI::Window::CloseRequestDecision::StayOpen; return GUI::Window::CloseRequestDecision::Close; } - if (result == GUI::MessageBox::ExecNo) + if (result == GUI::MessageBox::ExecResult::No) return GUI::Window::CloseRequestDecision::Close; return GUI::Window::CloseRequestDecision::StayOpen; diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 684f9361cb5..8ea601987ea 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -343,7 +343,7 @@ bool generate_profile(pid_t& pid) { if (!pid) { auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors()); - if (process_chooser->exec() == GUI::Dialog::ExecCancel) + if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel) return false; pid = process_chooser->pid(); } diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp index e353de32cb5..938a8f3f1f1 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.cpp +++ b/Userland/DevTools/SQLStudio/MainWidget.cpp @@ -266,9 +266,9 @@ bool MainWidget::request_close() auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), {}); switch (result) { - case GUI::Dialog::ExecResult::ExecYes: + case GUI::Dialog::ExecResult::Yes: break; - case GUI::Dialog::ExecResult::ExecNo: + case GUI::Dialog::ExecResult::No: return true; default: return false; diff --git a/Userland/DevTools/SQLStudio/ScriptEditor.cpp b/Userland/DevTools/SQLStudio/ScriptEditor.cpp index 49ed707a8de..ac25ee786b6 100644 --- a/Userland/DevTools/SQLStudio/ScriptEditor.cpp +++ b/Userland/DevTools/SQLStudio/ScriptEditor.cpp @@ -85,9 +85,9 @@ ErrorOr ScriptEditor::attempt_to_close() auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path.is_empty() ? name() : m_path, document().undo_stack().last_unmodified_timestamp()); switch (result) { - case GUI::Dialog::ExecResult::ExecYes: + case GUI::Dialog::ExecResult::Yes: return save(); - case GUI::Dialog::ExecResult::ExecNo: + case GUI::Dialog::ExecResult::No: return true; default: return false; diff --git a/Userland/Games/2048/GameSizeDialog.cpp b/Userland/Games/2048/GameSizeDialog.cpp index 3f4ccd3a4e5..0f925ccbaba 100644 --- a/Userland/Games/2048/GameSizeDialog.cpp +++ b/Userland/Games/2048/GameSizeDialog.cpp @@ -74,10 +74,10 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta button_layout.set_spacing(10); buttonbox.add("Cancel").on_click = [this](auto) { - done(Dialog::ExecCancel); + done(ExecResult::Cancel); }; buttonbox.add("OK").on_click = [this](auto) { - done(Dialog::ExecOK); + done(ExecResult::OK); }; } diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index 3a2d65a55af..e42066ceb3c 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -99,7 +99,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto change_settings = [&] { auto size_dialog = GameSizeDialog::construct(window, board_size, target_tile, evil_ai); - if (size_dialog->exec() || size_dialog->result() != GUI::Dialog::ExecOK) + if (size_dialog->exec() != GUI::Dialog::ExecResult::OK) return; board_size = size_dialog->board_size(); @@ -152,7 +152,7 @@ ErrorOr serenity_main(Main::Arguments arguments) "Congratulations!", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); - if (want_to_continue == GUI::MessageBox::ExecYes) + if (want_to_continue == GUI::MessageBox::ExecResult::Yes) game.set_want_to_continue(); else start_a_new_game(); diff --git a/Userland/Games/Breakout/Game.cpp b/Userland/Games/Breakout/Game.cpp index bf38388717c..134c7c979e7 100644 --- a/Userland/Games/Breakout/Game.cpp +++ b/Userland/Games/Breakout/Game.cpp @@ -20,7 +20,7 @@ Game::Game() { set_override_cursor(Gfx::StandardCursor::Hidden); auto level_dialog = LevelSelectDialog::show(m_board, window()); - if (level_dialog != GUI::Dialog::ExecOK) + if (level_dialog != GUI::Dialog::ExecResult::OK) m_board = -1; set_paused(false); start_timer(16); diff --git a/Userland/Games/Breakout/LevelSelectDialog.cpp b/Userland/Games/Breakout/LevelSelectDialog.cpp index dfbc5c49d4a..fb45e21adca 100644 --- a/Userland/Games/Breakout/LevelSelectDialog.cpp +++ b/Userland/Games/Breakout/LevelSelectDialog.cpp @@ -20,7 +20,7 @@ LevelSelectDialog::LevelSelectDialog(Window* parent_window) build(); } -int LevelSelectDialog::show(int& board_number, Window* parent_window) +GUI::Dialog::ExecResult LevelSelectDialog::show(int& board_number, Window* parent_window) { auto box = LevelSelectDialog::construct(parent_window); box->set_resizable(false); @@ -47,12 +47,12 @@ void LevelSelectDialog::build() level_list.add("Rainbow").on_click = [this](auto) { m_level = -1; - done(Dialog::ExecOK); + done(ExecResult::OK); }; level_list.add(":^)").on_click = [this](auto) { m_level = 0; - done(Dialog::ExecOK); + done(ExecResult::OK); }; } } diff --git a/Userland/Games/Breakout/LevelSelectDialog.h b/Userland/Games/Breakout/LevelSelectDialog.h index e3321936a80..89ccb400481 100644 --- a/Userland/Games/Breakout/LevelSelectDialog.h +++ b/Userland/Games/Breakout/LevelSelectDialog.h @@ -13,7 +13,7 @@ class LevelSelectDialog : public GUI::Dialog { C_OBJECT(LevelSelectDialog) public: virtual ~LevelSelectDialog() override = default; - static int show(int& board_number, Window* parent_window); + static ExecResult show(int& board_number, Window* parent_window); int level() const { return m_level; } private: diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index 5e013e464e2..8c4097b8a40 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -235,7 +235,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) Chess::Move move = { m_moving_square, target_square }; if (board().is_promotion_move(move)) { auto promotion_dialog = PromotionDialog::construct(*this); - if (promotion_dialog->exec() == PromotionDialog::ExecOK) + if (promotion_dialog->exec() == PromotionDialog::ExecResult::OK) move.promote_to = promotion_dialog->selected_piece(); } @@ -262,7 +262,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) update(); if (GUI::MessageBox::show(window(), "50 moves have elapsed without a capture. Claim Draw?", "Claim Draw?", GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::YesNo) - == GUI::Dialog::ExecYes) { + == GUI::Dialog::ExecResult::Yes) { msg = "Draw by 50 move rule."; } else { over = false; @@ -275,7 +275,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) update(); if (GUI::MessageBox::show(window(), "The same board state has repeated three times. Claim Draw?", "Claim Draw?", GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::YesNo) - == GUI::Dialog::ExecYes) { + == GUI::Dialog::ExecResult::Yes) { msg = "Draw by threefold repetition."; } else { over = false; @@ -691,7 +691,7 @@ int ChessWidget::resign() } auto result = GUI::MessageBox::show(window(), "Are you sure you wish to resign?", "Resign", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNo); - if (result != GUI::MessageBox::ExecYes) + if (result != GUI::MessageBox::ExecResult::Yes) return -1; board().set_resigned(m_board.turn()); diff --git a/Userland/Games/Chess/PromotionDialog.cpp b/Userland/Games/Chess/PromotionDialog.cpp index e89bd54d9ef..f20ab091484 100644 --- a/Userland/Games/Chess/PromotionDialog.cpp +++ b/Userland/Games/Chess/PromotionDialog.cpp @@ -28,7 +28,7 @@ PromotionDialog::PromotionDialog(ChessWidget& chess_widget) button.set_icon(chess_widget.get_piece_graphic({ chess_widget.board().turn(), type })); button.on_click = [this, type](auto) { m_selected_piece = type; - done(ExecOK); + done(ExecResult::OK); }; } } diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index f59a6125893..83986fe52a9 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -137,7 +137,7 @@ void Game::show_score_card(bool game_over) auto& close_button = button_container.add("OK"); close_button.on_click = [&score_dialog](auto) { - score_dialog->done(GUI::Dialog::ExecOK); + score_dialog->done(GUI::Dialog::ExecResult::OK); }; close_button.set_min_width(70); close_button.resize(70, 30); diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp index 2e027ad4f4c..c9e185cdedb 100644 --- a/Userland/Games/Hearts/SettingsDialog.cpp +++ b/Userland/Games/Hearts/SettingsDialog.cpp @@ -43,10 +43,10 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, String player_name) button_layout.set_spacing(10); button_box.add("Cancel").on_click = [this](auto) { - done(Dialog::ExecCancel); + done(ExecResult::Cancel); }; button_box.add("OK").on_click = [this](auto) { - done(Dialog::ExecOK); + done(ExecResult::OK); }; } diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp index 429779af2cf..3ce2a8c0a4a 100644 --- a/Userland/Games/Hearts/main.cpp +++ b/Userland/Games/Hearts/main.cpp @@ -75,7 +75,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto change_settings = [&] { auto settings_dialog = SettingsDialog::construct(window, player_name); - if (settings_dialog->exec() || settings_dialog->result() != GUI::Dialog::ExecOK) + if (settings_dialog->exec() != GUI::Dialog::ExecResult::OK) return; player_name = settings_dialog->player_name(); diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index 2d17318e266..abdeee8ff79 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -62,7 +62,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(game_menu->try_add_action(GUI::Action::create("Set &Word Length", [&](auto&) { auto word_length = Config::read_i32("MasterWord", "", "word_length", 5); auto word_length_string = String::number(word_length); - if (GUI::InputBox::show(window, word_length_string, "Word length:", "MasterWord") == GUI::InputBox::ExecOK && !word_length_string.is_empty()) { + if (GUI::InputBox::show(window, word_length_string, "Word length:", "MasterWord") == GUI::InputBox::ExecResult::OK && !word_length_string.is_empty()) { auto maybe_word_length = word_length_string.template to_uint(); if (!maybe_word_length.has_value() || maybe_word_length.value() < shortest_word || maybe_word_length.value() > longest_word) { GUI::MessageBox::show(window, String::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"); @@ -78,7 +78,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(game_menu->try_add_action(GUI::Action::create("Set &Number Of Guesses", [&](auto&) { auto max_guesses = Config::read_i32("MasterWord", "", "max_guesses", 5); auto max_guesses_string = String::number(max_guesses); - if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:", "MasterWord") == GUI::InputBox::ExecOK && !max_guesses_string.is_empty()) { + if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:", "MasterWord") == GUI::InputBox::ExecResult::OK && !max_guesses_string.is_empty()) { auto maybe_max_guesses = max_guesses_string.template to_uint(); if (!maybe_max_guesses.has_value() || maybe_max_guesses.value() < 1 || maybe_max_guesses.value() > 20) { GUI::MessageBox::show(window, "Please enter a number between 1 and 20.", "MasterWord"); diff --git a/Userland/Games/Minesweeper/CustomGameDialog.cpp b/Userland/Games/Minesweeper/CustomGameDialog.cpp index 7cdafb2ed31..ce5194d7673 100644 --- a/Userland/Games/Minesweeper/CustomGameDialog.cpp +++ b/Userland/Games/Minesweeper/CustomGameDialog.cpp @@ -9,7 +9,7 @@ #include "Field.h" #include -int CustomGameDialog::show(GUI::Window* parent_window, Field& field) +GUI::Dialog::ExecResult CustomGameDialog::show(GUI::Window* parent_window, Field& field) { auto dialog = CustomGameDialog::construct(parent_window); @@ -24,12 +24,12 @@ int CustomGameDialog::show(GUI::Window* parent_window, Field& field) auto result = dialog->exec(); - if (result != GUI::Dialog::ExecOK) + if (result != ExecResult::OK) return result; field.set_field_size(Field::Difficulty::Custom, dialog->m_rows_spinbox->value(), dialog->m_columns_spinbox->value(), dialog->m_mines_spinbox->value()); - return GUI::Dialog::ExecOK; + return ExecResult::OK; } void CustomGameDialog::set_max_mines() @@ -66,11 +66,11 @@ CustomGameDialog::CustomGameDialog(Window* parent_window) }; m_ok_button->on_click = [this](auto) { - done(ExecResult::ExecOK); + done(ExecResult::OK); }; m_cancel_button->on_click = [this](auto) { - done(ExecResult::ExecCancel); + done(ExecResult::Cancel); }; set_max_mines(); diff --git a/Userland/Games/Minesweeper/CustomGameDialog.h b/Userland/Games/Minesweeper/CustomGameDialog.h index 786a3252d31..42dd35625a5 100644 --- a/Userland/Games/Minesweeper/CustomGameDialog.h +++ b/Userland/Games/Minesweeper/CustomGameDialog.h @@ -17,7 +17,7 @@ class CustomGameDialog : public GUI::Dialog { C_OBJECT(CustomGameDialog); public: - static int show(GUI::Window* parent_window, Field& field); + static ExecResult show(GUI::Window* parent_window, Field& field); private: CustomGameDialog(GUI::Window* parent_window); diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index 2b70ce9e76b..a900574f74f 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -144,7 +144,7 @@ ErrorOr serenity_main(Main::Arguments arguments) GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNo); - if (result == GUI::MessageBox::ExecYes) + if (result == GUI::MessageBox::ExecResult::Yes) return GUI::Window::CloseRequestDecision::Close; else return GUI::Window::CloseRequestDecision::StayOpen; diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp index a4e25379795..db67616b809 100644 --- a/Userland/Games/Spider/main.cpp +++ b/Userland/Games/Spider/main.cpp @@ -201,7 +201,7 @@ ErrorOr serenity_main(Main::Arguments arguments) GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNo); - if (result == GUI::MessageBox::ExecYes) + if (result == GUI::MessageBox::ExecResult::Yes) return GUI::Window::CloseRequestDecision::Close; else return GUI::Window::CloseRequestDecision::StayOpen; diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index 63858aeac62..d40c9523d3d 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -82,7 +82,7 @@ AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* paren auto& ok_button = button_container.add