leave some documentation on Zone classes (#5199)

* leave some documentation on Zone classes

* small refactor

* undo functional change from refactor and clean up comments

* move variables into if block
This commit is contained in:
RickyRister 2024-11-28 11:40:49 -08:00 committed by GitHub
parent c6bfc8b8ea
commit 24b5dab456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 69 additions and 12 deletions

View file

@ -17,6 +17,15 @@
#include <QStyleOption>
#include <QStyleOptionTitleBar>
/**
* @param _player the player the cards were revealed to.
* @param _origZone the zone the cards were revealed from.
* @param numberCards num of cards to reveal from the zone. Ex: scry the top 3 cards.
* Pass in a negative number to reveal the entire zone.
* -1 specifically will give the option to shuffle the zone upon closing the window.
* @param _revealZone if false, the cards will be face down.
* @param _writeableRevealZone whether the player can interact with the revealed cards.
*/
ZoneViewWidget::ZoneViewWidget(Player *_player,
CardZone *_origZone,
int numberCards,
@ -31,10 +40,10 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
setFlag(ItemIgnoresTransformations);
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
QGraphicsLinearLayout *hPilebox = 0;
// If the number is < 0, then it means that we can give the option to make the area sorted
if (numberCards < 0) {
hPilebox = new QGraphicsLinearLayout(Qt::Horizontal);
QGraphicsLinearLayout *hPilebox = new QGraphicsLinearLayout(Qt::Horizontal);
QGraphicsLinearLayout *hFilterbox = new QGraphicsLinearLayout(Qt::Horizontal);
QGraphicsProxyWidget *sortByNameProxy = new QGraphicsProxyWidget;
@ -57,16 +66,16 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
QGraphicsProxyWidget *pileViewProxy = new QGraphicsProxyWidget;
pileViewProxy->setWidget(&pileViewCheckBox);
hPilebox->addItem(pileViewProxy);
}
if (_origZone->getIsShufflable() && (numberCards == -1)) {
shuffleCheckBox.setChecked(true);
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
shuffleProxy->setWidget(&shuffleCheckBox);
hPilebox->addItem(shuffleProxy);
}
if (_origZone->getIsShufflable() && numberCards == -1) {
shuffleCheckBox.setChecked(true);
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
shuffleProxy->setWidget(&shuffleCheckBox);
hPilebox->addItem(shuffleProxy);
}
vbox->addItem(hPilebox);
vbox->addItem(hPilebox);
}
extraHeight = vbox->sizeHint(Qt::PreferredSize).height();
resize(150, 150);
@ -93,8 +102,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), scrollBarProxy,
SLOT(recieveWheelEvent(QGraphicsSceneWheelEvent *)));
// numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards.
// If the number is < 0 then it means that we can make the area sorted and we dont care about the order.
// only wire up sort options after creating ZoneViewZone, since it segfaults otherwise.
if (numberCards < 0) {
connect(&sortByNameCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSortByName);
connect(&sortByTypeCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSortByType);