diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index 23d7d6a19..d8af797e9 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -121,6 +121,13 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, 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); zoneContainer = new QGraphicsWidget(this); @@ -138,6 +145,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, zoneHBox->addItem(scrollBarProxy); 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, _isReversed, zoneContainer), @@ -575,3 +587,11 @@ void ZoneViewWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) expandWindow(); } } + +bool ZoneViewWidget::showLibraryLabel(CardZoneLogic *zone, int numberOfCards) +{ + if (zone == nullptr || numberOfCards < 0) { + return false; + } + return zone->getName() == ZoneNames::DECK; +} diff --git a/cockatrice/src/game/zones/view_zone_widget.h b/cockatrice/src/game/zones/view_zone_widget.h index 1246192b8..988da4579 100644 --- a/cockatrice/src/game/zones/view_zone_widget.h +++ b/cockatrice/src/game/zones/view_zone_widget.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -62,6 +63,7 @@ private: QComboBox sortBySelector; QCheckBox shuffleCheckBox; QCheckBox pileViewCheckBox; + QLabel cardLocationLabel; bool canBeShuffled; int extraHeight; @@ -74,6 +76,7 @@ private: void stopWindowDrag(); void startWindowDrag(QGraphicsSceneMouseEvent *event); + bool showLibraryLabel(CardZoneLogic *zone, int numberOfCards); QRectF closeButtonRect(QWidget *styleWidget) const; /** * @brief Resolves the QGraphicsView to use for drag coordinate mapping