diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index 4014e8be..67bad456 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -96,7 +96,15 @@ public: bool getChatMention() const { return chatMention; } bool getZoneViewSortByName() const { return zoneViewSortByName; } 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; } + /** + 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 getSoundEnabled() const { return soundEnabled; } QString getSoundPath() const { return soundPath; } diff --git a/cockatrice/src/zoneviewwidget.cpp b/cockatrice/src/zoneviewwidget.cpp index 41bd24f4..4cf6f992 100644 --- a/cockatrice/src/zoneviewwidget.cpp +++ b/cockatrice/src/zoneviewwidget.cpp @@ -123,6 +123,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer); 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) { connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int))); connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int))); diff --git a/cockatrice/src/zoneviewzone.cpp b/cockatrice/src/zoneviewzone.cpp index 081da2fa..f3bd1064 100644 --- a/cockatrice/src/zoneviewzone.cpp +++ b/cockatrice/src/zoneviewzone.cpp @@ -118,10 +118,12 @@ void ZoneViewZone::reorganizeCards() } } - if (pileView && sortByType) - optimumRect = QRectF(0, 0, qMax(typeColumn + 1, 3) * CARD_WIDTH + 20, ((longestRow - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 60); - else - optimumRect = QRectF(0, 0, qMax(cols, 1) * CARD_WIDTH + 20, ((rows - 1) * CARD_HEIGHT) / 3 + CARD_HEIGHT + 20); + qreal aleft = 0; + qreal atop = 0; + qreal awidth = (pileView && sortByType) ? qMax(typeColumn + 1, 3) * CARD_WIDTH + 20 : qMax(cols, 1) * CARD_WIDTH + 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(); emit optimumRectChanged(); } @@ -134,7 +136,7 @@ void ZoneViewZone::setPileViewPositions(int cardCount, CardList &cardsToDisplay, QString cardType = c->getInfo()->getMainCardType(); 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; if (!cardTypeMatch) { // if no match then move card to next column typeColumn++;