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
|
* @return 0
|
||||||
*/
|
*/
|
||||||
int height() const override { return 0; }
|
int height() const override
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compare this card node against another for sorting.
|
* @brief Compare this card node against another for sorting.
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,10 @@ 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 { return parent; }
|
InnerDecklistNode *getParent() const
|
||||||
|
{
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compute the depth of this node in the tree.
|
* @brief Compute the depth of this node in the tree.
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ class InnerDecklistNode;
|
||||||
class SideboardPlan
|
class SideboardPlan
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QString name; ///< Human-readable name of this plan.
|
QString name; ///< Human-readable name of this plan.
|
||||||
QList<MoveCard_ToZone> moveList; ///< List of move instructions for this plan.
|
QList<MoveCard_ToZone> moveList; ///< List of move instructions for this plan.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,10 +71,16 @@ public:
|
||||||
void write(QXmlStreamWriter *xml);
|
void write(QXmlStreamWriter *xml);
|
||||||
|
|
||||||
/// @return The plan name.
|
/// @return The plan name.
|
||||||
QString getName() const { return name; }
|
QString getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/// @return Const reference to the move list.
|
/// @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.
|
/// @brief Replace the move list with a new one.
|
||||||
void setMoveList(const QList<MoveCard_ToZone> &_moveList);
|
void setMoveList(const QList<MoveCard_ToZone> &_moveList);
|
||||||
|
|
@ -119,13 +125,13 @@ class DeckList : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QString name; ///< User-defined deck name.
|
QString name; ///< User-defined deck name.
|
||||||
QString comments; ///< Free-form comments or notes.
|
QString comments; ///< Free-form comments or notes.
|
||||||
CardRef bannerCard; ///< Optional representative card for the deck.
|
CardRef bannerCard; ///< Optional representative card for the deck.
|
||||||
QString lastLoadedTimestamp; ///< Timestamp string of last load.
|
QString lastLoadedTimestamp; ///< Timestamp string of last load.
|
||||||
QStringList tags; ///< User-defined tags for deck classification.
|
QStringList tags; ///< User-defined tags for deck classification.
|
||||||
QMap<QString, SideboardPlan *> sideboardPlans; ///< Named sideboard plans.
|
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.
|
* @brief Cached deck hash, recalculated lazily.
|
||||||
|
|
@ -171,8 +177,14 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
/// @name Metadata setters
|
/// @name Metadata setters
|
||||||
///@{
|
///@{
|
||||||
void setName(const QString &_name = QString()) { name = _name; }
|
void setName(const QString &_name = QString())
|
||||||
void setComments(const QString &_comments = QString()) { comments = _comments; }
|
{
|
||||||
|
name = _name;
|
||||||
|
}
|
||||||
|
void setComments(const QString &_comments = QString())
|
||||||
|
{
|
||||||
|
comments = _comments;
|
||||||
|
}
|
||||||
void setTags(const QStringList &_tags = QStringList())
|
void setTags(const QStringList &_tags = QStringList())
|
||||||
{
|
{
|
||||||
tags = _tags;
|
tags = _tags;
|
||||||
|
|
@ -188,7 +200,10 @@ public slots:
|
||||||
tags.clear();
|
tags.clear();
|
||||||
emit deckTagsChanged();
|
emit deckTagsChanged();
|
||||||
}
|
}
|
||||||
void setBannerCard(const CardRef &_bannerCard = {}) { bannerCard = _bannerCard; }
|
void setBannerCard(const CardRef &_bannerCard = {})
|
||||||
|
{
|
||||||
|
bannerCard = _bannerCard;
|
||||||
|
}
|
||||||
void setLastLoadedTimestamp(const QString &_lastLoadedTimestamp = QString())
|
void setLastLoadedTimestamp(const QString &_lastLoadedTimestamp = QString())
|
||||||
{
|
{
|
||||||
lastLoadedTimestamp = _lastLoadedTimestamp;
|
lastLoadedTimestamp = _lastLoadedTimestamp;
|
||||||
|
|
@ -206,18 +221,36 @@ public:
|
||||||
|
|
||||||
/// @name Metadata getters
|
/// @name Metadata getters
|
||||||
///@{
|
///@{
|
||||||
QString getName() const { return name; }
|
QString getName() const
|
||||||
QString getComments() const { return comments; }
|
{
|
||||||
QStringList getTags() const { return tags; }
|
return name;
|
||||||
CardRef getBannerCard() const { return bannerCard; }
|
}
|
||||||
QString getLastLoadedTimestamp() const { return lastLoadedTimestamp; }
|
QString getComments() const
|
||||||
|
{
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
QStringList getTags() const
|
||||||
|
{
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
CardRef getBannerCard() const
|
||||||
|
{
|
||||||
|
return bannerCard;
|
||||||
|
}
|
||||||
|
QString getLastLoadedTimestamp() const
|
||||||
|
{
|
||||||
|
return lastLoadedTimestamp;
|
||||||
|
}
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/// @name Sideboard plans
|
/// @name Sideboard plans
|
||||||
///@{
|
///@{
|
||||||
QList<MoveCard_ToZone> getCurrentSideboardPlan();
|
QList<MoveCard_ToZone> getCurrentSideboardPlan();
|
||||||
void setCurrentSideboardPlan(const QList<MoveCard_ToZone> &plan);
|
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)
|
/// @name Serialization (XML)
|
||||||
|
|
@ -250,7 +283,10 @@ public:
|
||||||
QStringList getCardList() const;
|
QStringList getCardList() const;
|
||||||
QList<CardRef> getCardRefList() const;
|
QList<CardRef> getCardRefList() const;
|
||||||
int getSideboardSize() const;
|
int getSideboardSize() const;
|
||||||
InnerDecklistNode *getRoot() const { return root; }
|
InnerDecklistNode *getRoot() const
|
||||||
|
{
|
||||||
|
return root;
|
||||||
|
}
|
||||||
DecklistCardNode *addCard(const QString &cardName,
|
DecklistCardNode *addCard(const QString &cardName,
|
||||||
const QString &zoneName,
|
const QString &zoneName,
|
||||||
int position,
|
int position,
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@
|
||||||
*/
|
*/
|
||||||
class DecklistCardNode : public AbstractDecklistCardNode
|
class DecklistCardNode : public AbstractDecklistCardNode
|
||||||
{
|
{
|
||||||
QString name; ///< Display name of the card.
|
QString name; ///< Display name of the card.
|
||||||
int number; ///< Quantity of this card in the deck.
|
int number; ///< Quantity of this card in the deck.
|
||||||
QString cardSetShortName; ///< Short set code (e.g., "NEO").
|
QString cardSetShortName; ///< Short set code (e.g., "NEO").
|
||||||
QString cardSetNumber; ///< Collector number within the set.
|
QString cardSetNumber; ///< Collector number within the set.
|
||||||
QString cardProviderId; ///< External provider identifier (e.g., UUID).
|
QString cardProviderId; ///< External provider identifier (e.g., UUID).
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
@ -89,37 +89,70 @@ public:
|
||||||
explicit DecklistCardNode(DecklistCardNode *other, InnerDecklistNode *_parent);
|
explicit DecklistCardNode(DecklistCardNode *other, InnerDecklistNode *_parent);
|
||||||
|
|
||||||
/// @return The quantity of this card.
|
/// @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.
|
/// @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.
|
/// @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.
|
/// @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.
|
/// @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.
|
/// @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").
|
/// @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.
|
/// @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.
|
/// @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.
|
/// @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.
|
/// @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.
|
* @brief Convert this node to a CardRef.
|
||||||
|
|
@ -127,7 +160,10 @@ public:
|
||||||
* @return A CardRef with the card’s name and provider ID, suitable
|
* @return A CardRef with the card’s name and provider ID, suitable
|
||||||
* for database lookups or comparison with other card sources.
|
* 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
|
#endif // COCKATRICE_DECK_LIST_CARD_NODE_H
|
||||||
|
|
|
||||||
|
|
@ -94,10 +94,16 @@ public:
|
||||||
void setSortMethod(DeckSortMethod method) override;
|
void setSortMethod(DeckSortMethod method) override;
|
||||||
|
|
||||||
/// @return The internal name of this node.
|
/// @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.
|
/// @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.
|
* @brief Translate an internal name into a user-visible name.
|
||||||
|
|
@ -117,16 +123,28 @@ public:
|
||||||
[[nodiscard]] virtual QString getVisibleName() const;
|
[[nodiscard]] virtual QString getVisibleName() const;
|
||||||
|
|
||||||
/// @return Always empty for container nodes.
|
/// @return Always empty for container nodes.
|
||||||
[[nodiscard]] QString getCardProviderId() const override { return ""; }
|
[[nodiscard]] QString getCardProviderId() const override
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// @return Always empty for container nodes.
|
/// @return Always empty for container nodes.
|
||||||
[[nodiscard]] QString getCardSetShortName() const override { return ""; }
|
[[nodiscard]] QString getCardSetShortName() const override
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// @return Always empty for container nodes.
|
/// @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.
|
/// @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.
|
* @brief Delete all children of this node, recursively.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue