diff --git a/cockatrice/cockatrice.pro b/cockatrice/cockatrice.pro
index 6faeeff7..185eda75 100644
--- a/cockatrice/cockatrice.pro
+++ b/cockatrice/cockatrice.pro
@@ -20,6 +20,7 @@ HEADERS += src/counter.h \
src/carditem.h \
src/tablezone.h \
src/handzone.h \
+ src/handcounter.h \
src/carddatabase.h \
src/gameview.h \
src/deck_picturecacher.h \
@@ -73,6 +74,7 @@ SOURCES += src/counter.cpp \
src/carditem.cpp \
src/tablezone.cpp \
src/handzone.cpp \
+ src/handcounter.cpp \
src/carddatabase.cpp \
src/gameview.cpp \
src/deck_picturecacher.cpp \
diff --git a/cockatrice/cockatrice.qrc b/cockatrice/cockatrice.qrc
index 38910b7e..dd3217a6 100644
--- a/cockatrice/cockatrice.qrc
+++ b/cockatrice/cockatrice.qrc
@@ -18,6 +18,7 @@
resources/icon_phase_main2.svg
resources/icon_phase_cleanup.svg
resources/icon_nextturn.svg
+ resources/hand.svg
resources/pencil.svg
resources/icon_search.svg
resources/icon_clearsearch.svg
diff --git a/cockatrice/src/cardzone.cpp b/cockatrice/src/cardzone.cpp
index 050d400e..6cbb4535 100644
--- a/cockatrice/src/cardzone.cpp
+++ b/cockatrice/src/cardzone.cpp
@@ -24,6 +24,7 @@ void CardZone::clearContents()
for (int i = 0; i < cards.size(); i++)
delete cards.at(i);
cards.clear();
+ emit cardCountChanged();
}
QString CardZone::getTranslatedName(bool hisOwn, GrammaticalCase gc) const
@@ -90,6 +91,8 @@ void CardZone::addCard(CardItem *card, bool reorganize, int x, int y)
if (reorganize)
reorganizeCards();
+
+ emit cardCountChanged();
}
CardItem *CardZone::getCard(int cardId, const QString &cardName)
@@ -134,6 +137,7 @@ CardItem *CardZone::takeCard(int position, int cardId, const QString &cardName,
c->setName(cardName);
reorganizeCards();
+ emit cardCountChanged();
return c;
}
diff --git a/cockatrice/src/cardzone.h b/cockatrice/src/cardzone.h
index 8a726101..0c60b3ac 100644
--- a/cockatrice/src/cardzone.h
+++ b/cockatrice/src/cardzone.h
@@ -27,6 +27,8 @@ protected:
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void addCardImpl(CardItem *card, int x, int y) = 0;
+signals:
+ void cardCountChanged();
public slots:
void moveAllToZone();
public:
diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp
index 311c9cf2..21156886 100644
--- a/cockatrice/src/player.cpp
+++ b/cockatrice/src/player.cpp
@@ -8,6 +8,7 @@
#include "pilezone.h"
#include "tablezone.h"
#include "handzone.h"
+#include "handcounter.h"
#include "cardlist.h"
#include "tab_game.h"
#include "protocol_items.h"
@@ -41,9 +42,13 @@ Player::Player(const QString &_name, int _id, bool _local, Client *_client, TabG
PileZone *sb = new PileZone(this, "sb", false, false, this);
sb->setVisible(false);
+ HandCounter *handCounter = new HandCounter(this);
+ handCounter->setPos(base + QPointF(0, 3 * h));
+
table = new TableZone(this, this);
connect(table, SIGNAL(sizeChanged()), this, SLOT(updateBoundingRect()));
hand = new HandZone(this, (int) table->boundingRect().height(), this);
+ connect(hand, SIGNAL(cardCountChanged()), handCounter, SLOT(updateNumber()));
base = QPointF(deck->boundingRect().width() + counterAreaWidth + 5, 0);
hand->setPos(base);