Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

score.h

Go to the documentation of this file.
00001 #ifndef SCORE_H
00002 #define SCORE_H
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include <config.h>
00006 #endif
00007 
00008 #include "portable.h"
00009 
00010 #if defined( KDE2_PORT )
00011 #include <kapp.h>
00012 #endif
00013 
00014 #include <qwidget.h>
00015 #include <qstring.h>
00016 #include <qpoint.h>
00017 #include <qrect.h>
00018 #include <qfile.h>
00019 
00020 #include <qfileinfo.h>
00021 #include <qdatetime.h>
00022 
00023 #include "painter.h"
00024 #include "bitfont.h"
00025 
00026 #define maxPlayer 1
00027 #define minPlayerNameLength 3
00028 #define highscoreName "highscore"
00029 
00030 class Score : public QWidget
00031 {
00032     Q_OBJECT
00033 public:
00034     Score (QWidget *parent=0, const char *name=0, int scheme=-1, int mode=-1, Bitfont *font=0);
00035     ~Score();
00036 
00037 public slots:
00038     void setScheme(int scheme, int mode, Bitfont *font=0);
00039 
00040     void set(int score);
00041     void set(int score, int player);
00042     void setScore(int level, int player);
00043     void setPause(bool paused);
00044 
00045     void initKeys();
00046 
00047 private slots:
00048     void read();
00049     void write();
00050     void end();
00051 
00052 signals:
00053     void toggleNew();
00054     void forcedHallOfFame(bool);
00055 
00056 protected:
00057     void timerEvent(QTimerEvent *);
00058     void paintEvent(QPaintEvent *);
00059     void keyPressEvent(QKeyEvent *);
00060 
00061     void focusInEvent(QFocusEvent *) { ; }
00062     void focusOutEvent(QFocusEvent *) { ; }
00063 
00064     void confScheme();
00065     void confTiming(bool defGroup=TRUE);
00066 
00067 private:
00068     Bitfont *bitfont;
00069 
00070     QRect rect(int col, float row, QString str, int align = AlignCenter);
00071     int x(int col);
00072     int y(float row);
00073 
00074     QString formatDate(QDate date);
00075 
00083     QFileInfo locateHighscoreFilePath();
00084 
00085     int cursorBlinkMS;
00086     int hallOfFameMS;
00087     int afterPauseMS;
00088 
00089     bool paused;
00090 
00091     uint UpKey;
00092     uint DownKey;
00093     uint RightKey;
00094     uint LeftKey;
00095 
00096     int lastScore;
00097     int lastPlayer;
00098     int HighScore;
00099     int playerScore[maxPlayer];
00100     QString playerName[maxPlayer];
00101 
00102     struct {
00103         int x;
00104         int y;
00105         QChar chr;
00106         bool on;
00107     } cursor;
00108 
00109     int cursorBlinkTimer;
00110     bool scrollRepeat;
00111 
00112     struct {
00113         int points;
00114         int levels;
00115         QTime duration;
00116         QDateTime moment;
00117         QString name;
00118     } hallOfFame[10];
00119 
00120     QFileInfo systemHighscoreFileInfo;
00121     QFileInfo privateHighscoreFileInfo;
00122 
00123     QFile highscoreFile;
00124 
00125     int scheme;
00126     int mode;
00127 };
00128 
00129 #endif // SCORE_H

Generated on Sat Nov 5 16:17:22 2005 for OPIE by  doxygen 1.4.2