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