summaryrefslogtreecommitdiff
path: root/Userland/Games
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/Games
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/Games')
-rw-r--r--Userland/Games/MasterWord/main.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp
index c5c9dde320..ef1515267b 100644
--- a/Userland/Games/MasterWord/main.cpp
+++ b/Userland/Games/MasterWord/main.cpp
@@ -75,9 +75,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(settings_menu->try_add_action(GUI::Action::create("Set &Word Length", [&](auto&) {
auto word_length = Config::read_i32("MasterWord"sv, ""sv, "word_length"sv, 5);
- auto word_length_string = DeprecatedString::number(word_length);
+ auto word_length_string = String::number(word_length).release_value_but_fixme_should_propagate_errors();
if (GUI::InputBox::show(window, word_length_string, "Word length:"sv, "MasterWord"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) {
- auto maybe_word_length = word_length_string.template to_uint();
+ auto maybe_word_length = AK::StringUtils::convert_to_uint(word_length_string);
if (!maybe_word_length.has_value() || maybe_word_length.value() < shortest_word || maybe_word_length.value() > longest_word) {
GUI::MessageBox::show(window, DeprecatedString::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"sv);
return;
@@ -90,9 +90,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
TRY(settings_menu->try_add_action(GUI::Action::create("Set &Number Of Guesses", [&](auto&) {
auto max_guesses = Config::read_i32("MasterWord"sv, ""sv, "max_guesses"sv, 5);
- auto max_guesses_string = DeprecatedString::number(max_guesses);
+ auto max_guesses_string = String::number(max_guesses).release_value_but_fixme_should_propagate_errors();
if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:"sv, "MasterWord"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) {
- auto maybe_max_guesses = max_guesses_string.template to_uint();
+ auto maybe_max_guesses = AK::StringUtils::convert_to_uint(max_guesses_string);
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."sv, "MasterWord"sv);
return;