00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __KHIGHSCORE_H__
00024 #define __KHIGHSCORE_H__
00025
00026 #include <tqstring.h>
00027 #include <tqobject.h>
00028 #include <kdemacros.h>
00029 class KConfig;
00030 class KFileLock;
00031 class KRawConfig;
00032 class KHighscorePrivate;
00033
00084 class KDE_EXPORT KHighscore : public TQObject
00085 {
00086 Q_OBJECT
00087 TQ_OBJECT
00088 public:
00093 KHighscore(TQObject* parent = 0);
00094
00104 KHighscore(bool forceLocal, TQObject *parent);
00105
00112 void readCurrentConfig();
00113
00124 static void init(const char *appname);
00125
00141 bool lockForWriting(TQWidget *widget = 0);
00142
00149 void writeAndUnlock();
00150
00156 bool isLocked() const;
00157
00162 ~KHighscore();
00163
00171 void writeEntry(int entry, const TQString& key, const TQString& value);
00172
00177 void writeEntry(int entry, const TQString& key, int value);
00178
00184 void writeEntry(int entry, const TQString& key, const TQVariant &value);
00185
00197 TQString readEntry(int entry, const TQString& key, const TQString& pDefault = TQString()) const;
00198
00210 int readNumEntry(int entry, const TQString& key, int pDefault = -1) const;
00211
00219 TQVariant readPropertyEntry(int entry, const TQString &key, const TQVariant &pDefault) const;
00220
00225 bool hasEntry(int entry, const TQString& key) const;
00226
00244 TQStringList readList(const TQString& key, int lastEntry = 20) const;
00245
00257 void writeList(const TQString& key, const TQStringList& list);
00258
00266 bool hasTable() const;
00267
00271 void sync();
00272
00280 void setHighscoreGroup(const TQString& groupname = TQString());
00281
00287 const TQString& highscoreGroup() const;
00288
00289 protected:
00294 TQString group() const;
00295
00301 KConfig* config() const;
00302
00303 void init(bool forceLocal);
00304
00305 private:
00306 KHighscorePrivate* d;
00307
00308 static KFileLock *_lock;
00309 static KRawConfig *_config;
00310 };
00311
00312 #endif