QTfrontend/teamselhelper.cpp
changeset 140 50ccde437ea1
parent 135 53faa20669de
child 152 c558957ef644
equal deleted inserted replaced
139:340ded7cc336 140:50ccde437ea1
     3 
     3 
     4 #include <QPixmap>
     4 #include <QPixmap>
     5 #include <QPushButton>
     5 #include <QPushButton>
     6 #include <QPainter>
     6 #include <QPainter>
     7 
     7 
     8 #include "hedgehogerWidget.h"
       
     9 
       
    10 void TeamLabel::teamButtonClicked()
     8 void TeamLabel::teamButtonClicked()
    11 {
     9 {
    12   emit teamActivated(text());
    10   emit teamActivated(text());
    13 }
    11 }
    14 
    12 
    15 TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
    13 TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
    16   QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying)
    14   QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0)
    17 {
    15 {
    18   mainLayout.setSpacing(1);
    16   mainLayout.setSpacing(1);
    19   mainLayout.setMargin(2);
    17   mainLayout.setMargin(2);
    20   this->setMaximumHeight(35);
    18   this->setMaximumHeight(35);
    21   QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40));
    19   QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40));
    35   bText->setPalette(newPalette);
    33   bText->setPalette(newPalette);
    36   bText->setFlat(true);
    34   bText->setFlat(true);
    37   mainLayout.addWidget(bText);
    35   mainLayout.addWidget(bText);
    38 
    36 
    39   if(m_isPlaying) {
    37   if(m_isPlaying) {
    40     CHedgehogerWidget* phhoger=new CHedgehogerWidget(this);
    38     phhoger=new CHedgehogerWidget(this);
    41     mainLayout.addWidget(phhoger);
    39     mainLayout.addWidget(phhoger);
    42   }
    40   }
    43 
    41 
    44   QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
    42   QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
    45   QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
    43   QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
    47 
    45 
    48 void TeamShowWidget::activateTeam()
    46 void TeamShowWidget::activateTeam()
    49 {
    47 {
    50   emit teamStatusChanged(m_team);
    48   emit teamStatusChanged(m_team);
    51 }
    49 }
       
    50 
       
    51 unsigned char TeamShowWidget::getHedgehogsNum()
       
    52 {
       
    53   return phhoger ? phhoger->getHedgehogsNum() : 0;
       
    54 }