author | unc0rr |
Sun, 03 Sep 2006 18:01:34 +0000 | |
changeset 139 | 340ded7cc336 |
parent 135 | 53faa20669de |
child 140 | 50ccde437ea1 |
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 |
{ |
134 | 18 |
mainLayout.setSpacing(1); |
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
19 |
mainLayout.setMargin(2); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
20 |
this->setMaximumHeight(35); |
123 | 21 |
QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40)); |
80 | 22 |
|
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
23 |
QPalette newPalette = palette(); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
24 |
newPalette.setColor(QPalette::Button, palette().color(backgroundRole())); |
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
25 |
|
120 | 26 |
QPushButton* butt=new QPushButton(*px, "", this); |
27 |
butt->setFlat(true); |
|
28 |
butt->setGeometry(0, 0, 30, 30); |
|
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
29 |
butt->setMaximumWidth(30); |
135
53faa20669de
margin reduced (space between commands in teamselect widget)
displacer
parents:
134
diff
changeset
|
30 |
butt->setPalette(newPalette); |
80 | 31 |
mainLayout.addWidget(butt); |
120 | 32 |
butt->setIconSize(butt->size()); |
33 |
||
34 |
QPushButton* bText=new QPushButton(team.TeamName, this); |
|
35 |
bText->setPalette(newPalette); |
|
36 |
bText->setFlat(true); |
|
37 |
mainLayout.addWidget(bText); |
|
80 | 38 |
|
132 | 39 |
if(m_isPlaying) { |
40 |
CHedgehogerWidget* phhoger=new CHedgehogerWidget(this); |
|
41 |
mainLayout.addWidget(phhoger); |
|
42 |
} |
|
43 |
||
80 | 44 |
QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); |
120 | 45 |
QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); |
80 | 46 |
} |
47 |
||
48 |
void TeamShowWidget::activateTeam() |
|
49 |
{ |
|
50 |
emit teamStatusChanged(m_team); |
|
51 |
} |