50
|
1 |
#include <QLabel>
|
|
2 |
#include <QPixmap>
|
|
3 |
#include <QPushButton>
|
63
|
4 |
#include <QFrame>
|
50
|
5 |
|
|
6 |
#include <algorithm>
|
|
7 |
|
63
|
8 |
#include <vertScrollArea.h>
|
50
|
9 |
#include "teamselect.h"
|
|
10 |
#include "teamselhelper.h"
|
63
|
11 |
#include "frameTeam.h"
|
50
|
12 |
|
|
13 |
void TeamSelWidget::addTeam(tmprop team)
|
|
14 |
{
|
63
|
15 |
frameDontPlaying->addTeam(team);
|
50
|
16 |
curDontPlayingTeams.push_back(team);
|
63
|
17 |
QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(tmprop)),
|
|
18 |
this, SLOT(changeTeamStatus(tmprop)));
|
50
|
19 |
}
|
|
20 |
|
|
21 |
void TeamSelWidget::removeTeam(tmprop team)
|
|
22 |
{
|
63
|
23 |
//curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
|
50
|
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 |
|
63
|
41 |
FrameTeams* pRemoveTeams;
|
|
42 |
FrameTeams* pAddTeams;
|
61
|
43 |
if(itDontPlay==curDontPlayingTeams.end()) {
|
63
|
44 |
pRemoveTeams=framePlaying;
|
|
45 |
pAddTeams=frameDontPlaying;
|
61
|
46 |
} else {
|
63
|
47 |
pRemoveTeams=frameDontPlaying;
|
|
48 |
pAddTeams=framePlaying;
|
61
|
49 |
}
|
50
|
50 |
|
63
|
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, 50);
|
50
|
60 |
}
|
|
61 |
|
61
|
62 |
TeamSelWidget::TeamSelWidget(QWidget* parent) :
|
50
|
63 |
QWidget(parent), mainLayout(this)
|
|
64 |
{
|
63
|
65 |
framePlaying=new FrameTeams();
|
|
66 |
frameDontPlaying=new FrameTeams();
|
|
67 |
addScrArea(framePlaying, QColor("DarkTurquoise"));
|
|
68 |
addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
|
50
|
69 |
}
|