• 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_tab.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2002 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_TAB_H
21 #define KEXTHIGHSCORE_TAB_H
22 
23 #include <QtCore/QVector>
24 #include <QtGui/QComboBox>
25 
26 class QLabel;
27 class QTreeWidget;
28 
29 
30 namespace KExtHighscore
31 {
32 
33 //-----------------------------------------------------------------------------
34 class PlayersCombo : public QComboBox
35 {
36  Q_OBJECT
37  public:
38  PlayersCombo(QWidget *parent = 0);
39 
40  void load();
41 
42  signals:
43  void playerSelected(uint i);
44  void allSelected();
45  void noneSelected();
46 
47  private slots:
48  void activatedSlot(int i);
49 };
50 
51 //-----------------------------------------------------------------------------
52 class AdditionalTab : public QWidget
53 {
54  Q_OBJECT
55  public:
56  AdditionalTab(QWidget *parent);
57 
58  virtual void load();
59 
60  private slots:
61  void playerSelected(uint i) { display(i) ; }
62  void allSelected();
63 
64  protected:
65  void init();
66  static QString percent(uint n, uint total, bool withBraces = false);
67  virtual void display(uint i) = 0;
68 
69  private:
70  PlayersCombo *_combo;
71 };
72 
73 //-----------------------------------------------------------------------------
74 class StatisticsTab : public AdditionalTab
75 {
76  Q_OBJECT
77  public:
78  explicit StatisticsTab(QWidget *parent);
79 
80  void load();
81 
82  private:
83  enum Count { Total = 0, Won, Lost, Draw, Nb_Counts };
84  static const char *COUNT_LABELS[Nb_Counts];
85  enum Trend { CurrentTrend = 0, WonTrend, LostTrend, Nb_Trends };
86  static const char *TREND_LABELS[Nb_Trends];
87  struct Data {
88  uint count[Nb_Counts];
89  double trend[Nb_Trends];
90  };
91  QVector<Data> _data;
92  QLabel *_nbs[Nb_Counts], *_percents[Nb_Counts], *_trends[Nb_Trends];
93 
94  QString percent(const Data &, Count) const;
95  void display(uint i);
96 };
97 
98 //-----------------------------------------------------------------------------
99 class HistogramTab : public AdditionalTab
100 {
101  Q_OBJECT
102  public:
103  HistogramTab(QWidget *parent);
104 
105  void load();
106 
107  private:
108  QVector<uint> _counts;
109  QVector<uint> _data;
110  QTreeWidget *_list;
111 
112  void display(uint i);
113 };
114 
115 } // namespace
116 
117 #endif
QWidget
KExtHighscore::HistogramTab
Definition: kexthighscore_tab.h:99
KExtHighscore::AdditionalTab::init
void init()
Definition: kexthighscore_tab.cpp:88
KExtHighscore::HistogramTab::HistogramTab
HistogramTab(QWidget *parent)
Definition: kexthighscore_tab.cpp:218
KExtHighscore::StatisticsTab::StatisticsTab
StatisticsTab(QWidget *parent)
Definition: kexthighscore_tab.cpp:122
KExtHighscore::PlayersCombo::PlayersCombo
PlayersCombo(QWidget *parent=0)
Definition: kexthighscore_tab.cpp:43
KExtHighscore::StatisticsTab
Definition: kexthighscore_tab.h:74
KExtHighscore::PlayersCombo::load
void load()
Definition: kexthighscore_tab.cpp:61
KExtHighscore::PlayersCombo
Definition: kexthighscore_tab.h:34
KExtHighscore::PlayersCombo::playerSelected
void playerSelected(uint i)
KExtHighscore::AdditionalTab::load
virtual void load()
Definition: kexthighscore_tab.cpp:107
KExtHighscore::AdditionalTab::percent
static QString percent(uint n, uint total, bool withBraces=false)
Definition: kexthighscore_tab.cpp:100
QTreeWidget
KExtHighscore::StatisticsTab::load
void load()
Definition: kexthighscore_tab.cpp:161
KExtHighscore::PlayersCombo::allSelected
void allSelected()
KExtHighscore::HistogramTab::load
void load()
Definition: kexthighscore_tab.cpp:255
QString
KExtHighscore::AdditionalTab::AdditionalTab
AdditionalTab(QWidget *parent)
Definition: kexthighscore_tab.cpp:69
QVector< Data >
KExtHighscore::AdditionalTab
Definition: kexthighscore_tab.h:52
KExtHighscore::AdditionalTab::display
virtual void display(uint i)=0
QLabel
QObject::parent
QObject * parent() const
KExtHighscore::PlayersCombo::noneSelected
void noneSelected()
QComboBox
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