author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 11 Oct 2019 18:41:56 +0200 | |
changeset 15470 | a18f7e4681b8 |
parent 15468 | a7d54832fad6 |
permissions | -rw-r--r-- |
1621 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 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 |
|
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:
10017
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1621 | 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 |
{ |
10017 | 43 |
kindOfPoints = QString(""); |
44 |
defaultGraphTitle = true; |
|
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
45 |
pageLayout = new QGridLayout(); |
10017 | 46 |
pageLayout->setRowStretch(0, 1); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
47 |
pageLayout->setRowStretch(1, 20); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
48 |
pageLayout->setVerticalSpacing(20); |
5916
c76212c34192
fix back button location in post-game stats screen
sheepluva
parents:
5734
diff
changeset
|
49 |
pageLayout->setContentsMargins(7, 7, 7, 0); |
c76212c34192
fix back button location in post-game stats screen
sheepluva
parents:
5734
diff
changeset
|
50 |
|
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
51 |
gbDetails = new QGroupBox(this); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
52 |
gbDetails->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
53 |
QVBoxLayout * gbl = new QVBoxLayout; |
1621 | 54 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
55 |
// details |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
56 |
labelGameStats = new QLabel(this); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
57 |
labelDetails = new QLabel(this); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
58 |
labelDetails->setTextFormat(Qt::RichText); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
59 |
labelDetails->setText("<h1><img src=\":/res/StatsD.png\"> " + PageGameStats::tr("Details").toHtmlEscaped() + "</h1>"); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
60 |
labelDetails->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
61 |
labelGameStats->setTextFormat(Qt::RichText); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
62 |
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
|
63 |
labelGameStats->setWordWrap(true); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
64 |
gbl->addWidget(labelDetails); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
65 |
gbl->addWidget(labelGameStats); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
66 |
gbDetails->setLayout(gbl); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
67 |
pageLayout->addWidget(gbDetails, 1, 1); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
68 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
69 |
// graph |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
70 |
graphic = new FitGraphicsView(gbDetails); |
13236 | 71 |
graphic->setObjectName("gameStatsView"); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
72 |
labelGraphTitle = new QLabel(this); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
73 |
labelGraphTitle->setTextFormat(Qt::RichText); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
74 |
labelGraphTitle->setText("<h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph").toHtmlEscaped() + "</h1>"); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
75 |
labelGraphTitle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
76 |
gbl->addWidget(labelGraphTitle); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
77 |
gbl->addWidget(graphic); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
78 |
graphic->scale(1.0, -1.0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
79 |
graphic->setBackgroundBrush(QBrush(Qt::black)); |
13163 | 80 |
graphic->setRenderHint(QPainter::Antialiasing, true); |
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 |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
87 |
gbRanks = new QGroupBox(this); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
88 |
gbRanks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
89 |
gbl = new QVBoxLayout; |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
90 |
labelGameRank = new QLabel(gbRanks); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
91 |
QLabel* l = new QLabel(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
92 |
l->setTextFormat(Qt::RichText); |
14842 | 93 |
l->setText("<h1><img src=\":/res/StatsR.png\"> " + PageGameStats::tr("Ranking").toHtmlEscaped() + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
94 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
95 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
96 |
gbl->addWidget(labelGameRank); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
97 |
gbRanks->setLayout(gbl); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
98 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
99 |
labelGameRank->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
100 |
labelGameRank->setAlignment(Qt::AlignTop); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
101 |
pageLayout->addWidget(gbRanks, 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
|
102 |
|
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 |
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
|
104 |
} |
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
|
105 |
|
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
106 |
//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
|
107 |
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
|
108 |
{ |
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
|
109 |
QHBoxLayout * bottomLayout = new QHBoxLayout(); |
10017 | 110 |
|
9039
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
111 |
mainNote = new QLabel(this); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
112 |
mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
113 |
mainNote->setWordWrap(true); |
10017 | 114 |
|
9039
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
115 |
bottomLayout->addWidget(mainNote, 0); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
116 |
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
|
117 |
|
9039
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
118 |
btnRestart = addButton(":/res/Start.png", bottomLayout, 1, true); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
119 |
btnRestart->setWhatsThis(tr("Play again")); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
120 |
btnRestart->setFixedWidth(58); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
121 |
btnRestart->setFixedHeight(81); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
122 |
btnRestart->setStyleSheet("QPushButton{margin-top:24px}"); |
24e1ccd9326f
place better the current replay button
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8901
diff
changeset
|
123 |
btnSave = addButton(":/res/Save.png", bottomLayout, 2, true); |
15468
a7d54832fad6
Show message when failing to record demo/video due to /lua
Wuzzy <Wuzzy2@mail.ru>
parents:
15283
diff
changeset
|
124 |
saveDemoBtnEnabled(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
|
125 |
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
|
126 |
|
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 |
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
|
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 |
|
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 |
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
|
131 |
{ |
8384 | 132 |
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
|
133 |
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
|
134 |
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
|
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 |
|
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 |
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
|
138 |
{ |
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
|
139 |
initPage(); |
1621 | 140 |
} |
1622 | 141 |
|
142 |
void PageGameStats::AddStatText(const QString & msg) |
|
143 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
144 |
labelGameStats->setText(labelGameStats->text() + msg); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
145 |
labelDetails->show(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
146 |
labelGameStats->show(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
147 |
gbDetails->show(); |
1622 | 148 |
} |
149 |
||
150 |
void PageGameStats::clear() |
|
151 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
152 |
labelGameStats->setText(""); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
153 |
healthPoints.clear(); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
154 |
labelGameRank->setText(""); |
12336
6707ee1d2430
Fix caption of stats screen not being reset on clear()
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
155 |
labelGameWin->setText(""); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
156 |
playerPosition = 0; |
13762
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
157 |
scriptPlayerPosition = 0; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
158 |
lastColor = 0; |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
159 |
graphic->hide(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
160 |
labelDetails->hide(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
161 |
labelGameStats->hide(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
162 |
gbDetails->hide(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
163 |
gbRanks->hide(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
164 |
pageLayout->setColumnStretch(0, 0); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
165 |
pageLayout->setColumnStretch(1, 0); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
166 |
pageLayout->setHorizontalSpacing(0); |
1625 | 167 |
} |
168 |
||
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
169 |
void PageGameStats::restartBtnVisible(bool visible) |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
170 |
{ |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
171 |
btnRestart->setVisible(visible); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
172 |
} |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8384
diff
changeset
|
173 |
|
15283
16f389fcd462
Prevent saving of demo after /lua command was used
Wuzzy <Wuzzy2@mail.ru>
parents:
15076
diff
changeset
|
174 |
void PageGameStats::saveDemoBtnEnabled(bool enabled) |
16f389fcd462
Prevent saving of demo after /lua command was used
Wuzzy <Wuzzy2@mail.ru>
parents:
15076
diff
changeset
|
175 |
{ |
16f389fcd462
Prevent saving of demo after /lua command was used
Wuzzy <Wuzzy2@mail.ru>
parents:
15076
diff
changeset
|
176 |
btnSave->setEnabled(enabled); |
15468
a7d54832fad6
Show message when failing to record demo/video due to /lua
Wuzzy <Wuzzy2@mail.ru>
parents:
15283
diff
changeset
|
177 |
if (enabled) |
a7d54832fad6
Show message when failing to record demo/video due to /lua
Wuzzy <Wuzzy2@mail.ru>
parents:
15283
diff
changeset
|
178 |
btnSave->setWhatsThis(tr("Save demo")); |
a7d54832fad6
Show message when failing to record demo/video due to /lua
Wuzzy <Wuzzy2@mail.ru>
parents:
15283
diff
changeset
|
179 |
else |
a7d54832fad6
Show message when failing to record demo/video due to /lua
Wuzzy <Wuzzy2@mail.ru>
parents:
15283
diff
changeset
|
180 |
btnSave->setWhatsThis(tr("Save demo (unavailable because the /lua command was used)")); |
15283
16f389fcd462
Prevent saving of demo after /lua command was used
Wuzzy <Wuzzy2@mail.ru>
parents:
15076
diff
changeset
|
181 |
} |
16f389fcd462
Prevent saving of demo after /lua command was used
Wuzzy <Wuzzy2@mail.ru>
parents:
15076
diff
changeset
|
182 |
|
1625 | 183 |
void PageGameStats::renderStats() |
184 |
{ |
|
10017 | 185 |
if(defaultGraphTitle) { |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
186 |
labelGraphTitle->setText("<h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph").toHtmlEscaped() + "</h1>"); |
10017 | 187 |
} else { |
188 |
defaultGraphTitle = true; |
|
189 |
} |
|
190 |
// if not health data sent |
|
191 |
if(healthPoints.size() == 0) { |
|
192 |
labelGraphTitle->hide(); |
|
193 |
graphic->hide(); |
|
194 |
} else { |
|
13163 | 195 |
graphic->setScene(Q_NULLPTR); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
196 |
gbDetails->show(); |
13163 | 197 |
m_scene.reset(new QGraphicsScene(this)); |
1625 | 198 |
|
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
199 |
// min and max value across the entire chart |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
200 |
qint32 minValue = 0; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
201 |
qint32 maxValue = 0; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
202 |
bool minMaxValuesInitialized = false; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
203 |
|
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
204 |
// max data points per clan |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
205 |
int maxDataPoints = 0; |
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
206 |
for(QMap<qint32, QVector<qint32> >::const_iterator i = healthPoints.constBegin(); i != healthPoints.constEnd(); ++i) |
13191
07c93d864bc2
Workaround for the weird new qgraphicsview/qgraphicsscene fitInView behavior
unc0rr
parents:
13163
diff
changeset
|
207 |
{ |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
208 |
maxDataPoints = qMax(maxDataPoints, i.value().size()); |
13191
07c93d864bc2
Workaround for the weird new qgraphicsview/qgraphicsscene fitInView behavior
unc0rr
parents:
13163
diff
changeset
|
209 |
} |
07c93d864bc2
Workaround for the weird new qgraphicsview/qgraphicsscene fitInView behavior
unc0rr
parents:
13163
diff
changeset
|
210 |
|
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
211 |
/* There must be at least 2 data points for any clan, |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
212 |
otherwise there's not much to look at. ;-) */ |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
213 |
if(maxDataPoints < 2) { |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
214 |
labelGraphTitle->hide(); |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
215 |
graphic->hide(); |
15076
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
216 |
applySpacing(); |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
217 |
return; |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
218 |
} |
13191
07c93d864bc2
Workaround for the weird new qgraphicsview/qgraphicsscene fitInView behavior
unc0rr
parents:
13163
diff
changeset
|
219 |
|
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
220 |
QMap<qint32, QVector<qint32> >::const_iterator i = healthPoints.constBegin(); |
10017 | 221 |
while (i != healthPoints.constEnd()) |
222 |
{ |
|
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
223 |
qint32 c = i.key(); |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
224 |
const QVector<qint32>& hps = i.value(); |
2377 | 225 |
|
10017 | 226 |
QPainterPath path; |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
227 |
|
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
228 |
if (hps.size()) { |
10017 | 229 |
path.moveTo(0, hps[0]); |
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
230 |
if(minMaxValuesInitialized) { |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
231 |
minValue = qMin(minValue, hps[0]); |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
232 |
maxValue = qMax(maxValue, hps[0]); |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
233 |
} else { |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
234 |
minValue = hps[0]; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
235 |
maxValue = hps[0]; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
236 |
minMaxValuesInitialized = true; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
237 |
} |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
238 |
} |
1625 | 239 |
|
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
240 |
for(int t = 0; t < hps.size(); ++t) { |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
241 |
path.lineTo(t, hps[t]); |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
242 |
maxValue = qMax(maxValue, hps[t]); |
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
243 |
minValue = qMin(minValue, hps[t]); |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
244 |
} |
1625 | 245 |
|
14742
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
246 |
// Draw clan health/score graph lines |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
247 |
QColor col = QColor(c); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
248 |
|
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
249 |
// Special pen for very dark clan colors |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
250 |
if (!(col.red() >= cInvertTextColorAt || col.green() >= cInvertTextColorAt || col.blue() >= cInvertTextColorAt)) |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
251 |
{ |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
252 |
QPen pen_marker(QColor(255, 255, 255)); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
253 |
pen_marker.setWidth(3); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
254 |
pen_marker.setStyle(Qt::DotLine); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
255 |
pen_marker.setCosmetic(true); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
256 |
m_scene->addPath(path, pen_marker); |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
257 |
} |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
258 |
|
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
259 |
// Regular pen |
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
260 |
QPen pen(col); |
13163 | 261 |
pen.setWidth(2); |
262 |
pen.setCosmetic(true); |
|
14742
123aaa2bf4b5
Make dark clan colors visible in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14615
diff
changeset
|
263 |
m_scene->addPath(path, pen); |
13163 | 264 |
|
10017 | 265 |
++i; |
266 |
} |
|
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
267 |
|
13163 | 268 |
graphic->setScene(m_scene.data()); |
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
269 |
|
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
270 |
// Calculate the bounding box of the final chart |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
271 |
qint32 sceneMinY = minValue; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
272 |
qint32 sceneMaxY = maxValue; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
273 |
// If all values are 0 or greater, make sure to include 0 at the bottom. |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
274 |
if(sceneMinY >= 0 && sceneMaxY >= 0) |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
275 |
sceneMinY = 0; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
276 |
// If all values are equal, we must increase sceneMaxY, otherwise the scene rect |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
277 |
// would have a height of 0 and will screw up |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
278 |
if(sceneMinY == sceneMaxY) |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
279 |
sceneMaxY++; |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
280 |
graphic->setSceneRect(0, sceneMinY, maxDataPoints-1, sceneMaxY - sceneMinY); |
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
281 |
|
10017 | 282 |
graphic->fitInView(graphic->sceneRect()); |
13222
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
283 |
|
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
284 |
graphic->show(); |
1357dfbfa29c
Fix broken stats chart bounding box
Wuzzy <Wuzzy2@mail.ru>
parents:
13191
diff
changeset
|
285 |
labelGraphTitle->show(); |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
286 |
gbDetails->show(); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
287 |
} |
15076
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
288 |
applySpacing(); |
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
289 |
} |
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
290 |
|
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
291 |
void PageGameStats::applySpacing() |
dc236bcd7309
Fix stats screen group boxes sometimes having no spacing
Wuzzy <Wuzzy2@mail.ru>
parents:
14955
diff
changeset
|
292 |
{ |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
293 |
if (!labelGameStats->isHidden()) |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
294 |
{ |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
295 |
labelGraphTitle->setText("<br>" + labelGraphTitle->text()); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
296 |
} |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
297 |
if ((!gbDetails->isHidden()) && (!gbRanks->isHidden())) |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
298 |
{ |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
299 |
pageLayout->setColumnStretch(0, 1); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
300 |
pageLayout->setColumnStretch(1, 1); |
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
301 |
pageLayout->setHorizontalSpacing(20); |
10017 | 302 |
} |
1622 | 303 |
} |
304 |
||
305 |
void PageGameStats::GameStats(char type, const QString & info) |
|
306 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
307 |
switch(type) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
308 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
309 |
case 'r' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
310 |
{ |
14842 | 311 |
labelGameWin->setText(QString("<h1 align=\"center\">%1</h1>").arg(info.toHtmlEscaped())); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
312 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
313 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
314 |
case 'D' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
315 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
316 |
int i = info.indexOf(' '); |
10393 | 317 |
int num = info.left(i).toInt(); |
14842 | 318 |
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.", "", num).arg(info.mid(i + 1).toHtmlEscaped(), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
319 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
320 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
321 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
322 |
case 'k' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
323 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
324 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
325 |
int num = info.left(i).toInt(); |
14842 | 326 |
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).toHtmlEscaped(), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
327 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
328 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
329 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
330 |
case 'K' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
331 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
332 |
int num = info.toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
333 |
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
|
334 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
335 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
336 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
337 |
case 'H' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
338 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
339 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
340 |
quint32 clan = info.left(i).toInt(); |
13223
d0647647a697
Make chart in stats screen support negative numbers. Fixes e.g. Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
13222
diff
changeset
|
341 |
qint32 hp = info.mid(i + 1).toInt(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
342 |
healthPoints[clan].append(hp); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
343 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
344 |
} |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
345 |
case 'g' : |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
346 |
{ |
10017 | 347 |
// TODO: change default picture or add change pic capability |
348 |
defaultGraphTitle = false; |
|
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
349 |
labelGraphTitle->setText("<h1><img src=\":/res/StatsR.png\"> " + info.toHtmlEscaped() + "</h1>"); |
9175
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
350 |
break; |
dc3c0e44f7f3
added option to change stats graph title
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9172
diff
changeset
|
351 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
352 |
case 'T': // local team stats |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
353 |
{ |
13713
3264a26bbf8b
Remove frontend code dealing with unused team variables
Wuzzy <Wuzzy2@mail.ru>
parents:
13236
diff
changeset
|
354 |
// unused |
4176 | 355 |
break; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
356 |
} |
10017 | 357 |
case 'p' : |
9178
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
358 |
{ |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
359 |
kindOfPoints = info; |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
360 |
break; |
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
361 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
362 |
case 'P' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
363 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
364 |
int i = info.indexOf(' '); |
4176 | 365 |
playerPosition++; |
366 |
QString color = info.left(i); |
|
367 |
quint32 c = color.toInt(); |
|
368 |
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
|
369 |
|
4176 | 370 |
QString playerinfo = info.mid(i + 1); |
371 |
||
372 |
i = playerinfo.indexOf(' '); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
373 |
|
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
374 |
QString killsString = playerinfo.left(i); |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
375 |
int kills = killsString.toInt(); |
4176 | 376 |
QString playername = playerinfo.mid(i + 1); |
377 |
QString image; |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
378 |
|
4217
721bfa5f4f31
Fix wrong order in results screen when players team up
TheException
parents:
4192
diff
changeset
|
379 |
if (lastColor == c) playerPosition--; |
4176 | 380 |
lastColor = c; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
381 |
|
13762
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
382 |
unsigned int realPlayerPosition; |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
383 |
if(scriptPlayerPosition == 0) |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
384 |
realPlayerPosition = playerPosition; |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
385 |
else |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
386 |
realPlayerPosition = scriptPlayerPosition; |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
387 |
|
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
388 |
switch (realPlayerPosition) |
4176 | 389 |
{ |
390 |
case 1: |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
391 |
image = "<img src=\":/res/StatsMedal1.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
392 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
393 |
case 2: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
394 |
image = "<img src=\":/res/StatsMedal2.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
395 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
396 |
case 3: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
397 |
image = "<img src=\":/res/StatsMedal3.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
398 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
399 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
400 |
image = "<img src=\":/res/StatsMedal4.png\">"; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
401 |
break; |
4176 | 402 |
} |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
403 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
404 |
QString message; |
9178
c0902317c823
created a new sendstat type for changing the kills label
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9177
diff
changeset
|
405 |
QString killstring; |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
406 |
if(kindOfPoints.isEmpty()) { |
12479
42da9d8d82ab
Provide translator context for a few less obvious engine strings
Wuzzy <almikes@aol.com>
parents:
12449
diff
changeset
|
407 |
//: Number of kills in stats screen, written after the team name |
10017 | 408 |
killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
409 |
} else if (kindOfPoints == "!POINTS") { |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
410 |
//: Number of points in stats screen, written after the team name |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
411 |
killstring = PageGameStats::tr("(%1 point(s))", "", kills).arg(kills); |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
412 |
} else if (kindOfPoints == "!TIME") { |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
413 |
//: Time in seconds |
14615
de34abf040ed
pagegamestats: Fix time number rendering
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
414 |
killstring = PageGameStats::tr("(%L1 second(s))", "", kills).arg((double) kills/1000, 0, 'f', 3); |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
415 |
} else if (kindOfPoints.startsWith("!TIME") && kindOfPoints.length() == 6) { |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
416 |
int len = kindOfPoints.at(6).digitValue(); |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
417 |
if(len != -1) |
14615
de34abf040ed
pagegamestats: Fix time number rendering
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
418 |
killstring = PageGameStats::tr("(%L1 second(s))", "", kills).arg((double) kills/1000, 0, 'f', len); |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
419 |
else |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
420 |
qWarning("SendStat: siPointType received with !TIME and invalid number length!"); |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
421 |
} else if (kindOfPoints == "!CRATES") { |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
422 |
killstring = PageGameStats::tr("(%1 crate(s))", "", kills).arg(kills); |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
423 |
} else if (kindOfPoints == "!EMPTY") { |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
424 |
killstring = QString(""); |
10017 | 425 |
} else { |
12479
42da9d8d82ab
Provide translator context for a few less obvious engine strings
Wuzzy <almikes@aol.com>
parents:
12449
diff
changeset
|
426 |
//: For custom number of points in the stats screen, written after the team name. %1 is the number, %2 is the word. Example: “4 points” |
10017 | 427 |
killstring = PageGameStats::tr("(%1 %2)", "", kills).arg(kills).arg(kindOfPoints); |
428 |
} |
|
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
13773
diff
changeset
|
429 |
kindOfPoints = QString(""); |
4176 | 430 |
|
14842 | 431 |
message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(realPlayerPosition), playername.toHtmlEscaped(), clanColor.name().toHtmlEscaped()) + killstring.toHtmlEscaped() + "</h2></p>"; |
4176 | 432 |
|
433 |
labelGameRank->setText(labelGameRank->text() + message); |
|
13762
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
434 |
scriptPlayerPosition = 0; |
14955
ef3352839616
Stats screen: Automatically hide empty sections
Wuzzy <Wuzzy2@mail.ru>
parents:
14842
diff
changeset
|
435 |
gbRanks->show(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
436 |
break; |
4176 | 437 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
438 |
case 's' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
439 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
440 |
int i = info.indexOf(' '); |
4177 | 441 |
int num = info.left(i).toInt(); |
14842 | 442 |
QString message = "<p><img src=\":/res/StatsMostSelfDamage.png\"> " + PageGameStats::tr("<b>%1</b> thought it's good to shoot their own hedgehogs for <b>%2</b> pts.", "", num).arg(info.mid(i + 1).toHtmlEscaped()).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
443 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
444 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
445 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
446 |
case 'S' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
447 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
448 |
int i = info.indexOf(' '); |
4177 | 449 |
int num = info.left(i).toInt(); |
14842 | 450 |
QString message = "<p><img src=\":/res/StatsSelfKilled.png\"> " + PageGameStats::tr("<b>%1</b> killed <b>%2</b> of their own hedgehogs.", "", num).arg(info.mid(i + 1).toHtmlEscaped()).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
451 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
452 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
453 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
454 |
case 'B' : |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
455 |
{ |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
456 |
int i = info.indexOf(' '); |
4177 | 457 |
int num = info.left(i).toInt(); |
14842 | 458 |
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).toHtmlEscaped()).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
459 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
460 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
461 |
} |
9172
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
462 |
case 'c' : |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
463 |
{ |
14842 | 464 |
QString message = "<p><img src=\":/res/StatsCustomAchievement.png\"> "+info.toHtmlEscaped()+" </p>"; |
9172
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
465 |
AddStatText(message); |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
466 |
break; |
72bfa6a3e8e2
added custom stats message
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9080
diff
changeset
|
467 |
} |
13762
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
468 |
case 'R' : |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
469 |
{ |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
470 |
scriptPlayerPosition = info.toInt(); |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
471 |
break; |
f0cb47f0bfaf
Fix player rankings on round draw: Clans that die in the same turn now have the same rank
Wuzzy <Wuzzy2@mail.ru>
parents:
13713
diff
changeset
|
472 |
} |
13773
c084bd440009
Add funny message in stats screen when everyone wins
Wuzzy <Wuzzy2@mail.ru>
parents:
13762
diff
changeset
|
473 |
case 'h' : |
c084bd440009
Add funny message in stats screen when everyone wins
Wuzzy <Wuzzy2@mail.ru>
parents:
13762
diff
changeset
|
474 |
{ |
14842 | 475 |
QString message = "<p><img src=\":/res/StatsEverAfter.png\"> " + PageGameStats::tr("With everyone having the same clan color, there was no reason to fight. And so the hedgehogs happily lived in peace ever after.").toHtmlEscaped() + "</p>"; |
13773
c084bd440009
Add funny message in stats screen when everyone wins
Wuzzy <Wuzzy2@mail.ru>
parents:
13762
diff
changeset
|
476 |
AddStatText(message); |
c084bd440009
Add funny message in stats screen when everyone wins
Wuzzy <Wuzzy2@mail.ru>
parents:
13762
diff
changeset
|
477 |
break; |
c084bd440009
Add funny message in stats screen when everyone wins
Wuzzy <Wuzzy2@mail.ru>
parents:
13762
diff
changeset
|
478 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
479 |
} |
1622 | 480 |
} |