libkdegames/highscore
kscoredialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef KSCOREDIALOG_H
00027 #define KSCOREDIALOG_H
00028
00029 #include <libkdegames_export.h>
00030
00031 #include <QtCore/QMap>
00032 #include <QtCore/QFlags>
00033
00034 #include <kdialog.h>
00035
00091 class KDEGAMES_EXPORT KScoreDialog : public KDialog
00092 {
00093 Q_OBJECT
00094
00095 public:
00097 enum Fields {
00098 Name = 1 << 0,
00099 Level = 1 << 1,
00100 Date = 1 << 2,
00101 Time = 1 << 3,
00102 Score = 1 << 4,
00103
00104 Custom1 = 1 << 10,
00105 Custom2 = 1 << 11,
00106 Custom3 = 1 << 12,
00107 Custom4 = 1 << 13,
00108 Custom5 = 1 << 14,
00109
00110 Max = 1 << 30
00111 };
00112
00114 enum AddScoreFlag
00115 {
00116 AskName = 0x1,
00117 LessIsMore = 0x2
00118 };
00119 Q_DECLARE_FLAGS(AddScoreFlags, AddScoreFlag)
00120
00121 typedef QMap<int, QString> FieldInfo;
00122
00127 explicit KScoreDialog(int fields=Name, QWidget *parent=0);
00128
00129 ~KScoreDialog();
00130
00136 void setConfigGroup(const QString& group = QString());
00137
00138
00143 void setComment(const QString& comment);
00144
00151 void addField(int field, const QString& header, const QString& key);
00152
00157 void hideField(int field);
00158
00168 int addScore(const FieldInfo& newInfo = FieldInfo(), const AddScoreFlags& flags=0);
00169
00179 int addScore(int newScore, const AddScoreFlags& flags=0);
00180
00184 int highScore();
00185
00187 virtual void show();
00189 virtual void exec();
00190
00191 private Q_SLOTS:
00192 void slotGotReturn();
00193 void slotGotName();
00194
00195 private:
00196 void keyPressEvent(QKeyEvent *ev);
00197
00198 private:
00199 class KScoreDialogPrivate;
00200 KScoreDialogPrivate* const d;
00201 };
00202 Q_DECLARE_OPERATORS_FOR_FLAGS(KScoreDialog::AddScoreFlags)
00203
00204 #endif //KSCOREDIALOG_H