show colors of cards

This commit is contained in:
Zach H 2015-07-07 23:50:37 -04:00
parent f199e20740
commit afa8b53870
3 changed files with 11 additions and 7 deletions

View file

@ -9,11 +9,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
CardFrame::CardFrame(int width, int height, CardFrame::CardFrame(int width, int height, const QString &cardName, QWidget *parent)
const QString &cardName, QWidget *parent) : QTabWidget(parent), info(0), cardTextOnly(false)
: QTabWidget(parent)
, info(0)
, cardTextOnly(false)
{ {
setFixedWidth(width); setFixedWidth(width);
setMinimumHeight(height); setMinimumHeight(height);

View file

@ -8,8 +8,7 @@
#include "main.h" #include "main.h"
CardInfoText::CardInfoText(QWidget *parent) CardInfoText::CardInfoText(QWidget *parent)
: QFrame(parent) : QFrame(parent), info(0)
, info(0)
{ {
nameLabel1 = new QLabel; nameLabel1 = new QLabel;
nameLabel2 = new QLabel; nameLabel2 = new QLabel;
@ -17,6 +16,9 @@ CardInfoText::CardInfoText(QWidget *parent)
manacostLabel1 = new QLabel; manacostLabel1 = new QLabel;
manacostLabel2 = new QLabel; manacostLabel2 = new QLabel;
manacostLabel2->setWordWrap(true); manacostLabel2->setWordWrap(true);
colorLabel1 = new QLabel;
colorLabel2 = new QLabel;
colorLabel2->setWordWrap(true);
cardtypeLabel1 = new QLabel; cardtypeLabel1 = new QLabel;
cardtypeLabel2 = new QLabel; cardtypeLabel2 = new QLabel;
cardtypeLabel2->setWordWrap(true); cardtypeLabel2->setWordWrap(true);
@ -34,6 +36,8 @@ CardInfoText::CardInfoText(QWidget *parent)
grid->addWidget(nameLabel2, row++, 1); grid->addWidget(nameLabel2, row++, 1);
grid->addWidget(manacostLabel1, row, 0); grid->addWidget(manacostLabel1, row, 0);
grid->addWidget(manacostLabel2, row++, 1); grid->addWidget(manacostLabel2, row++, 1);
grid->addWidget(colorLabel1, row, 0);
grid->addWidget(colorLabel2, row++, 1);
grid->addWidget(cardtypeLabel1, row, 0); grid->addWidget(cardtypeLabel1, row, 0);
grid->addWidget(cardtypeLabel2, row++, 1); grid->addWidget(cardtypeLabel2, row++, 1);
grid->addWidget(powtoughLabel1, row, 0); grid->addWidget(powtoughLabel1, row, 0);
@ -51,6 +55,7 @@ void CardInfoText::setCard(CardInfo *card)
{ {
nameLabel2->setText(card->getName()); nameLabel2->setText(card->getName());
manacostLabel2->setText(card->getManaCost()); manacostLabel2->setText(card->getManaCost());
colorLabel2->setText(card->getColors().join(""));
cardtypeLabel2->setText(card->getCardType()); cardtypeLabel2->setText(card->getCardType());
powtoughLabel2->setText(card->getPowTough()); powtoughLabel2->setText(card->getPowTough());
loyaltyLabel2->setText(card->getLoyalty() > 0 ? QString::number(card->getLoyalty()) : QString()); loyaltyLabel2->setText(card->getLoyalty() > 0 ? QString::number(card->getLoyalty()) : QString());
@ -61,6 +66,7 @@ void CardInfoText::retranslateUi()
{ {
nameLabel1->setText(tr("Name:")); nameLabel1->setText(tr("Name:"));
manacostLabel1->setText(tr("Mana cost:")); manacostLabel1->setText(tr("Mana cost:"));
colorLabel1->setText(tr("Color(s):"));
cardtypeLabel1->setText(tr("Card type:")); cardtypeLabel1->setText(tr("Card type:"));
powtoughLabel1->setText(tr("P / T:")); powtoughLabel1->setText(tr("P / T:"));
loyaltyLabel1->setText(tr("Loyalty:")); loyaltyLabel1->setText(tr("Loyalty:"));

View file

@ -13,6 +13,7 @@ class CardInfoText : public QFrame {
private: private:
QLabel *nameLabel1, *nameLabel2; QLabel *nameLabel1, *nameLabel2;
QLabel *manacostLabel1, *manacostLabel2; QLabel *manacostLabel1, *manacostLabel2;
QLabel *colorLabel1, *colorLabel2;
QLabel *cardtypeLabel1, *cardtypeLabel2; QLabel *cardtypeLabel1, *cardtypeLabel2;
QLabel *powtoughLabel1, *powtoughLabel2; QLabel *powtoughLabel1, *powtoughLabel2;
QLabel *loyaltyLabel1, *loyaltyLabel2; QLabel *loyaltyLabel1, *loyaltyLabel2;