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