mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
improved token dialog
This commit is contained in:
parent
62a9003d3e
commit
49e3563386
16 changed files with 112 additions and 56 deletions
|
|
@ -53,48 +53,47 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
|
|||
} else {
|
||||
QFont f("Serif");
|
||||
f.setStyleHint(QFont::Serif);
|
||||
f.setPixelSize(11);
|
||||
f.setPixelSize(12);
|
||||
painter->setFont(f);
|
||||
painter->setBrush(QColor(230, 230, 230));
|
||||
qDebug() <<"COLORS:::::" << info->getColors();
|
||||
QString color;
|
||||
QPen pen;
|
||||
if(!info->getColors().empty())
|
||||
{
|
||||
color = info->getColors().first();
|
||||
if(color == "B")
|
||||
painter->setBrush(QColor(0,0,0));
|
||||
if(color == "U")
|
||||
painter->setBrush(QColor(0,140,180));
|
||||
if(color == "W")
|
||||
painter->setBrush(QColor(255,250,140));
|
||||
if(color == "R")
|
||||
painter->setBrush(QColor(230,0,0));
|
||||
if(color == "G")
|
||||
painter->setBrush(QColor(0,160,0));
|
||||
if(info->getColors().size() > 1)
|
||||
{
|
||||
painter->setBrush(QColor(250,190,30));
|
||||
color = "M"; // Multicolor
|
||||
}
|
||||
|
||||
}
|
||||
QString colorStr;
|
||||
if (!color.isEmpty())
|
||||
colorStr = color;
|
||||
else if (info->getColors().size() > 1)
|
||||
colorStr = "m";
|
||||
else
|
||||
colorStr = info->getColors().first().toLower();
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
QColor bgColor;
|
||||
QColor textColor = Qt::white;
|
||||
if (colorStr == "b")
|
||||
bgColor = QColor(0, 0, 0);
|
||||
else if (colorStr == "u")
|
||||
bgColor = QColor(0, 140, 180);
|
||||
else if (colorStr == "w") {
|
||||
bgColor = QColor(255, 250, 140);
|
||||
textColor = Qt::black;
|
||||
} else if (colorStr == "r")
|
||||
bgColor = QColor(230, 0, 0);
|
||||
else if (colorStr == "g")
|
||||
bgColor = QColor(0, 160, 0);
|
||||
else if (colorStr == "m") {
|
||||
bgColor = QColor(250, 190, 30);
|
||||
textColor = Qt::black;
|
||||
} else {
|
||||
bgColor = QColor(230, 230, 230);
|
||||
textColor = Qt::black;
|
||||
}
|
||||
painter->setBrush(bgColor);
|
||||
QPen pen(Qt::black);
|
||||
painter->setPen(pen);
|
||||
|
||||
painter->drawRect(QRectF(0.5, 0.5, CARD_WIDTH - 1, CARD_HEIGHT - 1));
|
||||
|
||||
pen.setWidth(3);
|
||||
painter->setPen(pen);
|
||||
painter->drawRect(QRectF(3, 3, CARD_WIDTH - 6, CARD_HEIGHT - 6));
|
||||
painter->setPen(Qt::white);
|
||||
if(color == "W" || color == "" || color == "M")
|
||||
painter->setPen(Qt::black);
|
||||
painter->setPen(textColor);
|
||||
painter->drawText(QRectF(5, 5, CARD_WIDTH - 15, CARD_HEIGHT - 15), Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap, name);
|
||||
if(info->getCardType().contains("Creature"))
|
||||
{
|
||||
painter->drawText(QRectF(CARD_WIDTH - 40, CARD_HEIGHT - 25, 30, 30), Qt::AlignTop | Qt::AlignRight | Qt::TextWordWrap, info->getPowTough());
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
|
|
@ -115,6 +114,12 @@ void AbstractCardItem::setName(const QString &_name)
|
|||
update();
|
||||
}
|
||||
|
||||
void AbstractCardItem::setColor(const QString &_color)
|
||||
{
|
||||
color = _color;
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractCardItem::setTapped(bool _tapped)
|
||||
{
|
||||
tapped = _tapped;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue