libkdegames/highscore
kexthighscore.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 #ifndef KEXTHIGHSCORE_H
00021 #define KEXTHIGHSCORE_H
00022
00023 #include "kexthighscore_item.h"
00024
00025 #include <kurl.h>
00026 #include <libkdegames_export.h>
00027
00028 #include <QtCore/QVector>
00029
00030
00031
00032 namespace KExtHighscore
00033 {
00034
00035 class Score;
00036 class Item;
00037
00038 class ManagerPrivate;
00039 extern ManagerPrivate *internal;
00040
00044 KDEGAMES_EXPORT uint gameType();
00045
00049 KDEGAMES_EXPORT void setGameType(uint gameType);
00050
00055 KDEGAMES_EXPORT bool configure(QWidget *parent);
00056
00060 KDEGAMES_EXPORT void show(QWidget *parent);
00061
00068 KDEGAMES_EXPORT void submitScore(const Score &score, QWidget *widget);
00069
00074 KDEGAMES_EXPORT Score lastScore();
00075
00080 KDEGAMES_EXPORT Score firstScore();
00081
00141 class KDEGAMES_EXPORT Manager
00142 {
00143 public:
00152 explicit Manager(uint nbGameTypes = 1, uint maxNbEntries = 10);
00153 virtual ~Manager();
00154
00165 void setWWHighscores(const KUrl &url, const QString &version);
00166
00174 void setTrackLostGames(bool track);
00175
00183 void setTrackDrawGames(bool track);
00184
00194 void setShowStatistics(bool show);
00195
00201 void setShowDrawGamesStatistic(bool show);
00202
00203 enum ScoreTypeBound { ScoreNotBound, ScoreBound };
00209 void setScoreHistogram(const QVector<uint> &scores, ScoreTypeBound type);
00210
00215 enum ShowMode { AlwaysShow,
00216 NeverShow,
00217 ShowForHigherScore,
00218 ShowForHighestScore
00219 };
00226 void setShowMode(ShowMode mode);
00227
00233 enum ScoreType { Normal, MinuteTime };
00240 void setScoreType(ScoreType type);
00241
00250 enum ItemType { ScoreDefault, MeanScoreDefault, BestScoreDefault,
00251 ElapsedTime };
00255 static Item *createItem(ItemType type);
00256
00263 void setScoreItem(uint worstScore, Item *item);
00264
00270 void addScoreItem(const QString &name, Item *item);
00271
00272 enum PlayerItemType { MeanScore, BestScore };
00278 void setPlayerItem(PlayerItemType type, Item *item);
00279
00289 virtual bool isStrictlyLess(const Score &s1, const Score &s2) const;
00290
00298 enum LabelType { Standard, I18N, WW, Icon };
00299
00305 virtual QString gameTypeLabel(uint gameType, LabelType type) const;
00306
00307 protected:
00315 virtual void convertLegacy(uint gameType) { Q_UNUSED(gameType); }
00316
00330 void submitLegacyScore(const Score &score) const;
00331
00340 virtual void additionalQueryItems(KUrl &url, const Score &score) const
00341 { Q_UNUSED(url); Q_UNUSED(score); }
00342
00350 static void addToQueryURL(KUrl &url, const QString &item,
00351 const QString &content);
00352
00353 friend class ManagerPrivate;
00354
00355 private:
00356 Manager(const Manager &);
00357 Manager &operator =(const Manager &);
00358 };
00359
00360 }
00361
00362 #endif