libkdegames/highscore
khighscore.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KHIGHSCORE_H
00022 #define KHIGHSCORE_H
00023
00024 #include <libkdegames_export.h>
00025
00026 #include <QtCore/QObject>
00027
00028 class KConfig;
00029
00082 class KDEGAMES_EXPORT KHighscore : public QObject
00083 {
00084 Q_OBJECT
00085 public:
00094 explicit KHighscore(bool forceLocal=true, QObject *parent=0);
00095
00101 void readCurrentConfig();
00102
00113 static void init(const char *appname);
00114
00130 bool lockForWriting(QWidget *widget = 0);
00131
00137 void writeAndUnlock();
00138
00143 bool isLocked() const;
00144
00149 ~KHighscore();
00150
00158 void writeEntry(int entry, const QString& key, const QString& value);
00159
00164 void writeEntry(int entry, const QString& key, int value);
00165
00171 void writeEntry(int entry, const QString& key, const QVariant &value);
00172
00184 QString readEntry(int entry, const QString& key, const QString& pDefault = "") const;
00185
00197 int readNumEntry(int entry, const QString& key, int pDefault = -1) const;
00198
00206 QVariant readPropertyEntry(int entry, const QString &key, const QVariant &pDefault) const;
00207
00212 bool hasEntry(int entry, const QString& key) const;
00213
00231 QStringList readList(const QString& key, int lastEntry = 20) const;
00232
00244 void writeList(const QString& key, const QStringList& list);
00245
00254 bool hasTable() const;
00255
00263 void setHighscoreGroup(const QString& groupname = "");
00264
00272 QStringList groupList() const;
00273
00279 QString highscoreGroup() const;
00280
00281 protected:
00286 QString group() const;
00287
00293 KConfig* config() const;
00294
00295 void init(bool forceLocal);
00296
00297 private:
00298 class KHighscorePrivate;
00299 KHighscorePrivate* const d;
00300 };
00301
00302 #endif