kexthighscore.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXTHIGHSCORE_H
00021 #define KEXTHIGHSCORE_H
00022
00023 #include "kexthighscore_item.h"
00024
00025 #include <kurl.h>
00026 #include <kdemacros.h>
00027
00028 class QTabWidget;
00029
00030
00031 namespace KExtHighscore
00032 {
00033
00034 class Score;
00035 class Item;
00036
00037 class ManagerPrivate;
00038 extern ManagerPrivate *internal;
00039
00043 KDE_EXPORT uint gameType();
00044
00048 KDE_EXPORT void setGameType(uint gameType);
00049
00054 KDE_EXPORT bool configure(QWidget *parent);
00055
00059 KDE_EXPORT void show(QWidget *parent);
00060
00066 KDE_EXPORT void submitScore(const Score &score, QWidget *widget);
00067
00072 KDE_EXPORT Score lastScore();
00073
00078 KDE_EXPORT Score firstScore();
00079
00139 class KDE_EXPORT Manager
00140 {
00141 public:
00150 Manager(uint nbGameTypes = 1, uint maxNbEntries = 10);
00151 virtual ~Manager();
00152
00163 void setWWHighscores(const KURL &url, const QString &version);
00164
00172 void setTrackLostGames(bool track);
00173
00182 void setTrackDrawGames(bool track);
00183
00194 void setShowStatistics(bool show);
00195
00197
00198 void showStatistics(bool show) KDE_DEPRECATED;
00199
00206 void setShowDrawGamesStatistic(bool show);
00207
00208 enum ScoreTypeBound { ScoreNotBound, ScoreBound };
00214 void setScoreHistogram(const QMemArray<uint> &scores, ScoreTypeBound type);
00215
00220 enum ShowMode { AlwaysShow,
00221 NeverShow,
00222 ShowForHigherScore,
00223 ShowForHighestScore
00224 };
00231 void setShowMode(ShowMode mode);
00232
00238 enum ScoreType { Normal, MinuteTime };
00245 void setScoreType(ScoreType type);
00246
00255 enum ItemType { ScoreDefault, MeanScoreDefault, BestScoreDefault,
00256 ElapsedTime };
00260 static Item *createItem(ItemType type);
00261
00268 void setScoreItem(uint worstScore, Item *item);
00269
00275 void addScoreItem(const QString &name, Item *item);
00276
00277 enum PlayerItemType { MeanScore, BestScore };
00283 void setPlayerItem(PlayerItemType type, Item *item);
00284
00294 virtual bool isStrictlyLess(const Score &s1, const Score &s2) const;
00295
00303 enum LabelType { Standard, I18N, WW, Icon };
00304
00310 virtual QString gameTypeLabel(uint gameType, LabelType type) const;
00311
00312 protected:
00320 virtual void convertLegacy(uint gameType) { Q_UNUSED(gameType); }
00321
00335 void submitLegacyScore(const Score &score) const;
00336
00345 virtual void additionalQueryItems(KURL &url, const Score &score) const
00346 { Q_UNUSED(url); Q_UNUSED(score); }
00347
00355 static void addToQueryURL(KURL &url, const QString &item,
00356 const QString &content);
00357
00358 friend class ManagerPrivate;
00359
00360 private:
00361 Manager(const Manager &);
00362 Manager &operator =(const Manager &);
00363 };
00364
00365 }
00366
00367 #endif
|