• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

Public Types | Public Member Functions | List of all members
KScoreDialog Class Reference

#include <kscoredialog.h>

Inherits KDialogBase.

Public Types

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
}
 
typedef TQMap< int, TQString > FieldInfo
 

Public Member Functions

 KScoreDialog (int fields, TQWidget *parent=0, const char *name=0)
 
void setConfigGroup (const TQString &group)
 
void setComment (const TQString &comment)
 
void addField (int field, const TQString &header, const TQString &key)
 
int addScore (int newScore, const FieldInfo &newInfo, bool askName, bool lessIsMore)
 
int addScore (int newScore, const FieldInfo &newInfo, bool askName=true)
 
int highScore ()
 
virtual void show ()
 

Detailed Description

A simple high score dialog.

Definition at line 40 of file kscoredialog.h.

Constructor & Destructor Documentation

◆ KScoreDialog()

KScoreDialog::KScoreDialog ( int  fields,
TQWidget *  parent = 0,
const char *  name = 0 
)
Parameters
fieldsWhich fields should be listed.
parentpassed to parent TQWidget constructor
namepassed to parent TQWidget constructor

Definition at line 67 of file kscoredialog.cpp.

Member Function Documentation

◆ addField()

void KScoreDialog::addField ( int  field,
const TQString &  header,
const TQString &  key 
)

Define an extra FieldInfo entry.

Parameters
fieldId of this field
headerHeader shown in the dialog for this field
keyused to store this field with.

Definition at line 112 of file kscoredialog.cpp.

◆ addScore()

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

Adds a new score to the list.

Parameters
newScorethe score of this game.
newInfoadditional info about the score.
askNameWhether to prompt for the players name.
lessIsMoreIf 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.

◆ highScore()

int KScoreDialog::highScore ( )

Returns the current best score.

Definition at line 392 of file kscoredialog.cpp.

◆ setComment()

void KScoreDialog::setComment ( const TQString &  comment)
Parameters
commentto add when showing high-scores. The comment is only used once.

Definition at line 107 of file kscoredialog.cpp.

◆ setConfigGroup()

void KScoreDialog::setConfigGroup ( const TQString &  group)
Parameters
groupto use for reading/writing highscores from/to. By default the class will use "High Score"

Definition at line 101 of file kscoredialog.cpp.


The documentation for this class was generated from the following files:
  • kscoredialog.h
  • kscoredialog.cpp

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.8.13
This website is maintained by Timothy Pearson.