mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
add back cardInfo constructor
This commit is contained in:
parent
0d9d328ee7
commit
1b5b1aee72
2 changed files with 9 additions and 2 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue