1 /* 2 * Hedgewars, a free turn based strategy game 3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef STATSPAGE_H 20 #define STATSPAGE_H 21 22 #include <QVector> 23 #include <QMap> 24 #include <QGraphicsView> 25 26 #include "AbstractPage.h" 27 28 class FitGraphicsView : public QGraphicsView 29 { 30 Q_OBJECT 31 32 public: 33 FitGraphicsView(QWidget* parent = 0); 34 35 protected: 36 void resizeEvent(QResizeEvent * event); 37 }; 38 39 class PageGameStats : public AbstractPage 40 { 41 Q_OBJECT 42 43 public: 44 PageGameStats(QWidget* parent = 0); 45 46 QPushButton *btnSave; 47 QPushButton *btnRestart; 48 QLabel *mainNote; 49 QLabel *labelGameStats; 50 QLabel *labelGameWin; 51 QLabel *labelGameRank; 52 QLabel *labelGraphTitle; 53 QString kindOfPoints; 54 FitGraphicsView * graphic; 55 56 public slots: 57 void GameStats(char type, const QString & info); 58 void clear(); 59 void renderStats(); 60 void restartBtnVisible(bool visible); 61 void saveDemoBtnEnabled(bool enabled); 62 63 signals: 64 void saveDemoRequested(); 65 void restartGameRequested(); 66 67 private: 68 void AddStatText(const QString & msg); 69 void applySpacing(); 70 71 QMap<qint32, QVector<qint32> > healthPoints; 72 unsigned int playerPosition; 73 unsigned int scriptPlayerPosition; 74 quint32 lastColor; 75 bool defaultGraphTitle; 76 QScopedPointer<QGraphicsScene> m_scene; 77 78 QLabel* labelDetails; 79 QGroupBox* gbDetails; 80 QGroupBox* gbRanks; 81 QGridLayout* pageLayout; 82 83 protected: 84 QLayout * bodyLayoutDefinition(); 85 QLayout * footerLayoutDefinition(); 86 void connectSignals(); 87 }; 88 89 #endif // STATSPAGE_H 90