mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 19:13:55 -07:00
Token dialog fixes (#3711)
* Token dialog fixes * clangify * edit custom tokens * Fix in-game token dialog
This commit is contained in:
parent
3830c85ce6
commit
6c21855f98
7 changed files with 43 additions and 11 deletions
|
|
@ -61,7 +61,7 @@ DlgEditTokens::DlgEditTokens(QWidget *parent) : QDialog(parent), currentCard(nul
|
|||
|
||||
databaseModel = new CardDatabaseModel(db, false, this);
|
||||
databaseModel->setObjectName("databaseModel");
|
||||
cardDatabaseDisplayModel = new TokenDisplayModel(this);
|
||||
cardDatabaseDisplayModel = new TokenEditModel(this);
|
||||
cardDatabaseDisplayModel->setSourceModel(databaseModel);
|
||||
cardDatabaseDisplayModel->setIsToken(CardDatabaseDisplayModel::ShowTrue);
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ DlgEditTokens::DlgEditTokens(QWidget *parent) : QDialog(parent), currentCard(nul
|
|||
mainLayout->addWidget(buttonBox);
|
||||
|
||||
setLayout(mainLayout);
|
||||
setWindowTitle(tr("Edit tokens"));
|
||||
setWindowTitle(tr("Edit custom tokens"));
|
||||
}
|
||||
|
||||
void DlgEditTokens::tokenSelectionChanged(const QModelIndex ¤t, const QModelIndex & /* previous */)
|
||||
|
|
@ -123,7 +123,7 @@ void DlgEditTokens::tokenSelectionChanged(const QModelIndex ¤t, const QMod
|
|||
currentCard.clear();
|
||||
}
|
||||
|
||||
if (!currentCard) {
|
||||
if (currentCard) {
|
||||
nameEdit->setText(currentCard->getName());
|
||||
const QChar cardColor = currentCard->getColorChar();
|
||||
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||
|
|
@ -154,9 +154,12 @@ void DlgEditTokens::actAddToken()
|
|||
}
|
||||
} while (askAgain);
|
||||
|
||||
CardInfoPtr card = CardInfo::newInstance(name, "", true);
|
||||
QString setName = CardDatabase::TOKENS_SETNAME;
|
||||
CardInfoPerSetMap sets;
|
||||
sets.insert(setName, CardInfoPerSet(databaseModel->getDatabase()->getSet(setName)));
|
||||
CardInfoPtr card = CardInfo::newInstance(name, "", true, QVariantHash(), QList<CardRelation *>(),
|
||||
QList<CardRelation *>(), sets, false, -1, false);
|
||||
card->setCardType("Token");
|
||||
card->addToSet(databaseModel->getDatabase()->getSet(CardDatabase::TOKENS_SETNAME));
|
||||
|
||||
databaseModel->getDatabase()->addCard(card);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue