diff -r d57af3defd56 -r 41b46f83d088 tools/MissionsEditor/teamedit.cpp --- a/tools/MissionsEditor/teamedit.cpp Fri Oct 30 19:41:39 2009 +0000 +++ b/tools/MissionsEditor/teamedit.cpp Sun Nov 01 17:19:55 2009 +0000 @@ -6,6 +6,8 @@ m_ui(new Ui::TeamEdit) { m_ui->setupUi(this); + + reset(); } TeamEdit::~TeamEdit() @@ -25,7 +27,15 @@ } } -void TeamEdit::addTeam(const QString & teamName, quint32 color) +void TeamEdit::reset() +{ + QLayout * l = m_ui->scrollArea->widget()->layout(); + + for(int i = 0; i < 8; ++i) + l->itemAt(i)->widget()->setVisible(false); +} + +void TeamEdit::setTeam(const QString & teamName, quint32 color) { m_ui->leTeamName->setText(teamName); } @@ -45,3 +55,44 @@ m_ui->leVoicepack->setText(name); } +void TeamEdit::addHedgehog(quint32 level, quint32 health, const QString & name) +{ + QLayout * l = m_ui->scrollArea->widget()->layout(); + + int i = 0; + while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; + + if(i < 8) + { + HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); + he->setHedgehog(level, health, name); + l->itemAt(i)->widget()->setVisible(true); + } +} + +void TeamEdit::setLastHHHat(const QString & name) +{ + QLayout * l = m_ui->scrollArea->widget()->layout(); + + int i = 0; + while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; + + --i; + + HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); + he->setHat(name); +} + +void TeamEdit::setLastHHCoords(int x, int y) +{ + QLayout * l = m_ui->scrollArea->widget()->layout(); + + int i = 0; + while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; + + --i; + + HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); + he->setCoordinates(x ,y); +} +