1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

GamesSettings: Rename Preview -> CardGamePreview

This commit is contained in:
Sam Atkins 2023-02-01 13:29:07 +00:00 committed by Andreas Kling
parent 286e3e6872
commit 66f2f4d647
3 changed files with 10 additions and 10 deletions

View file

@ -18,13 +18,13 @@ namespace GamesSettings {
static constexpr StringView default_card_back_image_path = "/res/icons/cards/buggie-deck.png"sv; static constexpr StringView default_card_back_image_path = "/res/icons/cards/buggie-deck.png"sv;
class Preview final : public Cards::CardGame { class CardGamePreview final : public Cards::CardGame {
C_OBJECT_ABSTRACT(Preview) C_OBJECT_ABSTRACT(CardGamePreview)
public: public:
static ErrorOr<NonnullRefPtr<Preview>> try_create() static ErrorOr<NonnullRefPtr<CardGamePreview>> try_create()
{ {
auto preview = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Preview())); auto preview = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) CardGamePreview()));
Gfx::IntPoint point { 25, 30 }; Gfx::IntPoint point { 25, 30 };
TRY(preview->add_stack(point, Cards::CardStack::Type::Stock)); TRY(preview->add_stack(point, Cards::CardStack::Type::Stock));
@ -51,7 +51,7 @@ public:
} }
private: private:
Preview() = default; CardGamePreview() = default;
virtual void paint_event(GUI::PaintEvent& event) override virtual void paint_event(GUI::PaintEvent& event) override
{ {
@ -73,7 +73,7 @@ CardSettingsWidget::CardSettingsWidget()
auto background_color = Gfx::Color::from_string(Config::read_string("Games"sv, "Cards"sv, "BackgroundColor"sv)).value_or(Gfx::Color::from_rgb(0x008000)); auto background_color = Gfx::Color::from_string(Config::read_string("Games"sv, "Cards"sv, "BackgroundColor"sv)).value_or(Gfx::Color::from_rgb(0x008000));
m_preview_frame = find_descendant_of_type_named<Preview>("cards_preview"); m_preview_frame = find_descendant_of_type_named<CardGamePreview>("cards_preview");
m_preview_frame->set_background_color(background_color); m_preview_frame->set_background_color(background_color);
m_background_color_input = find_descendant_of_type_named<GUI::ColorInput>("cards_background_color"); m_background_color_input = find_descendant_of_type_named<GUI::ColorInput>("cards_background_color");
@ -136,4 +136,4 @@ DeprecatedString CardSettingsWidget::card_back_image_path() const
} }
REGISTER_WIDGET(GamesSettings, Preview); REGISTER_WIDGET(GamesSettings, CardGamePreview);

View file

@ -4,7 +4,7 @@
margins: [8] margins: [8]
} }
@GamesSettings::Preview { @GamesSettings::CardGamePreview {
name: "cards_preview" name: "cards_preview"
fill_with_background_color: true fill_with_background_color: true
fixed_height: 160 fixed_height: 160

View file

@ -15,7 +15,7 @@
namespace GamesSettings { namespace GamesSettings {
class Preview; class CardGamePreview;
class CardSettingsWidget final : public GUI::SettingsWindow::Tab { class CardSettingsWidget final : public GUI::SettingsWindow::Tab {
C_OBJECT(CardSettingsWidget) C_OBJECT(CardSettingsWidget)
@ -31,7 +31,7 @@ private:
bool set_card_back_image_path(DeprecatedString const&); bool set_card_back_image_path(DeprecatedString const&);
DeprecatedString card_back_image_path() const; DeprecatedString card_back_image_path() const;
RefPtr<Preview> m_preview_frame; RefPtr<CardGamePreview> m_preview_frame;
RefPtr<GUI::ColorInput> m_background_color_input; RefPtr<GUI::ColorInput> m_background_color_input;
RefPtr<GUI::IconView> m_card_back_image_view; RefPtr<GUI::IconView> m_card_back_image_view;