From 66dfa0544517cad1be7b15d0c3aee6553ad196dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Wed, 1 Oct 2025 00:19:35 +0200 Subject: [PATCH] Auto-lint was disabled and my pre-commit hook didn't fire. Oh well. Took 3 minutes --- cockatrice/src/card/card_info.h | 1 - cockatrice/src/card/card_relation.h | 54 ++++++++++++++----- cockatrice/src/card/card_relation_type.h | 16 +++--- cockatrice/src/card/card_set.h | 69 ++++++++++++++++++------ cockatrice/src/card/card_set_list.cpp | 6 +-- cockatrice/src/card/card_set_list.h | 2 +- cockatrice/src/card/printing_info.h | 31 +++++++---- 7 files changed, 132 insertions(+), 47 deletions(-) diff --git a/cockatrice/src/card/card_info.h b/cockatrice/src/card/card_info.h index 30bd094b6..8252da1f9 100644 --- a/cockatrice/src/card/card_info.h +++ b/cockatrice/src/card/card_info.h @@ -36,7 +36,6 @@ typedef QHash SetNameMap; Q_DECLARE_METATYPE(CardInfoPtr) - class CardInfo : public QObject { Q_OBJECT diff --git a/cockatrice/src/card/card_relation.h b/cockatrice/src/card/card_relation.h index b100f1a8b..34f88e651 100644 --- a/cockatrice/src/card/card_relation.h +++ b/cockatrice/src/card/card_relation.h @@ -1,9 +1,10 @@ #ifndef COCKATRICE_CARD_RELATION_H #define COCKATRICE_CARD_RELATION_H +#include "card_relation_type.h" + #include #include -#include "card_relation_type.h" class CardRelation : public QObject { @@ -25,19 +26,48 @@ public: int _defaultCount = 1, bool _isPersistent = false); - const QString &getName() const { return name; } - CardRelationType getAttachType() const { return attachType; } - bool getDoesAttach() const { return attachType != CardRelationType::DoesNotAttach; } - bool getDoesTransform() const { return attachType == CardRelationType::TransformInto; } + const QString &getName() const + { + return name; + } + CardRelationType getAttachType() const + { + return attachType; + } + bool getDoesAttach() const + { + return attachType != CardRelationType::DoesNotAttach; + } + bool getDoesTransform() const + { + return attachType == CardRelationType::TransformInto; + } - QString getAttachTypeAsString() const { return cardAttachTypeToString(attachType); } + QString getAttachTypeAsString() const + { + return cardAttachTypeToString(attachType); + } - bool getCanCreateAnother() const { return !getDoesAttach(); } - bool getIsCreateAllExclusion() const { return isCreateAllExclusion; } - bool getIsVariable() const { return isVariableCount; } - int getDefaultCount() const { return defaultCount; } - bool getIsPersistent() const { return isPersistent; } + bool getCanCreateAnother() const + { + return !getDoesAttach(); + } + bool getIsCreateAllExclusion() const + { + return isCreateAllExclusion; + } + bool getIsVariable() const + { + return isVariableCount; + } + int getDefaultCount() const + { + return defaultCount; + } + bool getIsPersistent() const + { + return isPersistent; + } }; #endif // COCKATRICE_CARD_RELATION_H - diff --git a/cockatrice/src/card/card_relation_type.h b/cockatrice/src/card/card_relation_type.h index 84e660c5e..c1ea49fa3 100644 --- a/cockatrice/src/card/card_relation_type.h +++ b/cockatrice/src/card/card_relation_type.h @@ -6,20 +6,24 @@ /** * Represents how a card relates to another (attach, transform, etc.). */ -enum class CardRelationType { +enum class CardRelationType +{ DoesNotAttach = 0, AttachTo = 1, TransformInto = 2, }; // Optional helper -inline QString cardAttachTypeToString(CardRelationType type) { +inline QString cardAttachTypeToString(CardRelationType type) +{ switch (type) { - case CardRelationType::AttachTo: return "attach"; - case CardRelationType::TransformInto: return "transform"; - default: return ""; + case CardRelationType::AttachTo: + return "attach"; + case CardRelationType::TransformInto: + return "transform"; + default: + return ""; } } - #endif // COCKATRICE_CARD_RELATION_TYPE_H diff --git a/cockatrice/src/card/card_set.h b/cockatrice/src/card/card_set.h index 60cd14721..fc4d42239 100644 --- a/cockatrice/src/card/card_set.h +++ b/cockatrice/src/card/card_set.h @@ -3,8 +3,8 @@ #include #include -#include #include +#include class CardInfo; using CardInfoPtr = QSharedPointer; @@ -15,7 +15,8 @@ using CardSetPtr = QSharedPointer; class CardSet : public QList { public: - enum Priority { + enum Priority + { PriorityFallback = 0, PriorityPrimary = 10, PrioritySecondary = 20, @@ -33,6 +34,7 @@ private: QString setType; Priority priority; bool enabled, isknown; + public: explicit CardSet(const QString &_shortName = QString(), const QString &_longName = QString(), @@ -48,28 +50,65 @@ public: QString getCorrectedShortName() const; - QString getShortName() const { return shortName; } - QString getLongName() const { return longName; } - QString getSetType() const { return setType; } - QDate getReleaseDate() const { return releaseDate; } - Priority getPriority() const { return priority; } + QString getShortName() const + { + return shortName; + } + QString getLongName() const + { + return longName; + } + QString getSetType() const + { + return setType; + } + QDate getReleaseDate() const + { + return releaseDate; + } + Priority getPriority() const + { + return priority; + } - void setLongName(const QString &_longName) { longName = _longName; } - void setSetType(const QString &_setType) { setType = _setType; } - void setReleaseDate(const QDate &_releaseDate) { releaseDate = _releaseDate; } - void setPriority(const Priority _priority) { priority = _priority; } + void setLongName(const QString &_longName) + { + longName = _longName; + } + void setSetType(const QString &_setType) + { + setType = _setType; + } + void setReleaseDate(const QDate &_releaseDate) + { + releaseDate = _releaseDate; + } + void setPriority(const Priority _priority) + { + priority = _priority; + } void loadSetOptions(); - int getSortKey() const { return sortKey; } + int getSortKey() const + { + return sortKey; + } void setSortKey(unsigned int _sortKey); - bool getEnabled() const { return enabled; } + bool getEnabled() const + { + return enabled; + } void setEnabled(bool _enabled); - bool getIsKnown() const { return isknown; } + bool getIsKnown() const + { + return isknown; + } void setIsKnown(bool _isknown); - bool getIsKnownIgnored() const { + bool getIsKnownIgnored() const + { return longName.length() + setType.length() + releaseDate.toString().length() == 0; } }; diff --git a/cockatrice/src/card/card_set_list.cpp b/cockatrice/src/card/card_set_list.cpp index 3198fe0cc..8d6aa7365 100644 --- a/cockatrice/src/card/card_set_list.cpp +++ b/cockatrice/src/card/card_set_list.cpp @@ -6,7 +6,7 @@ public: inline bool operator()(const CardSetPtr &a, const CardSetPtr &b) const { if (a.isNull() || b.isNull()) { - //qCWarning(CardInfoLog) << "SetList::KeyCompareFunctor a or b is null"; + // qCWarning(CardInfoLog) << "SetList::KeyCompareFunctor a or b is null"; return false; } @@ -74,7 +74,7 @@ void CardSetList::enableAll() CardSetPtr set = at(i); if (set == nullptr) { - //qCWarning(CardInfoLog) << "enabledAll has null"; + // qCWarning(CardInfoLog) << "enabledAll has null"; continue; } @@ -105,7 +105,7 @@ void CardSetList::guessSortKeys() for (int i = 0; i < size(); ++i) { CardSetPtr set = at(i); if (set.isNull()) { - //qCWarning(CardInfoLog) << "guessSortKeys set is null"; + // qCWarning(CardInfoLog) << "guessSortKeys set is null"; continue; } set->setSortKey(i); diff --git a/cockatrice/src/card/card_set_list.h b/cockatrice/src/card/card_set_list.h index 8ed86bf38..af1bb365b 100644 --- a/cockatrice/src/card/card_set_list.h +++ b/cockatrice/src/card/card_set_list.h @@ -2,6 +2,7 @@ #define COCKATRICE_CARD_SET_LIST_H #include "card_set.h" + #include #include @@ -22,5 +23,4 @@ public: void defaultSort(); }; - #endif // COCKATRICE_CARD_SET_LIST_H diff --git a/cockatrice/src/card/printing_info.h b/cockatrice/src/card/printing_info.h index db4fa1e44..cf262b6bb 100644 --- a/cockatrice/src/card/printing_info.h +++ b/cockatrice/src/card/printing_info.h @@ -2,10 +2,11 @@ #define COCKATRICE_PRINTING_INFO_H #include "card_set.h" -#include -#include -#include + #include +#include +#include +#include class PrintingInfo; @@ -20,7 +21,8 @@ public: explicit PrintingInfo(const CardSetPtr &_set = nullptr); ~PrintingInfo() = default; - bool operator==(const PrintingInfo &other) const { + bool operator==(const PrintingInfo &other) const + { return this->set == other.set && this->properties == other.properties; } @@ -30,14 +32,25 @@ private: QVariantHash properties; public: - CardSetPtr getSet() const { return set; } + CardSetPtr getSet() const + { + return set; + } - QStringList getProperties() const { return properties.keys(); } - QString getProperty(const QString &propertyName) const { return properties.value(propertyName).toString(); } - void setProperty(const QString &_name, const QString &_value) { properties.insert(_name, _value); } + QStringList getProperties() const + { + return properties.keys(); + } + QString getProperty(const QString &propertyName) const + { + return properties.value(propertyName).toString(); + } + void setProperty(const QString &_name, const QString &_value) + { + properties.insert(_name, _value); + } QString getUuid() const; }; - #endif // COCKATRICE_PRINTING_INFO_H