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)));
|
131
|
54 |
|
|
55 |
QSize szh=pAddTeams->sizeHint();
|
|
56 |
QSize szh1=pRemoveTeams->sizeHint();
|
|
57 |
if(szh.isValid() && szh1.isValid()) {
|
|
58 |
pAddTeams->resize(pAddTeams->size().width(), szh.height());
|
|
59 |
pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height());
|
122
|
60 |
}
|
84
|
61 |
}
|
|
62 |
|
|
63 |
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color)
|
|
64 |
{
|
|
65 |
VertScrArea* area=new VertScrArea(color);
|
|
66 |
area->setWidget(pfteams);
|
|
67 |
mainLayout.addWidget(area, 30);
|
|
68 |
}
|
|
69 |
|
|
70 |
TeamSelWidget::TeamSelWidget(QWidget* parent) :
|
|
71 |
QWidget(parent), mainLayout(this)
|
|
72 |
{
|
|
73 |
framePlaying=new FrameTeams();
|
|
74 |
frameDontPlaying=new FrameTeams();
|
|
75 |
addScrArea(framePlaying, QColor("DarkTurquoise"));
|
|
76 |
addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
|
|
77 |
}
|