[CardInfo] Display set short name and collector number in info widget. (#6378)

* [CardInfo] Display set short name and collector number in info widget.

* Lint.

* Use reference.
This commit is contained in:
BruebachL
2025-12-02 22:24:39 +01:00
committed by GitHub
parent 30cc8ad6f9
commit d29e72ce72
4 changed files with 16 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ void CardInfoDisplayWidget::setCard(const ExactCard &card)
if (exactCard)
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
text->setCard(exactCard.getCardPtr());
text->setCard(exactCard);
pic->setCard(exactCard);
}

View File

@@ -154,7 +154,7 @@ void CardInfoFrameWidget::setCard(const ExactCard &card)
setViewTransformationButtonVisibility(hasTransformation(exactCard.getInfo()));
text->setCard(exactCard.getCardPtr());
text->setCard(exactCard);
pic->setCard(exactCard);
}

View File

@@ -50,8 +50,9 @@ void CardInfoTextWidget::setTexts(const QString &propsText, const QString &textT
textLabel->setText(textText);
}
void CardInfoTextWidget::setCard(CardInfoPtr card)
void CardInfoTextWidget::setCard(const ExactCard &exactCard)
{
auto card = exactCard.getCardPtr();
if (card == nullptr) {
setTexts("", "");
return;
@@ -61,6 +62,15 @@ void CardInfoTextWidget::setCard(CardInfoPtr card)
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>%2</td></tr>")
.arg(tr("Name:"), card->getName().toHtmlEscaped());
if (exactCard.getPrinting() != PrintingInfo()) {
QString setShort = exactCard.getPrinting().getSet()->getShortName().toHtmlEscaped();
QString cardNum = exactCard.getPrinting().getProperty("num").toHtmlEscaped();
text += QString("<tr><td>%1</td><td></td><td>%2</td></tr>").arg(tr("Set:"), setShort);
text += QString("<tr><td>%1</td><td></td><td>%2</td></tr>").arg(tr("Collector Number:"), cardNum);
}
QStringList cardProps = card->getProperties();
for (const QString &key : cardProps) {
if (key.contains("-"))

View File

@@ -7,6 +7,8 @@
#ifndef CARDINFOTEXT_H
#define CARDINFOTEXT_H
#include "libcockatrice/card/printing/exact_card.h"
#include <QFrame>
#include <libcockatrice/card/card_info.h>
class QLabel;
@@ -32,7 +34,7 @@ public:
signals:
void linkActivated(const QString &link);
public slots:
void setCard(CardInfoPtr card);
void setCard(const ExactCard &card);
};
#endif