Refactorings
+ added comments + refactored optimumRect
This commit is contained in:
parent
e4e3a1d2e5
commit
aad98756d1
3 changed files with 17 additions and 5 deletions
|
@ -96,7 +96,15 @@ public:
|
||||||
bool getChatMention() const { return chatMention; }
|
bool getChatMention() const { return chatMention; }
|
||||||
bool getZoneViewSortByName() const { return zoneViewSortByName; }
|
bool getZoneViewSortByName() const { return zoneViewSortByName; }
|
||||||
bool getZoneViewSortByType() const { return zoneViewSortByType; }
|
bool getZoneViewSortByType() const { return zoneViewSortByType; }
|
||||||
|
/**
|
||||||
|
Returns if the view should be sorted into pile view.
|
||||||
|
@return zoneViewPileView if the view should be sorted into pile view.
|
||||||
|
*/
|
||||||
bool getZoneViewPileView() const { return zoneViewPileView; }
|
bool getZoneViewPileView() const { return zoneViewPileView; }
|
||||||
|
/**
|
||||||
|
Returns if the view should be shuffled on closing.
|
||||||
|
@return zoneViewShuffle if the view should be shuffled on closing.
|
||||||
|
*/
|
||||||
bool getZoneViewShuffle() const { return zoneViewShuffle; }
|
bool getZoneViewShuffle() const { return zoneViewShuffle; }
|
||||||
bool getSoundEnabled() const { return soundEnabled; }
|
bool getSoundEnabled() const { return soundEnabled; }
|
||||||
QString getSoundPath() const { return soundPath; }
|
QString getSoundPath() const { return soundPath; }
|
||||||
|
|
|
@ -123,6 +123,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
|
||||||
zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer);
|
zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer);
|
||||||
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), this, SLOT(handleWheelEvent(QGraphicsSceneWheelEvent *)));
|
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), this, SLOT(handleWheelEvent(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.
|
||||||
if (numberCards < 0) {
|
if (numberCards < 0) {
|
||||||
connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int)));
|
connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int)));
|
||||||
connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int)));
|
connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int)));
|
||||||
|
|
|
@ -118,10 +118,12 @@ void ZoneViewZone::reorganizeCards()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pileView && sortByType)
|
qreal aleft = 0;
|
||||||
optimumRect = QRectF(0, 0, qMax(typeColumn + 1, 3) * CARD_WIDTH + 20, ((longestRow - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 60);
|
qreal atop = 0;
|
||||||
else
|
qreal awidth = (pileView && sortByType) ? qMax(typeColumn + 1, 3) * CARD_WIDTH + 20 : qMax(cols, 1) * CARD_WIDTH + 20;
|
||||||
optimumRect = QRectF(0, 0, qMax(cols, 1) * CARD_WIDTH + 20, ((rows - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 20);
|
qreal aheight = (pileView && sortByType) ? ((longestRow - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 60 : ((rows - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 20;
|
||||||
|
optimumRect = QRectF(aleft, atop, awidth, aheight);
|
||||||
|
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
emit optimumRectChanged();
|
emit optimumRectChanged();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +136,7 @@ void ZoneViewZone::setPileViewPositions(int cardCount, CardList &cardsToDisplay,
|
||||||
QString cardType = c->getInfo()->getMainCardType();
|
QString cardType = c->getInfo()->getMainCardType();
|
||||||
|
|
||||||
if (i){
|
if (i){
|
||||||
// last card and this card have a matching main type?
|
// if not the first card. Last card and this card have a matching main type?
|
||||||
cardTypeMatch = cardType.compare(cardsToDisplay.at(i-1)->getInfo()->getMainCardType()) == 0 ? true : false;
|
cardTypeMatch = cardType.compare(cardsToDisplay.at(i-1)->getInfo()->getMainCardType()) == 0 ? true : false;
|
||||||
if (!cardTypeMatch) { // if no match then move card to next column
|
if (!cardTypeMatch) { // if no match then move card to next column
|
||||||
typeColumn++;
|
typeColumn++;
|
||||||
|
|
Loading…
Reference in a new issue