mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Why would the linter do this to me?
Took 4 minutes
This commit is contained in:
parent
ae78aa1468
commit
ad4888fcf1
5 changed files with 141 additions and 45 deletions
|
|
@ -95,7 +95,10 @@ public:
|
|||
*
|
||||
* @return 0
|
||||
*/
|
||||
int height() const override { return 0; }
|
||||
int height() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare this card node against another for sorting.
|
||||
|
|
|
|||
|
|
@ -136,7 +136,10 @@ public:
|
|||
[[nodiscard]] virtual bool isDeckHeader() const = 0;
|
||||
|
||||
/// @return The parent node, or nullptr if this is the root.
|
||||
InnerDecklistNode *getParent() const { return parent; }
|
||||
InnerDecklistNode *getParent() const
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compute the depth of this node in the tree.
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ class InnerDecklistNode;
|
|||
class SideboardPlan
|
||||
{
|
||||
private:
|
||||
QString name; ///< Human-readable name of this plan.
|
||||
QList<MoveCard_ToZone> moveList; ///< List of move instructions for this plan.
|
||||
QString name; ///< Human-readable name of this plan.
|
||||
QList<MoveCard_ToZone> moveList; ///< List of move instructions for this plan.
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
@ -71,10 +71,16 @@ public:
|
|||
void write(QXmlStreamWriter *xml);
|
||||
|
||||
/// @return The plan name.
|
||||
QString getName() const { return name; }
|
||||
QString getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/// @return Const reference to the move list.
|
||||
const QList<MoveCard_ToZone> &getMoveList() const { return moveList; }
|
||||
const QList<MoveCard_ToZone> &getMoveList() const
|
||||
{
|
||||
return moveList;
|
||||
}
|
||||
|
||||
/// @brief Replace the move list with a new one.
|
||||
void setMoveList(const QList<MoveCard_ToZone> &_moveList);
|
||||
|
|
@ -119,13 +125,13 @@ class DeckList : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString name; ///< User-defined deck name.
|
||||
QString comments; ///< Free-form comments or notes.
|
||||
CardRef bannerCard; ///< Optional representative card for the deck.
|
||||
QString lastLoadedTimestamp; ///< Timestamp string of last load.
|
||||
QStringList tags; ///< User-defined tags for deck classification.
|
||||
QString name; ///< User-defined deck name.
|
||||
QString comments; ///< Free-form comments or notes.
|
||||
CardRef bannerCard; ///< Optional representative card for the deck.
|
||||
QString lastLoadedTimestamp; ///< Timestamp string of last load.
|
||||
QStringList tags; ///< User-defined tags for deck classification.
|
||||
QMap<QString, SideboardPlan *> sideboardPlans; ///< Named sideboard plans.
|
||||
InnerDecklistNode *root; ///< Root of the deck tree (zones + cards).
|
||||
InnerDecklistNode *root; ///< Root of the deck tree (zones + cards).
|
||||
|
||||
/**
|
||||
* @brief Cached deck hash, recalculated lazily.
|
||||
|
|
@ -171,8 +177,14 @@ signals:
|
|||
public slots:
|
||||
/// @name Metadata setters
|
||||
///@{
|
||||
void setName(const QString &_name = QString()) { name = _name; }
|
||||
void setComments(const QString &_comments = QString()) { comments = _comments; }
|
||||
void setName(const QString &_name = QString())
|
||||
{
|
||||
name = _name;
|
||||
}
|
||||
void setComments(const QString &_comments = QString())
|
||||
{
|
||||
comments = _comments;
|
||||
}
|
||||
void setTags(const QStringList &_tags = QStringList())
|
||||
{
|
||||
tags = _tags;
|
||||
|
|
@ -188,7 +200,10 @@ public slots:
|
|||
tags.clear();
|
||||
emit deckTagsChanged();
|
||||
}
|
||||
void setBannerCard(const CardRef &_bannerCard = {}) { bannerCard = _bannerCard; }
|
||||
void setBannerCard(const CardRef &_bannerCard = {})
|
||||
{
|
||||
bannerCard = _bannerCard;
|
||||
}
|
||||
void setLastLoadedTimestamp(const QString &_lastLoadedTimestamp = QString())
|
||||
{
|
||||
lastLoadedTimestamp = _lastLoadedTimestamp;
|
||||
|
|
@ -206,18 +221,36 @@ public:
|
|||
|
||||
/// @name Metadata getters
|
||||
///@{
|
||||
QString getName() const { return name; }
|
||||
QString getComments() const { return comments; }
|
||||
QStringList getTags() const { return tags; }
|
||||
CardRef getBannerCard() const { return bannerCard; }
|
||||
QString getLastLoadedTimestamp() const { return lastLoadedTimestamp; }
|
||||
QString getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
QString getComments() const
|
||||
{
|
||||
return comments;
|
||||
}
|
||||
QStringList getTags() const
|
||||
{
|
||||
return tags;
|
||||
}
|
||||
CardRef getBannerCard() const
|
||||
{
|
||||
return bannerCard;
|
||||
}
|
||||
QString getLastLoadedTimestamp() const
|
||||
{
|
||||
return lastLoadedTimestamp;
|
||||
}
|
||||
///@}
|
||||
|
||||
/// @name Sideboard plans
|
||||
///@{
|
||||
QList<MoveCard_ToZone> getCurrentSideboardPlan();
|
||||
void setCurrentSideboardPlan(const QList<MoveCard_ToZone> &plan);
|
||||
const QMap<QString, SideboardPlan *> &getSideboardPlans() const { return sideboardPlans; }
|
||||
const QMap<QString, SideboardPlan *> &getSideboardPlans() const
|
||||
{
|
||||
return sideboardPlans;
|
||||
}
|
||||
///@}
|
||||
|
||||
/// @name Serialization (XML)
|
||||
|
|
@ -250,7 +283,10 @@ public:
|
|||
QStringList getCardList() const;
|
||||
QList<CardRef> getCardRefList() const;
|
||||
int getSideboardSize() const;
|
||||
InnerDecklistNode *getRoot() const { return root; }
|
||||
InnerDecklistNode *getRoot() const
|
||||
{
|
||||
return root;
|
||||
}
|
||||
DecklistCardNode *addCard(const QString &cardName,
|
||||
const QString &zoneName,
|
||||
int position,
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@
|
|||
*/
|
||||
class DecklistCardNode : public AbstractDecklistCardNode
|
||||
{
|
||||
QString name; ///< Display name of the card.
|
||||
int number; ///< Quantity of this card in the deck.
|
||||
QString cardSetShortName; ///< Short set code (e.g., "NEO").
|
||||
QString cardSetNumber; ///< Collector number within the set.
|
||||
QString cardProviderId; ///< External provider identifier (e.g., UUID).
|
||||
QString name; ///< Display name of the card.
|
||||
int number; ///< Quantity of this card in the deck.
|
||||
QString cardSetShortName; ///< Short set code (e.g., "NEO").
|
||||
QString cardSetNumber; ///< Collector number within the set.
|
||||
QString cardProviderId; ///< External provider identifier (e.g., UUID).
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
@ -89,37 +89,70 @@ public:
|
|||
explicit DecklistCardNode(DecklistCardNode *other, InnerDecklistNode *_parent);
|
||||
|
||||
/// @return The quantity of this card.
|
||||
int getNumber() const override { return number; }
|
||||
int getNumber() const override
|
||||
{
|
||||
return number;
|
||||
}
|
||||
|
||||
/// @param _number Set the quantity of this card.
|
||||
void setNumber(int _number) override { number = _number; }
|
||||
void setNumber(int _number) override
|
||||
{
|
||||
number = _number;
|
||||
}
|
||||
|
||||
/// @return The display name of this card.
|
||||
QString getName() const override { return name; }
|
||||
QString getName() const override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/// @param _name Set the display name of this card.
|
||||
void setName(const QString &_name) override { name = _name; }
|
||||
void setName(const QString &_name) override
|
||||
{
|
||||
name = _name;
|
||||
}
|
||||
|
||||
/// @return The provider identifier for this card.
|
||||
QString getCardProviderId() const override { return cardProviderId; }
|
||||
QString getCardProviderId() const override
|
||||
{
|
||||
return cardProviderId;
|
||||
}
|
||||
|
||||
/// @param _providerId Set the provider identifier for this card.
|
||||
void setCardProviderId(const QString &_providerId) override { cardProviderId = _providerId; }
|
||||
void setCardProviderId(const QString &_providerId) override
|
||||
{
|
||||
cardProviderId = _providerId;
|
||||
}
|
||||
|
||||
/// @return The short set code (e.g., "NEO").
|
||||
QString getCardSetShortName() const override { return cardSetShortName; }
|
||||
QString getCardSetShortName() const override
|
||||
{
|
||||
return cardSetShortName;
|
||||
}
|
||||
|
||||
/// @param _cardSetShortName Set the short set code.
|
||||
void setCardSetShortName(const QString &_cardSetShortName) override { cardSetShortName = _cardSetShortName; }
|
||||
void setCardSetShortName(const QString &_cardSetShortName) override
|
||||
{
|
||||
cardSetShortName = _cardSetShortName;
|
||||
}
|
||||
|
||||
/// @return The collector number of this card within its set.
|
||||
QString getCardCollectorNumber() const override { return cardSetNumber; }
|
||||
QString getCardCollectorNumber() const override
|
||||
{
|
||||
return cardSetNumber;
|
||||
}
|
||||
|
||||
/// @param _cardSetNumber Set the collector number.
|
||||
void setCardCollectorNumber(const QString &_cardSetNumber) override { cardSetNumber = _cardSetNumber; }
|
||||
void setCardCollectorNumber(const QString &_cardSetNumber) override
|
||||
{
|
||||
cardSetNumber = _cardSetNumber;
|
||||
}
|
||||
|
||||
/// @return Always false; card nodes are not deck headers.
|
||||
[[nodiscard]] bool isDeckHeader() const override { return false; }
|
||||
[[nodiscard]] bool isDeckHeader() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert this node to a CardRef.
|
||||
|
|
@ -127,7 +160,10 @@ public:
|
|||
* @return A CardRef with the card’s name and provider ID, suitable
|
||||
* for database lookups or comparison with other card sources.
|
||||
*/
|
||||
CardRef toCardRef() const { return {name, cardProviderId}; }
|
||||
CardRef toCardRef() const
|
||||
{
|
||||
return {name, cardProviderId};
|
||||
}
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_DECK_LIST_CARD_NODE_H
|
||||
|
|
|
|||
|
|
@ -94,10 +94,16 @@ public:
|
|||
void setSortMethod(DeckSortMethod method) override;
|
||||
|
||||
/// @return The internal name of this node.
|
||||
[[nodiscard]] QString getName() const override { return name; }
|
||||
[[nodiscard]] QString getName() const override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/// @param _name Set the internal name of this node.
|
||||
void setName(const QString &_name) { name = _name; }
|
||||
void setName(const QString &_name)
|
||||
{
|
||||
name = _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Translate an internal name into a user-visible name.
|
||||
|
|
@ -117,16 +123,28 @@ public:
|
|||
[[nodiscard]] virtual QString getVisibleName() const;
|
||||
|
||||
/// @return Always empty for container nodes.
|
||||
[[nodiscard]] QString getCardProviderId() const override { return ""; }
|
||||
[[nodiscard]] QString getCardProviderId() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// @return Always empty for container nodes.
|
||||
[[nodiscard]] QString getCardSetShortName() const override { return ""; }
|
||||
[[nodiscard]] QString getCardSetShortName() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// @return Always empty for container nodes.
|
||||
[[nodiscard]] QString getCardCollectorNumber() const override { return ""; }
|
||||
[[nodiscard]] QString getCardCollectorNumber() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// @return Always true; InnerDecklistNode represents deck structure.
|
||||
[[nodiscard]] bool isDeckHeader() const override { return true; }
|
||||
[[nodiscard]] bool isDeckHeader() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete all children of this node, recursively.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue