author | displacer |
Fri, 15 Sep 2006 15:45:30 +0000 | |
changeset 147 | 52a3c431db8a |
parent 140 | 50ccde437ea1 |
child 152 | c558957ef644 |
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 |
||
80 | 8 |
void TeamLabel::teamButtonClicked() |
9 |
{ |
|
10 |
emit teamActivated(text()); |
|
11 |
} |
|
12 |
||
132 | 13 |
TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) : |
140
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
14 |
QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0) |
80 | 15 |
{ |
134 | 16 |
mainLayout.setSpacing(1); |
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
17 |
mainLayout.setMargin(2); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
18 |
this->setMaximumHeight(35); |
123 | 19 |
QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40)); |
80 | 20 |
|
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
21 |
QPalette newPalette = palette(); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
22 |
newPalette.setColor(QPalette::Button, palette().color(backgroundRole())); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
23 |
|
120 | 24 |
QPushButton* butt=new QPushButton(*px, "", this); |
25 |
butt->setFlat(true); |
|
26 |
butt->setGeometry(0, 0, 30, 30); |
|
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
27 |
butt->setMaximumWidth(30); |
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
28 |
butt->setPalette(newPalette); |
80 | 29 |
mainLayout.addWidget(butt); |
120 | 30 |
butt->setIconSize(butt->size()); |
31 |
||
32 |
QPushButton* bText=new QPushButton(team.TeamName, this); |
|
33 |
bText->setPalette(newPalette); |
|
34 |
bText->setFlat(true); |
|
35 |
mainLayout.addWidget(bText); |
|
80 | 36 |
|
132 | 37 |
if(m_isPlaying) { |
140
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
38 |
phhoger=new CHedgehogerWidget(this); |
132 | 39 |
mainLayout.addWidget(phhoger); |
40 |
} |
|
41 |
||
80 | 42 |
QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); |
120 | 43 |
QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); |
80 | 44 |
} |
45 |
||
46 |
void TeamShowWidget::activateTeam() |
|
47 |
{ |
|
48 |
emit teamStatusChanged(m_team); |
|
49 |
} |
|
140
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
50 |
|
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
51 |
unsigned char TeamShowWidget::getHedgehogsNum() |
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
52 |
{ |
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
53 |
return phhoger ? phhoger->getHedgehogsNum() : 0; |
50ccde437ea1
teams and hedgedogs num selection added to HWgame
displacer
parents:
135
diff
changeset
|
54 |
} |