libkdegames/highscore
kexthighscore_gui.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 #ifndef KEXTHIGHSCORE_GUI_H
00021 #define KEXTHIGHSCORE_GUI_H
00022
00023 #include <QtGui/QCheckBox>
00024 #include <QtGui/QLineEdit>
00025 #include <QtGui/QTreeWidget>
00026 #include <kpagedialog.h>
00027 #include <QtCore/QList>
00028
00029 #include "kexthighscore.h"
00030
00031 class QTabWidget;
00032 class KLineEdit;
00033 class KPushButton;
00034 class KUrlLabel;
00035
00036 namespace KExtHighscore
00037 {
00038
00039 class ItemContainer;
00040 class ItemArray;
00041 class Score;
00042 class AdditionalTab;
00043
00044
00045 class ShowItem : public QTreeWidgetItem
00046 {
00047 public:
00048 ShowItem(QTreeWidget *, bool highlight);
00049
00050 private:
00051 bool _highlight;
00052 };
00053
00054 class ScoresList : public QTreeWidget
00055 {
00056 Q_OBJECT
00057 public:
00058 ScoresList(QWidget *parent);
00059
00060 void addHeader(const ItemArray &);
00061
00062 protected:
00063 QTreeWidgetItem *addLine(const ItemArray &, uint index, bool highlight);
00064 virtual QString itemText(const ItemContainer &, uint row) const = 0;
00065
00066 private:
00067 virtual void addLineItem(const ItemArray &, uint index,
00068 QTreeWidgetItem *item);
00069 };
00070
00071
00072 class HighscoresList : public ScoresList
00073 {
00074 Q_OBJECT
00075 public:
00076 explicit HighscoresList(QWidget *parent);
00077
00078 void load(const ItemArray &, int highlight);
00079
00080 protected:
00081 QString itemText(const ItemContainer &, uint row) const;
00082 };
00083
00084 class HighscoresWidget : public QWidget
00085 {
00086 Q_OBJECT
00087 public:
00088 explicit HighscoresWidget(QWidget *parent);
00089
00090 void load(int rank);
00091
00092 signals:
00093 void tabChanged(int i);
00094
00095 public slots:
00096 void changeTab(int i);
00097
00098 private slots:
00099 void showURL(const QString &);
00100 void tabChanged() { emit tabChanged(_tw->currentIndex()); }
00101
00102 private:
00103 QTabWidget *_tw;
00104 HighscoresList *_scoresList, *_playersList;
00105 KUrlLabel *_scoresUrl, *_playersUrl;
00106 AdditionalTab *_statsTab, *_histoTab;
00107 };
00108
00109 class HighscoresDialog : public KPageDialog
00110 {
00111 Q_OBJECT
00112 public:
00113 HighscoresDialog(int rank, QWidget *parent);
00114
00115 private slots:
00116 void slotUser1();
00117 void slotUser2();
00118 void tabChanged(int i) { _tab = i; }
00119 void highscorePageChanged(KPageWidgetItem *newpage, KPageWidgetItem *before);
00120
00121 private:
00122 int _rank, _tab;
00123 QWidget *_current;
00124 QList<KPageWidgetItem*> _pages;
00125 };
00126
00127
00128 class LastMultipleScoresList : public ScoresList
00129 {
00130 Q_OBJECT
00131 public:
00132 LastMultipleScoresList(const QVector<Score> &, QWidget *parent);
00133
00134 private:
00135 void addLineItem(const ItemArray &, uint index, QTreeWidgetItem *line);
00136 QString itemText(const ItemContainer &, uint row) const;
00137
00138 private:
00139 const QVector<Score> &_scores;
00140 };
00141
00142 class TotalMultipleScoresList : public ScoresList
00143 {
00144 Q_OBJECT
00145 public:
00146 TotalMultipleScoresList(const QVector<Score> &, QWidget *parent);
00147
00148 private:
00149 void addLineItem(const ItemArray &, uint index, QTreeWidgetItem *line);
00150 QString itemText(const ItemContainer &, uint row) const;
00151
00152 private:
00153 const QVector<Score> &_scores;
00154 };
00155
00156
00157 class ConfigDialog : public KDialog
00158 {
00159 Q_OBJECT
00160 public:
00161 explicit ConfigDialog(QWidget *parent);
00162
00163 bool hasBeenSaved() const { return _saved; }
00164
00165 private slots:
00166 void modifiedSlot();
00167 void removeSlot();
00168 void accept();
00169 void slotApply() { save(); }
00170 void nickNameChanged(const QString &);
00171
00172 private:
00173 bool _saved;
00174 QCheckBox *_WWHEnabled;
00175 QLineEdit *_nickname, *_comment;
00176 KLineEdit *_key, *_registeredName;
00177 KPushButton *_removeButton;
00178
00179 void load();
00180 bool save();
00181 };
00182
00183
00184 class AskNameDialog : public KDialog
00185 {
00186 Q_OBJECT
00187 public:
00188 explicit AskNameDialog(QWidget *parent);
00189
00190 QString name() const { return _edit->text(); }
00191 bool dontAskAgain() const { return _checkbox->isChecked(); }
00192
00193 private slots:
00194 void nameChanged();
00195
00196 private:
00197 QLineEdit *_edit;
00198 QCheckBox *_checkbox;
00199 };
00200
00201 }
00202
00203 #endif