void CCardLabelNexus::showCardLabelToolTip(const CCard &card, int x, int y)
{
    if (!mCardLabelToolTip->isVisible() && card.isValid())
    {
        const CGlobalConfig &cfg = CGlobalConfig::getCfg();
        const CCardTable &cardTable = CCardTable::getCardTable();

        mCardLabelToolTipSummonLabel->setVisible(false);
        const QList<CCardSkill> &skills = card.getSkills();
        QStringList skillDescr;
        skillDescr.append(QString("<b>%1</b><br>").arg(card.getName()));
        QString subTitleStr = card.isUnique() ? "Unique " : "";
        switch(card.getFaction())
        {
        case EImperialFaction: subTitleStr += "Imperial"; break;
        case EBloodthirstyFaction: subTitleStr += "Bloodthirsty"; break;
        case EXenoFaction: subTitleStr += "Xeno"; break;
        case ERighteousFaction: subTitleStr += "Righteous"; break;
        case ERaiderFaction: subTitleStr += "Raider"; break;
        default: break;
        }
        skillDescr.append(QString("<i>%1</i><table valign='middle'>").arg(subTitleStr));
        for (int i = 0; i < skills.size(); ++i)
        {
            const CSkill& curSkill = cardTable.getSkillForId(skills.at(i).getId());
            if (curSkill.isValid())
            {
                skillDescr.append(QString("<tr><td><img src='%1.png'/></td><td> %2</td></tr>")
                    .arg(cfg.getResourcePicturePath() + curSkill.getPicture())
                    .arg(curSkill.makeSignature(skills.at(i), true)));
                if (curSkill.isSummon())
                {
                    const CCard &summonCard = cardTable.getCardForId(skills.at(i).getX());
                    mCardLabelToolTipSummonLabel->setCard(summonCard);
                    mCardLabelToolTipSummonLabel->setVisible(true);
                }
            }
        }
        skillDescr.append(QString("</table>"));
        mCardLabelToolTipText->setText(skillDescr.join(""));
        mCardLabelToolTipLayout->activate();
        mCardLabelToolTip->adjustSize();

        int reqW = mCardLabelToolTip->width() + 5;
        int reqH = mCardLabelToolTip->height() + 20;
        int xRel = (QApplication::desktop()->width() - x < reqW)
            ? -reqW
            : 5;
        int yRel = (QApplication::desktop()->height() - y < reqH)
            ? -reqH
            : 20;
        mCardLabelToolTip->setGeometry(x + xRel, y + yRel, 80, 40);
        mCardLabelToolTip->setVisible(true);
    }
}
void CCardLabel::setCard(const CCard& card)
{
    const CGlobalConfig &cfg = CGlobalConfig::getCfg();
    mCard = card;
    mTitleIcon = QPixmap();
    switch(card.getType())
    {
    case EAssaultType:
        switch(card.getRarity())
        {
        case ECommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "AssaultRegIcon.png"); break;
        case EUncommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "AssaultSilverIcon.png"); break;
        case ERareRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "AssaultGoldIcon.png"); break;
        case ELegendaryRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "AssaultLegendaryIcon.png"); break;
        default: break;
        }
        break;
    case ECommanderType:
        switch(card.getRarity())
        {
        case ECommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "CommanderRegIcon.png"); break;
        case EUncommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "CommanderSilverIcon.png"); break;
        case ERareRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "CommanderGoldIcon.png"); break;
        case ELegendaryRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "CommanderLegendaryIcon.png"); break;
        default: break;
        }
        break;
    case EStructureType:
        switch(card.getRarity())
        {
        case ECommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "StructureRegIcon.png"); break;
        case EUncommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "StructureSilverIcon.png"); break;
        case ERareRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "StructureGoldIcon.png"); break;
        case ELegendaryRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "StructureLegendaryIcon.png"); break;
        default: break;
        }
        break;
    case EActionType:
        switch(card.getRarity())
        {
        case ECommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "ActionRegIcon.png"); break;
        case EUncommonRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "ActionSilverIcon.png"); break;
        case ERareRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "ActionGoldIcon.png"); break;
        case ELegendaryRarity: mTitleIcon.load(cfg.getResourcePicturePath() + "ActionLegendaryIcon.png"); break;
        default: break;
        }
        break;
    default:
        break;

    }
    QPixmap cardImg;
    switch(card.getFaction())
    {
    case EImperialFaction: cardImg.load(cfg.getResourcePicturePath() + "CardImperialStyled.png"); break;
    case EBloodthirstyFaction: cardImg.load(cfg.getResourcePicturePath() + "CardBloodthirstyStyle.png"); break;
    case EXenoFaction: cardImg.load(cfg.getResourcePicturePath() + "CardXenoStyle.png"); break;
    case ERighteousFaction: cardImg.load(cfg.getResourcePicturePath() + "CardRighteousStyle.png"); break;
    case ERaiderFaction: cardImg.load(cfg.getResourcePicturePath() + "CardRaiderStyle.png"); break;
    case ENoFaction: cardImg.load(cfg.getResourcePicturePath() + "CardBasic.png"); break;
    default: cardImg.load(cfg.getResourcePicturePath() + "CardBack.png"); break;
    }

    if (card.isValid())
    {
        QPixmap unitImg;
        mCards.getCardPicture(mCard, unitImg);
        QPainter painter(&cardImg);
        painter.drawPixmap(5, 24, 150, 120, unitImg.copy(0, 15, unitImg.width(), unitImg.height() - 30));
        painter.end();
    }
    QLabel::setPixmap(cardImg);
}