QTfrontend/teamselhelper.cpp
author unc0rr
Sun, 03 Sep 2006 18:01:34 +0000
changeset 139 340ded7cc336
parent 135 53faa20669de
child 140 50ccde437ea1
permissions -rw-r--r--
Fixed AI bug, introduced by previous changes
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"
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
     2
#include "hwconsts.h"
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     3
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     4
#include <QPixmap>
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     5
#include <QPushButton>
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
     6
#include <QPainter>
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
     7
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
     8
#include "hedgehogerWidget.h"
80
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
void TeamLabel::teamButtonClicked()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    11
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    12
  emit teamActivated(text());
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    13
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    14
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    15
TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    16
  QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying)
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    17
{
134
3d87d8e58020 spacing reduced, 4 hedgehog per team by default
displacer
parents: 133
diff changeset
    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
6987769ced3d Various small fixes
unc0rr
parents: 120
diff changeset
    21
  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
    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
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    26
  QPushButton* butt=new QPushButton(*px, "", this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    27
  butt->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    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
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    31
  mainLayout.addWidget(butt);
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    32
  butt->setIconSize(butt->size());
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    33
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    34
  QPushButton* bText=new QPushButton(team.TeamName, this);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    35
  bText->setPalette(newPalette);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    36
  bText->setFlat(true);
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    37
  mainLayout.addWidget(bText);
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    38
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    39
  if(m_isPlaying) {
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    40
    CHedgehogerWidget* phhoger=new CHedgehogerWidget(this);
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    41
    mainLayout.addWidget(phhoger);
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    42
  }
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 123
diff changeset
    43
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    44
  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
120
87264c35b09a flat buttons
displacer
parents: 118
diff changeset
    45
  QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    46
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    47
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    48
void TeamShowWidget::activateTeam()
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    49
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    50
  emit teamStatusChanged(m_team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    51
}