mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
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:
parent
c6bfc8b8ea
commit
24b5dab456
10 changed files with 69 additions and 12 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue