diff -r ddf020d0941a -r fdfc01419815 QTfrontend/ui/page/pagegamestats.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/ui/page/pagegamestats.cpp Wed Sep 28 19:27:56 2011 +0200
@@ -0,0 +1,274 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2010-2011 Andrey Korotaev " + PageGameStats::tr("The best shot award was won by %1 with %2 pts.").arg(info.mid(i + 1), info.left(i)) + " " + PageGameStats::tr("The best killer is %1 with %2 kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + " " + PageGameStats::tr("A total of %1 hedgehog(s) were killed during this round.", "", num).arg(num) + " local team: " + info + " " + PageGameStats::tr("Details") + "
");
+ l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ labelGameStats->setTextFormat(Qt::RichText);
+ labelGameStats->setAlignment(Qt::AlignTop);
+ labelGameStats->setWordWrap(true);
+ gbl->addWidget(l);
+ gbl->addWidget(labelGameStats);
+ gb->setLayout(gbl);
+ pageLayout->addWidget(gb, 1, 1, 1, 2);
+
+ // graph
+ graphic = new FitGraphicsView(gb);
+ l = new QLabel(this);
+ l->setTextFormat(Qt::RichText);
+ l->setText(" " + PageGameStats::tr("Health graph") + "
");
+ l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ gbl->addWidget(l);
+ gbl->addWidget(graphic);
+ graphic->scale(1.0, -1.0);
+ graphic->setBackgroundBrush(QBrush(Qt::black));
+
+ labelGameWin = new QLabel(this);
+ labelGameWin->setTextFormat(Qt::RichText);
+ pageLayout->addWidget(labelGameWin, 0, 0, 1, 2);
+
+ // ranking box
+ gb = new QGroupBox(this);
+ gbl = new QVBoxLayout;
+ labelGameRank = new QLabel(gb);
+ l = new QLabel(this);
+ l->setTextFormat(Qt::RichText);
+ l->setText(" " + PageGameStats::tr("Ranking") + "
");
+ l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ gbl->addWidget(l);
+ gbl->addWidget(labelGameRank);
+ gb->setLayout(gbl);
+
+ labelGameRank->setTextFormat(Qt::RichText);
+ labelGameRank->setAlignment(Qt::AlignTop);
+ pageLayout->addWidget(gb, 1, 0);
+
+ return pageLayout;
+}
+
+QLayout * PageGameStats::footerLayoutDefinition()
+{
+ QHBoxLayout * bottomLayout = new QHBoxLayout();
+
+ btnSave = addButton(":/res/Save.png", bottomLayout, 0, true);
+ btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
+ bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom);
+
+ return bottomLayout;
+}
+
+void PageGameStats::connectSignals()
+{
+ connect(btnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested()));
+}
+
+PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent)
+{
+ initPage();
+}
+
+void PageGameStats::AddStatText(const QString & msg)
+{
+ labelGameStats->setText(labelGameStats->text() + msg);
+}
+
+void PageGameStats::clear()
+{
+ labelGameStats->setText("");
+ healthPoints.clear();
+ labelGameRank->setText("");
+ playerPosition = 0;
+ lastColor = 0;
+}
+
+void PageGameStats::renderStats()
+{
+ QGraphicsScene * scene = new QGraphicsScene();
+
+ QMap%1
").arg(info));
+ break;
+ }
+ case 'D' : {
+ int i = info.indexOf(' ');
+ QString message = "%1 %2. %3 ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "
" + PageGameStats::tr("%1 thought it's good to shoot his own hedgehogs with %2 pts.", "", num).arg(info.mid(i + 1)).arg(num) + "
"; + AddStatText(message); + break; + } + case 'S' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "" + PageGameStats::tr("%1 killed %2 of his own hedgehogs.", "", num).arg(info.mid(i + 1)).arg(num) + "
"; + AddStatText(message); + break; + } + case 'B' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "" + PageGameStats::tr("%1 was scared and skipped turn %2 times.", "", num).arg(info.mid(i + 1)).arg(num) + "
"; + AddStatText(message); + break; + } + + } +}