mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
Games: Add a Cards Settings menu item to Hearts, Solitaire, and Spider
This commit is contained in:
parent
33fd2c1af9
commit
8c7f6abf58
3 changed files with 13 additions and 7 deletions
|
@ -35,15 +35,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
Config::pledge_domains({ "Games", "Hearts" });
|
Config::pledge_domains({ "Games", "Hearts" });
|
||||||
Config::monitor_domain("Games");
|
Config::monitor_domain("Games");
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||||
|
|
||||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man6/Hearts.md") }));
|
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man6/Hearts.md") }));
|
||||||
TRY(Desktop::Launcher::seal_allowlist());
|
TRY(Desktop::Launcher::seal_allowlist());
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw"));
|
TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw"));
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/bin/GamesSettings", "x"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
auto window = TRY(GUI::Window::try_create());
|
auto window = TRY(GUI::Window::try_create());
|
||||||
|
@ -93,7 +94,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
game.setup(player_name);
|
game.setup(player_name);
|
||||||
})));
|
})));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
|
TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
|
||||||
|
TRY(game_menu->try_add_action(GUI::Action::create("Hearts &Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
|
||||||
change_settings();
|
change_settings();
|
||||||
})));
|
})));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::try_create(arguments));
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv));
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv));
|
||||||
|
@ -40,9 +40,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
Config::pledge_domains({ "Games", "Solitaire" });
|
Config::pledge_domains({ "Games", "Solitaire" });
|
||||||
Config::monitor_domain("Games");
|
Config::monitor_domain("Games");
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/bin/GamesSettings", "x"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
auto window = TRY(GUI::Window::try_create());
|
auto window = TRY(GUI::Window::try_create());
|
||||||
|
@ -204,6 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
undo_action->set_enabled(false);
|
undo_action->set_enabled(false);
|
||||||
TRY(game_menu->try_add_action(undo_action));
|
TRY(game_menu->try_add_action(undo_action));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
|
TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
|
||||||
TRY(game_menu->try_add_action(single_card_draw_action));
|
TRY(game_menu->try_add_action(single_card_draw_action));
|
||||||
TRY(game_menu->try_add_action(three_card_draw_action));
|
TRY(game_menu->try_add_action(three_card_draw_action));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
|
|
|
@ -40,7 +40,7 @@ static DeprecatedString format_seconds(uint64_t seconds_elapsed)
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::try_create(arguments));
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-spider"sv));
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-spider"sv));
|
||||||
|
@ -48,9 +48,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
Config::pledge_domains({ "Games", "Spider" });
|
Config::pledge_domains({ "Games", "Spider" });
|
||||||
Config::monitor_domain("Games");
|
Config::monitor_domain("Games");
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/bin/GamesSettings", "x"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
auto window = TRY(GUI::Window::try_create());
|
auto window = TRY(GUI::Window::try_create());
|
||||||
|
@ -245,6 +246,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
undo_action->set_enabled(false);
|
undo_action->set_enabled(false);
|
||||||
TRY(game_menu->try_add_action(undo_action));
|
TRY(game_menu->try_add_action(undo_action));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
|
TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
|
||||||
TRY(game_menu->try_add_action(single_suit_action));
|
TRY(game_menu->try_add_action(single_suit_action));
|
||||||
TRY(game_menu->try_add_action(two_suit_action));
|
TRY(game_menu->try_add_action(two_suit_action));
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue