author | unc0rr |
Wed, 23 Feb 2011 18:38:11 +0300 | |
changeset 4957 | 3684faf5b3d1 |
parent 4410 | f9e38ce1e813 |
child 4976 | 088d40d8aba2 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
486 | 3 |
* Copyright (c) 2006, 2007 Ulyanov Igor <iulyanov@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
572 | 19 |
#include <algorithm> |
20 |
||
184 | 21 |
#include <QLabel> |
22 |
#include <QPixmap> |
|
23 |
#include <QPushButton> |
|
24 |
#include <QFrame> |
|
884 | 25 |
#include <QDebug> |
184 | 26 |
|
2522 | 27 |
#include "vertScrollArea.h" |
184 | 28 |
#include "teamselect.h" |
29 |
#include "teamselhelper.h" |
|
30 |
#include "frameTeam.h" |
|
31 |
||
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
322
diff
changeset
|
32 |
void TeamSelWidget::addTeam(HWTeam team) |
184 | 33 |
{ |
352 | 34 |
if(team.isNetTeam()) { |
322 | 35 |
framePlaying->addTeam(team, true); |
36 |
curPlayingTeams.push_back(team); |
|
352 | 37 |
connect(framePlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
38 |
this, SLOT(netTeamStatusChanged(const HWTeam&))); |
486 | 39 |
connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
40 |
this, SLOT(hhNumChanged(const HWTeam&))); |
523
eddcef907b28
num hedgehogs while new team addition (dirty) fixed
displacer
parents:
492
diff
changeset
|
41 |
dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
486 | 42 |
connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
43 |
this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
322 | 44 |
} else { |
45 |
frameDontPlaying->addTeam(team, false); |
|
46 |
curDontPlayingTeams.push_back(team); |
|
373 | 47 |
if(m_acceptOuter) { |
48 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
49 |
this, SLOT(pre_changeTeamStatus(HWTeam))); |
373 | 50 |
} else { |
51 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
52 |
this, SLOT(changeTeamStatus(HWTeam))); |
373 | 53 |
} |
322 | 54 |
} |
492 | 55 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
184 | 56 |
} |
57 |
||
1475
bab5650fc894
- Fix ConfigAsked not sending full config (leads to team divide checkbox inconsistency)
unc0rr
parents:
1425
diff
changeset
|
58 |
void TeamSelWidget::setInteractivity(bool interactive) |
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
59 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
60 |
framePlaying->setInteractivity(interactive); |
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
61 |
} |
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
62 |
|
352 | 63 |
void TeamSelWidget::hhNumChanged(const HWTeam& team) |
64 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
65 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
66 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
67 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
68 |
qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
69 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
70 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
71 |
itPlay->numHedgehogs=team.numHedgehogs; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
72 |
emit hhogsNumChanged(team); |
352 | 73 |
} |
74 |
||
372 | 75 |
void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team) |
76 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
77 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
78 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
79 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
80 |
qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
81 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
82 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
83 |
itPlay->teamColor=team.teamColor; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
84 |
emit teamColorChanged(team); |
372 | 85 |
} |
86 |
||
352 | 87 |
void TeamSelWidget::changeHHNum(const HWTeam& team) |
88 |
{ |
|
89 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
90 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
91 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
92 |
qWarning() << QString("changeHHNum: team '%1' not found").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
93 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
94 |
} |
352 | 95 |
itPlay->numHedgehogs=team.numHedgehogs; |
96 |
||
97 |
framePlaying->setHHNum(team); |
|
98 |
} |
|
99 |
||
372 | 100 |
void TeamSelWidget::changeTeamColor(const HWTeam& team) |
101 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
102 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
103 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
104 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
105 |
qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
106 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
107 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
108 |
itPlay->teamColor=team.teamColor; |
372 | 109 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
110 |
framePlaying->setTeamColor(team); |
372 | 111 |
} |
112 |
||
347 | 113 |
void TeamSelWidget::removeNetTeam(const HWTeam& team) |
114 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
115 |
//qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
116 |
for(;;) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
117 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
118 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
119 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
120 |
qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
121 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
122 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
123 |
if(itPlay->isNetTeam()) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
124 |
QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
125 |
framePlaying->removeTeam(team); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
126 |
curPlayingTeams.erase(itPlay); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
127 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
128 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
129 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
130 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
347 | 131 |
} |
132 |
||
133 |
void TeamSelWidget::netTeamStatusChanged(const HWTeam& team) |
|
134 |
{ |
|
352 | 135 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
486 | 136 |
|
347 | 137 |
} |
138 |
||
184 | 139 |
//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team) |
140 |
//{ |
|
141 |
//curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team)); |
|
142 |
//} |
|
143 |
||
144 |
void TeamSelWidget::changeTeamStatus(HWTeam team) |
|
145 |
{ |
|
352 | 146 |
QList<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team); |
147 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
|
184 | 148 |
|
149 |
bool willBePlaying=itDontPlay!=curDontPlayingTeams.end(); |
|
150 |
||
151 |
if(!willBePlaying) { |
|
152 |
// playing team => dont playing |
|
153 |
curDontPlayingTeams.push_back(*itPlay); |
|
347 | 154 |
emit teamNotPlaying(*itPlay); |
184 | 155 |
curPlayingTeams.erase(itPlay); |
156 |
} else { |
|
157 |
// return if max playing teams reached |
|
158 |
if(framePlaying->isFullTeams()) return; |
|
159 |
// dont playing team => playing |
|
482
61c617f1bec7
correct team info in frames (displaying bots difficulty fixed)
displacer
parents:
387
diff
changeset
|
160 |
team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) |
387 | 161 |
itDontPlay->teamColor=framePlaying->getNextColor(); |
184 | 162 |
curPlayingTeams.push_back(*itDontPlay); |
373 | 163 |
if(!m_acceptOuter) emit teamWillPlay(*itDontPlay); |
184 | 164 |
curDontPlayingTeams.erase(itDontPlay); |
165 |
} |
|
166 |
||
167 |
FrameTeams* pRemoveTeams; |
|
168 |
FrameTeams* pAddTeams; |
|
169 |
if(!willBePlaying) { |
|
170 |
pRemoveTeams=framePlaying; |
|
171 |
pAddTeams=frameDontPlaying; |
|
172 |
} else { |
|
173 |
pRemoveTeams=frameDontPlaying; |
|
174 |
pAddTeams=framePlaying; |
|
175 |
} |
|
176 |
||
177 |
pAddTeams->addTeam(team, willBePlaying); |
|
178 |
pRemoveTeams->removeTeam(team); |
|
384
29299ca39155
adding the same command twice bug fixed for net game
displacer
parents:
383
diff
changeset
|
179 |
if(!team.isNetTeam() && m_acceptOuter && !willBePlaying) { |
29299ca39155
adding the same command twice bug fixed for net game
displacer
parents:
383
diff
changeset
|
180 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
181 |
this, SLOT(pre_changeTeamStatus(HWTeam))); |
384
29299ca39155
adding the same command twice bug fixed for net game
displacer
parents:
383
diff
changeset
|
182 |
} else { |
29299ca39155
adding the same command twice bug fixed for net game
displacer
parents:
383
diff
changeset
|
183 |
connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
184 |
this, SLOT(changeTeamStatus(HWTeam))); |
384
29299ca39155
adding the same command twice bug fixed for net game
displacer
parents:
383
diff
changeset
|
185 |
} |
372 | 186 |
if(willBePlaying) { |
486 | 187 |
connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
188 |
this, SLOT(hhNumChanged(const HWTeam&))); |
523
eddcef907b28
num hedgehogs while new team addition (dirty) fixed
displacer
parents:
492
diff
changeset
|
189 |
dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
486 | 190 |
connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
191 |
this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
372 | 192 |
emit teamColorChanged(((TeamShowWidget*)framePlaying->getTeamWidget(team))->getTeam()); |
193 |
} |
|
184 | 194 |
|
195 |
QSize szh=pAddTeams->sizeHint(); |
|
196 |
QSize szh1=pRemoveTeams->sizeHint(); |
|
197 |
if(szh.isValid() && szh1.isValid()) { |
|
198 |
pAddTeams->resize(pAddTeams->size().width(), szh.height()); |
|
199 |
pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height()); |
|
200 |
} |
|
492 | 201 |
|
202 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
|
184 | 203 |
} |
204 |
||
1647 | 205 |
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int fixedHeight) |
184 | 206 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
207 |
VertScrArea* area = new VertScrArea(color); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
208 |
area->setWidget(pfteams); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
209 |
mainLayout.addWidget(area, 30); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
210 |
if (fixedHeight > 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
211 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
212 |
area->setMinimumHeight(fixedHeight); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
213 |
area->setMaximumHeight(fixedHeight); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
214 |
area->setStyleSheet( |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
215 |
"FrameTeams{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
216 |
"border: solid;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
217 |
"border-width: 1px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
218 |
"border-radius: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
219 |
"border-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
220 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
221 |
); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
222 |
} |
184 | 223 |
} |
224 |
||
225 |
TeamSelWidget::TeamSelWidget(QWidget* parent) : |
|
373 | 226 |
QGroupBox(parent), mainLayout(this), m_acceptOuter(false) |
184 | 227 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
228 |
setTitle(QGroupBox::tr("Playing teams")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
229 |
framePlaying = new FrameTeams(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
230 |
frameDontPlaying = new FrameTeams(); |
2377 | 231 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
232 |
QPalette p; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
233 |
p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
234 |
addScrArea(framePlaying, p.color(QPalette::Window).light(105), 250); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
235 |
addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0); |
184 | 236 |
} |
237 |
||
373 | 238 |
void TeamSelWidget::setAcceptOuter(bool acceptOuter) |
239 |
{ |
|
240 |
m_acceptOuter=acceptOuter; |
|
241 |
} |
|
242 |
||
231 | 243 |
void TeamSelWidget::resetPlayingTeams(const QList<HWTeam>& teamslist) |
184 | 244 |
{ |
352 | 245 |
QList<HWTeam>::iterator it; |
383 | 246 |
//for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) { |
247 |
//framePlaying->removeTeam(*it); |
|
248 |
//} |
|
249 |
framePlaying->resetTeams(); |
|
207 | 250 |
framePlaying->resetColors(); |
184 | 251 |
curPlayingTeams.clear(); |
383 | 252 |
//for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { |
253 |
//frameDontPlaying->removeTeam(*it); |
|
254 |
//} |
|
255 |
frameDontPlaying->resetTeams(); |
|
184 | 256 |
curDontPlayingTeams.clear(); |
257 |
||
231 | 258 |
for (QList<HWTeam>::ConstIterator it = teamslist.begin(); it != teamslist.end(); ++it ) { |
184 | 259 |
addTeam(*it); |
260 |
} |
|
261 |
} |
|
262 |
||
263 |
bool TeamSelWidget::isPlaying(HWTeam team) const |
|
264 |
{ |
|
265 |
return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end(); |
|
266 |
} |
|
267 |
||
352 | 268 |
QList<HWTeam> TeamSelWidget::getPlayingTeams() const |
184 | 269 |
{ |
270 |
return curPlayingTeams; |
|
271 |
} |
|
272 |
||
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
273 |
QList<HWTeam> TeamSelWidget::getDontPlayingTeams() const |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
274 |
{ |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
275 |
return curDontPlayingTeams; |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
276 |
} |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
277 |
|
373 | 278 |
void TeamSelWidget::pre_changeTeamStatus(HWTeam team) |
279 |
{ |
|
382
e7220e48ead1
colors changing config fully working (still need disabling in slaves)
displacer
parents:
373
diff
changeset
|
280 |
team.teamColor=framePlaying->getNextColor(); |
373 | 281 |
emit acceptRequested(team); |
282 |
} |