Fix signal naming
This commit is contained in:
parent
c35dd9e56e
commit
b558a3396e
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
16
gamestate.h
16
gamestate.h
|
@ -8,10 +8,10 @@
|
|||
class GameState : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QList<PlayingCard*> drawPile READ drawPile NOTIFY onDrawPileChanged)
|
||||
Q_PROPERTY(QList<PlayingCard*> throwawayPile READ throwawayPile NOTIFY onThrowawayPileChanged)
|
||||
Q_PROPERTY(QList<QList<ColumnSlot*>> columns READ columns NOTIFY onColumnsChanged)
|
||||
Q_PROPERTY(QList<QList<PlayingCard*>> foundation READ foundation NOTIFY onFoundationChanged)
|
||||
Q_PROPERTY(QList<PlayingCard*> drawPile READ drawPile NOTIFY drawPileChanged)
|
||||
Q_PROPERTY(QList<PlayingCard*> throwawayPile READ throwawayPile NOTIFY throwawayPileChanged)
|
||||
Q_PROPERTY(QList<QList<ColumnSlot*>> columns READ columns NOTIFY columnsChanged)
|
||||
Q_PROPERTY(QList<QList<PlayingCard*>> 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<PlayingCard*> m_drawPile;
|
||||
|
|
|
@ -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 *> PlayingCard::createDeck()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue