QTfrontend/frameTeam.cpp
author unc0rr
Sun, 03 Sep 2006 15:39:53 +0000
changeset 138 00e8d3693e90
parent 134 3d87d8e58020
child 140 50ccde437ea1
permissions -rw-r--r--
Actualize translation
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 "frameTeam.h"
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     2
#include "teamselhelper.h"
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 <QResizeEvent>
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
     5
#include <QCoreApplication>
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
using namespace std;
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
FrameTeams::FrameTeams(QWidget* parent) :
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    10
  QWidget(parent), mainLayout(this)
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    11
{
134
3d87d8e58020 spacing reduced, 4 hedgehog per team by default
displacer
parents: 132
diff changeset
    12
  mainLayout.setSpacing(1);
80
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: 117
diff changeset
    15
void FrameTeams::addTeam(HWTeam team, bool willPlay)
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    16
{
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 117
diff changeset
    17
  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, willPlay, this);
87
ff213e443336 Convert all pages to classes
unc0rr
parents: 80
diff changeset
    18
//  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    19
  teamToWidget.insert(make_pair(team, pTeamShowWidget));
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    20
  mainLayout.addWidget(pTeamShowWidget);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    21
  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    22
  QCoreApplication::postEvent(parentWidget(), pevent);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    23
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    24
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 87
diff changeset
    25
void FrameTeams::removeTeam(HWTeam team)
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    26
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    27
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    28
  mainLayout.removeWidget(it->second);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    29
  delete it->second;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    30
  teamToWidget.erase(team);
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
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 87
diff changeset
    33
QWidget* FrameTeams::getTeamWidget(HWTeam team)
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
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    36
  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    37
  if(!ret) throw; // FIXME: this is debug exception
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    38
  return ret;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    39
}