author | Wuzzy <Wuzzy2@mail.ru> |
Sun, 19 May 2019 23:52:13 +0200 | |
changeset 15016 | bea068dd9356 |
parent 14534 | db646b3c0b95 |
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> |
11046 | 4 |
* Copyright (c) 2004-2015 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | 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 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
35 |
if(team.isNetTeam()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
36 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
37 |
framePlaying->addTeam(team, true); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
38 |
curPlayingTeams.push_back(team); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
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&))); |
8910
a60f7ebab219
Fix hedgehogs number desync. Now all desyncs except the one from issue 521 should be fixed. Please, test.
unc0rr
parents:
8886
diff
changeset
|
41 |
blockSignals(true); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
42 |
dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
8910
a60f7ebab219
Fix hedgehogs number desync. Now all desyncs except the one from issue 521 should be fixed. Please, test.
unc0rr
parents:
8886
diff
changeset
|
43 |
blockSignals(false); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
44 |
connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
45 |
this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
12693
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
46 |
|
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
47 |
// Hide team notice if at least two teams. |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
48 |
if (curPlayingTeams.size() >= 2) |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
49 |
{ |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
50 |
numTeamNotice->hide(); |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
51 |
} |
373 | 52 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
53 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
54 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
55 |
frameDontPlaying->addTeam(team, false); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
56 |
m_curNotPlayingTeams.push_back(team); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
57 |
if(m_acceptOuter) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
58 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
59 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
60 |
this, SLOT(pre_changeTeamStatus(HWTeam))); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
61 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
62 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
63 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
64 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
65 |
this, SLOT(changeTeamStatus(HWTeam))); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
66 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
67 |
} |
8129 | 68 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
69 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
184 | 70 |
} |
71 |
||
1475
bab5650fc894
- Fix ConfigAsked not sending full config (leads to team divide checkbox inconsistency)
unc0rr
parents:
1425
diff
changeset
|
72 |
void TeamSelWidget::setInteractivity(bool interactive) |
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
73 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
74 |
framePlaying->setInteractivity(interactive); |
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
75 |
} |
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
356
diff
changeset
|
76 |
|
13694
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
77 |
void TeamSelWidget::setUser(const QString& nickname) |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
78 |
{ |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
79 |
m_curUser = nickname; |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
80 |
} |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
81 |
|
352 | 82 |
void TeamSelWidget::hhNumChanged(const HWTeam& team) |
83 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
84 |
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
|
85 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
86 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
87 |
qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.name()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
88 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
89 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
90 |
itPlay->setNumHedgehogs(team.numHedgehogs()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
91 |
emit hhogsNumChanged(team); |
352 | 92 |
} |
93 |
||
372 | 94 |
void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team) |
95 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
96 |
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
|
97 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
98 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
99 |
qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.name()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
100 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
101 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
102 |
itPlay->setColor(team.color()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
103 |
emit teamColorChanged(team); |
372 | 104 |
} |
105 |
||
352 | 106 |
void TeamSelWidget::changeHHNum(const HWTeam& team) |
107 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
108 |
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
|
109 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
110 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
111 |
qWarning() << QString("changeHHNum: team '%1' not found").arg(team.name()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
112 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
113 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
114 |
itPlay->setNumHedgehogs(team.numHedgehogs()); |
352 | 115 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
116 |
framePlaying->setHHNum(team); |
352 | 117 |
} |
118 |
||
372 | 119 |
void TeamSelWidget::changeTeamColor(const HWTeam& team) |
120 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
121 |
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
|
122 |
if(itPlay==curPlayingTeams.end()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
123 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
124 |
qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.name()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
125 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
126 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5773
diff
changeset
|
127 |
itPlay->setColor(team.color()); |
372 | 128 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
129 |
framePlaying->setTeamColor(team); |
372 | 130 |
} |
131 |
||
347 | 132 |
void TeamSelWidget::removeNetTeam(const HWTeam& team) |
133 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
134 |
//qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName); |
10248 | 135 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
136 |
if(itPlay==curPlayingTeams.end()) |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
137 |
{ |
10248 | 138 |
qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name()); |
139 |
return; |
|
140 |
} |
|
141 |
||
142 |
if(itPlay->isNetTeam()) |
|
143 |
{ |
|
144 |
QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); |
|
145 |
framePlaying->removeTeam(team); |
|
146 |
curPlayingTeams.erase(itPlay); |
|
12693
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
147 |
// Show team notice if less than two teams. |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
148 |
if (curPlayingTeams.size() < 2) |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
149 |
{ |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
150 |
numTeamNotice->show(); |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
151 |
} |
10248 | 152 |
} |
153 |
else |
|
154 |
{ |
|
155 |
qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name()); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
156 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
157 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
347 | 158 |
} |
159 |
||
13694
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
160 |
// Removes teams classified as net teams but which are owned by the local user. |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
161 |
// Those teams don't make sense and might be leftovers from a finished game |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
162 |
// after rejoining. See also: Bugzilla bug 597. |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
163 |
void TeamSelWidget::cleanupFakeNetTeams() |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
164 |
{ |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
165 |
// m_curUser is not set for offline games. No cleanup is needed when offline. |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
166 |
if(m_curUser.isNull()) |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
167 |
return; |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
168 |
|
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
169 |
QList<HWTeam>::iterator itPlay = curPlayingTeams.begin(); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
170 |
while(itPlay != curPlayingTeams.end()) |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
171 |
{ |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
172 |
if(itPlay->isNetTeam() && itPlay->owner() == m_curUser) |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
173 |
{ |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
174 |
qDebug() << QString("cleanupFakeNetTeams: team '%1' removed").arg(itPlay->name()); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
175 |
QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
176 |
framePlaying->removeTeam(*itPlay); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
177 |
itPlay = curPlayingTeams.erase(itPlay); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
178 |
} |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
179 |
else |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
180 |
itPlay++; |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
181 |
} |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
182 |
|
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
183 |
// Show team notice if less than two teams. |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
184 |
if (curPlayingTeams.size() < 2) |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
185 |
{ |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
186 |
numTeamNotice->show(); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
187 |
} |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
188 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
189 |
} |
27e5e311c7a3
Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents:
13235
diff
changeset
|
190 |
|
184 | 191 |
void TeamSelWidget::changeTeamStatus(HWTeam team) |
192 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
193 |
QList<HWTeam>::iterator itDontPlay=std::find(m_curNotPlayingTeams.begin(), m_curNotPlayingTeams.end(), team); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
194 |
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
184 | 195 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
196 |
bool willBePlaying=itDontPlay!=m_curNotPlayingTeams.end(); |
184 | 197 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
198 |
if(!willBePlaying) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
199 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
200 |
// playing team => dont playing |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
201 |
m_curNotPlayingTeams.push_back(*itPlay); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
202 |
emit teamNotPlaying(*itPlay); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
203 |
curPlayingTeams.erase(itPlay); |
8129 | 204 |
|
205 |
// Show team notice if less than two teams. |
|
206 |
if (curPlayingTeams.size() < 2) |
|
207 |
{ |
|
208 |
numTeamNotice->show(); |
|
209 |
} |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
210 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
211 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
212 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
213 |
// return if max playing teams reached |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
214 |
if(framePlaying->isFullTeams()) return; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
215 |
// dont playing team => playing |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
6952
diff
changeset
|
216 |
itDontPlay->setColor(framePlaying->getNextColor()); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
217 |
team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) |
14534
db646b3c0b95
Send and display owner name of own teams in online games (fixes bug 468)
Wuzzy <Wuzzy2@mail.ru>
parents:
13694
diff
changeset
|
218 |
team.setOwner(m_curUser); |
db646b3c0b95
Send and display owner name of own teams in online games (fixes bug 468)
Wuzzy <Wuzzy2@mail.ru>
parents:
13694
diff
changeset
|
219 |
curPlayingTeams.push_back(team); |
db646b3c0b95
Send and display owner name of own teams in online games (fixes bug 468)
Wuzzy <Wuzzy2@mail.ru>
parents:
13694
diff
changeset
|
220 |
if(!m_acceptOuter) emit teamWillPlay(team); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
221 |
m_curNotPlayingTeams.erase(itDontPlay); |
8129 | 222 |
|
223 |
// Hide team notice if at least two teams. |
|
224 |
if (curPlayingTeams.size() >= 2) |
|
225 |
{ |
|
226 |
numTeamNotice->hide(); |
|
227 |
} |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
228 |
} |
184 | 229 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
230 |
FrameTeams* pRemoveTeams; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
231 |
FrameTeams* pAddTeams; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
232 |
if(!willBePlaying) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
233 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
234 |
pRemoveTeams=framePlaying; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
235 |
pAddTeams=frameDontPlaying; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
236 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
237 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
238 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
239 |
pRemoveTeams=frameDontPlaying; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
240 |
pAddTeams=framePlaying; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
241 |
} |
184 | 242 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
243 |
pAddTeams->addTeam(team, willBePlaying); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
244 |
pRemoveTeams->removeTeam(team); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
245 |
if(!team.isNetTeam() && m_acceptOuter && !willBePlaying) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
246 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
247 |
connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
248 |
this, SLOT(pre_changeTeamStatus(HWTeam))); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
249 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
250 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
251 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
252 |
connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
253 |
this, SLOT(changeTeamStatus(HWTeam))); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
254 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
255 |
if(willBePlaying) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
256 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
257 |
connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
258 |
this, SLOT(hhNumChanged(const HWTeam&))); |
8910
a60f7ebab219
Fix hedgehogs number desync. Now all desyncs except the one from issue 521 should be fixed. Please, test.
unc0rr
parents:
8886
diff
changeset
|
259 |
blockSignals(true); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
260 |
dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
8910
a60f7ebab219
Fix hedgehogs number desync. Now all desyncs except the one from issue 521 should be fixed. Please, test.
unc0rr
parents:
8886
diff
changeset
|
261 |
blockSignals(false); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
262 |
connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
263 |
this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
264 |
emit teamColorChanged(((TeamShowWidget*)framePlaying->getTeamWidget(team))->getTeam()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
265 |
} |
184 | 266 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
267 |
QSize szh=pAddTeams->sizeHint(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
268 |
QSize szh1=pRemoveTeams->sizeHint(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
269 |
if(szh.isValid() && szh1.isValid()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
270 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
271 |
pAddTeams->resize(pAddTeams->size().width(), szh.height()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
272 |
pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
273 |
} |
492 | 274 |
|
8430
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
275 |
repaint(); |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
276 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
277 |
emit setEnabledGameStart(curPlayingTeams.size()>1); |
184 | 278 |
} |
279 |
||
12303
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
280 |
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int minHeight, int maxHeight, bool setFrame) |
184 | 281 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
282 |
VertScrArea* area = new VertScrArea(color); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
283 |
area->setWidget(pfteams); |
12303
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
284 |
mainLayout.addWidget(area); |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
285 |
if (minHeight > 0) |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
286 |
area->setMinimumHeight(minHeight); |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
287 |
if (maxHeight > 0) |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
288 |
area->setMaximumHeight(maxHeight); |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
289 |
if (setFrame) |
13235
d5a029299407
QTfrontend: Remove ugly rectangle in list of active teams when there are no teams
Wuzzy <Wuzzy2@mail.ru>
parents:
12693
diff
changeset
|
290 |
pfteams->setDecoFrameEnabled(true); |
184 | 291 |
} |
292 |
||
293 |
TeamSelWidget::TeamSelWidget(QWidget* parent) : |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
294 |
QGroupBox(parent), mainLayout(this), m_acceptOuter(false) |
184 | 295 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
296 |
setTitle(QGroupBox::tr("Playing teams")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
297 |
framePlaying = new FrameTeams(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
298 |
frameDontPlaying = new FrameTeams(); |
2377 | 299 |
|
8129 | 300 |
// Add notice about number of required teams. |
8726 | 301 |
numTeamNotice = new QLabel(tr("At least two teams are required to play!")); |
8886
5c521d1fdd63
Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents:
8726
diff
changeset
|
302 |
numTeamNotice->setWordWrap(true); |
8140 | 303 |
mainLayout.addWidget(numTeamNotice); |
8129 | 304 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
305 |
QPalette p; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2522
diff
changeset
|
306 |
p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); |
12303
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
307 |
addScrArea(framePlaying, p.color(QPalette::Window).light(105), 161, 325, true); |
91ebbadc461d
Stretch teamselwidget across whole page in local multiplayer page
Wuzzy <almikes@aol.com>
parents:
12222
diff
changeset
|
308 |
addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 80, 0, false); |
8886
5c521d1fdd63
Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents:
8726
diff
changeset
|
309 |
|
5c521d1fdd63
Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents:
8726
diff
changeset
|
310 |
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
5c521d1fdd63
Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents:
8726
diff
changeset
|
311 |
this->setMinimumWidth(200); |
184 | 312 |
} |
313 |
||
373 | 314 |
void TeamSelWidget::setAcceptOuter(bool acceptOuter) |
315 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
316 |
m_acceptOuter=acceptOuter; |
373 | 317 |
} |
318 |
||
231 | 319 |
void TeamSelWidget::resetPlayingTeams(const QList<HWTeam>& teamslist) |
184 | 320 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
321 |
//for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) { |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
322 |
//framePlaying->removeTeam(*it); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
323 |
//} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
324 |
framePlaying->resetTeams(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
325 |
framePlaying->resetColors(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
326 |
curPlayingTeams.clear(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
327 |
//for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
328 |
//frameDontPlaying->removeTeam(*it); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
329 |
//} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
330 |
frameDontPlaying->resetTeams(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
331 |
m_curNotPlayingTeams.clear(); |
184 | 332 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
333 |
foreach(HWTeam team, teamslist) |
8430
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
334 |
addTeam(team); |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
335 |
|
12693
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
336 |
numTeamNotice->show(); |
e095ed002652
Fix "at least 2 teams" warning not updated when net team is added/removed
Wuzzy <almikes@aol.com>
parents:
12303
diff
changeset
|
337 |
|
8430
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
338 |
repaint(); |
184 | 339 |
} |
340 |
||
7835
a84936d1618a
Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents:
7523
diff
changeset
|
341 |
bool TeamSelWidget::isPlaying(const HWTeam &team) const |
184 | 342 |
{ |
7835
a84936d1618a
Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents:
7523
diff
changeset
|
343 |
return curPlayingTeams.contains(team); |
184 | 344 |
} |
345 |
||
352 | 346 |
QList<HWTeam> TeamSelWidget::getPlayingTeams() const |
184 | 347 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
348 |
return curPlayingTeams; |
184 | 349 |
} |
350 |
||
5773 | 351 |
QList<HWTeam> TeamSelWidget::getNotPlayingTeams() const |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
352 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
353 |
return m_curNotPlayingTeams; |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
354 |
} |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
523
diff
changeset
|
355 |
|
12222
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
356 |
unsigned short TeamSelWidget::getNumHedgehogs() const |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
357 |
{ |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
358 |
unsigned short numHogs = 0; |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
359 |
QList<HWTeam>::const_iterator team; |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
360 |
for(team = curPlayingTeams.begin(); team != curPlayingTeams.end(); ++team) |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
361 |
{ |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
362 |
numHogs += (*team).numHedgehogs(); |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
363 |
} |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
364 |
return numHogs; |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
365 |
} |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
366 |
|
7835
a84936d1618a
Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents:
7523
diff
changeset
|
367 |
void TeamSelWidget::pre_changeTeamStatus(const HWTeam & team) |
373 | 368 |
{ |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
6952
diff
changeset
|
369 |
//team.setColor(framePlaying->getNextColor()); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
370 |
emit acceptRequested(team); |
373 | 371 |
} |
8430
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
372 |
|
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
373 |
void TeamSelWidget::repaint() |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
374 |
{ |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
375 |
QWidget::repaint(); |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
376 |
framePlaying->repaint(); |
5a5c34a75e1a
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents:
8424
diff
changeset
|
377 |
frameDontPlaying->repaint(); |
8432
f2d57e987ba9
small cleanup, fix ancient warning (the "itPlay" one)
sheepluva
parents:
8430
diff
changeset
|
378 |
} |