mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
[DeckList] Refactor: Create class to RAII underlying tree (#6412)
* [DeckList] Create class to RAII underlying tree * Update usages * fixes after rebase * update docs
This commit is contained in:
parent
589e9a15a6
commit
b29909bdbe
7 changed files with 325 additions and 168 deletions
|
|
@ -41,7 +41,7 @@ void DeckListModel::rebuildTree()
|
|||
beginResetModel();
|
||||
root->clearTree();
|
||||
|
||||
InnerDecklistNode *listRoot = deckList->getRoot();
|
||||
InnerDecklistNode *listRoot = deckList->getTree()->getRoot();
|
||||
|
||||
for (int i = 0; i < listRoot->size(); i++) {
|
||||
auto *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
|
||||
|
|
@ -313,7 +313,7 @@ bool DeckListModel::removeRows(int row, int count, const QModelIndex &parent)
|
|||
for (int i = 0; i < count; i++) {
|
||||
AbstractDecklistNode *toDelete = node->takeAt(row);
|
||||
if (auto *temp = dynamic_cast<DecklistModelCardNode *>(toDelete)) {
|
||||
deckList->deleteNode(temp->getDataNode());
|
||||
deckList->getTree()->deleteNode(temp->getDataNode());
|
||||
}
|
||||
delete toDelete;
|
||||
}
|
||||
|
|
@ -668,7 +668,7 @@ bool DeckListModel::isCardQuantityLegalForCurrentFormat(const CardInfoPtr cardIn
|
|||
|
||||
void DeckListModel::refreshCardFormatLegalities()
|
||||
{
|
||||
InnerDecklistNode *listRoot = deckList->getRoot();
|
||||
InnerDecklistNode *listRoot = deckList->getTree()->getRoot();
|
||||
|
||||
for (int i = 0; i < listRoot->size(); i++) {
|
||||
auto *currentZone = static_cast<InnerDecklistNode *>(listRoot->at(i));
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public:
|
|||
* affects its hash.
|
||||
*
|
||||
* Slots:
|
||||
* - rebuildTree(): rebuilds the model structure from the underlying DeckLoader.
|
||||
* - rebuildTree(): rebuilds the model structure from the underlying node tree.
|
||||
*/
|
||||
class DeckListModel : public QAbstractItemModel
|
||||
{
|
||||
|
|
@ -210,7 +210,7 @@ class DeckListModel : public QAbstractItemModel
|
|||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Rebuilds the model tree from the underlying DeckLoader.
|
||||
* @brief Rebuilds the model tree from the underlying node tree.
|
||||
*
|
||||
* This updates all indices and ensures the model reflects the current
|
||||
* state of the deck.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue