khighscore.h00001
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 <qstring.h>
00027 #include <qobject.h>
00028 #include <kdemacros.h>
00029 class KConfig;
00030 class KFileLock;
00031 class KRawConfig;
00032 class KHighscorePrivate;
00033
00084 class KDE_EXPORT KHighscore : public QObject
00085 {
00086 Q_OBJECT
00087 public:
00092 KHighscore(QObject* parent = 0);
00093
00103 KHighscore(bool forceLocal, QObject *parent);
00104
00111 void readCurrentConfig();
00112
00123 static void init(const char *appname);
00124
00140 bool lockForWriting(QWidget *widget = 0);
00141
00148 void writeAndUnlock();
00149
00155 bool isLocked() const;
00156
00161 ~KHighscore();
00162
00170 void writeEntry(int entry, const QString& key, const QString& value);
00171
00176 void writeEntry(int entry, const QString& key, int value);
00177
00183 void writeEntry(int entry, const QString& key, const QVariant &value);
00184
00196 QString readEntry(int entry, const QString& key, const QString& pDefault = QString::null) const;
00197
00209 int readNumEntry(int entry, const QString& key, int pDefault = -1) const;
00210
00218 QVariant readPropertyEntry(int entry, const QString &key, const QVariant &pDefault) const;
00219
00224 bool hasEntry(int entry, const QString& key) const;
00225
00243 QStringList readList(const QString& key, int lastEntry = 20) const;
00244
00256 void writeList(const QString& key, const QStringList& list);
00257
00265 bool hasTable() const;
00266
00270 void sync();
00271
00279 void setHighscoreGroup(const QString& groupname = QString::null);
00280
00286 const QString& highscoreGroup() const;
00287
00288 protected:
00293 QString group() const;
00294
00300 KConfig* config() const;
00301
00302 void init(bool forceLocal);
00303
00304 private:
00305 KHighscorePrivate* d;
00306
00307 static KFileLock *_lock;
00308 static KRawConfig *_config;
00309 };
00310
00311 #endif
|