QTfrontend/teamselhelper.cpp
author unc0rr
Sat, 26 Aug 2006 09:41:33 +0000
changeset 124 75b892eff74d
parent 123 6987769ced3d
child 132 2d0f404cdf05
permissions -rw-r--r--
Fixed PRNG to properly use seed string
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     1
#include "teamselhelper.h"
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     2
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     3
#include <QPixmap>
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     4
#include <QPushButton>
123
6987769ced3d Various small fixes
unc0rr
parents: 120
diff changeset
     5
#include "hwconsts.h"
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     6
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     7
void TeamLabel::teamButtonClicked()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     8
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     9
  emit teamActivated(text());
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    10
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    11
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 116
diff changeset
    12
TeamShowWidget::TeamShowWidget(HWTeam team, QWidget * parent) :
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    13
  QWidget(parent), mainLayout(this), m_team(team)
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    14
{
86
664b536a1c27 Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents: 84
diff changeset
    15
  this->setMaximumHeight(40);
123
6987769ced3d Various small fixes
unc0rr
parents: 120
diff changeset
    16
  QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40));
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    17
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    18
  QPushButton* butt=new QPushButton(*px, "", this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    19
  butt->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    20
  butt->setGeometry(0, 0, 30, 30);
86
664b536a1c27 Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents: 84
diff changeset
    21
  butt->setMaximumWidth(30);
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    22
  mainLayout.addWidget(butt);
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    23
  butt->setIconSize(butt->size());
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    24
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    25
  QPushButton* bText=new QPushButton(team.TeamName, this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    26
  QPalette newPalette = palette();
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    27
  newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    28
  bText->setPalette(newPalette);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    29
  bText->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    30
  mainLayout.addWidget(bText);
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    31
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    32
  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    33
  QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    34
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    35
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    36
void TeamShowWidget::activateTeam()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    37
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    38
  emit teamStatusChanged(m_team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    39
}