QTfrontend/teamselhelper.cpp
author displacer
Sun, 20 Aug 2006 15:22:26 +0000
changeset 120 87264c35b09a
parent 118 fac200ee771c
child 123 6987769ced3d
permissions -rw-r--r--
flat buttons
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>
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     5
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     6
void TeamLabel::teamButtonClicked()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     7
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     8
  emit teamActivated(text());
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     9
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    10
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 116
diff changeset
    11
TeamShowWidget::TeamShowWidget(HWTeam team, QWidget * parent) :
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    12
  QWidget(parent), mainLayout(this), m_team(team)
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    13
{
86
664b536a1c27 Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents: 84
diff changeset
    14
  this->setMaximumHeight(40);
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    15
  QPixmap* px=new QPixmap(QPixmap(QString("../share/hedgewars/Data/Forts/")+m_team.Fort+"L.png").scaled(40, 40));
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    16
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    17
  QPushButton* butt=new QPushButton(*px, "", this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    18
  butt->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    19
  butt->setGeometry(0, 0, 30, 30);
86
664b536a1c27 Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents: 84
diff changeset
    20
  butt->setMaximumWidth(30);
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    21
  mainLayout.addWidget(butt);
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    22
  butt->setIconSize(butt->size());
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    23
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    24
  QPushButton* bText=new QPushButton(team.TeamName, this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    25
  QPalette newPalette = palette();
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    26
  newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    27
  bText->setPalette(newPalette);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    28
  bText->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    29
  mainLayout.addWidget(bText);
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    30
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    31
  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    32
  QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    33
}
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
void TeamShowWidget::activateTeam()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    36
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    37
  emit teamStatusChanged(m_team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    38
}