libkdegames Library API Documentation

kexthighscore.h

00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001-02 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., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef KEXTHIGHSCORE_H
00021 #define KEXTHIGHSCORE_H
00022 
00023 #include "kexthighscore_item.h"
00024 
00025 #include <kurl.h>
00026 
00027 class QTabWidget;
00028 
00029 
00030 namespace KExtHighscore
00031 {
00032 
00033 class Score;
00034 class Item;
00035 
00036 class ManagerPrivate;
00037 extern ManagerPrivate *internal;
00038 
00042 uint gameType();
00043 
00047 void setGameType(uint gameType);
00048 
00053 bool configure(QWidget *parent);
00054 
00058 void show(QWidget *parent);
00059 
00065 void submitScore(const Score &score, QWidget *widget);
00066 
00071 Score lastScore();
00072 
00077 Score firstScore();
00078 
00138 class Manager
00139 {
00140  public:
00149     Manager(uint nbGameTypes = 1, uint maxNbEntries = 10);
00150     virtual ~Manager();
00151 
00161     void setWWHighscores(const KURL &url, const QString &version);
00162 
00169     void setTrackLostGames(bool track);
00170 
00179     void showStatistics(bool show);
00180 
00181     enum ScoreTypeBound { ScoreNotBound, ScoreBound };
00187     void setScoreHistogram(const QMemArray<uint> &scores, ScoreTypeBound type);
00188 
00189     enum ShowMode { AlwaysShow, NeverShow, ShowForHigherScore,
00190                     ShowForHighestScore };
00197     void setShowMode(ShowMode mode);
00198 
00204     enum ScoreType { Normal, MinuteTime };
00210     void setScoreType(ScoreType type);
00211 
00220     enum ItemType { ScoreDefault, MeanScoreDefault, BestScoreDefault,
00221                     ElapsedTime };
00225     static Item *createItem(ItemType type);
00226 
00233     void setScoreItem(uint worstScore, Item *item);
00234 
00240     void addScoreItem(const QString &name, Item *item);
00241 
00242     enum PlayerItemType { MeanScore, BestScore };
00248     void setPlayerItem(PlayerItemType type, Item *item);
00249 
00259     virtual bool isStrictlyLess(const Score &s1, const Score &s2) const;
00260 
00268     enum LabelType { Standard, I18N, WW, Icon };
00269 
00275     virtual QString gameTypeLabel(uint gameType, LabelType type) const;
00276 
00277  protected:
00285     virtual void convertLegacy(uint gameType) { Q_UNUSED(gameType); }
00286 
00300     void submitLegacyScore(const Score &score) const;
00301 
00310     virtual void additionalQueryItems(KURL &url, const Score &score) const
00311         { Q_UNUSED(url); Q_UNUSED(score); }
00312 
00320     static void addToQueryURL(KURL &url, const QString &item,
00321                               const QString &content);
00322 
00323     friend class ManagerPrivate;
00324 
00325  private:
00326     Manager(const Manager &);
00327     Manager &operator =(const Manager &);
00328 };
00329 
00330 } // namespace
00331 
00332 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Apr 18 06:22:49 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003