kexthighscore.h
00001 /* 00002 This file is part of the KDE games library 00003 Copyright (C) 2001-2004 Nicolas Hadacek (hadacek@kde.org) 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 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 TQTabWidget; 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(TQWidget *parent); 00055 00059 KDE_EXPORT void show(TQWidget *parent); 00060 00066 KDE_EXPORT void submitScore(const Score &score, TQWidget *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 TQString &version); 00164 00172 void setTrackLostGames(bool track); 00173 00182 void setTrackDrawGames(bool track); 00183 00194 void setShowStatistics(bool show); 00195 00197 // KDE4 remove this 00198 void showStatistics(bool show) KDE_DEPRECATED; 00199 00206 void setShowDrawGamesStatistic(bool show); 00207 00208 enum ScoreTypeBound { ScoreNotBound, ScoreBound }; 00214 void setScoreHistogram(const TQMemArray<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 TQString &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 TQString 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 TQString &item, 00356 const TQString &content); 00357 00358 friend class ManagerPrivate; 00359 00360 private: 00361 Manager(const Manager &); 00362 Manager &operator =(const Manager &); 00363 }; 00364 00365 } // namespace 00366 00367 #endif