Diffstat (limited to 'noncore/games/tetrix/ohighscoredlg.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/noncore/games/tetrix/ohighscoredlg.h b/noncore/games/tetrix/ohighscoredlg.h new file mode 100644 index 0000000..fdbe623 --- a/dev/null +++ b/noncore/games/tetrix/ohighscoredlg.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * ( at your option ) any later version. * | ||
7 | * * | ||
8 | **************************************************************************/ | ||
9 | |||
10 | class QWidget; | ||
11 | class QVBoxLayout; | ||
12 | class QListView; | ||
13 | |||
14 | #include <qdialog.h> | ||
15 | #include <list> | ||
16 | |||
17 | using namespace std; | ||
18 | |||
19 | struct t_playerData | ||
20 | { | ||
21 | QString sName; | ||
22 | int points; | ||
23 | int level; | ||
24 | }; | ||
25 | |||
26 | class OHighscore : public QWidget | ||
27 | { | ||
28 | Q_OBJECT | ||
29 | |||
30 | public: | ||
31 | /* | ||
32 | *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector | ||
33 | */ | ||
34 | OHighscore( int , int ); | ||
35 | |||
36 | ~OHighscore(); | ||
37 | |||
38 | /* | ||
39 | * is true if the player did a new highscore | ||
40 | */ | ||
41 | bool isNewhighscore; | ||
42 | |||
43 | /* | ||
44 | * this inserts the new entry at the correct position | ||
45 | */ | ||
46 | void insertData( QString , int , int ); | ||
47 | |||
48 | list<t_playerData*> playerData; | ||
49 | |||
50 | /* | ||
51 | * As Qt/e does not support QInputDialog I did that code myself | ||
52 | */ | ||
53 | QString getName(); | ||
54 | private: | ||
55 | |||
56 | list<t_playerData*>::iterator iPlayerData; | ||
57 | |||
58 | /* | ||
59 | * the lowest score in the highscorelist | ||
60 | */ | ||
61 | int lowest; | ||
62 | |||
63 | /* | ||
64 | * the level of the highscore | ||
65 | */ | ||
66 | int pLevel; | ||
67 | |||
68 | /* | ||
69 | * get all scores in a vector and give "lowest" a value | ||
70 | */ | ||
71 | void getList(); | ||
72 | |||
73 | /* | ||
74 | * sets the bool if the current score is in the top10 | ||
75 | */ | ||
76 | void checkIfItIsANewhighscore( int ); | ||
77 | }; | ||
78 | |||
79 | class OHighscoreDialog : public QDialog | ||
80 | { | ||
81 | Q_OBJECT | ||
82 | |||
83 | public: | ||
84 | OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); | ||
85 | |||
86 | private: | ||
87 | OHighscore *hs_; | ||
88 | |||
89 | QVBoxLayout *vbox_layout; | ||
90 | |||
91 | /* | ||
92 | * this method creates the QListView with all data | ||
93 | */ | ||
94 | void createHighscoreListView(); | ||
95 | |||
96 | QListView *list; | ||
97 | }; | ||