don't update the deckhash on load

add a new property to decklists that tracks if the deck needs to update
the deckhash

only update the deckhash if needed when it is asked for

this saves computing the deckhash for every loaded deck as performed by
the visual deck selector with impunity

the copy constructor also now no longer computes the deck hash again

the deck hash is now only computed once, on deck load, as expected,
resulting in massive amounts of cpu cycles not being wasted
This commit is contained in:
ebbit1q 2025-03-10 19:21:10 +01:00
parent 0a1d0f650f
commit 1b62022f25
2 changed files with 27 additions and 17 deletions

View file

@ -253,6 +253,7 @@ private:
QString name, comments;
QPair<QString, QString> bannerCard;
QString deckHash;
bool deckHashDirty;
QString lastLoadedTimestamp;
QStringList tags;
QMap<QString, SideboardPlan *> sideboardPlans;
@ -363,10 +364,7 @@ public:
int getSideboardSize() const;
QString getDeckHash() const
{
return deckHash;
}
QString getDeckHash();
void updateDeckHash();
InnerDecklistNode *getRoot() const
@ -399,4 +397,4 @@ public:
}
};
#endif
#endif