author | Periklis Ntanasis <pntanasis@gmail.com> |
Mon, 10 Jun 2013 15:18:03 +0300 | |
changeset 9178 | c0902317c823 |
parent 9177 | d5e98b81e135 |
child 9998 | 736015b847e3 |
permissions | -rw-r--r-- |
1621 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
9080 | 3 |
* Copyright (c) 2004-2013 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> |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
21 |
#include <QHBoxLayout> |
1625 | 22 |
#include <QGraphicsScene> |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
23 |
#include <QGroupBox> |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
24 |
#include <QSizePolicy> |
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5028
diff
changeset
|
25 |
|
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5028
diff
changeset
|
26 |
#include "pagegamestats.h" |
3381 | 27 |
#include "team.h" |
1621 | 28 |
|
1636 | 29 |
FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) |
30 |
{ |
|
31 |
||
32 |
} |
|
33 |
||
34 |
void FitGraphicsView::resizeEvent(QResizeEvent * event) |
|
35 |
{ |
|
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4217
diff
changeset
|
36 |
Q_UNUSED(event); |
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4217
diff
changeset
|
37 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
38 |
fitInView(sceneRect()); |
1636 | 39 |
} |
40 |
||
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
41 |
QLayout * PageGameStats::bodyLayoutDefinition() |
1621 | 42 |
{ |
9178
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
43 |
kindOfPoints = QString(""); |
9177
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
44 |
defaultGraphTitle = true; |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
45 |
QGridLayout * pageLayout = new QGridLayout(); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
46 |
pageLayout->setSpacing(20); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
47 |
pageLayout->setColumnStretch(0, 1); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
48 |
pageLayout->setColumnStretch(1, 1); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
49 |
pageLayout->setRowStretch(0, 1); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
50 |
pageLayout->setRowStretch(1, 20); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
51 |
//pageLayout->setRowStretch(1, -1); this should work but there is unnecessary empty space betwin lines if used |
5916
c76212c34192
fix back button location in post-game stats screen
sheepluva
parents:
5734
diff
changeset
|
52 |
pageLayout->setContentsMargins(7, 7, 7, 0); |
c76212c34192
fix back button location in post-game stats screen
sheepluva
parents:
5734
diff
changeset
|
53 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
54 |
QGroupBox * gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
55 |
QVBoxLayout * gbl = new QVBoxLayout; |
1621 | 56 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
57 |
// details |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
58 |
labelGameStats = new QLabel(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
59 |
QLabel * l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
60 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
61 |
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
|
62 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
63 |
labelGameStats->setTextFormat(Qt::RichText); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
64 |
labelGameStats->setAlignment(Qt::AlignTop); |
5028
3c43f00b0743
This should fix http://code.google.com/p/hedgewars/issues/detail?id=153
shreyasbp@gmail.com
parents:
4976
diff
changeset
|
65 |
labelGameStats->setWordWrap(true); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
66 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
67 |
gbl->addWidget(labelGameStats); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
68 |
gb->setLayout(gbl); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
69 |
pageLayout->addWidget(gb, 1, 1); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
70 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
71 |
// graph |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
72 |
graphic = new FitGraphicsView(gb); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
73 |
labelGraphTitle = new QLabel(this); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
74 |
labelGraphTitle->setTextFormat(Qt::RichText); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
75 |
labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>"); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
76 |
labelGraphTitle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
77 |
gbl->addWidget(labelGraphTitle); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
78 |
gbl->addWidget(graphic); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
79 |
graphic->scale(1.0, -1.0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
80 |
graphic->setBackgroundBrush(QBrush(Qt::black)); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
81 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
82 |
labelGameWin = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
83 |
labelGameWin->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
84 |
pageLayout->addWidget(labelGameWin, 0, 0, 1, 2); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
85 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
86 |
// ranking box |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
87 |
gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
88 |
gbl = new QVBoxLayout; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
89 |
labelGameRank = new QLabel(gb); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
90 |
l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
91 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
92 |
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
|
93 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
94 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
95 |
gbl->addWidget(labelGameRank); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
96 |
gb->setLayout(gbl); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
97 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
98 |
labelGameRank->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
99 |
labelGameRank->setAlignment(Qt::AlignTop); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
100 |
pageLayout->addWidget(gb, 1, 0); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
101 |
|
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
102 |
return pageLayout; |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
103 |
} |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
104 |
|
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
105 |
//TODO button placement, image etc |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
106 |
QLayout * PageGameStats::footerLayoutDefinition() |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
107 |
{ |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
108 |
QHBoxLayout * bottomLayout = new QHBoxLayout(); |
9039
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
109 |
|
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
110 |
mainNote = new QLabel(this); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
111 |
mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
112 |
mainNote->setWordWrap(true); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
113 |
|
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
114 |
bottomLayout->addWidget(mainNote, 0); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
115 |
bottomLayout->setStretch(0,1); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
116 |
|
9039
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
117 |
btnRestart = addButton(":/res/Start.png", bottomLayout, 1, true); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
118 |
btnRestart->setWhatsThis(tr("Play again")); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
119 |
btnRestart->setFixedWidth(58); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
120 |
btnRestart->setFixedHeight(81); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
121 |
btnRestart->setStyleSheet("QPushButton{margin-top:24px}"); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
122 |
btnSave = addButton(":/res/Save.png", bottomLayout, 2, true); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
123 |
btnSave->setWhatsThis(tr("Save")); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
124 |
btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
125 |
|
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
126 |
return bottomLayout; |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
127 |
} |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
128 |
|
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
129 |
void PageGameStats::connectSignals() |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
130 |
{ |
8384 | 131 |
connect(this, SIGNAL(pageEnter()), this, SLOT(renderStats())); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
132 |
connect(btnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested())); |
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
133 |
connect(btnRestart, SIGNAL(clicked()), this, SIGNAL(restartGameRequested())); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
134 |
} |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
135 |
|
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
136 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
137 |
{ |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6015
diff
changeset
|
138 |
initPage(); |
1621 | 139 |
} |
1622 | 140 |
|
141 |
void PageGameStats::AddStatText(const QString & msg) |
|
142 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
143 |
labelGameStats->setText(labelGameStats->text() + msg); |
1622 | 144 |
} |
145 |
||
146 |
void PageGameStats::clear() |
|
147 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
148 |
labelGameStats->setText(""); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
149 |
healthPoints.clear(); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
150 |
labelGameRank->setText(""); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
151 |
playerPosition = 0; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
152 |
lastColor = 0; |
1625 | 153 |
} |
154 |
||
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
155 |
void PageGameStats::restartBtnVisible(bool visible) |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
156 |
{ |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
157 |
btnRestart->setVisible(visible); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
158 |
} |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
159 |
|
1625 | 160 |
void PageGameStats::renderStats() |
161 |
{ |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
162 |
graphic->show(); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
163 |
labelGraphTitle-> show(); |
9177
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
164 |
if(defaultGraphTitle) { |
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
165 |
labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>"); |
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
166 |
} else { |
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
167 |
defaultGraphTitle = true; |
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
168 |
} |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
169 |
// if not health data sent |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
170 |
if(healthPoints.size() == 0) { |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
171 |
labelGraphTitle->hide(); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
172 |
graphic->hide(); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
173 |
} else { |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
174 |
QGraphicsScene * scene = new QGraphicsScene(); |
1625 | 175 |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
176 |
QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin(); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
177 |
while (i != healthPoints.constEnd()) |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
178 |
{ |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
179 |
quint32 c = i.key(); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
180 |
//QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
181 |
QVector<quint32> hps = i.value(); |
2377 | 182 |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
183 |
QPainterPath path; |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
184 |
if (hps.size()) |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
185 |
path.moveTo(0, hps[0]); |
1625 | 186 |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
187 |
for(int t = 1; t < hps.size(); ++t) |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
188 |
path.lineTo(t, hps[t]); |
1625 | 189 |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
190 |
scene->addPath(path, QPen(c)); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
191 |
++i; |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
192 |
} |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
193 |
|
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
194 |
graphic->setScene(scene); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
195 |
graphic->fitInView(graphic->sceneRect()); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
196 |
} |
1622 | 197 |
} |
198 |
||
199 |
void PageGameStats::GameStats(char type, const QString & info) |
|
200 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
201 |
switch(type) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
202 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
203 |
case 'r' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
204 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
205 |
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
|
206 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
207 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
208 |
case 'D' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
209 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
210 |
int i = info.indexOf(' '); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
211 |
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
|
212 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
213 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
214 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
215 |
case 'k' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
216 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
217 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
218 |
int num = info.left(i).toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
219 |
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
|
220 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
221 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
222 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
223 |
case 'K' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
224 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
225 |
int num = info.toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
226 |
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
|
227 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
228 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
229 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
230 |
case 'H' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
231 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
232 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
233 |
quint32 clan = info.left(i).toInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
234 |
quint32 hp = info.mid(i + 1).toUInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
235 |
healthPoints[clan].append(hp); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
236 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
237 |
} |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
238 |
case 'g' : |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
239 |
{ |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
240 |
// TODO: change default picture or add change pic capability |
9177
d5e98b81e135
fix non changing graph title and sendstat health
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9175
diff
changeset
|
241 |
defaultGraphTitle = false; |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
242 |
labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>"); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
243 |
break; |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
244 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
245 |
case 'T': // local team stats |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
246 |
{ |
3381 | 247 |
//AddStatText("<p>local team: " + info + "</p>"); |
248 |
QStringList infol = info.split(":"); |
|
249 |
HWTeam team(infol[0]); |
|
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:
6009
diff
changeset
|
250 |
if(team.fileExists()) // do some better test to avoid influence from scripted/predefined teams? |
3381 | 251 |
{ |
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:
6009
diff
changeset
|
252 |
team.loadFromFile(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
6009
diff
changeset
|
253 |
team.incRounds(); |
3381 | 254 |
if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! |
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:
6009
diff
changeset
|
255 |
team.incWins(); // should draws count as wins? |
3381 | 256 |
//team.SaveToFile(); // don't save yet |
257 |
} |
|
4176 | 258 |
break; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
259 |
} |
9178
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
260 |
case 'p' : |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
261 |
{ |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
262 |
kindOfPoints = info; |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
263 |
break; |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
264 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
265 |
case 'P' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
266 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
267 |
int i = info.indexOf(' '); |
4176 | 268 |
playerPosition++; |
269 |
QString color = info.left(i); |
|
270 |
quint32 c = color.toInt(); |
|
271 |
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
|
272 |
|
4176 | 273 |
QString playerinfo = info.mid(i + 1); |
274 |
||
275 |
i = playerinfo.indexOf(' '); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
276 |
|
4176 | 277 |
int kills = playerinfo.left(i).toInt(); |
278 |
QString playername = playerinfo.mid(i + 1); |
|
279 |
QString image; |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
280 |
|
4217
721bfa5f4f31
Fix wrong order in results screen when players team up
TheException
parents:
4192
diff
changeset
|
281 |
if (lastColor == c) playerPosition--; |
4176 | 282 |
lastColor = c; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
283 |
|
4176 | 284 |
switch (playerPosition) |
285 |
{ |
|
286 |
case 1: |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
287 |
image = "<img src=\":/res/StatsMedal1.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
288 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
289 |
case 2: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
290 |
image = "<img src=\":/res/StatsMedal2.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
291 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
292 |
case 3: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
293 |
image = "<img src=\":/res/StatsMedal3.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
294 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
295 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
296 |
image = "<img src=\":/res/StatsMedal4.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
297 |
break; |
4176 | 298 |
} |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
299 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
300 |
QString message; |
9178
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
301 |
QString killstring; |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
302 |
if(kindOfPoints.compare("") == 0) { |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
303 |
killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
304 |
} else { |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
305 |
killstring = PageGameStats::tr("(%1 %2)", "", kills).arg(kills).arg(kindOfPoints); |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
306 |
kindOfPoints = QString(""); |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
307 |
} |
4176 | 308 |
|
309 |
message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "</h2></p>"; |
|
310 |
||
311 |
labelGameRank->setText(labelGameRank->text() + message); |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
312 |
break; |
4176 | 313 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
314 |
case 's' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
315 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
316 |
int i = info.indexOf(' '); |
4177 | 317 |
int num = info.left(i).toInt(); |
4192 | 318 |
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
|
319 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
320 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
321 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
322 |
case 'S' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
323 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
324 |
int i = info.indexOf(' '); |
4177 | 325 |
int num = info.left(i).toInt(); |
4192 | 326 |
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
|
327 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
328 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
329 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
330 |
case 'B' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
331 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
332 |
int i = info.indexOf(' '); |
4177 | 333 |
int num = info.left(i).toInt(); |
4192 | 334 |
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
|
335 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
336 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
337 |
} |
9172
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
338 |
case 'c' : |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
339 |
{ |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
340 |
QString message = "<p><img src=\":/res/StatsCustomAchievement.png\"> "+info+" </p>"; |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
341 |
AddStatText(message); |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
342 |
break; |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
343 |
} |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
344 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
345 |
} |
1622 | 346 |
} |