author | displacer |
Sun, 03 Sep 2006 12:56:13 +0000 | |
changeset 132 | 2d0f404cdf05 |
parent 123 | 6987769ced3d |
child 133 | c79cb5e5b24a |
permissions | -rw-r--r-- |
80 | 1 |
#include "teamselhelper.h" |
132 | 2 |
#include "hwconsts.h" |
80 | 3 |
|
4 |
#include <QPixmap> |
|
5 |
#include <QPushButton> |
|
132 | 6 |
#include <QPainter> |
7 |
||
8 |
#include "hedgehogerWidget.h" |
|
80 | 9 |
|
10 |
void TeamLabel::teamButtonClicked() |
|
11 |
{ |
|
12 |
emit teamActivated(text()); |
|
13 |
} |
|
14 |
||
132 | 15 |
TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) : |
16 |
QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying) |
|
80 | 17 |
{ |
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
18 |
this->setMaximumHeight(40); |
123 | 19 |
QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40)); |
80 | 20 |
|
120 | 21 |
QPushButton* butt=new QPushButton(*px, "", this); |
22 |
butt->setFlat(true); |
|
23 |
butt->setGeometry(0, 0, 30, 30); |
|
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
24 |
butt->setMaximumWidth(30); |
80 | 25 |
mainLayout.addWidget(butt); |
120 | 26 |
butt->setIconSize(butt->size()); |
27 |
||
28 |
QPushButton* bText=new QPushButton(team.TeamName, this); |
|
29 |
QPalette newPalette = palette(); |
|
30 |
newPalette.setColor(QPalette::Button, palette().color(backgroundRole())); |
|
31 |
bText->setPalette(newPalette); |
|
32 |
bText->setFlat(true); |
|
33 |
mainLayout.addWidget(bText); |
|
80 | 34 |
|
132 | 35 |
if(m_isPlaying) { |
36 |
CHedgehogerWidget* phhoger=new CHedgehogerWidget(this); |
|
37 |
mainLayout.addWidget(phhoger); |
|
38 |
} |
|
39 |
||
80 | 40 |
QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); |
120 | 41 |
QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); |
80 | 42 |
} |
43 |
||
44 |
void TeamShowWidget::activateTeam() |
|
45 |
{ |
|
46 |
emit teamStatusChanged(m_team); |
|
47 |
} |