Fix signal naming
This commit is contained in:
parent
c35dd9e56e
commit
b558a3396e
|
@ -48,10 +48,10 @@ void GameState::dealCards()
|
||||||
m_foundation.clear();
|
m_foundation.clear();
|
||||||
m_throwawayPile.clear();
|
m_throwawayPile.clear();
|
||||||
|
|
||||||
emit onDrawPileChanged();
|
emit drawPileChanged();
|
||||||
emit onThrowawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
emit onColumnsChanged();
|
emit columnsChanged();
|
||||||
emit onFoundationChanged();
|
emit foundationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::drawNextCard()
|
void GameState::drawNextCard()
|
||||||
|
@ -66,8 +66,8 @@ void GameState::drawNextCard()
|
||||||
// Draw the top card from drawPile, dropping it into throwawayPile
|
// Draw the top card from drawPile, dropping it into throwawayPile
|
||||||
m_throwawayPile.append(m_drawPile.takeFirst());
|
m_throwawayPile.append(m_drawPile.takeFirst());
|
||||||
|
|
||||||
emit onDrawPileChanged();
|
emit drawPileChanged();
|
||||||
emit onThrowawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::moveCardToColumn(int columnId)
|
bool GameState::moveCardToColumn(int columnId)
|
||||||
|
@ -91,8 +91,8 @@ bool GameState::moveCardToColumn(int columnId)
|
||||||
m_columns[columnId].append(col);
|
m_columns[columnId].append(col);
|
||||||
m_throwawayPile.removeLast();
|
m_throwawayPile.removeLast();
|
||||||
|
|
||||||
emit onThrowawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
emit onColumnsChanged();
|
emit columnsChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ bool GameState::moveCardToColumn(int columnId)
|
||||||
m_throwawayPile.removeLast();
|
m_throwawayPile.removeLast();
|
||||||
ensureColumnRevealed(columnId);
|
ensureColumnRevealed(columnId);
|
||||||
|
|
||||||
emit onThrowawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
emit onColumnsChanged();
|
emit columnsChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ bool GameState::moveThrownCardToFoundation(PlayingCard::Suit foundationId)
|
||||||
// let's remove the card from the throwaway pile.
|
// let's remove the card from the throwaway pile.
|
||||||
m_throwawayPile.removeLast();
|
m_throwawayPile.removeLast();
|
||||||
|
|
||||||
emit onThrowawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ bool GameState::moveColumnCardToFoundation(int columnId, PlayingCard::Suit found
|
||||||
m_columns[columnId].removeFirst();
|
m_columns[columnId].removeFirst();
|
||||||
ensureColumnRevealed(columnId);
|
ensureColumnRevealed(columnId);
|
||||||
|
|
||||||
emit onColumnsChanged();
|
emit columnsChanged();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ bool GameState::tryMoveCardToFoundation(PlayingCard::Suit foundationId, PlayingC
|
||||||
|
|
||||||
m_foundation[foundationId].push_front(cardToMove);
|
m_foundation[foundationId].push_front(cardToMove);
|
||||||
|
|
||||||
emit onFoundationChanged();
|
emit foundationChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
gamestate.h
16
gamestate.h
|
@ -8,10 +8,10 @@
|
||||||
class GameState : public QObject
|
class GameState : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QList<PlayingCard*> drawPile READ drawPile NOTIFY onDrawPileChanged)
|
Q_PROPERTY(QList<PlayingCard*> drawPile READ drawPile NOTIFY drawPileChanged)
|
||||||
Q_PROPERTY(QList<PlayingCard*> throwawayPile READ throwawayPile NOTIFY onThrowawayPileChanged)
|
Q_PROPERTY(QList<PlayingCard*> throwawayPile READ throwawayPile NOTIFY throwawayPileChanged)
|
||||||
Q_PROPERTY(QList<QList<ColumnSlot*>> columns READ columns NOTIFY onColumnsChanged)
|
Q_PROPERTY(QList<QList<ColumnSlot*>> columns READ columns NOTIFY columnsChanged)
|
||||||
Q_PROPERTY(QList<QList<PlayingCard*>> foundation READ foundation NOTIFY onFoundationChanged)
|
Q_PROPERTY(QList<QList<PlayingCard*>> foundation READ foundation NOTIFY foundationChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GameState(QObject *parent = nullptr);
|
explicit GameState(QObject *parent = nullptr);
|
||||||
|
@ -28,10 +28,10 @@ public:
|
||||||
bool moveColumnCardToFoundation(int columnId, PlayingCard::Suit foundationId);
|
bool moveColumnCardToFoundation(int columnId, PlayingCard::Suit foundationId);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onDrawPileChanged();
|
void drawPileChanged();
|
||||||
void onThrowawayPileChanged();
|
void throwawayPileChanged();
|
||||||
void onColumnsChanged();
|
void columnsChanged();
|
||||||
void onFoundationChanged();
|
void foundationChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<PlayingCard*> m_drawPile;
|
QList<PlayingCard*> m_drawPile;
|
||||||
|
|
|
@ -26,7 +26,7 @@ void PlayingCard::setSuit(const PlayingCard::Suit &suit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_suit = suit;
|
m_suit = suit;
|
||||||
emit onSuitChanged();
|
emit suitChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayingCard::Value PlayingCard::value() const
|
PlayingCard::Value PlayingCard::value() const
|
||||||
|
@ -60,7 +60,7 @@ void PlayingCard::setValue(const PlayingCard::Value &value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_value = value;
|
m_value = value;
|
||||||
emit onValueChanged();
|
emit valueChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PlayingCard *> PlayingCard::createDeck()
|
QList<PlayingCard *> PlayingCard::createDeck()
|
||||||
|
|
|
@ -10,11 +10,11 @@ class PlayingCard : public QObject
|
||||||
Q_ENUMS(Value)
|
Q_ENUMS(Value)
|
||||||
Q_ENUMS(Suit)
|
Q_ENUMS(Suit)
|
||||||
|
|
||||||
Q_PROPERTY(Suit suit READ suit WRITE setSuit NOTIFY onSuitChanged REQUIRED)
|
Q_PROPERTY(Suit suit READ suit WRITE setSuit NOTIFY suitChanged REQUIRED)
|
||||||
Q_PROPERTY(Value value READ value WRITE setValue NOTIFY onValueChanged REQUIRED)
|
Q_PROPERTY(Value value READ value WRITE setValue NOTIFY valueChanged REQUIRED)
|
||||||
|
|
||||||
Q_PROPERTY(QString valueString READ valueString NOTIFY onValueChanged)
|
Q_PROPERTY(QString valueString READ valueString NOTIFY valueChanged)
|
||||||
Q_PROPERTY(QString suitString READ suitString NOTIFY onSuitChanged)
|
Q_PROPERTY(QString suitString READ suitString NOTIFY suitChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Value {
|
enum Value {
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
static bool areOppositeColors(const PlayingCard &card1, const PlayingCard &card2);
|
static bool areOppositeColors(const PlayingCard &card1, const PlayingCard &card2);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onSuitChanged();
|
void suitChanged();
|
||||||
void onValueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Suit m_suit;
|
Suit m_suit;
|
||||||
|
|
Loading…
Reference in a new issue