mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 02:53:56 -07:00
* Player refactor. Took 1 hour 43 minutes Took 1 minute Took 23 seconds * Tiny lint. Took 3 minutes * Hook up tap logic again. Took 13 minutes * Fix an include. Took 3 minutes * Stuff. Took 6 minutes * Fix typo. Took 7 minutes * Include. Took 1 minute * Reorganize method/variable definitions, remove unused ones. Took 1 hour 8 minutes Took 24 seconds * Clean up some unused imports. Took 6 minutes * Player holds the deck, emits deckChanged(), other elements player->getDeck() to respond to changes. Took 37 minutes * Connect player->openDeckEditor signal directly in the player constructor Took 6 minutes * Emit openDeckEditor signal in player_actions again. Took 3 minutes * Do to-do's Took 3 hours 32 minutes * Lint. Took 3 minutes * Lint again. Took 2 minutes * Fix include. Took 32 minutes * The stack should ensure card visibility. Took 21 minutes * Fine, the game can remember the tab. Took 10 minutes Took 21 seconds Took 9 seconds * zoneId is a dynamic gameplay property and thus belongs in player.cpp Took 11 minutes Took 19 seconds * Signal view removal, addition. Took 5 minutes * Ensure all players are considered local in local game. Took 10 minutes * ENSURE they are. Took 8 minutes * Bounds check data sent by QAction() Took 54 minutes * Move comment. Took 20 seconds * Reimplement logging category for game_event_handler.cpp, remove linebreaks. Took 36 seconds * PlayerGraphicsItem is responsible for retranslateUi, not Player. Took 14 seconds * Set menu for sideboard again, translate some menu titles, reimplement actIncPT action Took 54 seconds * Comment spacing. Took 43 seconds * Change message_log_widget.cpp slots to take CardZoneLogic parameters as emitted by PlayerEventHandler. Took 7 minutes Took 14 seconds * Remove unused player_logger.cpp Took 2 minutes * Query local game state correctly from tab_supervisor again Took 3 minutes * Revert Deck legality checker. Took 3 minutes * Instantiate menu before graphics item. Took 1 hour 5 minutes Took 55 minutes * Differentiate games and replays. Took 9 seconds * Lint. Took 10 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
84 lines
2.6 KiB
C++
84 lines
2.6 KiB
C++
#ifndef ZONEVIEWERZONE_H
|
|
#define ZONEVIEWERZONE_H
|
|
|
|
#include "../filters/filter_string.h"
|
|
#include "logic/view_zone_logic.h"
|
|
#include "select_zone.h"
|
|
|
|
#include <QGraphicsLayoutItem>
|
|
#include <QLoggingCategory>
|
|
#include <pb/commands.pb.h>
|
|
|
|
inline Q_LOGGING_CATEGORY(ViewZoneLog, "view_zone");
|
|
|
|
class ZoneViewWidget;
|
|
class Response;
|
|
class ServerInfo_Card;
|
|
class QGraphicsSceneWheelEvent;
|
|
|
|
/**
|
|
* A CardZone that is a view into another CardZone.
|
|
* If this zone is writable, then modifications to this zone will be reflected in the underlying zone.
|
|
*
|
|
* Most interactions with StackZones are handled through a zone view.
|
|
* For example, viewing the deck/graveyard/exile is handled through a view.
|
|
*
|
|
* Handles both limited reveals (eg. look at top X cards) and full zone reveals (eg. searching the deck).
|
|
*/
|
|
class ZoneViewZone : public SelectZone, public QGraphicsLayoutItem
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(QGraphicsLayoutItem)
|
|
private:
|
|
static constexpr int HORIZONTAL_PADDING = 12;
|
|
static constexpr int VERTICAL_PADDING = 5;
|
|
|
|
QRectF bRect, optimumRect;
|
|
int minRows;
|
|
FilterString filterString = FilterString("");
|
|
CardList::SortOption groupBy, sortBy;
|
|
bool pileView;
|
|
|
|
struct GridSize
|
|
{
|
|
int rows;
|
|
int cols;
|
|
};
|
|
|
|
GridSize positionCardsForDisplay(CardList &cards, CardList::SortOption pileOption = CardList::NoSort);
|
|
|
|
void
|
|
handleDropEvent(const QList<CardDragItem *> &dragItems, CardZoneLogic *startZone, const QPoint &dropPoint) override;
|
|
|
|
public:
|
|
ZoneViewZone(ZoneViewZoneLogic *_logic, QGraphicsItem *parent);
|
|
QRectF boundingRect() const override;
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
void reorganizeCards() override;
|
|
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
|
|
void setGeometry(const QRectF &rect) override;
|
|
QRectF getOptimumRect() const
|
|
{
|
|
return optimumRect;
|
|
}
|
|
public slots:
|
|
void addToViews();
|
|
void removeFromViews();
|
|
void close();
|
|
void setFilterString(const QString &_filterString);
|
|
void setGroupBy(CardList::SortOption _groupBy);
|
|
void setSortBy(CardList::SortOption _sortBy);
|
|
void setPileView(int _pileView);
|
|
private slots:
|
|
void zoneDumpReceived(const Response &r);
|
|
signals:
|
|
void closed();
|
|
void optimumRectChanged();
|
|
void wheelEventReceived(QGraphicsSceneWheelEvent *event);
|
|
|
|
protected:
|
|
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
|
|
void wheelEvent(QGraphicsSceneWheelEvent *event) override;
|
|
};
|
|
|
|
#endif
|