libkdegames Library API Documentation

kscoredialog.h

00001 /****************************************************************
00002 Copyright (c) 1998 Sandro Sigala <ssigala@globalnet.it>.
00003 Copyright (c) 2001 Waldo Bastian <bastian@kde.org>
00004 All rights reserved.
00005 
00006 Permission to use, copy, modify, and distribute this software
00007 and its documentation for any purpose and without fee is hereby
00008 granted, provided that the above copyright notice appear in all
00009 copies and that both that the copyright notice and this
00010 permission notice and warranty disclaimer appear in supporting
00011 documentation, and that the name of the author not be used in
00012 advertising or publicity pertaining to distribution of the
00013 software without specific, written prior permission.
00014 
00015 The author disclaim all warranties with regard to this
00016 software, including all implied warranties of merchantability
00017 and fitness.  In no event shall the author be liable for any
00018 special, indirect or consequential damages or any damages
00019 whatsoever resulting from loss of use, data or profits, whether
00020 in an action of contract, negligence or other tortious action,
00021 arising out of or in connection with the use or performance of
00022 this software.
00023 ****************************************************************/
00024 
00025 #ifndef KSCOREDIALOG_H
00026 #define KSCOREDIALOG_H
00027 
00028 #include <qmap.h>
00029 #include <qptrlist.h>
00030 
00031 #include <kdialogbase.h>
00032 
00033 class QGridLayout;
00034 class QLineEdit;
00035 class QWidgetStack;
00036 
00040 class KScoreDialog : public KDialogBase {
00041    Q_OBJECT
00042    
00043 public:
00044    enum Fields { Name = 1 << 0, 
00045                  Level = 1 << 1, 
00046                  
00047                  Custom1 = 1 << 10,
00048                  Custom2 = 1 << 11,
00049                  Custom3 = 1 << 12,     
00050                  
00051                  Time = 1 << 28, 
00052                  Score = 1 << 29 };
00053         
00054    typedef QMap<int, QString> FieldInfo;
00055 
00061    KScoreDialog(int fields, QWidget *parent=0, const char *name=0);
00062 
00063    ~KScoreDialog();
00064 
00069    void setConfigGroup(const QString &group);
00070 
00075    void setComment(const QString &comment);
00076 
00083    void addField(int field, const QString &header, const QString &key); 
00084 
00096    int addScore(int newScore, const FieldInfo &newInfo, bool askName, bool lessIsMore);
00097    int addScore(int newScore, const FieldInfo &newInfo, bool askName=true);
00098 
00102    int highScore();
00103 
00104    virtual void show();
00105 
00106 private slots:
00107    void slotGotReturn();
00108    void slotGotName();
00109 
00110 private:
00111    /* read scores */
00112    void loadScores();   
00113    void saveScores();
00114    
00115    void aboutToShow();
00116    void setupDialog();
00117    void keyPressEvent( QKeyEvent *ev);
00118 
00119 private:           
00120    class KScoreDialogPrivate;
00121    KScoreDialogPrivate *d;
00122 };
00123 
00124 #endif // !KSCOREDIALOG_H
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 Sat May 1 10:06:38 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003