--- a/QTfrontend/frameTeam.cpp Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/frameTeam.cpp Fri Aug 18 20:37:50 2006 +0000
@@ -11,7 +11,7 @@
{
}
-void FrameTeams::addTeam(tmprop team)
+void FrameTeams::addTeam(HWTeam team)
{
TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, this);
// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
@@ -21,7 +21,7 @@
QCoreApplication::postEvent(parentWidget(), pevent);
}
-void FrameTeams::removeTeam(tmprop team)
+void FrameTeams::removeTeam(HWTeam team)
{
tmapTeamToWidget::iterator it=teamToWidget.find(team);
mainLayout.removeWidget(it->second);
@@ -29,7 +29,7 @@
teamToWidget.erase(team);
}
-QWidget* FrameTeams::getTeamWidget(tmprop team)
+QWidget* FrameTeams::getTeamWidget(HWTeam team)
{
tmapTeamToWidget::iterator it=teamToWidget.find(team);
QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
--- a/QTfrontend/frameTeam.h Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/frameTeam.h Fri Aug 18 20:37:50 2006 +0000
@@ -12,15 +12,15 @@
public:
FrameTeams(QWidget* parent=0);
- QWidget* getTeamWidget(tmprop team);
+ QWidget* getTeamWidget(HWTeam team);
public slots:
- void addTeam(tmprop team);
- void removeTeam(tmprop team);
+ void addTeam(HWTeam team);
+ void removeTeam(HWTeam team);
private:
QVBoxLayout mainLayout;
- typedef map<tmprop, QWidget*> tmapTeamToWidget;
+ typedef map<HWTeam, QWidget*> tmapTeamToWidget;
tmapTeamToWidget teamToWidget;
};
--- a/QTfrontend/team.cpp Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/team.cpp Fri Aug 18 20:37:50 2006 +0000
@@ -36,7 +36,6 @@
#include <QApplication>
#include "team.h"
#include "hwform.h"
-#include "gameuiconfig.h"
#include "predefteams.h"
#include "pages.h"
#include "hwconsts.h"
@@ -208,3 +207,10 @@
return buf;
}
+bool HWTeam::operator==(const HWTeam& t1) const {
+ return TeamName==t1.TeamName;
+}
+
+bool HWTeam::operator<(const HWTeam& t1) const {
+ return TeamName<t1.TeamName;
+}
--- a/QTfrontend/team.h Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/team.h Fri Aug 18 20:37:50 2006 +0000
@@ -57,7 +57,9 @@
void SetToPage(HWForm * hwform);
void GetFromPage(HWForm * hwform);
QByteArray IPCTeamInfo() const;
- private:
+
+ bool operator==(const HWTeam& t1) const;
+ bool operator<(const HWTeam& t1) const;
};
#endif
--- a/QTfrontend/teamselect.cpp Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/teamselect.cpp Fri Aug 18 20:37:50 2006 +0000
@@ -9,23 +9,23 @@
#include "teamselhelper.h"
#include "frameTeam.h"
-void TeamSelWidget::addTeam(tmprop team)
+void TeamSelWidget::addTeam(HWTeam team)
{
frameDontPlaying->addTeam(team);
curDontPlayingTeams.push_back(team);
- QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(tmprop)),
- this, SLOT(changeTeamStatus(tmprop)));
+ QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+ this, SLOT(changeTeamStatus(HWTeam)));
}
-void TeamSelWidget::removeTeam(tmprop team)
-{
+//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
+//{
//curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
-}
+//}
-void TeamSelWidget::changeTeamStatus(tmprop team)
+void TeamSelWidget::changeTeamStatus(HWTeam team)
{
- list<tmprop>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
- list<tmprop>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+ list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
+ list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itDontPlay==curDontPlayingTeams.end()) {
// playing team => dont playing
@@ -49,8 +49,8 @@
pAddTeams->addTeam(team);
pRemoveTeams->removeTeam(team);
- QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(tmprop)),
- this, SLOT(changeTeamStatus(tmprop)));
+ QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+ this, SLOT(changeTeamStatus(HWTeam)));
}
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color)
--- a/QTfrontend/teamselect.h Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/teamselect.h Fri Aug 18 20:37:50 2006 +0000
@@ -8,35 +8,24 @@
#include <list>
#include <map>
+#include "team.h"
+
class TeamSelWidget;
class FrameTeams;
using namespace std;
-struct tmprop
-{
- tmprop(QString nm) : teamName(nm) {};
- QString teamName;
- QString pixmapFileName;
- bool operator==(const tmprop& t1) const {
- return teamName==t1.teamName;
- };
- bool operator<(const tmprop& t1) const {
- return teamName<t1.teamName;
- };
-};
-
class TeamSelWidget : public QWidget
{
Q_OBJECT
public:
TeamSelWidget(QWidget* parent=0);
- void addTeam(tmprop team);
- void removeTeam(tmprop team);
+ void addTeam(HWTeam team);
+ //void removeTeam(HWTeam team);
private slots:
- void changeTeamStatus(tmprop team);
+ void changeTeamStatus(HWTeam team);
private:
void addScrArea(FrameTeams* pfteams, QColor color);
@@ -45,8 +34,8 @@
QVBoxLayout mainLayout;
- list<tmprop> curPlayingTeams;
- list<tmprop> curDontPlayingTeams;
+ list<HWTeam> curPlayingTeams;
+ list<HWTeam> curDontPlayingTeams;
};
#endif // _TEAM_SELECT_INCLUDED
--- a/QTfrontend/teamselhelper.cpp Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/teamselhelper.cpp Fri Aug 18 20:37:50 2006 +0000
@@ -8,7 +8,7 @@
emit teamActivated(text());
}
-TeamShowWidget::TeamShowWidget(tmprop team, QWidget * parent) :
+TeamShowWidget::TeamShowWidget(HWTeam team, QWidget * parent) :
QWidget(parent), mainLayout(this), m_team(team)
{
this->setMaximumHeight(40);
@@ -16,7 +16,7 @@
pixlbl->setPixmap(QPixmap("../share/hedgewars/Data/Graphics/thinking.png"));
mainLayout.addWidget(pixlbl);
- TeamLabel* lbl=new TeamLabel(team.teamName);
+ TeamLabel* lbl=new TeamLabel(team.TeamName);
mainLayout.addWidget(lbl);
QPushButton* butt=new QPushButton("o");
--- a/QTfrontend/teamselhelper.h Fri Aug 18 19:59:16 2006 +0000
+++ b/QTfrontend/teamselhelper.h Fri Aug 18 20:37:50 2006 +0000
@@ -30,14 +30,14 @@
void activateTeam();
public:
- TeamShowWidget(tmprop team, QWidget * parent = 0);
+ TeamShowWidget(HWTeam team, QWidget * parent = 0);
private:
QHBoxLayout mainLayout;
- tmprop m_team;
+ HWTeam m_team;
signals:
- void teamStatusChanged(tmprop team);
+ void teamStatusChanged(HWTeam team);
};
#endif // _TEAMSEL_HELPER_INCLUDED