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
00036 class KLocalizedString;
00037
00095 class KDEGAMES_EXPORT KScoreDialog : public KDialog
00096 {
00097 Q_OBJECT
00098
00099 public:
00101 enum Fields {
00102 Name = 1 << 0,
00103 Level = 1 << 1,
00104 Date = 1 << 2,
00105 Time = 1 << 3,
00106 Score = 1 << 4,
00107
00108 Custom1 = 1 << 10,
00109 Custom2 = 1 << 11,
00110 Custom3 = 1 << 12,
00111 Custom4 = 1 << 13,
00112 Custom5 = 1 << 14,
00113
00114 Max = 1 << 30
00115 };
00116
00118 enum AddScoreFlag
00119 {
00120 AskName = 0x1,
00121 LessIsMore = 0x2
00122 };
00123 Q_DECLARE_FLAGS(AddScoreFlags, AddScoreFlag)
00124
00125 typedef QMap<int, QString> FieldInfo;
00126
00131 explicit KScoreDialog(int fields=Name, QWidget *parent=0);
00132
00133 ~KScoreDialog();
00134
00145 void KDE_DEPRECATED setConfigGroup(const QString& group = QString());
00146
00147
00157 void setConfigGroup(const QPair<QByteArray, QString>& group);
00158
00167 void addLocalizedConfigGroupName(const QPair<QByteArray, QString>& group);
00168
00179 void addLocalizedConfigGroupNames(const QMap<QByteArray, QString>& groups);
00180
00185 void setComment(const QString& comment);
00186
00193 void addField(int field, const QString& header, const QString& key);
00194
00199 void hideField(int field);
00200
00210 int addScore(const FieldInfo& newInfo = FieldInfo(), const AddScoreFlags& flags=0);
00211
00221 int addScore(int newScore, const AddScoreFlags& flags=0);
00222
00226 int highScore();
00227
00229 virtual void show();
00231 virtual void exec();
00232
00233 private Q_SLOTS:
00234 void slotGotReturn();
00235 void slotGotName();
00236
00237 private:
00238 void keyPressEvent(QKeyEvent *ev);
00239
00240 private:
00241 class KScoreDialogPrivate;
00242 KScoreDialogPrivate* const d;
00243 };
00244 Q_DECLARE_OPERATORS_FOR_FLAGS(KScoreDialog::AddScoreFlags)
00245
00246 #endif //KSCOREDIALOG_H