add back cardInfo constructor

This commit is contained in:
RickyRister 2026-01-14 01:25:37 -08:00
parent 0d9d328ee7
commit 1b5b1aee72
2 changed files with 9 additions and 2 deletions

View file

@ -25,6 +25,11 @@ ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, const QString &_colorI
&ColorIdentityWidget::toggleUnusedVisibility); &ColorIdentityWidget::toggleUnusedVisibility);
} }
ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, const CardInfoPtr &card)
: ColorIdentityWidget(parent, card->getColors())
{
}
void ColorIdentityWidget::populateManaSymbolWidgets() void ColorIdentityWidget::populateManaSymbolWidgets()
{ {
// Define the full WUBRG set (White, Blue, Black, Red, Green) // Define the full WUBRG set (White, Blue, Black, Red, Green)
@ -74,12 +79,12 @@ void ColorIdentityWidget::resizeEvent(QResizeEvent *event)
} }
} }
QStringList ColorIdentityWidget::parseColorIdentity(const QString &cmc) QStringList ColorIdentityWidget::parseColorIdentity(const QString &manaString)
{ {
QStringList symbols; QStringList symbols;
// Handle split costs (e.g., "3U // 4UU") // Handle split costs (e.g., "3U // 4UU")
QStringList splitCosts = cmc.split(" // "); QStringList splitCosts = manaString.split(" // ");
for (const QString &part : splitCosts) { for (const QString &part : splitCosts) {
QRegularExpression regex(R"(\{([^}]+)\}|(\d+)|([WUBRGCSPX]))"); QRegularExpression regex(R"(\{([^}]+)\}|(\d+)|([WUBRGCSPX]))");
QRegularExpressionMatchIterator matches = regex.globalMatch(part); QRegularExpressionMatchIterator matches = regex.globalMatch(part);

View file

@ -16,6 +16,8 @@ class ColorIdentityWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ColorIdentityWidget(QWidget *parent, const QString &_colorIdentity = ""); explicit ColorIdentityWidget(QWidget *parent, const QString &_colorIdentity = "");
explicit ColorIdentityWidget(QWidget *parent, const CardInfoPtr &card);
void populateManaSymbolWidgets(); void populateManaSymbolWidgets();
static QStringList parseColorIdentity(const QString &manaString); static QStringList parseColorIdentity(const QString &manaString);