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 #include <kdemacros.h>
00033 class QGridLayout;
00034 class QLineEdit;
00035 class QWidgetStack;
00036 
00040 class KDE_EXPORT 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                  Date = 1 << 27, 
00052                  Time = 1 << 28, 
00053                  Score = 1 << 29 };
00054         
00055    typedef QMap<int, QString> FieldInfo;
00056 
00062    KScoreDialog(int fields, QWidget *parent=0, const char *name=0);
00063 
00064    ~KScoreDialog();
00065 
00070    void setConfigGroup(const QString &group);
00071 
00076    void setComment(const QString &comment);
00077 
00084    void addField(int field, const QString &header, const QString &key); 
00085 
00097    int addScore(int newScore, const FieldInfo &newInfo, bool askName, bool lessIsMore);
00098    int addScore(int newScore, const FieldInfo &newInfo, bool askName=true);
00099 
00103    int highScore();
00104 
00105    virtual void show();
00106 
00107 private slots:
00108    void slotGotReturn();
00109    void slotGotName();
00110 
00111 private:
00112    /* read scores */
00113    void loadScores();   
00114    void saveScores();
00115    
00116    void aboutToShow();
00117    void setupDialog();
00118    void keyPressEvent( QKeyEvent *ev);
00119 
00120 private:           
00121    class KScoreDialogPrivate;
00122    KScoreDialogPrivate *d;
00123 };
00124 
00125 #endif // !KSCOREDIALOG_H
KDE Home | KDE Accessibility Home | Description of Access Keys