84
|
1 |
#include <QLabel>
|
|
2 |
#include <QPixmap>
|
|
3 |
#include <QPushButton>
|
|
4 |
#include <QFrame>
|
114
|
5 |
#include <QDebug>
|
84
|
6 |
|
|
7 |
#include <vertScrollArea.h>
|
|
8 |
#include "teamselect.h"
|
|
9 |
#include "teamselhelper.h"
|
|
10 |
#include "frameTeam.h"
|
|
11 |
|
117
|
12 |
void TeamSelWidget::addTeam(HWTeam team)
|
84
|
13 |
{
|
|
14 |
frameDontPlaying->addTeam(team);
|
|
15 |
curDontPlayingTeams.push_back(team);
|
117
|
16 |
QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
|
|
17 |
this, SLOT(changeTeamStatus(HWTeam)));
|
84
|
18 |
}
|
|
19 |
|
117
|
20 |
//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
|
|
21 |
//{
|
84
|
22 |
//curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
|
117
|
23 |
//}
|
84
|
24 |
|
117
|
25 |
void TeamSelWidget::changeTeamStatus(HWTeam team)
|
84
|
26 |
{
|
117
|
27 |
list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
|
|
28 |
list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
|
84
|
29 |
|
|
30 |
if(itDontPlay==curDontPlayingTeams.end()) {
|
|
31 |
// playing team => dont playing
|
|
32 |
curDontPlayingTeams.push_back(*itPlay);
|
|
33 |
curPlayingTeams.erase(itPlay);
|
|
34 |
} else {
|
|
35 |
// dont playing team => playing
|
|
36 |
curPlayingTeams.push_back(*itDontPlay);
|
|
37 |
curDontPlayingTeams.erase(itDontPlay);
|
|
38 |
}
|
|
39 |
|
|
40 |
FrameTeams* pRemoveTeams;
|
|
41 |
FrameTeams* pAddTeams;
|
|
42 |
if(itDontPlay==curDontPlayingTeams.end()) {
|
|
43 |
pRemoveTeams=framePlaying;
|
|
44 |
pAddTeams=frameDontPlaying;
|
|
45 |
} else {
|
|
46 |
pRemoveTeams=frameDontPlaying;
|
|
47 |
pAddTeams=framePlaying;
|
|
48 |
}
|
|
49 |
|
|
50 |
pAddTeams->addTeam(team);
|
|
51 |
pRemoveTeams->removeTeam(team);
|
117
|
52 |
QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
|
|
53 |
this, SLOT(changeTeamStatus(HWTeam)));
|
84
|
54 |
}
|
|
55 |
|
|
56 |
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color)
|
|
57 |
{
|
|
58 |
VertScrArea* area=new VertScrArea(color);
|
|
59 |
area->setWidget(pfteams);
|
|
60 |
mainLayout.addWidget(area, 30);
|
|
61 |
}
|
|
62 |
|
|
63 |
TeamSelWidget::TeamSelWidget(QWidget* parent) :
|
|
64 |
QWidget(parent), mainLayout(this)
|
|
65 |
{
|
|
66 |
framePlaying=new FrameTeams();
|
|
67 |
frameDontPlaying=new FrameTeams();
|
|
68 |
addScrArea(framePlaying, QColor("DarkTurquoise"));
|
|
69 |
addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
|
|
70 |
}
|