QTfrontend/frameTeam.cpp
author displacer
Sun, 03 Sep 2006 12:56:13 +0000
changeset 132 2d0f404cdf05
parent 117 d21a48200772
child 134 3d87d8e58020
permissions -rw-r--r--
first hedgehogs number selection added
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
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    12
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    13
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 117
diff changeset
    14
void FrameTeams::addTeam(HWTeam team, bool willPlay)
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    15
{
132
2d0f404cdf05 first hedgehogs number selection added
displacer
parents: 117
diff changeset
    16
  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, willPlay, this);
87
ff213e443336 Convert all pages to classes
unc0rr
parents: 80
diff changeset
    17
//  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
    18
  teamToWidget.insert(make_pair(team, pTeamShowWidget));
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    19
  mainLayout.addWidget(pTeamShowWidget);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    20
  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    21
  QCoreApplication::postEvent(parentWidget(), pevent);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    22
}
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    23
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 87
diff changeset
    24
void FrameTeams::removeTeam(HWTeam team)
80
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    25
{
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    26
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    27
  mainLayout.removeWidget(it->second);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    28
  delete it->second;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    29
  teamToWidget.erase(team);
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
117
d21a48200772 HWTeam integration in team select widget
displacer
parents: 87
diff changeset
    32
QWidget* FrameTeams::getTeamWidget(HWTeam team)
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
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    35
  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    36
  if(!ret) throw; // FIXME: this is debug exception
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    37
  return ret;
3c3dc6a148ca - Fixed bug with hedgehog under water using rope
unc0rr
parents: 63
diff changeset
    38
}