mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Rework the way sets selection/importing works; fix #539 (rebased)
This commit is contained in:
parent
e69ca60164
commit
881cea27f4
13 changed files with 369 additions and 162 deletions
|
|
@ -42,7 +42,10 @@ QVariant CardDatabaseModel::data(const QModelIndex &index, int role) const
|
|||
QStringList setList;
|
||||
const QList<CardSet *> &sets = card->getSets();
|
||||
for (int i = 0; i < sets.size(); i++)
|
||||
setList << sets[i]->getShortName();
|
||||
{
|
||||
if(sets[i]->getEnabled())
|
||||
setList << sets[i]->getShortName();
|
||||
}
|
||||
return setList.join(", ");
|
||||
}
|
||||
case ManaCostColumn: return role == SortRole ?
|
||||
|
|
@ -77,9 +80,26 @@ void CardDatabaseModel::updateCardList()
|
|||
for (int i = 0; i < cardList.size(); ++i)
|
||||
disconnect(cardList[i], 0, this, 0);
|
||||
|
||||
cardList = db->getCardList();
|
||||
for (int i = 0; i < cardList.size(); ++i)
|
||||
connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
|
||||
cardList.clear();
|
||||
|
||||
foreach(CardInfo * card, db->getCardList())
|
||||
{
|
||||
bool hasSet = false;
|
||||
foreach(CardSet * set, card->getSets())
|
||||
{
|
||||
if(set->getEnabled())
|
||||
{
|
||||
hasSet = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(hasSet)
|
||||
{
|
||||
cardList.append(card);
|
||||
connect(card, SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
|
||||
}
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue