00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * ( at your option ) any later version. * 00007 * * 00008 **************************************************************************/ 00009 00010 class QWidget; 00011 class QVBoxLayout; 00012 class QListView; 00013 00014 #include <qdialog.h> 00015 #include <qlist.h> 00016 00017 class t_playerData 00018 { 00019 00020 public : 00021 00022 QString sName; 00023 int points; 00024 int level; 00025 }; 00026 00027 class OHighscore : public QWidget 00028 { 00029 Q_OBJECT 00030 00031 public: 00032 /* 00033 *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector 00034 */ 00035 OHighscore( int , int ); 00036 00037 ~OHighscore(); 00038 00039 /* 00040 * is true if the player did a new highscore 00041 */ 00042 bool isNewhighscore; 00043 00044 /* 00045 * this inserts the new entry at the correct position 00046 */ 00047 void insertData( QString , int , int ); 00048 00049 QList<t_playerData> playerData; 00050 00051 /* 00052 * As Qt/e does not support QInputDialog I did that code myself 00053 */ 00054 QString getName(); 00055 private: 00056 00057 /* 00058 * the lowest score in the highscorelist 00059 */ 00060 int lowest; 00061 00062 /* 00063 * the level of the highscore 00064 */ 00065 int pLevel; 00066 00067 /* 00068 * get all scores in a vector and give "lowest" a value 00069 */ 00070 void getList(); 00071 00072 /* 00073 * sets the bool if the current score is in the top10 00074 */ 00075 void checkIfItIsANewhighscore( int ); 00076 }; 00077 00078 class OHighscoreDialog : public QDialog 00079 { 00080 Q_OBJECT 00081 00082 public: 00083 OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); 00084 00085 private: 00086 OHighscore *hs_; 00087 00088 QVBoxLayout *vbox_layout; 00089 00090 /* 00091 * this method creates the QListView with all data 00092 */ 00093 void createHighscoreListView(); 00094 00095 QListView *list; 00096 };
1.4.2