mirror of
https://github.com/RGBCube/serenity
synced 2025-07-30 06:17:35 +00:00
AK: Make "foo"_string infallible
Stop worrying about tiny OOMs. Work towards #20405.
This commit is contained in:
parent
db2a8725c6
commit
34344120f2
181 changed files with 626 additions and 630 deletions
|
@ -145,7 +145,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
GUI::Process::spawn_or_show_error(window, "/bin/GamesSettings"sv, Array { "--open-tab", "chess" });
|
||||
},
|
||||
window);
|
||||
settings_action->set_status_tip(TRY("Open the Game Settings for Chess"_string));
|
||||
settings_action->set_status_tip("Open the Game Settings for Chess"_string);
|
||||
TRY(game_menu->try_add_action(settings_action));
|
||||
|
||||
auto show_available_moves_action = GUI::Action::create_checkable("Show Available Moves", [&](auto& action) {
|
||||
|
|
|
@ -186,7 +186,7 @@ void BoardWidget::context_menu_event(GUI::ContextMenuEvent& event)
|
|||
if (!m_context_menu) {
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
|
||||
auto& insert_pattern_menu = m_context_menu->add_submenu("&Insert Pattern"_string.release_value_but_fixme_should_propagate_errors());
|
||||
auto& insert_pattern_menu = m_context_menu->add_submenu("&Insert Pattern"_string);
|
||||
for_each_pattern([&](auto& pattern) {
|
||||
if (pattern.action())
|
||||
insert_pattern_menu.add_action(*pattern.action());
|
||||
|
|
|
@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto click_tip = TRY("Tip: click the board to toggle individual cells, or click+drag to toggle multiple cells"_string);
|
||||
auto click_tip = "Tip: click the board to toggle individual cells, or click+drag to toggle multiple cells"_string;
|
||||
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gameoflife"sv));
|
||||
|
||||
|
@ -153,7 +153,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
board_widget->on_running_state_change = [&]() {
|
||||
if (board_widget->is_running()) {
|
||||
statusbar.set_text("Running..."_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text("Running..."_string);
|
||||
toggle_running_toolbar_button->set_icon(*paused_icon);
|
||||
main_widget->set_override_cursor(Gfx::StandardCursor::None);
|
||||
} else {
|
||||
|
@ -177,7 +177,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
board_widget->on_stall = [&] {
|
||||
toggle_running_action->activate();
|
||||
statusbar.set_text("Stalled..."_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text("Stalled..."_string);
|
||||
};
|
||||
|
||||
board_widget->on_cell_toggled = [&](auto, auto, auto) {
|
||||
|
|
|
@ -78,7 +78,7 @@ Game::Game()
|
|||
m_players[3].name = "Lisa";
|
||||
m_players[3].taken_cards_target = { width, height / 2 - Card::height / 2 };
|
||||
|
||||
m_passing_button = add<GUI::Button>("Pass Left"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_passing_button = add<GUI::Button>("Pass Left"_string);
|
||||
constexpr int button_width = 120;
|
||||
constexpr int button_height = 30;
|
||||
m_passing_button->set_relative_rect(width / 2 - button_width / 2, height - 3 * outer_border_size - Card::height - button_height, button_width, button_height);
|
||||
|
@ -178,13 +178,13 @@ void Game::setup(DeprecatedString player_name, int hand_number)
|
|||
m_human_can_play = true;
|
||||
switch (passing_direction()) {
|
||||
case PassingDirection::Left:
|
||||
m_passing_button->set_text("Pass Left"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_passing_button->set_text("Pass Left"_string);
|
||||
break;
|
||||
case PassingDirection::Across:
|
||||
m_passing_button->set_text("Pass Across"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_passing_button->set_text("Pass Across"_string);
|
||||
break;
|
||||
case PassingDirection::Right:
|
||||
m_passing_button->set_text("Pass Right"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_passing_button->set_text("Pass Right"_string);
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -405,7 +405,7 @@ void Game::let_player_play_card()
|
|||
auto& player = current_player();
|
||||
|
||||
if (&player == &m_players[0])
|
||||
on_status_change("Select a card to play."_string.release_value_but_fixme_should_propagate_errors());
|
||||
on_status_change("Select a card to play."_string);
|
||||
else
|
||||
on_status_change(String::formatted("Waiting for {} to play a card...", player).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
|
@ -455,7 +455,7 @@ void Game::advance_game()
|
|||
|
||||
if (m_state == State::Play && game_ended()) {
|
||||
m_state = State::GameEnded;
|
||||
on_status_change("Game ended."_string.release_value_but_fixme_should_propagate_errors());
|
||||
on_status_change("Game ended."_string);
|
||||
advance_game();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.set_focus(true);
|
||||
|
||||
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||
statusbar.set_text(0, TRY("Score: 0"_string));
|
||||
statusbar.set_text(0, "Score: 0"_string);
|
||||
|
||||
DeprecatedString player_name = Config::read_string("Hearts"sv, ""sv, "player_name"sv, "Gunnar"sv);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
GUI::Application::the()->quit();
|
||||
})));
|
||||
|
||||
auto settings_menu = TRY(window->try_add_menu(TRY("&Settings"_string)));
|
||||
auto settings_menu = TRY(window->try_add_menu("&Settings"_string));
|
||||
|
||||
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);
|
||||
|
|
|
@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
GUI::Application::the()->quit();
|
||||
})));
|
||||
|
||||
auto difficulty_menu = TRY(window->try_add_menu(TRY("&Difficulty"_string)));
|
||||
auto difficulty_menu = TRY(window->try_add_menu("&Difficulty"_string));
|
||||
GUI::ActionGroup difficulty_actions;
|
||||
difficulty_actions.set_exclusive(true);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto snake_skin_name = Config::read_string("Snake"sv, "Snake"sv, "SnakeSkin"sv, "Classic"sv);
|
||||
|
||||
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"sv);
|
||||
statusbar.set_text(0, TRY("Score: 0"_string));
|
||||
statusbar.set_text(0, "Score: 0"_string);
|
||||
statusbar.set_text(1, TRY(String::formatted("High Score: {}", high_score)));
|
||||
GUI::Application::the()->on_action_enter = [&statusbar](GUI::Action& action) {
|
||||
statusbar.set_override_text(action.status_tip());
|
||||
|
|
|
@ -91,9 +91,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.set_focus(true);
|
||||
|
||||
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||
statusbar.set_text(0, TRY("Score: 0"_string));
|
||||
statusbar.set_text(0, "Score: 0"_string);
|
||||
statusbar.set_text(1, TRY(String::formatted("High Score: {}", high_score())));
|
||||
statusbar.set_text(2, TRY("Time: 00:00"_string));
|
||||
statusbar.set_text(2, "Time: 00:00"_string);
|
||||
|
||||
app->on_action_enter = [&](GUI::Action& action) {
|
||||
statusbar.set_override_text(action.status_tip());
|
||||
|
@ -117,7 +117,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.on_game_start = [&]() {
|
||||
seconds_elapsed = 0;
|
||||
timer->start();
|
||||
statusbar.set_text(2, "Time: 00:00"_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text(2, "Time: 00:00"_string);
|
||||
};
|
||||
game.on_game_end = [&](Solitaire::GameOverReason reason, uint32_t score) {
|
||||
if (timer->is_active())
|
||||
|
@ -135,7 +135,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
statusbar.set_text(1, String::formatted("High Score: {}", score).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
}
|
||||
statusbar.set_text(2, "Timer starts after your first move"_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text(2, "Timer starts after your first move"_string);
|
||||
};
|
||||
|
||||
auto confirm_end_current_game = [&]() {
|
||||
|
@ -172,7 +172,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.setup(mode);
|
||||
});
|
||||
single_card_draw_action->set_checked(mode == Solitaire::Mode::SingleCardDraw);
|
||||
single_card_draw_action->set_status_tip(TRY("Draw one card at a time"_string));
|
||||
single_card_draw_action->set_status_tip("Draw one card at a time"_string);
|
||||
draw_setting_actions.add_action(single_card_draw_action);
|
||||
|
||||
auto three_card_draw_action = GUI::Action::create_checkable("&Three Card Draw", [&](auto&) {
|
||||
|
@ -185,7 +185,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.setup(mode);
|
||||
});
|
||||
three_card_draw_action->set_checked(mode == Solitaire::Mode::ThreeCardDraw);
|
||||
three_card_draw_action->set_status_tip(TRY("Draw three cards at a time"_string));
|
||||
three_card_draw_action->set_status_tip("Draw three cards at a time"_string);
|
||||
draw_setting_actions.add_action(three_card_draw_action);
|
||||
|
||||
game.set_auto_collect(Config::read_bool("Solitaire"sv, "Settings"sv, "AutoCollect"sv, false));
|
||||
|
@ -195,7 +195,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Config::write_bool("Solitaire"sv, "Settings"sv, "AutoCollect"sv, checked);
|
||||
});
|
||||
toggle_auto_collect_action->set_checked(game.is_auto_collecting());
|
||||
toggle_auto_collect_action->set_status_tip(TRY("Auto-collect to foundation piles"_string));
|
||||
toggle_auto_collect_action->set_status_tip("Auto-collect to foundation piles"_string);
|
||||
|
||||
auto game_menu = TRY(window->try_add_menu("&Game"_short_string));
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
};
|
||||
|
||||
statusbar.set_text(0, TRY("Score: 0"_string));
|
||||
statusbar.set_text(0, "Score: 0"_string);
|
||||
reset_statistic_status();
|
||||
statusbar.set_text(2, TRY("Time: 00:00:00"_string));
|
||||
statusbar.set_text(2, "Time: 00:00:00"_string);
|
||||
|
||||
app->on_action_enter = [&](GUI::Action& action) {
|
||||
statusbar.set_override_text(action.status_tip());
|
||||
|
@ -156,7 +156,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
game.on_game_start = [&]() {
|
||||
seconds_elapsed = 0;
|
||||
timer->start();
|
||||
statusbar.set_text(2, "Time: 00:00:00"_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text(2, "Time: 00:00:00"_string);
|
||||
};
|
||||
game.on_game_end = [&](Spider::GameOverReason reason, uint32_t score) {
|
||||
auto game_was_in_progress = timer->is_active();
|
||||
|
@ -181,7 +181,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
reset_statistic_status();
|
||||
}
|
||||
statusbar.set_text(2, "Timer starts after your first move"_string.release_value_but_fixme_should_propagate_errors());
|
||||
statusbar.set_text(2, "Timer starts after your first move"_string);
|
||||
};
|
||||
|
||||
auto confirm_end_current_game = [&]() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue