From b558a3396e45f4c0f533aea5e4d44cff12ec149f Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 3 Dec 2024 00:33:22 +0100 Subject: [PATCH] Fix signal naming --- gamestate.cpp | 26 +++++++++++++------------- gamestate.h | 16 ++++++++-------- playingcard.cpp | 4 ++-- playingcard.h | 12 ++++++------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/gamestate.cpp b/gamestate.cpp index 4ca29ab..169c9b7 100644 --- a/gamestate.cpp +++ b/gamestate.cpp @@ -48,10 +48,10 @@ void GameState::dealCards() m_foundation.clear(); m_throwawayPile.clear(); - emit onDrawPileChanged(); - emit onThrowawayPileChanged(); - emit onColumnsChanged(); - emit onFoundationChanged(); + emit drawPileChanged(); + emit throwawayPileChanged(); + emit columnsChanged(); + emit foundationChanged(); } void GameState::drawNextCard() @@ -66,8 +66,8 @@ void GameState::drawNextCard() // Draw the top card from drawPile, dropping it into throwawayPile m_throwawayPile.append(m_drawPile.takeFirst()); - emit onDrawPileChanged(); - emit onThrowawayPileChanged(); + emit drawPileChanged(); + emit throwawayPileChanged(); } bool GameState::moveCardToColumn(int columnId) @@ -91,8 +91,8 @@ bool GameState::moveCardToColumn(int columnId) m_columns[columnId].append(col); m_throwawayPile.removeLast(); - emit onThrowawayPileChanged(); - emit onColumnsChanged(); + emit throwawayPileChanged(); + emit columnsChanged(); return true; } @@ -112,8 +112,8 @@ bool GameState::moveCardToColumn(int columnId) m_throwawayPile.removeLast(); ensureColumnRevealed(columnId); - emit onThrowawayPileChanged(); - emit onColumnsChanged(); + emit throwawayPileChanged(); + emit columnsChanged(); return true; } @@ -135,7 +135,7 @@ bool GameState::moveThrownCardToFoundation(PlayingCard::Suit foundationId) // let's remove the card from the throwaway pile. m_throwawayPile.removeLast(); - emit onThrowawayPileChanged(); + emit throwawayPileChanged(); return true; } @@ -160,7 +160,7 @@ bool GameState::moveColumnCardToFoundation(int columnId, PlayingCard::Suit found m_columns[columnId].removeFirst(); ensureColumnRevealed(columnId); - emit onColumnsChanged(); + emit columnsChanged(); return true; } @@ -192,7 +192,7 @@ bool GameState::tryMoveCardToFoundation(PlayingCard::Suit foundationId, PlayingC m_foundation[foundationId].push_front(cardToMove); - emit onFoundationChanged(); + emit foundationChanged(); return true; } diff --git a/gamestate.h b/gamestate.h index f462421..944814c 100644 --- a/gamestate.h +++ b/gamestate.h @@ -8,10 +8,10 @@ class GameState : public QObject { Q_OBJECT - Q_PROPERTY(QList drawPile READ drawPile NOTIFY onDrawPileChanged) - Q_PROPERTY(QList throwawayPile READ throwawayPile NOTIFY onThrowawayPileChanged) - Q_PROPERTY(QList> columns READ columns NOTIFY onColumnsChanged) - Q_PROPERTY(QList> foundation READ foundation NOTIFY onFoundationChanged) + Q_PROPERTY(QList drawPile READ drawPile NOTIFY drawPileChanged) + Q_PROPERTY(QList throwawayPile READ throwawayPile NOTIFY throwawayPileChanged) + Q_PROPERTY(QList> columns READ columns NOTIFY columnsChanged) + Q_PROPERTY(QList> foundation READ foundation NOTIFY foundationChanged) public: explicit GameState(QObject *parent = nullptr); @@ -28,10 +28,10 @@ public: bool moveColumnCardToFoundation(int columnId, PlayingCard::Suit foundationId); signals: - void onDrawPileChanged(); - void onThrowawayPileChanged(); - void onColumnsChanged(); - void onFoundationChanged(); + void drawPileChanged(); + void throwawayPileChanged(); + void columnsChanged(); + void foundationChanged(); private: QList m_drawPile; diff --git a/playingcard.cpp b/playingcard.cpp index d37c521..f1b9d34 100644 --- a/playingcard.cpp +++ b/playingcard.cpp @@ -26,7 +26,7 @@ void PlayingCard::setSuit(const PlayingCard::Suit &suit) return; m_suit = suit; - emit onSuitChanged(); + emit suitChanged(); } PlayingCard::Value PlayingCard::value() const @@ -60,7 +60,7 @@ void PlayingCard::setValue(const PlayingCard::Value &value) return; m_value = value; - emit onValueChanged(); + emit valueChanged(); } QList PlayingCard::createDeck() diff --git a/playingcard.h b/playingcard.h index 6780fdb..e103a6c 100644 --- a/playingcard.h +++ b/playingcard.h @@ -10,11 +10,11 @@ class PlayingCard : public QObject Q_ENUMS(Value) Q_ENUMS(Suit) - Q_PROPERTY(Suit suit READ suit WRITE setSuit NOTIFY onSuitChanged REQUIRED) - Q_PROPERTY(Value value READ value WRITE setValue NOTIFY onValueChanged REQUIRED) + Q_PROPERTY(Suit suit READ suit WRITE setSuit NOTIFY suitChanged REQUIRED) + Q_PROPERTY(Value value READ value WRITE setValue NOTIFY valueChanged REQUIRED) - Q_PROPERTY(QString valueString READ valueString NOTIFY onValueChanged) - Q_PROPERTY(QString suitString READ suitString NOTIFY onSuitChanged) + Q_PROPERTY(QString valueString READ valueString NOTIFY valueChanged) + Q_PROPERTY(QString suitString READ suitString NOTIFY suitChanged) public: enum Value { @@ -54,8 +54,8 @@ public: static bool areOppositeColors(const PlayingCard &card1, const PlayingCard &card2); signals: - void onSuitChanged(); - void onValueChanged(); + void suitChanged(); + void valueChanged(); private: Suit m_suit;