Fix related cards menu in deck editor (#3649)
This commit is contained in:
parent
0326f0d4c9
commit
6f95556632
3 changed files with 8 additions and 16 deletions
|
@ -47,9 +47,8 @@ void CardInfoText::setCard(CardInfoPtr card)
|
||||||
QString("<tr><td>%1</td><td></td><td>%2</td></tr>").arg(keyText, card->getProperty(key).toHtmlEscaped());
|
QString("<tr><td>%1</td><td></td><td>%2</td></tr>").arg(keyText, card->getProperty(key).toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto relatedCards = card->getRelatedCards();
|
auto relatedCards = card->getAllRelatedCards();
|
||||||
auto reverserelatedCards2Me = card->getReverseRelatedCards2Me();
|
if (!relatedCards.empty()) {
|
||||||
if (!relatedCards.empty() || !reverserelatedCards2Me.empty()) {
|
|
||||||
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>").arg(tr("Related cards:"));
|
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>").arg(tr("Related cards:"));
|
||||||
|
|
||||||
for (auto *relatedCard : relatedCards) {
|
for (auto *relatedCard : relatedCards) {
|
||||||
|
@ -57,11 +56,6 @@ void CardInfoText::setCard(CardInfoPtr card)
|
||||||
text += "<a href=\"" + tmp + "\">" + tmp + "</a><br>";
|
text += "<a href=\"" + tmp + "\">" + tmp + "</a><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto *i : reverserelatedCards2Me) {
|
|
||||||
QString tmp = i->getName().toHtmlEscaped();
|
|
||||||
text += "<a href=\"" + tmp + "\">" + tmp + "</a><br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
text += "</td></tr>";
|
text += "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1229,9 +1229,7 @@ void Player::actCreateRelatedCard()
|
||||||
}
|
}
|
||||||
auto *action = static_cast<QAction *>(sender());
|
auto *action = static_cast<QAction *>(sender());
|
||||||
// If there is a better way of passing a CardRelation through a QAction, please add it here.
|
// If there is a better way of passing a CardRelation through a QAction, please add it here.
|
||||||
QList<CardRelation *> relatedCards = QList<CardRelation *>();
|
auto relatedCards = sourceCard->getInfo()->getAllRelatedCards();
|
||||||
relatedCards.append(sourceCard->getInfo()->getRelatedCards());
|
|
||||||
relatedCards.append(sourceCard->getInfo()->getReverseRelatedCards2Me());
|
|
||||||
CardRelation *cardRelation = relatedCards.at(action->data().toInt());
|
CardRelation *cardRelation = relatedCards.at(action->data().toInt());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1251,9 +1249,8 @@ void Player::actCreateAllRelatedCards()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<CardRelation *> relatedCards = sourceCard->getInfo()->getRelatedCards();
|
auto relatedCards = sourceCard->getInfo()->getAllRelatedCards();
|
||||||
relatedCards.append(sourceCard->getInfo()->getReverseRelatedCards2Me());
|
if (relatedCards.isEmpty()) {
|
||||||
if (relatedCards.empty()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -460,11 +460,12 @@ void TabDeckEditor::databaseCustomMenu(QPoint point)
|
||||||
// filling out the related cards submenu
|
// filling out the related cards submenu
|
||||||
auto *relatedMenu = new QMenu(tr("Show Related cards"));
|
auto *relatedMenu = new QMenu(tr("Show Related cards"));
|
||||||
menu.addMenu(relatedMenu);
|
menu.addMenu(relatedMenu);
|
||||||
if (info->getRelatedCards().isEmpty()) {
|
auto relatedCards = info->getAllRelatedCards();
|
||||||
|
if (relatedCards.isEmpty()) {
|
||||||
relatedMenu->setDisabled(true);
|
relatedMenu->setDisabled(true);
|
||||||
} else {
|
} else {
|
||||||
auto *signalMapper = new QSignalMapper(this);
|
auto *signalMapper = new QSignalMapper(this);
|
||||||
for (const CardRelation *rel : info->getRelatedCards()) {
|
for (const CardRelation *rel : relatedCards) {
|
||||||
QAction *relatedCard;
|
QAction *relatedCard;
|
||||||
relatedCard = relatedMenu->addAction(rel->getName());
|
relatedCard = relatedMenu->addAction(rel->getName());
|
||||||
connect(relatedCard, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
connect(relatedCard, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||||
|
|
Loading…
Reference in a new issue