1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

GamesSettings: Add chess settings :^)

This adds a tab for configuring the appearance of Chess, along with a
preview.
This commit is contained in:
Sam Atkins 2023-02-01 21:09:32 +00:00 committed by Andreas Kling
parent 64c9c7a4da
commit 05913b853a
5 changed files with 416 additions and 6 deletions

View file

@ -1,10 +1,11 @@
/*
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CardSettingsWidget.h"
#include "ChessSettingsWidget.h"
#include <LibConfig/Client.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/System.h>
@ -21,10 +22,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView selected_tab;
Core::ArgsParser args_parser;
args_parser.add_option(selected_tab, "Tab, must be 'cards'", "open-tab", 't', "tab");
args_parser.add_option(selected_tab, "Tab, one of 'cards' or 'chess'", "open-tab", 't', "tab");
args_parser.parse(arguments);
TRY(Core::System::unveil("/res", "r"));
// Both of these are used by the GUI::FileSystemModel in CardSettingsWidget.
TRY(Core::System::unveil("/etc/passwd", "r"));
TRY(Core::System::unveil("/etc/group", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
auto app_icon = GUI::Icon::default_icon("games"sv);
@ -32,6 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::SettingsWindow::create("Games Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
window->set_icon(app_icon.bitmap_for_size(16));
(void)TRY(window->add_tab<GamesSettings::CardSettingsWidget>("Cards"sv, "cards"sv));
(void)TRY(window->add_tab<GamesSettings::ChessSettingsWidget>("Chess"sv, "chess"sv));
window->set_active_tab(selected_tab);
window->show();