author | koda |
Wed, 02 Mar 2011 00:27:20 +0100 | |
changeset 4976 | 088d40d8aba2 |
parent 4560 | 5d6c7f88db73 |
child 5028 | 3c43f00b0743 |
permissions | -rw-r--r-- |
1621 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
4976 | 3 |
* Copyright (c) 2010-2011 Andrey Korotaev <unC0Rr@gmail.com> |
1621 | 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 |
||
19 |
#include <QLabel> |
|
20 |
#include <QGridLayout> |
|
1625 | 21 |
#include <QGraphicsScene> |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
22 |
#include <QGroupBox> |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
23 |
#include <QSizePolicy> |
1621 | 24 |
#include "statsPage.h" |
3381 | 25 |
#include "team.h" |
1621 | 26 |
|
1636 | 27 |
FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) |
28 |
{ |
|
29 |
||
30 |
} |
|
31 |
||
32 |
void FitGraphicsView::resizeEvent(QResizeEvent * event) |
|
33 |
{ |
|
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4217
diff
changeset
|
34 |
Q_UNUSED(event); |
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4217
diff
changeset
|
35 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
36 |
fitInView(sceneRect()); |
1636 | 37 |
} |
38 |
||
1621 | 39 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
40 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
41 |
QGridLayout * pageLayout = new QGridLayout(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
42 |
pageLayout->setSpacing(20); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
43 |
pageLayout->setColumnStretch(0, 1); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
44 |
pageLayout->setColumnStretch(1, 1); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
45 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
46 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
47 |
BtnBack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1621 | 48 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
49 |
QGroupBox * gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
50 |
QVBoxLayout * gbl = new QVBoxLayout; |
1621 | 51 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
52 |
// details |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
53 |
labelGameStats = new QLabel(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
54 |
QLabel * l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
55 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
56 |
l->setText("<h1><img src=\":/res/StatsD.png\"> " + PageGameStats::tr("Details") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
57 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
58 |
labelGameStats->setTextFormat(Qt::RichText); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
59 |
labelGameStats->setAlignment(Qt::AlignTop); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
60 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
61 |
gbl->addWidget(labelGameStats); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
62 |
gb->setLayout(gbl); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
63 |
pageLayout->addWidget(gb, 1, 1); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
64 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
65 |
// graph |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
66 |
graphic = new FitGraphicsView(gb); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
67 |
l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
68 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
69 |
l->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
70 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
71 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
72 |
gbl->addWidget(graphic); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
73 |
graphic->scale(1.0, -1.0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
74 |
graphic->setBackgroundBrush(QBrush(Qt::black)); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
75 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
76 |
labelGameWin = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
77 |
labelGameWin->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
78 |
pageLayout->addWidget(labelGameWin, 0, 0, 1, 2); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
79 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
80 |
// ranking box |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
81 |
gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
82 |
gbl = new QVBoxLayout; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
83 |
labelGameRank = new QLabel(gb); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
84 |
l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
85 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
86 |
l->setText("<h1><img src=\":/res/StatsR.png\"> " + PageGameStats::tr("Ranking") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
87 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
88 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
89 |
gbl->addWidget(labelGameRank); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
90 |
gb->setLayout(gbl); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
91 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
92 |
labelGameRank->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
93 |
labelGameRank->setAlignment(Qt::AlignTop); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
94 |
pageLayout->addWidget(gb, 1, 0); |
1621 | 95 |
} |
1622 | 96 |
|
97 |
void PageGameStats::AddStatText(const QString & msg) |
|
98 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
99 |
labelGameStats->setText(labelGameStats->text() + msg); |
1622 | 100 |
} |
101 |
||
102 |
void PageGameStats::clear() |
|
103 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
104 |
labelGameStats->setText(""); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
105 |
healthPoints.clear(); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
106 |
labelGameRank->setText(""); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
107 |
playerPosition = 0; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
108 |
lastColor = 0; |
1625 | 109 |
} |
110 |
||
111 |
void PageGameStats::renderStats() |
|
112 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
113 |
QGraphicsScene * scene = new QGraphicsScene(); |
1625 | 114 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
115 |
QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
116 |
while (i != healthPoints.constEnd()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
117 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
118 |
quint32 c = i.key(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
119 |
QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
120 |
QVector<quint32> hps = i.value(); |
1625 | 121 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
122 |
QPainterPath path; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
123 |
if (hps.size()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
124 |
path.moveTo(0, hps[0]); |
2377 | 125 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
126 |
for(int t = 1; t < hps.size(); ++t) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
127 |
path.lineTo(t, hps[t]); |
1625 | 128 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
129 |
scene->addPath(path, QPen(c)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
130 |
++i; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
131 |
} |
1625 | 132 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
133 |
graphic->setScene(scene); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
134 |
graphic->fitInView(graphic->sceneRect()); |
1622 | 135 |
} |
136 |
||
137 |
void PageGameStats::GameStats(char type, const QString & info) |
|
138 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
139 |
switch(type) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
140 |
case 'r' : { |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
141 |
labelGameWin->setText(QString("<h1 align=\"center\">%1</h1>").arg(info)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
142 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
143 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
144 |
case 'D' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
145 |
int i = info.indexOf(' '); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
146 |
QString message = "<p><img src=\":/res/StatsBestShot.png\"> " + PageGameStats::tr("The best shot award was won by <b>%1</b> with <b>%2</b> pts.").arg(info.mid(i + 1), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
147 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
148 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
149 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
150 |
case 'k' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
151 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
152 |
int num = info.left(i).toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
153 |
QString message = "<p><img src=\":/res/StatsBestKiller.png\"> " + PageGameStats::tr("The best killer is <b>%1</b> with <b>%2</b> kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
154 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
155 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
156 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
157 |
case 'K' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
158 |
int num = info.toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
159 |
QString message = "<p><img src=\":/res/StatsHedgehogsKilled.png\"> " + PageGameStats::tr("A total of <b>%1</b> hedgehog(s) were killed during this round.", "", num).arg(num) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
160 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
161 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
162 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
163 |
case 'H' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
164 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
165 |
quint32 clan = info.left(i).toInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
166 |
quint32 hp = info.mid(i + 1).toUInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
167 |
healthPoints[clan].append(hp); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
168 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
169 |
} |
3381 | 170 |
case 'T': { // local team stats |
171 |
//AddStatText("<p>local team: " + info + "</p>"); |
|
172 |
QStringList infol = info.split(":"); |
|
173 |
HWTeam team(infol[0]); |
|
174 |
if(team.FileExists()) // do some better test to avoid influence from scripted/predefined teams? |
|
175 |
{ |
|
176 |
team.LoadFromFile(); |
|
177 |
team.Rounds++; |
|
178 |
if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! |
|
179 |
team.Wins++; // should draws count as wins? |
|
180 |
//team.SaveToFile(); // don't save yet |
|
181 |
} |
|
4176 | 182 |
break; |
183 |
} |
|
184 |
||
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
185 |
case 'P' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
186 |
int i = info.indexOf(' '); |
4176 | 187 |
playerPosition++; |
188 |
QString color = info.left(i); |
|
189 |
quint32 c = color.toInt(); |
|
190 |
QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
191 |
|
4176 | 192 |
QString playerinfo = info.mid(i + 1); |
193 |
||
194 |
i = playerinfo.indexOf(' '); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
195 |
|
4176 | 196 |
int kills = playerinfo.left(i).toInt(); |
197 |
QString playername = playerinfo.mid(i + 1); |
|
198 |
QString image; |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
199 |
|
4217
721bfa5f4f31
Fix wrong order in results screen when players team up
TheException
parents:
4192
diff
changeset
|
200 |
if (lastColor == c) playerPosition--; |
4176 | 201 |
lastColor = c; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
202 |
|
4176 | 203 |
switch (playerPosition) |
204 |
{ |
|
205 |
case 1: |
|
206 |
image = "<img src=\":/res/StatsMedal1.png\">"; |
|
207 |
break; |
|
208 |
case 2: |
|
209 |
image = "<img src=\":/res/StatsMedal2.png\">"; |
|
210 |
break; |
|
211 |
case 3: |
|
212 |
image = "<img src=\":/res/StatsMedal3.png\">"; |
|
213 |
break; |
|
214 |
default: |
|
215 |
image = "<img src=\":/res/StatsMedal4.png\">"; |
|
216 |
break; |
|
217 |
} |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
218 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
219 |
QString message; |
4176 | 220 |
QString killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); |
221 |
||
222 |
message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "</h2></p>"; |
|
223 |
||
224 |
labelGameRank->setText(labelGameRank->text() + message); |
|
225 |
break; |
|
226 |
} |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
227 |
case 's' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
228 |
int i = info.indexOf(' '); |
4177 | 229 |
int num = info.left(i).toInt(); |
4192 | 230 |
QString message = "<p><img src=\":/res/StatsMostSelfDamage.png\"> " + PageGameStats::tr("<b>%1</b> thought it's good to shoot his own hedgehogs with <b>%2</b> pts.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
231 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
232 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
233 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
234 |
case 'S' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
235 |
int i = info.indexOf(' '); |
4177 | 236 |
int num = info.left(i).toInt(); |
4192 | 237 |
QString message = "<p><img src=\":/res/StatsSelfKilled.png\"> " + PageGameStats::tr("<b>%1</b> killed <b>%2</b> of his own hedgehogs.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
238 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
239 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
240 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
241 |
case 'B' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
242 |
int i = info.indexOf(' '); |
4177 | 243 |
int num = info.left(i).toInt(); |
4192 | 244 |
QString message = "<p><img src=\":/res/StatsSkipped.png\"> " + PageGameStats::tr("<b>%1</b> was scared and skipped turn <b>%2</b> times.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
245 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
246 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
247 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
248 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
249 |
} |
1622 | 250 |
} |