8b2733c5ef8905f8db4f8827d46192413a98dcde
[impuzzle] / src / statistics.h
1 #ifndef STATISTICS_H
2 #define STATISTICS_H
3
4 #include <QObject>
5 #include <QList>
6
7 class Statistics : public QObject
8 {
9     Q_OBJECT
10
11 public:
12     enum Difficulty {
13         easyDifficulty = 0,
14         hardDifficulty
15     };
16
17     static Statistics *instance();
18
19     int gameCount(Difficulty difficulty) const;
20
21     int totalGameCount() const;
22
23     qreal averageMoves(Difficulty difficulty) const;
24
25     int minMoves(Difficulty difficulty) const;
26
27     int maxMoves(Difficulty difficulty) const;
28
29 public slots:
30     void addNewScore(int moves, Difficulty difficulty);
31
32     void increaseGameCount(Difficulty difficulty);
33
34     void readFile();
35
36     void saveFile();
37
38     void resetStatistics();
39
40 private:
41     Statistics(QObject *parent = 0);
42
43     static Statistics *instance_;
44
45     QList<int> moves_;
46     QList<int> minMoves_;
47     QList<int> maxMoves_;
48     QList<int> games_;
49 };
50
51 #endif