KScoreDialog Class Reference

A simple high score dialog. More...

#include <kscoredialog.h>

Collaboration diagram for KScoreDialog:

Collaboration graph
[legend]
List of all members.

Public Types

typedef QMap< int, QString > FieldInfo
enum  Fields {
  Name = 1 << 0, Level = 1 << 1, Custom1 = 1 << 10, Custom2 = 1 << 11,
  Custom3 = 1 << 12, Date = 1 << 27, Time = 1 << 28, Score = 1 << 29
}

Public Member Functions

 KScoreDialog (int fields, QWidget *parent=0, const char *name=0)
 ~KScoreDialog ()
void setConfigGroup (const QString &group)
void setComment (const QString &comment)
void addField (int field, const QString &header, const QString &key)
 Define an extra FieldInfo entry.
int addScore (int newScore, const FieldInfo &newInfo, bool askName, bool lessIsMore)
 Adds a new score to the list.
int addScore (int newScore, const FieldInfo &newInfo, bool askName=true)
int highScore ()
 Returns the current best score.
virtual void show ()

Classes

class  KScoreDialogPrivate

Detailed Description

A simple high score dialog.

Definition at line 40 of file kscoredialog.h.


Member Typedef Documentation

typedef QMap<int, QString> KScoreDialog::FieldInfo
 

Definition at line 55 of file kscoredialog.h.


Member Enumeration Documentation

enum KScoreDialog::Fields
 

Enumerator:
Name 
Level 
Custom1 
Custom2 
Custom3 
Date 
Time 
Score 

Definition at line 44 of file kscoredialog.h.


Constructor & Destructor Documentation

KScoreDialog::KScoreDialog int  fields,
QWidget *  parent = 0,
const char *  name = 0
 

Parameters:
fields Which fields should be listed.
parent passed to parent QWidget constructor
name passed to parent QWidget constructor

Definition at line 67 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::configGroup, Date, KScoreDialog::KScoreDialogPrivate::edit, KScoreDialog::KScoreDialogPrivate::fields, KScoreDialog::KScoreDialogPrivate::header, KScoreDialog::KScoreDialogPrivate::key, KScoreDialog::KScoreDialogPrivate::latest, Level, KScoreDialog::KScoreDialogPrivate::loaded, Name, KScoreDialog::KScoreDialogPrivate::newName, KScoreDialog::KScoreDialogPrivate::nrCols, KScoreDialog::KScoreDialogPrivate::page, Score, and KScoreDialog::KScoreDialogPrivate::scores.

KScoreDialog::~KScoreDialog  ) 
 

Definition at line 96 of file kscoredialog.cpp.


Member Function Documentation

void KScoreDialog::addField int  field,
const QString &  header,
const QString &  key
 

Define an extra FieldInfo entry.

Parameters:
field Id of this field
header Header shown in the dialog for this field
key used to store this field with.

Definition at line 112 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::fields, KScoreDialog::KScoreDialogPrivate::header, and KScoreDialog::KScoreDialogPrivate::key.

int KScoreDialog::addScore int  newScore,
const FieldInfo newInfo,
bool  askName = true
 

Definition at line 321 of file kscoredialog.cpp.

References addScore().

Here is the call graph for this function:

int KScoreDialog::addScore int  newScore,
const FieldInfo newInfo,
bool  askName,
bool  lessIsMore
 

Adds a new score to the list.

Parameters:
newScore the score of this game.
newInfo additional info about the score.
askName Whether to prompt for the players name.
lessIsMore If true, the lowest score is the best score.
Returns:
The highscore position if the score was good enough to make it into the list (1 being topscore) or 0 otherwise.

Definition at line 326 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::comment, KScoreDialog::KScoreDialogPrivate::latest, KScoreDialog::KScoreDialogPrivate::loaded, KScoreDialog::KScoreDialogPrivate::newName, Score, and KScoreDialog::KScoreDialogPrivate::scores.

Referenced by addScore().

int KScoreDialog::highScore  ) 
 

Returns the current best score.

Definition at line 392 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::loaded, Score, and KScoreDialog::KScoreDialogPrivate::scores.

void KScoreDialog::setComment const QString &  comment  ) 
 

Parameters:
comment to add when showing high-scores. The comment is only used once.

Definition at line 107 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::comment.

void KScoreDialog::setConfigGroup const QString &  group  ) 
 

Parameters:
group to use for reading/writing highscores from/to. By default the class will use "High Score"

Definition at line 101 of file kscoredialog.cpp.

References KScoreDialog::KScoreDialogPrivate::configGroup, and KScoreDialog::KScoreDialogPrivate::loaded.

void KScoreDialog::show  )  [virtual]
 

Definition at line 360 of file kscoredialog.cpp.

References KExtHighscore::show().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Aug 23 18:06:04 2006 for libkdegames by  doxygen 1.4.6