mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Compute deck hashes lazily (#5707)
* Calculate deck hashes lazily * rename
This commit is contained in:
parent
9b00bdcaea
commit
ec536126b9
3 changed files with 43 additions and 21 deletions
|
|
@ -252,7 +252,6 @@ class DeckList : public QObject
|
|||
private:
|
||||
QString name, comments;
|
||||
QPair<QString, QString> bannerCard;
|
||||
QString deckHash;
|
||||
QString lastLoadedTimestamp;
|
||||
QStringList tags;
|
||||
QMap<QString, SideboardPlan *> sideboardPlans;
|
||||
|
|
@ -261,6 +260,11 @@ private:
|
|||
void getCardListWithProviderIdHelper(InnerDecklistNode *item, QMap<QString, QString> &result) const;
|
||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
||||
|
||||
/**
|
||||
* Empty string indicates invalidated cache.
|
||||
*/
|
||||
mutable QString cachedDeckHash;
|
||||
|
||||
protected:
|
||||
virtual QString getCardZoneFromName(const QString /*cardName*/, QString currentZoneName)
|
||||
{
|
||||
|
|
@ -363,12 +367,6 @@ public:
|
|||
|
||||
int getSideboardSize() const;
|
||||
|
||||
QString getDeckHash() const
|
||||
{
|
||||
return deckHash;
|
||||
}
|
||||
void updateDeckHash();
|
||||
|
||||
InnerDecklistNode *getRoot() const
|
||||
{
|
||||
return root;
|
||||
|
|
@ -380,6 +378,9 @@ public:
|
|||
const QString &cardProviderId = QString());
|
||||
bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode = nullptr);
|
||||
|
||||
QString getDeckHash() const;
|
||||
void refreshDeckHash();
|
||||
|
||||
/**
|
||||
* Calls a given function object for each card in the deck. It must
|
||||
* take a InnerDecklistNode* as its first argument and a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue