mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
[Player] Pull handVisible out of player_info and let graphics_item just determine this on its own. (#6911)
Took 12 minutes Took 15 seconds Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
7a5b2e9f0e
commit
af2f888293
4 changed files with 9 additions and 20 deletions
|
|
@ -158,11 +158,11 @@ void PlayerGraphicsItem::rearrangeZones()
|
|||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
if (mirrored) {
|
||||
if (player->getHandZone()->contentsKnown()) {
|
||||
player->getPlayerInfo()->setHandVisible(true);
|
||||
handVisible = true;
|
||||
handZoneGraphicsItem->setPos(base);
|
||||
base += QPointF(0, handZoneGraphicsItem->boundingRect().height());
|
||||
} else {
|
||||
player->getPlayerInfo()->setHandVisible(false);
|
||||
handVisible = false;
|
||||
}
|
||||
|
||||
stackZoneGraphicsItem->setPos(base);
|
||||
|
|
@ -176,16 +176,16 @@ void PlayerGraphicsItem::rearrangeZones()
|
|||
base += QPointF(0, tableZoneGraphicsItem->boundingRect().height());
|
||||
|
||||
if (player->getHandZone()->contentsKnown()) {
|
||||
player->getPlayerInfo()->setHandVisible(true);
|
||||
handVisible = true;
|
||||
handZoneGraphicsItem->setPos(base);
|
||||
} else {
|
||||
player->getPlayerInfo()->setHandVisible(false);
|
||||
handVisible = false;
|
||||
}
|
||||
}
|
||||
handZoneGraphicsItem->setWidth(tableZoneGraphicsItem->getWidth() +
|
||||
stackZoneGraphicsItem->boundingRect().width());
|
||||
} else {
|
||||
player->getPlayerInfo()->setHandVisible(true);
|
||||
handVisible = true;
|
||||
|
||||
handZoneGraphicsItem->setPos(base);
|
||||
base += QPointF(handZoneGraphicsItem->boundingRect().width(), 0);
|
||||
|
|
@ -195,7 +195,7 @@ void PlayerGraphicsItem::rearrangeZones()
|
|||
|
||||
tableZoneGraphicsItem->setPos(base);
|
||||
}
|
||||
handZoneGraphicsItem->setVisible(player->getPlayerInfo()->getHandVisible());
|
||||
handZoneGraphicsItem->setVisible(handVisible);
|
||||
handZoneGraphicsItem->updateOrientation();
|
||||
tableZoneGraphicsItem->reorganizeCards();
|
||||
updateBoundingRect();
|
||||
|
|
@ -207,8 +207,7 @@ void PlayerGraphicsItem::updateBoundingRect()
|
|||
prepareGeometryChange();
|
||||
qreal width = CardDimensions::HEIGHT_F + 15 + counterAreaWidth + stackZoneGraphicsItem->boundingRect().width();
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
qreal handHeight =
|
||||
player->getPlayerInfo()->getHandVisible() ? handZoneGraphicsItem->boundingRect().height() : 0;
|
||||
qreal handHeight = handVisible ? handZoneGraphicsItem->boundingRect().height() : 0;
|
||||
bRect = QRectF(0, 0, width + tableZoneGraphicsItem->boundingRect().width(),
|
||||
tableZoneGraphicsItem->boundingRect().height() + handHeight);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ private:
|
|||
HandZone *handZoneGraphicsItem;
|
||||
QRectF bRect;
|
||||
bool mirrored;
|
||||
bool handVisible = false;
|
||||
|
||||
private slots:
|
||||
void updateBoundingRect();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "player_info.h"
|
||||
|
||||
PlayerInfo::PlayerInfo(const ServerInfo_User &info, int _id, bool _local, bool _judge)
|
||||
: id(_id), local(_local), judge(_judge), handVisible(false)
|
||||
: id(_id), local(_local), judge(_judge)
|
||||
{
|
||||
userInfo = new ServerInfo_User;
|
||||
userInfo->CopyFrom(info);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ public:
|
|||
int id;
|
||||
bool local;
|
||||
bool judge;
|
||||
bool handVisible;
|
||||
|
||||
int getId() const
|
||||
{
|
||||
|
|
@ -51,16 +50,6 @@ public:
|
|||
return judge;
|
||||
}
|
||||
|
||||
void setHandVisible(bool _handVisible)
|
||||
{
|
||||
handVisible = _handVisible;
|
||||
}
|
||||
|
||||
bool getHandVisible() const
|
||||
{
|
||||
return handVisible;
|
||||
}
|
||||
|
||||
QString getName() const
|
||||
{
|
||||
return QString::fromStdString(userInfo->name());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue