This commit is contained in:
scotland0208 2026-04-25 10:01:48 -03:00 committed by GitHub
commit a94db13601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -121,6 +121,13 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
extraHeight = vbox->sizeHint(Qt::PreferredSize).height(); extraHeight = vbox->sizeHint(Qt::PreferredSize).height();
QGraphicsProxyWidget *cardLocationLabelProxy = new QGraphicsProxyWidget;
cardLocationLabelProxy->setWidget(&cardLocationLabel);
if (!_isReversed && showLibraryLabel(_origZone, numberCards)) {
cardLocationLabel.setText(tr("Top of Library"));
vbox->addItem(cardLocationLabelProxy);
}
QGraphicsLinearLayout *zoneHBox = new QGraphicsLinearLayout(Qt::Horizontal); QGraphicsLinearLayout *zoneHBox = new QGraphicsLinearLayout(Qt::Horizontal);
zoneContainer = new QGraphicsWidget(this); zoneContainer = new QGraphicsWidget(this);
@ -139,6 +146,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
vbox->addItem(zoneHBox); vbox->addItem(zoneHBox);
if (_isReversed && showLibraryLabel(_origZone, numberCards)) {
cardLocationLabel.setText(tr("Bottom of Library"));
vbox->addItem(cardLocationLabelProxy);
}
zone = new ZoneViewZone(new ZoneViewZoneLogic(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zone = new ZoneViewZone(new ZoneViewZoneLogic(player, _origZone, numberCards, _revealZone, _writeableRevealZone,
_isReversed, zoneContainer), _isReversed, zoneContainer),
zoneContainer); zoneContainer);
@ -575,3 +587,11 @@ void ZoneViewWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
expandWindow(); expandWindow();
} }
} }
bool ZoneViewWidget::showLibraryLabel(CardZoneLogic *zone, int numberOfCards)
{
if (zone == nullptr || numberOfCards < 0) {
return false;
}
return zone->getName() == ZoneNames::DECK;
}

View file

@ -12,6 +12,7 @@
#include <QComboBox> #include <QComboBox>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPointer> #include <QPointer>
#include <libcockatrice/utility/macros.h> #include <libcockatrice/utility/macros.h>
@ -62,6 +63,7 @@ private:
QComboBox sortBySelector; QComboBox sortBySelector;
QCheckBox shuffleCheckBox; QCheckBox shuffleCheckBox;
QCheckBox pileViewCheckBox; QCheckBox pileViewCheckBox;
QLabel cardLocationLabel;
bool canBeShuffled; bool canBeShuffled;
int extraHeight; int extraHeight;
@ -74,6 +76,7 @@ private:
void stopWindowDrag(); void stopWindowDrag();
void startWindowDrag(QGraphicsSceneMouseEvent *event); void startWindowDrag(QGraphicsSceneMouseEvent *event);
bool showLibraryLabel(CardZoneLogic *zone, int numberOfCards);
QRectF closeButtonRect(QWidget *styleWidget) const; QRectF closeButtonRect(QWidget *styleWidget) const;
/** /**
* @brief Resolves the QGraphicsView to use for drag coordinate mapping * @brief Resolves the QGraphicsView to use for drag coordinate mapping