QTfrontend/frameTeam.cpp
author displacer
Fri, 18 Aug 2006 20:37:50 +0000
changeset 117 d21a48200772
parent 87 ff213e443336
child 132 2d0f404cdf05
permissions -rw-r--r--
HWTeam integration in team select widget

#include "frameTeam.h"
#include "teamselhelper.h"

#include <QResizeEvent>
#include <QCoreApplication>

using namespace std;

FrameTeams::FrameTeams(QWidget* parent) :
  QWidget(parent), mainLayout(this)
{
}

void FrameTeams::addTeam(HWTeam team)
{
  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, this);
//  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
  teamToWidget.insert(make_pair(team, pTeamShowWidget));
  mainLayout.addWidget(pTeamShowWidget);
  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
  QCoreApplication::postEvent(parentWidget(), pevent);
}

void FrameTeams::removeTeam(HWTeam team)
{
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
  mainLayout.removeWidget(it->second);
  delete it->second;
  teamToWidget.erase(team);
}

QWidget* FrameTeams::getTeamWidget(HWTeam team)
{
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
  if(!ret) throw; // FIXME: this is debug exception
  return ret;
}