• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/highscore

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
  • highscore
kexthighscore_gui.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2001-02 Nicolas Hadacek (hadacek@kde.org)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KEXTHIGHSCORE_GUI_H
21 #define KEXTHIGHSCORE_GUI_H
22 
23 #include <QtGui/QCheckBox>
24 #include <QtGui/QLineEdit>
25 #include <QtGui/QTreeWidget>
26 #include <kpagedialog.h>
27 #include <QtCore/QList>
28 
29 #include "kexthighscore.h"
30 
31 class QTabWidget;
32 class KLineEdit;
33 class KPushButton;
34 class KUrlLabel;
35 
36 namespace KExtHighscore
37 {
38 
39 class ItemContainer;
40 class ItemArray;
41 class Score;
42 class AdditionalTab;
43 
44 //-----------------------------------------------------------------------------
45 class ShowItem : public QTreeWidgetItem
46 {
47  public:
48  ShowItem(QTreeWidget *, bool highlight);
49 
50  private:
51  bool _highlight;
52 };
53 
54 class ScoresList : public QTreeWidget
55 {
56  Q_OBJECT
57  public:
58  ScoresList(QWidget *parent);
59 
60  void addHeader(const ItemArray &);
61 
62  protected:
63  QTreeWidgetItem *addLine(const ItemArray &, uint index, bool highlight);
64  virtual QString itemText(const ItemContainer &, uint row) const = 0;
65 
66  private:
67  virtual void addLineItem(const ItemArray &, uint index,
68  QTreeWidgetItem *item);
69 };
70 
71 //-----------------------------------------------------------------------------
72 class HighscoresList : public ScoresList
73 {
74  Q_OBJECT
75  public:
76  explicit HighscoresList(QWidget *parent);
77 
78  void load(const ItemArray &, int highlight);
79 
80  protected:
81  QString itemText(const ItemContainer &, uint row) const;
82 };
83 
84 class HighscoresWidget : public QWidget
85 {
86  Q_OBJECT
87  public:
88  explicit HighscoresWidget(QWidget *parent);
89 
90  void load(int rank);
91 
92  signals:
93  void tabChanged(int i);
94 
95  public slots:
96  void changeTab(int i);
97 
98  private slots:
99  void showURL(const QString &);
100  void tabChanged() { emit tabChanged(_tw->currentIndex()); }
101 
102  private:
103  QTabWidget *_tw;
104  HighscoresList *_scoresList, *_playersList;
105  KUrlLabel *_scoresUrl, *_playersUrl;
106  AdditionalTab *_statsTab, *_histoTab;
107 };
108 
109 class HighscoresDialog : public KPageDialog
110 {
111  Q_OBJECT
112  public:
113  HighscoresDialog(int rank, QWidget *parent);
114 
115  private slots:
116  void slotUser1();
117  void slotUser2();
118  void tabChanged(int i) { _tab = i; }
119  void highscorePageChanged(KPageWidgetItem *newpage, KPageWidgetItem *before);
120 
121  private:
122  int _rank, _tab;
123  QWidget *_current;
124  QList<KPageWidgetItem*> _pages;
125 };
126 
127 //-----------------------------------------------------------------------------
128 class LastMultipleScoresList : public ScoresList
129 {
130  Q_OBJECT
131 public:
132  LastMultipleScoresList(const QVector<Score> &, QWidget *parent);
133 
134 private:
135  void addLineItem(const ItemArray &, uint index, QTreeWidgetItem *line);
136  QString itemText(const ItemContainer &, uint row) const;
137 
138 private:
139  const QVector<Score> &_scores;
140 };
141 
142 class TotalMultipleScoresList : public ScoresList
143 {
144  Q_OBJECT
145 public:
146  TotalMultipleScoresList(const QVector<Score> &, QWidget *parent);
147 
148 private:
149  void addLineItem(const ItemArray &, uint index, QTreeWidgetItem *line);
150  QString itemText(const ItemContainer &, uint row) const;
151 
152 private:
153  const QVector<Score> &_scores;
154 };
155 
156 //-----------------------------------------------------------------------------
157 class ConfigDialog : public KDialog
158 {
159  Q_OBJECT
160  public:
161  explicit ConfigDialog(QWidget *parent);
162 
163  bool hasBeenSaved() const { return _saved; }
164 
165  private slots:
166  void modifiedSlot();
167  void removeSlot();
168  void accept();
169  void slotApply() { save(); }
170  void nickNameChanged(const QString &);
171 
172  private:
173  bool _saved;
174  QCheckBox *_WWHEnabled;
175  QLineEdit *_nickname, *_comment;
176  KLineEdit *_key, *_registeredName;
177  KPushButton *_removeButton;
178 
179  void load();
180  bool save();
181 };
182 
183 //-----------------------------------------------------------------------------
184 class AskNameDialog : public KDialog
185 {
186  Q_OBJECT
187  public:
188  explicit AskNameDialog(QWidget *parent);
189 
190  QString name() const { return _edit->text(); }
191  bool dontAskAgain() const { return _checkbox->isChecked(); }
192 
193  private slots:
194  void nameChanged();
195 
196  private:
197  QLineEdit *_edit;
198  QCheckBox *_checkbox;
199 };
200 
201 } // namespace
202 
203 #endif
QWidget
KPageDialog
KExtHighscore::HighscoresWidget::tabChanged
void tabChanged(int i)
QLineEdit::text
text
KExtHighscore::AskNameDialog::name
QString name() const
Definition: kexthighscore_gui.h:190
KExtHighscore::TotalMultipleScoresList
Definition: kexthighscore_gui.h:142
KExtHighscore::HighscoresDialog
Definition: kexthighscore_gui.h:109
KExtHighscore::ConfigDialog
Definition: kexthighscore_gui.h:157
KDialog
KExtHighscore::ScoresList::addLine
QTreeWidgetItem * addLine(const ItemArray &, uint index, bool highlight)
Definition: kexthighscore_gui.cpp:84
QTabWidget
QTreeWidget
QTabWidget::currentIndex
currentIndex
KExtHighscore::ShowItem
Definition: kexthighscore_gui.h:45
KExtHighscore::AskNameDialog
Definition: kexthighscore_gui.h:184
KExtHighscore::ShowItem::ShowItem
ShowItem(QTreeWidget *, bool highlight)
Definition: kexthighscore_gui.cpp:54
KExtHighscore::LastMultipleScoresList::LastMultipleScoresList
LastMultipleScoresList(const QVector< Score > &, QWidget *parent)
Definition: kexthighscore_gui.cpp:307
KExtHighscore::ScoresList
Definition: kexthighscore_gui.h:54
QCheckBox
KExtHighscore::ConfigDialog::ConfigDialog
ConfigDialog(QWidget *parent)
Definition: kexthighscore_gui.cpp:404
KExtHighscore::HighscoresList::HighscoresList
HighscoresList(QWidget *parent)
Definition: kexthighscore_gui.cpp:117
KExtHighscore::HighscoresList
Definition: kexthighscore_gui.h:72
QString
QList< KPageWidgetItem * >
KExtHighscore::HighscoresWidget
Definition: kexthighscore_gui.h:84
KExtHighscore::HighscoresWidget::changeTab
void changeTab(int i)
Definition: kexthighscore_gui.cpp:200
KExtHighscore::AskNameDialog::dontAskAgain
bool dontAskAgain() const
Definition: kexthighscore_gui.h:191
KExtHighscore::HighscoresList::load
void load(const ItemArray &, int highlight)
Definition: kexthighscore_gui.cpp:129
QAbstractButton::isChecked
bool isChecked() const
KExtHighscore::LastMultipleScoresList
Definition: kexthighscore_gui.h:128
QVector
KExtHighscore::AdditionalTab
Definition: kexthighscore_tab.h:52
QTreeWidgetItem
KExtHighscore::HighscoresWidget::HighscoresWidget
HighscoresWidget(QWidget *parent)
Definition: kexthighscore_gui.cpp:142
KExtHighscore::ScoresList::ScoresList
ScoresList(QWidget *parent)
Definition: kexthighscore_gui.cpp:66
KExtHighscore::ItemContainer
Definition: kexthighscore_internal.h:89
KExtHighscore::TotalMultipleScoresList::TotalMultipleScoresList
TotalMultipleScoresList(const QVector< Score > &, QWidget *parent)
Definition: kexthighscore_gui.cpp:351
KExtHighscore::HighscoresDialog::HighscoresDialog
HighscoresDialog(int rank, QWidget *parent)
Definition: kexthighscore_gui.cpp:227
KExtHighscore::HighscoresWidget::load
void load(int rank)
Definition: kexthighscore_gui.cpp:213
KExtHighscore::HighscoresList::itemText
QString itemText(const ItemContainer &, uint row) const
Definition: kexthighscore_gui.cpp:123
QLineEdit
kexthighscore.h
QObject::parent
QObject * parent() const
KExtHighscore::ScoresList::itemText
virtual QString itemText(const ItemContainer &, uint row) const =0
KExtHighscore::ConfigDialog::hasBeenSaved
bool hasBeenSaved() const
Definition: kexthighscore_gui.h:163
KExtHighscore::ScoresList::addHeader
void addHeader(const ItemArray &)
Definition: kexthighscore_gui.cpp:78
KExtHighscore::ItemArray
Manage a bunch of Item which are saved under the same group in KHighscores config file...
Definition: kexthighscore_internal.h:132
KExtHighscore::AskNameDialog::AskNameDialog
AskNameDialog(QWidget *parent)
Definition: kexthighscore_gui.cpp:580
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:46 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/highscore

Skip menu "libkdegames/highscore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal