Mark more functions as [[nodiscard]] (#6320)

* Fix local variable double declaration.

Took 44 seconds

* Mark functions as [[nodiscard]]

Took 31 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-11-16 01:39:24 +01:00 committed by GitHub
parent 27708d5964
commit 73763b5ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 258 additions and 257 deletions

View file

@ -57,27 +57,27 @@ protected:
} }
public: public:
QString getName() const [[nodiscard]] QString getName() const
{ {
return name; return name;
} }
QString getDescriptionUrl() const [[nodiscard]] QString getDescriptionUrl() const
{ {
return descriptionUrl; return descriptionUrl;
} }
QString getDownloadUrl() const [[nodiscard]] QString getDownloadUrl() const
{ {
return downloadUrl; return downloadUrl;
} }
QString getCommitHash() const [[nodiscard]] QString getCommitHash() const
{ {
return commitHash; return commitHash;
} }
QDate getPublishDate() const [[nodiscard]] QDate getPublishDate() const
{ {
return publishDate; return publishDate;
} }
bool isCompatibleVersionFound() const [[nodiscard]] bool isCompatibleVersionFound() const
{ {
return compatibleVersionFound; return compatibleVersionFound;
} }
@ -97,15 +97,15 @@ protected:
protected: protected:
static bool downloadMatchesCurrentOS(const QString &fileName); static bool downloadMatchesCurrentOS(const QString &fileName);
virtual QString getReleaseChannelUrl() const = 0; [[nodiscard]] virtual QString getReleaseChannelUrl() const = 0;
public: public:
Release *getLastRelease() Release *getLastRelease()
{ {
return lastRelease; return lastRelease;
} }
virtual QString getManualDownloadUrl() const = 0; [[nodiscard]] virtual QString getManualDownloadUrl() const = 0;
virtual QString getName() const = 0; [[nodiscard]] virtual QString getName() const = 0;
void checkForUpdates(); void checkForUpdates();
signals: signals:
void finishedCheck(bool needToUpdate, bool isCompatible, Release *release); void finishedCheck(bool needToUpdate, bool isCompatible, Release *release);
@ -122,12 +122,12 @@ public:
explicit StableReleaseChannel() = default; explicit StableReleaseChannel() = default;
~StableReleaseChannel() override = default; ~StableReleaseChannel() override = default;
QString getManualDownloadUrl() const override; [[nodiscard]] QString getManualDownloadUrl() const override;
QString getName() const override; [[nodiscard]] QString getName() const override;
protected: protected:
QString getReleaseChannelUrl() const override; [[nodiscard]] QString getReleaseChannelUrl() const override;
protected slots: protected slots:
void releaseListFinished() override; void releaseListFinished() override;
@ -143,12 +143,12 @@ public:
BetaReleaseChannel() = default; BetaReleaseChannel() = default;
~BetaReleaseChannel() override = default; ~BetaReleaseChannel() override = default;
QString getManualDownloadUrl() const override; [[nodiscard]] QString getManualDownloadUrl() const override;
QString getName() const override; [[nodiscard]] QString getName() const override;
protected: protected:
QString getReleaseChannelUrl() const override; [[nodiscard]] QString getReleaseChannelUrl() const override;
protected slots: protected slots:
void releaseListFinished() override; void releaseListFinished() override;

View file

@ -27,22 +27,22 @@ public:
{ {
Type = typeCardDrag Type = typeCardDrag
}; };
int type() const override [[nodiscard]] int type() const override
{ {
return Type; return Type;
} }
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0); AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
QRectF boundingRect() const override [[nodiscard]] QRectF boundingRect() const override
{ {
return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT); return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT);
} }
QPainterPath shape() const override; [[nodiscard]] QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
AbstractCardItem *getItem() const [[nodiscard]] AbstractCardItem *getItem() const
{ {
return item; return item;
} }
QPointF getHotSpot() const [[nodiscard]] QPointF getHotSpot() const
{ {
return hotSpot; return hotSpot;
} }

View file

@ -36,22 +36,22 @@ public:
ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color); ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
~ArrowItem() override; ~ArrowItem() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QRectF boundingRect() const override [[nodiscard]] QRectF boundingRect() const override
{ {
return path.boundingRect(); return path.boundingRect();
} }
QPainterPath shape() const override [[nodiscard]] QPainterPath shape() const override
{ {
return path; return path;
} }
void updatePath(); void updatePath();
void updatePath(const QPointF &endPoint); void updatePath(const QPointF &endPoint);
int getId() const [[nodiscard]] int getId() const
{ {
return id; return id;
} }
Player *getPlayer() const [[nodiscard]] Player *getPlayer() const
{ {
return player; return player;
} }
@ -63,11 +63,11 @@ public:
{ {
targetItem = _item; targetItem = _item;
} }
ArrowTarget *getStartItem() const [[nodiscard]] ArrowTarget *getStartItem() const
{ {
return startItem; return startItem;
} }
ArrowTarget *getTargetItem() const [[nodiscard]] ArrowTarget *getTargetItem() const
{ {
return targetItem; return targetItem;
} }

View file

@ -28,18 +28,18 @@ public:
explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr); explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
~ArrowTarget() override; ~ArrowTarget() override;
Player *getOwner() const [[nodiscard]] Player *getOwner() const
{ {
return owner; return owner;
} }
void setBeingPointedAt(bool _beingPointedAt); void setBeingPointedAt(bool _beingPointedAt);
bool getBeingPointedAt() const [[nodiscard]] bool getBeingPointedAt() const
{ {
return beingPointedAt; return beingPointedAt;
} }
const QList<ArrowItem *> &getArrowsFrom() const [[nodiscard]] const QList<ArrowItem *> &getArrowsFrom() const
{ {
return arrowsFrom; return arrowsFrom;
} }
@ -51,7 +51,7 @@ public:
{ {
arrowsFrom.removeOne(arrow); arrowsFrom.removeOne(arrow);
} }
const QList<ArrowItem *> &getArrowsTo() const [[nodiscard]] const QList<ArrowItem *> &getArrowsTo() const
{ {
return arrowsTo; return arrowsTo;
} }

View file

@ -51,7 +51,7 @@ public:
{ {
Type = typeCard Type = typeCard
}; };
int type() const override [[nodiscard]] int type() const override
{ {
return Type; return Type;
} }
@ -62,13 +62,13 @@ public:
CardZoneLogic *_zone = nullptr); CardZoneLogic *_zone = nullptr);
void retranslateUi(); void retranslateUi();
CardZoneLogic *getZone() const [[nodiscard]] CardZoneLogic *getZone() const
{ {
return zone; return zone;
} }
void setZone(CardZoneLogic *_zone); void setZone(CardZoneLogic *_zone);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QPoint getGridPoint() const [[nodiscard]] QPoint getGridPoint() const
{ {
return gridPoint; return gridPoint;
} }
@ -76,11 +76,11 @@ public:
{ {
gridPoint = _gridPoint; gridPoint = _gridPoint;
} }
QPoint getGridPos() const [[nodiscard]] QPoint getGridPos() const
{ {
return gridPoint; return gridPoint;
} }
Player *getOwner() const [[nodiscard]] Player *getOwner() const
{ {
return owner; return owner;
} }
@ -88,32 +88,32 @@ public:
{ {
owner = _owner; owner = _owner;
} }
bool getAttacking() const [[nodiscard]] bool getAttacking() const
{ {
return attacking; return attacking;
} }
void setAttacking(bool _attacking); void setAttacking(bool _attacking);
const QMap<int, int> &getCounters() const [[nodiscard]] const QMap<int, int> &getCounters() const
{ {
return counters; return counters;
} }
void setCounter(int _id, int _value); void setCounter(int _id, int _value);
QString getAnnotation() const [[nodiscard]] QString getAnnotation() const
{ {
return annotation; return annotation;
} }
void setAnnotation(const QString &_annotation); void setAnnotation(const QString &_annotation);
bool getDoesntUntap() const [[nodiscard]] bool getDoesntUntap() const
{ {
return doesntUntap; return doesntUntap;
} }
void setDoesntUntap(bool _doesntUntap); void setDoesntUntap(bool _doesntUntap);
QString getPT() const [[nodiscard]] QString getPT() const
{ {
return pt; return pt;
} }
void setPT(const QString &_pt); void setPT(const QString &_pt);
bool getDestroyOnZoneChange() const [[nodiscard]] bool getDestroyOnZoneChange() const
{ {
return destroyOnZoneChange; return destroyOnZoneChange;
} }
@ -121,7 +121,7 @@ public:
{ {
destroyOnZoneChange = _destroy; destroyOnZoneChange = _destroy;
} }
CardItem *getAttachedTo() const [[nodiscard]] CardItem *getAttachedTo() const
{ {
return attachedTo; return attachedTo;
} }
@ -134,7 +134,7 @@ public:
{ {
attachedCards.removeOne(card); attachedCards.removeOne(card);
} }
const QList<CardItem *> &getAttachedCards() const [[nodiscard]] const QList<CardItem *> &getAttachedCards() const
{ {
return attachedCards; return attachedCards;
} }

View file

@ -35,7 +35,7 @@ public:
const QString &_originZone = QString()); const QString &_originZone = QString());
~DeckViewCard() override; ~DeckViewCard() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
const QString &getOriginZone() const [[nodiscard]] const QString &getOriginZone() const
{ {
return originZone; return originZone;
} }
@ -71,34 +71,34 @@ private:
QMultiMap<QString, DeckViewCard *> cardsByType; QMultiMap<QString, DeckViewCard *> cardsByType;
QList<QPair<int, int>> currentRowsAndCols; QList<QPair<int, int>> currentRowsAndCols;
qreal width, height; qreal width, height;
int getCardTypeTextWidth() const; [[nodiscard]] int getCardTypeTextWidth() const;
public: public:
enum enum
{ {
Type = typeDeckViewCardContainer Type = typeDeckViewCardContainer
}; };
int type() const override [[nodiscard]] int type() const override
{ {
return Type; return Type;
} }
explicit DeckViewCardContainer(const QString &_name); explicit DeckViewCardContainer(const QString &_name);
QRectF boundingRect() const override; [[nodiscard]] QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void addCard(DeckViewCard *card); void addCard(DeckViewCard *card);
void removeCard(DeckViewCard *card); void removeCard(DeckViewCard *card);
const QList<DeckViewCard *> &getCards() const [[nodiscard]] const QList<DeckViewCard *> &getCards() const
{ {
return cards; return cards;
} }
const QString &getName() const [[nodiscard]] const QString &getName() const
{ {
return name; return name;
} }
void setWidth(qreal _width); void setWidth(qreal _width);
QList<QPair<int, int>> getRowsAndCols() const; [[nodiscard]] QList<QPair<int, int>> getRowsAndCols() const;
QSizeF calculateBoundingRect(const QList<QPair<int, int>> &rowsAndCols) const; [[nodiscard]] QSizeF calculateBoundingRect(const QList<QPair<int, int>> &rowsAndCols) const;
void rearrangeItems(const QList<QPair<int, int>> &rowsAndCols); void rearrangeItems(const QList<QPair<int, int>> &rowsAndCols);
}; };
@ -123,7 +123,7 @@ public:
{ {
locked = _locked; locked = _locked;
} }
bool getLocked() const [[nodiscard]] bool getLocked() const
{ {
return locked; return locked;
} }
@ -135,7 +135,7 @@ public:
} }
void rearrangeItems(); void rearrangeItems();
void updateContents(); void updateContents();
QList<MoveCard_ToZone> getSideboardPlan() const; [[nodiscard]] QList<MoveCard_ToZone> getSideboardPlan() const;
void resetSideboardPlan(); void resetSideboardPlan();
void applySideboardPlan(const QList<MoveCard_ToZone> &plan); void applySideboardPlan(const QList<MoveCard_ToZone> &plan);
}; };
@ -162,7 +162,7 @@ public:
{ {
deckViewScene->setLocked(_locked); deckViewScene->setLocked(_locked);
} }
QList<MoveCard_ToZone> getSideboardPlan() const [[nodiscard]] QList<MoveCard_ToZone> getSideboardPlan() const
{ {
return deckViewScene->getSideboardPlan(); return deckViewScene->getSideboardPlan();
} }

View file

@ -32,7 +32,7 @@ signals:
public: public:
explicit ToggleButton(QWidget *parent = nullptr); explicit ToggleButton(QWidget *parent = nullptr);
bool getState() const [[nodiscard]] bool getState() const
{ {
return state; return state;
} }

View file

@ -39,7 +39,7 @@ class DlgCreateToken : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr); explicit DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr);
TokenInfo getTokenInfo() const; [[nodiscard]] TokenInfo getTokenInfo() const;
protected: protected:
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;

View file

@ -34,10 +34,10 @@ public:
QStringList exprs = QStringList(), QStringList exprs = QStringList(),
uint numberOfHits = 1, uint numberOfHits = 1,
bool autoPlay = false); bool autoPlay = false);
QString getExpr() const; [[nodiscard]] QString getExpr() const;
QStringList getExprs() const; [[nodiscard]] QStringList getExprs() const;
uint getNumberOfHits() const; [[nodiscard]] uint getNumberOfHits() const;
bool isAutoPlay() const; [[nodiscard]] bool isAutoPlay() const;
}; };
#endif // DLG_MOVE_TOP_CARDS_UNTIL_H #endif // DLG_MOVE_TOP_CARDS_UNTIL_H

View file

@ -45,10 +45,10 @@ public:
QGraphicsItem *parent = nullptr, QGraphicsItem *parent = nullptr,
QAction *_doubleClickAction = nullptr, QAction *_doubleClickAction = nullptr,
bool _highlightable = true); bool _highlightable = true);
QRectF boundingRect() const override; [[nodiscard]] QRectF boundingRect() const override;
void setWidth(double _width); void setWidth(double _width);
void setActive(bool _active); void setActive(bool _active);
bool getActive() const [[nodiscard]] bool getActive() const
{ {
return active; return active;
} }
@ -77,18 +77,18 @@ private:
public: public:
explicit PhasesToolbar(QGraphicsItem *parent = nullptr); explicit PhasesToolbar(QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override; [[nodiscard]] QRectF boundingRect() const override;
void retranslateUi(); void retranslateUi();
void setHeight(double _height); void setHeight(double _height);
double getWidth() const [[nodiscard]] double getWidth() const
{ {
return width; return width;
} }
int phaseCount() const [[nodiscard]] int phaseCount() const
{ {
return buttonList.size(); return buttonList.size();
} }
QString getLongPhaseName(int phase) const; [[nodiscard]] QString getLongPhaseName(int phase) const;
public slots: public slots:
void setActivePhase(int phase); void setActivePhase(int phase);
void triggerPhaseAction(int phase); void triggerPhaseAction(int phase);

View file

@ -49,15 +49,15 @@ public:
} }
// expose useful actions/menus if PlayerMenu needs them // expose useful actions/menus if PlayerMenu needs them
QMenu *revealLibrary() const [[nodiscard]] QMenu *revealLibrary() const
{ {
return mRevealLibrary; return mRevealLibrary;
} }
QMenu *lendLibraryMenu() const [[nodiscard]] QMenu *lendLibraryMenu() const
{ {
return mLendLibrary; return mLendLibrary;
} }
QMenu *revealTopCardMenu() const [[nodiscard]] QMenu *revealTopCardMenu() const
{ {
return mRevealTopCard; return mRevealTopCard;
} }

View file

@ -61,7 +61,7 @@ public:
return utilityMenu; return utilityMenu;
} }
bool getShortcutsActive() const [[nodiscard]] bool getShortcutsActive() const
{ {
return shortcutsActive; return shortcutsActive;
} }

View file

@ -63,7 +63,7 @@ public:
void moveOneCardUntil(CardItem *card); void moveOneCardUntil(CardItem *card);
void stopMoveTopCardsUntil(); void stopMoveTopCardsUntil();
bool isMovingCardsUntil() const [[nodiscard]] bool isMovingCardsUntil() const
{ {
return movingCardsUntil; return movingCardsUntil;
} }

View file

@ -28,13 +28,13 @@ public:
{ {
Type = typeOther Type = typeOther
}; };
int type() const override [[nodiscard]] int type() const override
{ {
return Type; return Type;
} }
explicit PlayerArea(QGraphicsItem *parent = nullptr); explicit PlayerArea(QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override [[nodiscard]] QRectF boundingRect() const override
{ {
return bRect; return bRect;
} }
@ -43,7 +43,7 @@ public:
void setSize(qreal width, qreal height); void setSize(qreal width, qreal height);
void setPlayerZoneId(int _playerZoneId); void setPlayerZoneId(int _playerZoneId);
int getPlayerZoneId() const [[nodiscard]] int getPlayerZoneId() const
{ {
return playerZoneId; return playerZoneId;
} }

View file

@ -27,39 +27,39 @@ public:
bool localPlayerIsSpectator; bool localPlayerIsSpectator;
QMap<int, ServerInfo_User> spectators; QMap<int, ServerInfo_User> spectators;
bool isSpectator() const [[nodiscard]] bool isSpectator() const
{ {
return localPlayerIsSpectator; return localPlayerIsSpectator;
} }
bool isJudge() const [[nodiscard]] bool isJudge() const
{ {
return localPlayerIsJudge; return localPlayerIsJudge;
} }
int getLocalPlayerId() const [[nodiscard]] int getLocalPlayerId() const
{ {
return localPlayerId; return localPlayerId;
} }
const QMap<int, Player *> &getPlayers() const [[nodiscard]] const QMap<int, Player *> &getPlayers() const
{ {
return players; return players;
} }
int getPlayerCount() const [[nodiscard]] int getPlayerCount() const
{ {
return players.size(); return players.size();
} }
Player *getActiveLocalPlayer(int activePlayer) const; [[nodiscard]] Player *getActiveLocalPlayer(int activePlayer) const;
bool isLocalPlayer(int playerId); bool isLocalPlayer(int playerId);
Player *addPlayer(int playerId, const ServerInfo_User &info); Player *addPlayer(int playerId, const ServerInfo_User &info);
void removePlayer(int playerId); void removePlayer(int playerId);
Player *getPlayer(int playerId) const; [[nodiscard]] Player *getPlayer(int playerId) const;
void onPlayerConceded(int playerId, bool conceded); void onPlayerConceded(int playerId, bool conceded);
@ -70,17 +70,17 @@ public:
return playerId == getLocalPlayerId(); return playerId == getLocalPlayerId();
} }
const QMap<int, ServerInfo_User> &getSpectators() const [[nodiscard]] const QMap<int, ServerInfo_User> &getSpectators() const
{ {
return spectators; return spectators;
} }
ServerInfo_User getSpectator(int playerId) const [[nodiscard]] ServerInfo_User getSpectator(int playerId) const
{ {
return spectators.value(playerId); return spectators.value(playerId);
} }
QString getSpectatorName(int spectatorId) const [[nodiscard]] QString getSpectatorName(int spectatorId) const
{ {
return QString::fromStdString(spectators.value(spectatorId).name()); return QString::fromStdString(spectators.value(spectatorId).name());
} }
@ -100,7 +100,7 @@ public:
emit spectatorRemoved(spectatorId, spectatorInfo); emit spectatorRemoved(spectatorId, spectatorInfo);
} }
AbstractGame *getGame() const [[nodiscard]] AbstractGame *getGame() const
{ {
return game; return game;
} }

View file

@ -63,16 +63,16 @@ public:
{ {
cards.sortBy(options); cards.sortBy(options);
} }
QString getName() const [[nodiscard]] QString getName() const
{ {
return name; return name;
} }
QString getTranslatedName(bool theirOwn, GrammaticalCase gc) const; [[nodiscard]] QString getTranslatedName(bool theirOwn, GrammaticalCase gc) const;
Player *getPlayer() const [[nodiscard]] Player *getPlayer() const
{ {
return player; return player;
} }
bool contentsKnown() const [[nodiscard]] bool contentsKnown() const
{ {
return cards.getContentsKnown(); return cards.getContentsKnown();
} }
@ -84,15 +84,15 @@ public:
{ {
alwaysRevealTopCard = _alwaysRevealTopCard; alwaysRevealTopCard = _alwaysRevealTopCard;
} }
bool getAlwaysRevealTopCard() const [[nodiscard]] bool getAlwaysRevealTopCard() const
{ {
return alwaysRevealTopCard; return alwaysRevealTopCard;
} }
bool getHasCardAttr() const [[nodiscard]] bool getHasCardAttr() const
{ {
return hasCardAttr; return hasCardAttr;
} }
bool getIsShufflable() const [[nodiscard]] bool getIsShufflable() const
{ {
return isShufflable; return isShufflable;
} }

View file

@ -84,7 +84,7 @@ private:
*/ */
bool active = false; bool active = false;
bool isInverted() const; [[nodiscard]] bool isInverted() const;
private slots: private slots:
/** /**
@ -110,7 +110,7 @@ public:
/** /**
@return a QRectF of the TableZone bounding box. @return a QRectF of the TableZone bounding box.
*/ */
QRectF boundingRect() const override; [[nodiscard]] QRectF boundingRect() const override;
/** /**
Render the TableZone Render the TableZone
@ -140,12 +140,12 @@ public:
/** /**
@return CardItem from grid location @return CardItem from grid location
*/ */
CardItem *getCardFromGrid(const QPoint &gridPoint) const; [[nodiscard]] CardItem *getCardFromGrid(const QPoint &gridPoint) const;
/** /**
@return CardItem from coordinate location @return CardItem from coordinate location
*/ */
CardItem *getCardFromCoords(const QPointF &point) const; [[nodiscard]] CardItem *getCardFromCoords(const QPointF &point) const;
QPointF closestGridPoint(const QPointF &point) override; QPointF closestGridPoint(const QPointF &point) override;
@ -157,7 +157,7 @@ public:
*/ */
void resizeToContents(); void resizeToContents();
int getMinimumWidth() const [[nodiscard]] int getMinimumWidth() const
{ {
return currentMinimumWidth; return currentMinimumWidth;
} }
@ -166,7 +166,7 @@ public:
prepareGeometryChange(); prepareGeometryChange();
width = _width; width = _width;
} }
qreal getWidth() const [[nodiscard]] qreal getWidth() const
{ {
return width; return width;
} }
@ -188,13 +188,13 @@ private:
/* /*
Mapping functions for points to/from gridpoints. Mapping functions for points to/from gridpoints.
*/ */
QPointF mapFromGrid(QPoint gridPoint) const; [[nodiscard]] QPointF mapFromGrid(QPoint gridPoint) const;
QPoint mapToGrid(const QPointF &mapPoint) const; [[nodiscard]] QPoint mapToGrid(const QPointF &mapPoint) const;
/* /*
Helper function to create a single key from a card stack location. Helper function to create a single key from a card stack location.
*/ */
int getCardStackMapKey(int x, int y) const [[nodiscard]] int getCardStackMapKey(int x, int y) const
{ {
return x + (y * 1000); return x + (y * 1000);
} }

View file

@ -58,12 +58,12 @@ private:
public: public:
ZoneViewZone(ZoneViewZoneLogic *_logic, QGraphicsItem *parent); ZoneViewZone(ZoneViewZoneLogic *_logic, QGraphicsItem *parent);
QRectF boundingRect() const override; [[nodiscard]] QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards() override; void reorganizeCards() override;
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>()); void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
void setGeometry(const QRectF &rect) override; void setGeometry(const QRectF &rect) override;
QRectF getOptimumRect() const [[nodiscard]] QRectF getOptimumRect() const
{ {
return optimumRect; return optimumRect;
} }
@ -83,7 +83,7 @@ signals:
void wheelEventReceived(QGraphicsSceneWheelEvent *event); void wheelEventReceived(QGraphicsSceneWheelEvent *event);
protected: protected:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override; [[nodiscard]] QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
void wheelEvent(QGraphicsSceneWheelEvent *event) override; void wheelEvent(QGraphicsSceneWheelEvent *event) override;
}; };

View file

@ -46,7 +46,7 @@ public:
} }
/** Returns whether the request has finished */ /** Returns whether the request has finished */
bool getFinished() const [[nodiscard]] bool getFinished() const
{ {
return finished->text() == "True"; return finished->text() == "True";
} }
@ -74,13 +74,13 @@ public:
} }
/** Returns the start time as a string */ /** Returns the start time as a string */
QString getStartTime() const [[nodiscard]] QString getStartTime() const
{ {
return startTime->text(); return startTime->text();
} }
/** Returns the URL of the request */ /** Returns the URL of the request */
QString getUrl() const [[nodiscard]] QString getUrl() const
{ {
return url->text(); return url->text();
} }

View file

@ -117,7 +117,7 @@ private:
QSet<QString> currentlyLoading; ///< Deduplication: contains pixmapCacheKey currently being loaded QSet<QString> currentlyLoading; ///< Deduplication: contains pixmapCacheKey currently being loaded
/** @brief Returns cached redirect URL for the given original URL, if available. */ /** @brief Returns cached redirect URL for the given original URL, if available. */
QUrl getCachedRedirect(const QUrl &originalUrl) const; [[nodiscard]] QUrl getCachedRedirect(const QUrl &originalUrl) const;
/** @brief Loads redirect cache from disk. */ /** @brief Loads redirect cache from disk. */
void loadRedirectCache(); void loadRedirectCache();

View file

@ -37,25 +37,25 @@ public:
explicit CardPictureToLoad(const ExactCard &_card); explicit CardPictureToLoad(const ExactCard &_card);
/** @return The card being loaded. */ /** @return The card being loaded. */
const ExactCard &getCard() const [[nodiscard]] const ExactCard &getCard() const
{ {
return card; return card;
} }
/** @return The current URL being attempted. */ /** @return The current URL being attempted. */
QString getCurrentUrl() const [[nodiscard]] QString getCurrentUrl() const
{ {
return currentUrl; return currentUrl;
} }
/** @return The current set being attempted. */ /** @return The current set being attempted. */
CardSetPtr getCurrentSet() const [[nodiscard]] CardSetPtr getCurrentSet() const
{ {
return currentSet; return currentSet;
} }
/** @return The short name of the current set, or empty string if no set. */ /** @return The short name of the current set, or empty string if no set. */
QString getSetName() const; [[nodiscard]] QString getSetName() const;
/** /**
* @brief Transforms a URL template into a concrete URL for this card/set. * @brief Transforms a URL template into a concrete URL for this card/set.

View file

@ -27,18 +27,18 @@ public:
void insertWidgetAtIndex(QWidget *toInsert, int index); void insertWidgetAtIndex(QWidget *toInsert, int index);
void addItem(QLayoutItem *item) override; void addItem(QLayoutItem *item) override;
int count() const override; [[nodiscard]] int count() const override;
QLayoutItem *itemAt(int index) const override; [[nodiscard]] QLayoutItem *itemAt(int index) const override;
QLayoutItem *takeAt(int index) override; QLayoutItem *takeAt(int index) override;
void setGeometry(const QRect &rect) override; void setGeometry(const QRect &rect) override;
QSize minimumSize() const override; [[nodiscard]] QSize minimumSize() const override;
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
void setMaxColumns(int _maxColumns); void setMaxColumns(int _maxColumns);
void setMaxRows(int _maxRows); void setMaxRows(int _maxRows);
int calculateMaxColumns() const; [[nodiscard]] int calculateMaxColumns() const;
int calculateRowsForColumns(int columns) const; [[nodiscard]] int calculateRowsForColumns(int columns) const;
int calculateMaxRows() const; [[nodiscard]] int calculateMaxRows() const;
int calculateColumnsForRows(int rows) const; [[nodiscard]] int calculateColumnsForRows(int rows) const;
void setDirection(Qt::Orientation _direction); void setDirection(Qt::Orientation _direction);
private: private:
@ -50,7 +50,7 @@ private:
Qt::Orientation flowDirection; Qt::Orientation flowDirection;
// Calculate the preferred size of the layout // Calculate the preferred size of the layout
QSize calculatePreferredSize() const; [[nodiscard]] QSize calculatePreferredSize() const;
}; };
#endif // OVERLAP_LAYOUT_H #endif // OVERLAP_LAYOUT_H

View file

@ -20,15 +20,15 @@ public:
void toggleSymbol(); void toggleSymbol();
void setColorActive(bool active); void setColorActive(bool active);
void updateOpacity(); void updateOpacity();
bool isColorActive() const [[nodiscard]] bool isColorActive() const
{ {
return isActive; return isActive;
}; };
QString getSymbol() const [[nodiscard]] QString getSymbol() const
{ {
return symbol; return symbol;
}; };
QChar getSymbolChar() const [[nodiscard]] QChar getSymbolChar() const
{ {
return symbol[0]; return symbol[0];
}; };

View file

@ -233,9 +233,7 @@ ExactCard DeckEditorDeckDockWidget::getCurrentCard()
const QString zoneName = gparent.sibling(gparent.row(), 1).data(Qt::EditRole).toString(); const QString zoneName = gparent.sibling(gparent.row(), 1).data(Qt::EditRole).toString();
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) { if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
QString cardName = current.sibling(current.row(), 1).data().toString(); if (ExactCard selectedCard = CardDatabaseManager::query()->getCard({cardName, cardProviderID})) {
QString providerId = current.sibling(current.row(), 4).data().toString();
if (ExactCard selectedCard = CardDatabaseManager::query()->getCard({cardName, providerId})) {
return selectedCard; return selectedCard;
} }
} }

View file

@ -9,7 +9,7 @@ class DeckListStyleProxy : public QIdentityProxyModel
public: public:
using QIdentityProxyModel::QIdentityProxyModel; using QIdentityProxyModel::QIdentityProxyModel;
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
}; };
#endif // COCKATRICE_DECK_LIST_STYLE_PROXY_H #endif // COCKATRICE_DECK_LIST_STYLE_PROXY_H

View file

@ -34,16 +34,16 @@ signals:
public: public:
explicit DlgConnect(QWidget *parent = nullptr); explicit DlgConnect(QWidget *parent = nullptr);
~DlgConnect() override; ~DlgConnect() override;
QString getHost() const; [[nodiscard]] QString getHost() const;
int getPort() const [[nodiscard]] int getPort() const
{ {
return portEdit->text().toInt(); return portEdit->text().toInt();
} }
QString getPlayerName() const [[nodiscard]] QString getPlayerName() const
{ {
return playernameEdit->text(); return playernameEdit->text();
} }
QString getPassword() const [[nodiscard]] QString getPassword() const
{ {
return passwordEdit->text(); return passwordEdit->text();
} }

View file

@ -23,15 +23,15 @@ public:
QString email = QString(), QString email = QString(),
QString country = QString(), QString country = QString(),
QString realName = QString()); QString realName = QString());
QString getEmail() const [[nodiscard]] QString getEmail() const
{ {
return emailEdit->text(); return emailEdit->text();
} }
QString getCountry() const [[nodiscard]] QString getCountry() const
{ {
return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText(); return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText();
} }
QString getRealName() const [[nodiscard]] QString getRealName() const
{ {
return realnameEdit->text(); return realnameEdit->text();
} }

View file

@ -20,19 +20,19 @@ class DlgForgotPasswordChallenge : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit DlgForgotPasswordChallenge(QWidget *parent = nullptr); explicit DlgForgotPasswordChallenge(QWidget *parent = nullptr);
QString getHost() const [[nodiscard]] QString getHost() const
{ {
return hostEdit->text(); return hostEdit->text();
} }
int getPort() const [[nodiscard]] int getPort() const
{ {
return portEdit->text().toInt(); return portEdit->text().toInt();
} }
QString getPlayerName() const [[nodiscard]] QString getPlayerName() const
{ {
return playernameEdit->text(); return playernameEdit->text();
} }
QString getEmail() const [[nodiscard]] QString getEmail() const
{ {
return emailEdit->text(); return emailEdit->text();
} }

View file

@ -39,7 +39,7 @@ public:
* to use it, since otherwise it will get destroyed once this dlg is destroyed * to use it, since otherwise it will get destroyed once this dlg is destroyed
* @return The DeckLoader * @return The DeckLoader
*/ */
virtual DeckLoader *getDeckList() const = 0; [[nodiscard]] virtual DeckLoader *getDeckList() const = 0;
protected: protected:
void setText(const QString &text); void setText(const QString &text);
@ -67,7 +67,7 @@ private:
public: public:
explicit DlgLoadDeckFromClipboard(QWidget *parent = nullptr); explicit DlgLoadDeckFromClipboard(QWidget *parent = nullptr);
DeckLoader *getDeckList() const override [[nodiscard]] DeckLoader *getDeckList() const override
{ {
return deckList; return deckList;
} }
@ -90,7 +90,7 @@ private:
public: public:
explicit DlgEditDeckInClipboard(const DeckLoader &deckList, bool _annotated, QWidget *parent = nullptr); explicit DlgEditDeckInClipboard(const DeckLoader &deckList, bool _annotated, QWidget *parent = nullptr);
DeckLoader *getDeckList() const override [[nodiscard]] DeckLoader *getDeckList() const override
{ {
return deckLoader; return deckLoader;
} }

View file

@ -28,7 +28,7 @@ private slots:
public: public:
explicit DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent = nullptr); explicit DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent = nullptr);
int getDeckId() const; [[nodiscard]] int getDeckId() const;
}; };
#endif #endif

View file

@ -78,7 +78,7 @@ public:
QStringList getAllCardsForSet(); QStringList getAllCardsForSet();
void populateCardList(); void populateCardList();
void updateCardDisplayWidgets(); void updateCardDisplayWidgets();
bool isChecked() const; [[nodiscard]] bool isChecked() const;
DlgSelectSetForCards *parent; DlgSelectSetForCards *parent;
QString setName; QString setName;
bool expanded; bool expanded;

View file

@ -26,7 +26,7 @@ public:
void setText(const QString &text) const; void setText(const QString &text) const;
void setClickable(bool _clickable); void setClickable(bool _clickable);
void setBuddy(QWidget *_buddy); void setBuddy(QWidget *_buddy);
QString getText() const [[nodiscard]] QString getText() const
{ {
return bannerLabel->text(); return bannerLabel->text();
} }

View file

@ -36,7 +36,7 @@ public:
void setCard(const CardInfoPtr &newCard, const QString &_currentZone); void setCard(const CardInfoPtr &newCard, const QString &_currentZone);
void getAllSetsForCurrentCard(); void getAllSetsForCurrentCard();
DeckListModel *getDeckModel() const [[nodiscard]] DeckListModel *getDeckModel() const
{ {
return deckModel; return deckModel;
}; };

View file

@ -68,7 +68,7 @@ private:
QAction *messageClicked; QAction *messageClicked;
QMap<QString, QVector<UserMessagePosition>> userMessagePositions; QMap<QString, QVector<UserMessagePosition>> userMessagePositions;
QTextFragment getFragmentUnderMouse(const QPoint &pos) const; [[nodiscard]] QTextFragment getFragmentUnderMouse(const QPoint &pos) const;
QTextCursor prepareBlock(bool same = false); QTextCursor prepareBlock(bool same = false);
void appendCardTag(QTextCursor &cursor, const QString &cardName); void appendCardTag(QTextCursor &cursor, const QString &cardName);
void appendUrlTag(QTextCursor &cursor, QString url); void appendUrlTag(QTextCursor &cursor, QString url);

View file

@ -18,11 +18,11 @@ class ServerInfo_User;
class UserListProxy class UserListProxy
{ {
public: public:
virtual bool isOwnUserRegistered() const = 0; [[nodiscard]] virtual bool isOwnUserRegistered() const = 0;
virtual QString getOwnUsername() const = 0; [[nodiscard]] virtual QString getOwnUsername() const = 0;
virtual bool isUserBuddy(const QString &userName) const = 0; [[nodiscard]] virtual bool isUserBuddy(const QString &userName) const = 0;
virtual bool isUserIgnored(const QString &userName) const = 0; [[nodiscard]] virtual bool isUserIgnored(const QString &userName) const = 0;
virtual const ServerInfo_User *getOnlineUser(const QString &userName) const = 0; // Can return nullptr [[nodiscard]] virtual const ServerInfo_User *getOnlineUser(const QString &userName) const = 0; // Can return nullptr
}; };
#endif // COCKATRICE_USERLISTPROXY_H #endif // COCKATRICE_USERLISTPROXY_H

View file

@ -20,39 +20,39 @@ public:
void debugPrint() const; void debugPrint() const;
// Getter methods for card prices // Getter methods for card prices
const QJsonObject &getCardhoarder() const [[nodiscard]] const QJsonObject &getCardhoarder() const
{ {
return cardhoarder; return cardhoarder;
} }
const QJsonObject &getCardkingdom() const [[nodiscard]] const QJsonObject &getCardkingdom() const
{ {
return cardkingdom; return cardkingdom;
} }
const QJsonObject &getCardmarket() const [[nodiscard]] const QJsonObject &getCardmarket() const
{ {
return cardmarket; return cardmarket;
} }
const QJsonObject &getFace2face() const [[nodiscard]] const QJsonObject &getFace2face() const
{ {
return face2face; return face2face;
} }
const QJsonObject &getManapool() const [[nodiscard]] const QJsonObject &getManapool() const
{ {
return manapool; return manapool;
} }
const QJsonObject &getMtgstocks() const [[nodiscard]] const QJsonObject &getMtgstocks() const
{ {
return mtgstocks; return mtgstocks;
} }
const QJsonObject &getScg() const [[nodiscard]] const QJsonObject &getScg() const
{ {
return scg; return scg;
} }
const QJsonObject &getTcgl() const [[nodiscard]] const QJsonObject &getTcgl() const
{ {
return tcgl; return tcgl;
} }
const QJsonObject &getTcgplayer() const [[nodiscard]] const QJsonObject &getTcgplayer() const
{ {
return tcgplayer; return tcgplayer;
} }

View file

@ -20,7 +20,7 @@ public:
explicit TabEdhRec(TabSupervisor *_tabSupervisor); explicit TabEdhRec(TabSupervisor *_tabSupervisor);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
auto cardName = cardToQuery.isNull() ? QString() : cardToQuery->getName(); auto cardName = cardToQuery.isNull() ? QString() : cardToQuery->getName();
return tr("EDHREC: ") + cardName; return tr("EDHREC: ") + cardName;

View file

@ -29,8 +29,8 @@ private:
public: public:
explicit ShutdownDialog(QWidget *parent = nullptr); explicit ShutdownDialog(QWidget *parent = nullptr);
QString getReason() const; [[nodiscard]] QString getReason() const;
int getMinutes() const; [[nodiscard]] int getMinutes() const;
}; };
class TabAdmin : public Tab class TabAdmin : public Tab
@ -62,11 +62,11 @@ private slots:
public: public:
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin); TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return tr("Administration"); return tr("Administration");
} }
bool getLocked() const [[nodiscard]] bool getLocked() const
{ {
return locked; return locked;
} }

View file

@ -86,7 +86,7 @@ public:
void retranslateUi() override; void retranslateUi() override;
/** @brief Returns the tab text, including modified mark if applicable. */ /** @brief Returns the tab text, including modified mark if applicable. */
QString getTabText() const override; [[nodiscard]] QString getTabText() const override;
/** @brief Creates menus for deck editing and view options. */ /** @brief Creates menus for deck editing and view options. */
void createMenus() override; void createMenus() override;

View file

@ -183,9 +183,9 @@ public:
void updatePlayerListDockTitle(); void updatePlayerListDockTitle();
bool closeRequest() override; bool closeRequest() override;
QString getTabText() const override; [[nodiscard]] QString getTabText() const override;
AbstractGame *getGame() const [[nodiscard]] AbstractGame *getGame() const
{ {
return game; return game;
} }

View file

@ -62,7 +62,7 @@ public:
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client); TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client);
~TabLog() override; ~TabLog() override;
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return tr("Logs"); return tr("Logs");
} }

View file

@ -84,7 +84,7 @@ signals:
public: public:
TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User *currentUserInfo); TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User *currentUserInfo);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return tr("Game Replays"); return tr("Game Replays");
} }

View file

@ -68,7 +68,7 @@ private:
QAction *aLeaveRoom; QAction *aLeaveRoom;
QAction *aOpenChatSettings; QAction *aOpenChatSettings;
QAction *aClearChat; QAction *aClearChat;
QString sanitizeHtml(QString dirty) const; [[nodiscard]] QString sanitizeHtml(QString dirty) const;
QStringList autocompleteUserList; QStringList autocompleteUserList;
QCompleter *completer; QCompleter *completer;
@ -106,23 +106,23 @@ public:
void retranslateUi() override; void retranslateUi() override;
void tabActivated() override; void tabActivated() override;
void processRoomEvent(const RoomEvent &event); void processRoomEvent(const RoomEvent &event);
int getRoomId() const [[nodiscard]] int getRoomId() const
{ {
return roomId; return roomId;
} }
const QMap<int, QString> &getGameTypes() const [[nodiscard]] const QMap<int, QString> &getGameTypes() const
{ {
return gameTypes; return gameTypes;
} }
QString getChannelName() const [[nodiscard]] QString getChannelName() const
{ {
return roomName; return roomName;
} }
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return roomName; return roomName;
} }
const ServerInfo_User *getUserInfo() const [[nodiscard]] const ServerInfo_User *getUserInfo() const
{ {
return ownUser; return ownUser;
} }

View file

@ -63,7 +63,7 @@ private:
public: public:
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client); TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return tr("Server"); return tr("Server");
} }

View file

@ -64,8 +64,8 @@ class CloseButton : public QAbstractButton
Q_OBJECT Q_OBJECT
public: public:
explicit CloseButton(QWidget *parent = nullptr); explicit CloseButton(QWidget *parent = nullptr);
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
inline QSize minimumSizeHint() const override [[nodiscard]] QSize minimumSizeHint() const override
{ {
return sizeHint(); return sizeHint();
} }
@ -129,36 +129,36 @@ public:
void start(const ServerInfo_User &userInfo); void start(const ServerInfo_User &userInfo);
void startLocal(const QList<AbstractClient *> &_clients); void startLocal(const QList<AbstractClient *> &_clients);
void stop(); void stop();
bool getIsLocalGame() const [[nodiscard]] bool getIsLocalGame() const
{ {
return isLocalGame; return isLocalGame;
} }
int getGameCount() const [[nodiscard]] int getGameCount() const
{ {
return gameTabs.size(); return gameTabs.size();
} }
TabAccount *getTabAccount() const [[nodiscard]] TabAccount *getTabAccount() const
{ {
return tabAccount; return tabAccount;
} }
ServerInfo_User *getUserInfo() const [[nodiscard]] ServerInfo_User *getUserInfo() const
{ {
return userInfo; return userInfo;
} }
AbstractClient *getClient() const; [[nodiscard]] AbstractClient *getClient() const;
const UserListManager *getUserListManager() const [[nodiscard]] const UserListManager *getUserListManager() const
{ {
return userListManager; return userListManager;
} }
const QMap<int, TabRoom *> &getRoomTabs() const [[nodiscard]] const QMap<int, TabRoom *> &getRoomTabs() const
{ {
return roomTabs; return roomTabs;
} }
QList<AbstractTabDeckEditor *> getDeckEditorTabs() const [[nodiscard]] QList<AbstractTabDeckEditor *> getDeckEditorTabs() const
{ {
return deckEditorTabs; return deckEditorTabs;
} }
bool getAdminLocked() const; [[nodiscard]] bool getAdminLocked() const;
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;
bool switchToGameTabIfAlreadyExists(const int gameId); bool switchToGameTabIfAlreadyExists(const int gameId);
static void actShowPopup(const QString &message); static void actShowPopup(const QString &message);

View file

@ -23,7 +23,7 @@ private:
public: public:
TabVisualDatabaseDisplay(TabSupervisor *_tabSupervisor); TabVisualDatabaseDisplay(TabSupervisor *_tabSupervisor);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override [[nodiscard]] QString getTabText() const override
{ {
return tr("Visual Database Display"); return tr("Visual Database Display");
} }

View file

@ -125,7 +125,7 @@ public:
* @brief Get the display text for the tab. * @brief Get the display text for the tab.
* @return Tab text with optional modification indicator. * @return Tab text with optional modification indicator.
*/ */
QString getTabText() const override; [[nodiscard]] QString getTabText() const override;
/** /**
* @brief Update the currently selected card in the deck and UI. * @brief Update the currently selected card in the deck and UI.

View file

@ -73,10 +73,10 @@ public:
void setTabTitle(int index, const QString &title); void setTabTitle(int index, const QString &title);
/// Get the currently active tab widget. /// Get the currently active tab widget.
QWidget *getCurrentTab() const; [[nodiscard]] QWidget *getCurrentTab() const;
/// Get the total number of tabs. /// Get the total number of tabs.
int getTabCount() const; [[nodiscard]] int getTabCount() const;
VisualDeckEditorWidget *visualDeckView; ///< Visual deck editor widget. VisualDeckEditorWidget *visualDeckView; ///< Visual deck editor widget.
DeckAnalyticsWidget *deckAnalytics; ///< Deck analytics widget. DeckAnalyticsWidget *deckAnalytics; ///< Deck analytics widget.

View file

@ -25,7 +25,7 @@ public:
void retranslateUi(); void retranslateUi();
void createSubTypeButtons(); void createSubTypeButtons();
void updateSubTypeButtonsVisibility(); void updateSubTypeButtonsVisibility();
int getMaxSubTypeCount() const; [[nodiscard]] int getMaxSubTypeCount() const;
void handleSubTypeToggled(const QString &mainType, bool active); void handleSubTypeToggled(const QString &mainType, bool active);
void updateSubTypeFilter(); void updateSubTypeFilter();

View file

@ -25,7 +25,7 @@ public:
explicit DeckPreviewTagDialog(const QStringList &knownTags, explicit DeckPreviewTagDialog(const QStringList &knownTags,
const QStringList &activeTags, const QStringList &activeTags,
QWidget *parent = nullptr); QWidget *parent = nullptr);
QStringList getActiveTags() const; [[nodiscard]] QStringList getActiveTags() const;
void filterTags(const QString &text); void filterTags(const QString &text);
private slots: private slots:

View file

@ -19,7 +19,7 @@ public:
DeckPreviewTagItemWidget(const QString &tagName, bool isChecked, QWidget *parent = nullptr); DeckPreviewTagItemWidget(const QString &tagName, bool isChecked, QWidget *parent = nullptr);
// Accessor for the checkbox widget // Accessor for the checkbox widget
QCheckBox *checkBox() const; [[nodiscard]] QCheckBox *checkBox() const;
private: private:
QCheckBox *checkBox_; // Checkbox to represent the tag's state QCheckBox *checkBox_; // Checkbox to represent the tag's state

View file

@ -33,7 +33,7 @@ public:
const QString &_filePath); const QString &_filePath);
void retranslateUi(); void retranslateUi();
QString getColorIdentity(); QString getColorIdentity();
QString getDisplayName() const; [[nodiscard]] QString getDisplayName() const;
VisualDeckStorageWidget *visualDeckStorageWidget; VisualDeckStorageWidget *visualDeckStorageWidget;
QVBoxLayout *layout; QVBoxLayout *layout;
@ -47,7 +47,7 @@ public:
bool filteredBySearch = false; bool filteredBySearch = false;
bool filteredByColor = false; bool filteredByColor = false;
bool filteredByTags = false; bool filteredByTags = false;
bool checkVisibility() const; [[nodiscard]] bool checkVisibility() const;
signals: signals:
void deckLoadRequested(const QString &filePath); void deckLoadRequested(const QString &filePath);

View file

@ -27,8 +27,8 @@ public:
void createWidgetsForFiles(); void createWidgetsForFiles();
void createWidgetsForFolders(); void createWidgetsForFolders();
void flattenFolderStructure(); void flattenFolderStructure();
QStringList gatherAllTagsFromFlowWidget() const; [[nodiscard]] QStringList gatherAllTagsFromFlowWidget() const;
FlowWidget *getFlowWidget() const [[nodiscard]] FlowWidget *getFlowWidget() const
{ {
return flowWidget; return flowWidget;
}; };

View file

@ -47,14 +47,14 @@ public:
void retranslateUi(); void retranslateUi();
bool getShowFolders() const; [[nodiscard]] bool getShowFolders() const;
bool getDrawUnusedColorIdentities() const; [[nodiscard]] bool getDrawUnusedColorIdentities() const;
bool getShowBannerCardComboBox() const; [[nodiscard]] bool getShowBannerCardComboBox() const;
bool getShowTagFilter() const; [[nodiscard]] bool getShowTagFilter() const;
bool getShowTagsOnDeckPreviews() const; [[nodiscard]] bool getShowTagsOnDeckPreviews() const;
int getUnusedColorIdentitiesOpacity() const; [[nodiscard]] int getUnusedColorIdentitiesOpacity() const;
TooltipType getDeckPreviewTooltip() const; [[nodiscard]] TooltipType getDeckPreviewTooltip() const;
int getCardSize() const; [[nodiscard]] int getCardSize() const;
signals: signals:
void showFoldersChanged(bool enabled); void showFoldersChanged(bool enabled);

View file

@ -18,7 +18,7 @@ class VisualDeckStorageTagFilterWidget : public QWidget
VisualDeckStorageWidget *parent; VisualDeckStorageWidget *parent;
QSet<QString> gatherAllTags() const; [[nodiscard]] QSet<QString> gatherAllTags() const;
void removeTagsNotInList(const QSet<QString> &tags); void removeTagsNotInList(const QSet<QString> &tags);
void addTagsIfNotPresent(const QSet<QString> &tags); void addTagsIfNotPresent(const QSet<QString> &tags);
void addTagIfNotPresent(const QString &tag); void addTagIfNotPresent(const QString &tag);
@ -26,7 +26,7 @@ class VisualDeckStorageTagFilterWidget : public QWidget
public: public:
explicit VisualDeckStorageTagFilterWidget(VisualDeckStorageWidget *_parent); explicit VisualDeckStorageTagFilterWidget(VisualDeckStorageWidget *_parent);
QStringList getAllKnownTags() const; [[nodiscard]] QStringList getAllKnownTags() const;
void filterDecksBySelectedTags(const QList<DeckPreviewWidget *> &deckPreviews) const; void filterDecksBySelectedTags(const QList<DeckPreviewWidget *> &deckPreviews) const;
public slots: public slots:

View file

@ -40,7 +40,7 @@ public:
VisualDeckStorageTagFilterWidget *tagFilterWidget; VisualDeckStorageTagFilterWidget *tagFilterWidget;
bool deckPreviewSelectionAnimationEnabled; bool deckPreviewSelectionAnimationEnabled;
const VisualDeckStorageQuickSettingsWidget *settings() const; [[nodiscard]] const VisualDeckStorageQuickSettingsWidget *settings() const;
public slots: public slots:
void createRootFolderWidget(); // Refresh the display of cards based on the current sorting option void createRootFolderWidget(); // Refresh the display of cards based on the current sorting option

View file

@ -94,7 +94,7 @@ public:
void clear(); void clear();
/** @brief Returns the map of cards by name. */ /** @brief Returns the map of cards by name. */
const CardNameMap &getCardList() const [[nodiscard]] const CardNameMap &getCardList() const
{ {
return cards; return cards;
} }
@ -107,16 +107,16 @@ public:
CardSetPtr getSet(const QString &setName); CardSetPtr getSet(const QString &setName);
/** @brief Returns a list of all sets in the database. */ /** @brief Returns a list of all sets in the database. */
CardSetList getSetList() const; [[nodiscard]] CardSetList getSetList() const;
/** @brief Returns the current load status. */ /** @brief Returns the current load status. */
LoadStatus getLoadStatus() const [[nodiscard]] LoadStatus getLoadStatus() const
{ {
return loadStatus; return loadStatus;
} }
/** @brief Returns the querier for performing card lookups. */ /** @brief Returns the querier for performing card lookups. */
CardDatabaseQuerier *query() const [[nodiscard]] CardDatabaseQuerier *query() const
{ {
return querier; return querier;
} }

View file

@ -124,7 +124,7 @@ public:
* @param cardName Name of the card. * @param cardName Name of the card.
* @return The preferred ExactCard. * @return The preferred ExactCard.
*/ */
ExactCard getPreferredCard(const QString &cardName) const; [[nodiscard]] ExactCard getPreferredCard(const QString &cardName) const;
/** /**
* @brief Returns the preferred printing of a card based on user preferences and set priority. * @brief Returns the preferred printing of a card based on user preferences and set priority.

View file

@ -59,31 +59,31 @@ public:
} }
/// @return The number of copies of this card in the deck. /// @return The number of copies of this card in the deck.
virtual int getNumber() const = 0; [[nodiscard]] virtual int getNumber() const = 0;
/// @param _number Set the number of copies of this card. /// @param _number Set the number of copies of this card.
virtual void setNumber(int _number) = 0; virtual void setNumber(int _number) = 0;
/// @return The display name of this card. /// @return The display name of this card.
QString getName() const override = 0; [[nodiscard]] QString getName() const override = 0;
/// @param _name Set the display name of this card. /// @param _name Set the display name of this card.
virtual void setName(const QString &_name) = 0; virtual void setName(const QString &_name) = 0;
/// @return The provider identifier for this card (e.g., UUID). /// @return The provider identifier for this card (e.g., UUID).
virtual QString getCardProviderId() const override = 0; [[nodiscard]] virtual QString getCardProviderId() const override = 0;
/// @param _cardProviderId Set the provider identifier for this card. /// @param _cardProviderId Set the provider identifier for this card.
virtual void setCardProviderId(const QString &_cardProviderId) = 0; virtual void setCardProviderId(const QString &_cardProviderId) = 0;
/// @return The abbreviated set code (e.g., "NEO"). /// @return The abbreviated set code (e.g., "NEO").
virtual QString getCardSetShortName() const override = 0; [[nodiscard]] virtual QString getCardSetShortName() const override = 0;
/// @param _cardSetShortName Set the abbreviated set code. /// @param _cardSetShortName Set the abbreviated set code.
virtual void setCardSetShortName(const QString &_cardSetShortName) = 0; virtual void setCardSetShortName(const QString &_cardSetShortName) = 0;
/// @return The collector number of the card within its set. /// @return The collector number of the card within its set.
virtual QString getCardCollectorNumber() const override = 0; [[nodiscard]] virtual QString getCardCollectorNumber() const override = 0;
/// @param _cardSetNumber Set the collector number. /// @param _cardSetNumber Set the collector number.
virtual void setCardCollectorNumber(const QString &_cardSetNumber) = 0; virtual void setCardCollectorNumber(const QString &_cardSetNumber) = 0;
@ -96,7 +96,7 @@ public:
* *
* @return 0 * @return 0
*/ */
int height() const override [[nodiscard]] int height() const override
{ {
return 0; return 0;
} }

View file

@ -123,10 +123,10 @@ public:
* identifying information about a node, regardless of type. * identifying information about a node, regardless of type.
* @{ * @{
*/ */
virtual QString getName() const = 0; [[nodiscard]] virtual QString getName() const = 0;
virtual QString getCardProviderId() const = 0; [[nodiscard]] virtual QString getCardProviderId() const = 0;
virtual QString getCardSetShortName() const = 0; [[nodiscard]] virtual QString getCardSetShortName() const = 0;
virtual QString getCardCollectorNumber() const = 0; [[nodiscard]] virtual QString getCardCollectorNumber() const = 0;
/// @} /// @}
/** /**
@ -138,7 +138,7 @@ public:
[[nodiscard]] virtual bool isDeckHeader() const = 0; [[nodiscard]] virtual bool isDeckHeader() const = 0;
/// @return The parent node, or nullptr if this is the root. /// @return The parent node, or nullptr if this is the root.
InnerDecklistNode *getParent() const [[nodiscard]] InnerDecklistNode *getParent() const
{ {
return parent; return parent;
} }
@ -147,7 +147,7 @@ public:
* @brief Compute the depth of this node in the tree. * @brief Compute the depth of this node in the tree.
* @return Distance from the root (root = 0, children = 1, etc.). * @return Distance from the root (root = 0, children = 1, etc.).
*/ */
int depth() const; [[nodiscard]] int depth() const;
/** /**
* @brief Compute the "height" of this node. * @brief Compute the "height" of this node.
@ -159,7 +159,7 @@ public:
* - A card node has height 1. * - A card node has height 1.
* - A group node containing cards has height 2. * - A group node containing cards has height 2.
*/ */
virtual int height() const = 0; [[nodiscard]] virtual int height() const = 0;
/** /**
* @brief Compare this node against another for sorting. * @brief Compare this node against another for sorting.

View file

@ -72,13 +72,13 @@ public:
void write(QXmlStreamWriter *xml); void write(QXmlStreamWriter *xml);
/// @return The plan name. /// @return The plan name.
QString getName() const [[nodiscard]] QString getName() const
{ {
return name; return name;
} }
/// @return Const reference to the move list. /// @return Const reference to the move list.
const QList<MoveCard_ToZone> &getMoveList() const [[nodiscard]] const QList<MoveCard_ToZone> &getMoveList() const
{ {
return moveList; return moveList;
} }

View file

@ -176,7 +176,7 @@ public:
* @brief Compute the height of this node. * @brief Compute the height of this node.
* @return Maximum depth of descendants + 1. * @return Maximum depth of descendants + 1.
*/ */
int height() const override; [[nodiscard]] int height() const override;
/** /**
* @brief Count cards recursively under this node. * @brief Count cards recursively under this node.
@ -184,7 +184,7 @@ public:
* If false, counts unique card nodes. * If false, counts unique card nodes.
* @return Total count. * @return Total count.
*/ */
int recursiveCount(bool countTotalCards = false) const; [[nodiscard]] int recursiveCount(bool countTotalCards = false) const;
/** /**
* @brief Compare this node against another for sorting. * @brief Compare this node against another for sorting.

View file

@ -57,7 +57,7 @@ public:
ServerInfo_Zone::ZoneType _type); ServerInfo_Zone::ZoneType _type);
~Server_CardZone(); ~Server_CardZone();
const QList<Server_Card *> &getCards() const [[nodiscard]] const QList<Server_Card *> &getCards() const
{ {
return cards; return cards;
} }
@ -65,7 +65,7 @@ public:
int removeCard(Server_Card *card, bool &wasLookedAt); int removeCard(Server_Card *card, bool &wasLookedAt);
Server_Card *getCard(int id, int *position = nullptr, bool remove = false); Server_Card *getCard(int id, int *position = nullptr, bool remove = false);
int getCardsBeingLookedAt() const [[nodiscard]] int getCardsBeingLookedAt() const
{ {
return cardsBeingLookedAt; return cardsBeingLookedAt;
} }
@ -73,28 +73,28 @@ public:
{ {
cardsBeingLookedAt = qMax(0, _cardsBeingLookedAt); cardsBeingLookedAt = qMax(0, _cardsBeingLookedAt);
} }
bool isCardAtPosLookedAt(int pos) const; [[nodiscard]] bool isCardAtPosLookedAt(int pos) const;
bool hasCoords() const [[nodiscard]] bool hasCoords() const
{ {
return has_coords; return has_coords;
} }
ServerInfo_Zone::ZoneType getType() const [[nodiscard]] ServerInfo_Zone::ZoneType getType() const
{ {
return type; return type;
} }
QString getName() const [[nodiscard]] QString getName() const
{ {
return name; return name;
} }
Server_AbstractPlayer *getPlayer() const [[nodiscard]] Server_AbstractPlayer *getPlayer() const
{ {
return player; return player;
} }
void getInfo(ServerInfo_Zone *info, Server_AbstractParticipant *recipient, bool omniscient); void getInfo(ServerInfo_Zone *info, Server_AbstractParticipant *recipient, bool omniscient);
int getFreeGridColumn(int x, int y, const QString &cardName, bool dontStackSameName) const; [[nodiscard]] int getFreeGridColumn(int x, int y, const QString &cardName, bool dontStackSameName) const;
bool isColumnEmpty(int x, int y) const; [[nodiscard]] bool isColumnEmpty(int x, int y) const;
bool isColumnStacked(int x, int y) const; [[nodiscard]] bool isColumnStacked(int x, int y) const;
void fixFreeSpaces(GameEventStorage &ges); void fixFreeSpaces(GameEventStorage &ges);
void moveCardInRow(GameEventStorage &ges, Server_Card *card, int x, int y); void moveCardInRow(GameEventStorage &ges, Server_Card *card, int x, int y);
void insertCard(Server_Card *card, int x, int y); void insertCard(Server_Card *card, int x, int y);
@ -102,11 +102,11 @@ public:
void shuffle(int start = 0, int end = -1); void shuffle(int start = 0, int end = -1);
void clear(); void clear();
void addWritePermission(int playerId); void addWritePermission(int playerId);
const QSet<int> &getPlayersWithWritePermission() const [[nodiscard]] const QSet<int> &getPlayersWithWritePermission() const
{ {
return playersWithWritePermission; return playersWithWritePermission;
} }
bool getAlwaysRevealTopCard() const [[nodiscard]] bool getAlwaysRevealTopCard() const
{ {
return alwaysRevealTopCard; return alwaysRevealTopCard;
} }
@ -114,7 +114,7 @@ public:
{ {
alwaysRevealTopCard = _alwaysRevealTopCard; alwaysRevealTopCard = _alwaysRevealTopCard;
} }
bool getAlwaysLookAtTopCard() const [[nodiscard]] bool getAlwaysLookAtTopCard() const
{ {
return alwaysLookAtTopCard; return alwaysLookAtTopCard;
} }

View file

@ -31,11 +31,11 @@ public:
GameEventStorageItem(const ::google::protobuf::Message &_event, int _playerId, EventRecipients _recipients); GameEventStorageItem(const ::google::protobuf::Message &_event, int _playerId, EventRecipients _recipients);
~GameEventStorageItem(); ~GameEventStorageItem();
const GameEvent &getGameEvent() const [[nodiscard]] const GameEvent &getGameEvent() const
{ {
return *event; return *event;
} }
EventRecipients getRecipients() const [[nodiscard]] EventRecipients getRecipients() const
{ {
return recipients; return recipients;
} }
@ -56,15 +56,15 @@ public:
~GameEventStorage(); ~GameEventStorage();
void setGameEventContext(const ::google::protobuf::Message &_gameEventContext); void setGameEventContext(const ::google::protobuf::Message &_gameEventContext);
::google::protobuf::Message *getGameEventContext() const [[nodiscard]] ::google::protobuf::Message *getGameEventContext() const
{ {
return gameEventContext; return gameEventContext;
} }
const QList<GameEventStorageItem *> &getGameEventList() const [[nodiscard]] const QList<GameEventStorageItem *> &getGameEventList() const
{ {
return gameEventList; return gameEventList;
} }
int getPrivatePlayerId() const [[nodiscard]] int getPrivatePlayerId() const
{ {
return privatePlayerId; return privatePlayerId;
} }
@ -96,7 +96,7 @@ public:
ResponseContainer(int _cmdId); ResponseContainer(int _cmdId);
~ResponseContainer(); ~ResponseContainer();
int getCmdId() const [[nodiscard]] int getCmdId() const
{ {
return cmdId; return cmdId;
} }
@ -104,7 +104,7 @@ public:
{ {
responseExtension = _responseExtension; responseExtension = _responseExtension;
} }
::google::protobuf::Message *getResponseExtension() const [[nodiscard]] ::google::protobuf::Message *getResponseExtension() const
{ {
return responseExtension; return responseExtension;
} }
@ -116,11 +116,13 @@ public:
{ {
postResponseQueue.append(qMakePair(type, item)); postResponseQueue.append(qMakePair(type, item));
} }
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &getPreResponseQueue() const [[nodiscard]] const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &
getPreResponseQueue() const
{ {
return preResponseQueue; return preResponseQueue;
} }
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &getPostResponseQueue() const [[nodiscard]] const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &
getPostResponseQueue() const
{ {
return postResponseQueue; return postResponseQueue;
} }

View file

@ -14,14 +14,15 @@ public:
ServerInfo_User_Container(const ServerInfo_User_Container &other); ServerInfo_User_Container(const ServerInfo_User_Container &other);
ServerInfo_User_Container &operator=(const ServerInfo_User_Container &other) = default; ServerInfo_User_Container &operator=(const ServerInfo_User_Container &other) = default;
virtual ~ServerInfo_User_Container(); virtual ~ServerInfo_User_Container();
ServerInfo_User *getUserInfo() const [[nodiscard]] ServerInfo_User *getUserInfo() const
{ {
return userInfo; return userInfo;
} }
void setUserInfo(const ServerInfo_User &_userInfo); void setUserInfo(const ServerInfo_User &_userInfo);
ServerInfo_User & ServerInfo_User &
copyUserInfo(ServerInfo_User &result, bool complete, bool internalInfo = false, bool sessionInfo = false) const; copyUserInfo(ServerInfo_User &result, bool complete, bool internalInfo = false, bool sessionInfo = false) const;
ServerInfo_User copyUserInfo(bool complete, bool internalInfo = false, bool sessionInfo = false) const; [[nodiscard]] ServerInfo_User
copyUserInfo(bool complete, bool internalInfo = false, bool sessionInfo = false) const;
}; };
#endif #endif