1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 03:58:12 +00:00

LibGUI+Userland: Make Dialog::ExecResult an enum class

This commit is contained in:
Sam Atkins 2022-05-13 13:10:27 +01:00 committed by Linus Groh
parent 1f82beded3
commit cdffe556c8
90 changed files with 232 additions and 232 deletions

View file

@ -62,7 +62,7 @@ ErrorOr<int> 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<int> 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");