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