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

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgrselector.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2003 Marco Krüger <grisuji@gmx.de> *
3  * Copyright 2003 Ian Wadham <iandw.au@gmail.com> *
4  * Copyright 2009 Ian Wadham <iandw.au@gmail.com> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18  ****************************************************************************/
19 
20 #ifndef KGRSELECTOR_H
21 #define KGRSELECTOR_H
22 
23 #include <QTreeWidget>
24 #include <QTreeWidgetItem>
25 
26 #include <QList>
27 
28 #include <KLocale>
29 #include <KDialog>
30 #include <KMessageBox>
31 
36 class KGrGameData;
37 class KGrThumbNail;
38 class KGrGameListItem;
39 class KGrGameIO;
40 class KIntSpinBox;
41 class QScrollBar;
42 class QPushButton;
43 class QLabel;
44 class QTextEdit;
45 
46 /******************************************************************************/
47 /******************* DIALOG TO SELECT A GAME AND LEVEL *******************/
48 /******************************************************************************/
49 
50 class KGrSLDialog : public KDialog
51 {
52 Q_OBJECT
53 public:
54  KGrSLDialog (int action, int requestedLevel, int gameIndex,
55  QList<KGrGameData *> & gameList,
56  const QString & pSystemDir, const QString & pUserDir,
57  QWidget * parent = 0);
58  ~KGrSLDialog();
59 
60  bool selectLevel (int & selectedGame, int & selectedLevel);
61 
62 signals:
63  void editNameAndHint();
64 
65 private slots:
66  void slSetGames (int cIndex);
67  void slGame();
68  void slShowLevel (int i);
69  void slUpdate (const QString & text);
70  void slPaintLevel();
71  void slotHelp(); // Will replace KDE slotHelp().
72 
73 private:
74  void setupWidgets();
75 
76  int slAction;
77  QList<KGrGameData *> myGameList; // List of games.
78  int defaultGame;
79  int defaultLevel;
80  int slGameIndex;
81  QString systemDir;
82  QString userDir;
83  QWidget * slParent;
84 
85  QLabel * gameL;
86  QTreeWidget * games;
87  QLabel * gameN;
88  QLabel * gameD;
89  QTextEdit * gameAbout;
90 
91  QLabel * numberL;
92  KIntSpinBox * display;
93  QScrollBar * number;
94  QPushButton * levelNH;
95  QLabel * slName;
96  KGrThumbNail * thumbNail;
97 };
98 
99 /*******************************************************************************
100 ************************* ITEM FOR THE LIST OF GAMES *************************
101 *******************************************************************************/
102 
103 class KGrGameListItem : public QTreeWidgetItem
104 {
105 public:
106  explicit KGrGameListItem (const QStringList & data, const int internalId = -1);
107  int id() const;
108  void setId (const int internalId);
109 private:
110  int mInternalId;
111 };
112 
113 /******************************************************************************/
114 /********************** CLASS TO DISPLAY THUMBNAIL ***********************/
115 /******************************************************************************/
116 
117 class KGrThumbNail : public QFrame
118 {
119 public:
120  explicit KGrThumbNail (QWidget *parent = 0);
121  ~KGrThumbNail();
122 
123  void setLevelData (const QString& dir, const QString& prefix,
124  int level, QLabel * sln);
125 
126  static QColor backgroundColor;
127  static QColor brickColor;
128  static QColor ladderColor;
129  static QColor poleColor;
130 
131 protected:
132  void paintEvent (QPaintEvent * event); // Draw a preview of a level.
133 
134 private:
135  KGrGameIO * io;
136  QByteArray levelName;
137  QByteArray levelLayout;
138  QLabel * lName; // Place to write level-name.
139 };
140 
141 #endif
QWidget
KGrSLDialog::~KGrSLDialog
~KGrSLDialog()
Definition: kgrselector.cpp:68
KGrGameIO
The KGrGameIO class handles I/O for text-files containing KGoldrunner games and levels.
Definition: kgrgameio.h:58
KGrThumbNail::KGrThumbNail
KGrThumbNail(QWidget *parent=0)
Definition: kgrselector.cpp:620
KGrGameData
KGrGameData structure: contains attributes of a KGoldrunner game.
Definition: kgrglobals.h:88
QByteArray
KGrThumbNail::brickColor
static QColor brickColor
Definition: kgrselector.h:127
QScrollBar
KGrGameListItem::KGrGameListItem
KGrGameListItem(const QStringList &data, const int internalId=-1)
Definition: kgrselector.cpp:599
KDialog
KGrGameListItem::id
int id() const
Definition: kgrselector.cpp:606
QTreeWidgetItem::data
virtual QVariant data(int column, int role) const
QTreeWidget
KGrThumbNail::ladderColor
static QColor ladderColor
Definition: kgrselector.h:128
KGrSLDialog::KGrSLDialog
KGrSLDialog(int action, int requestedLevel, int gameIndex, QList< KGrGameData * > &gameList, const QString &pSystemDir, const QString &pUserDir, QWidget *parent=0)
Definition: kgrselector.cpp:51
KGrThumbNail::setLevelData
void setLevelData(const QString &dir, const QString &prefix, int level, QLabel *sln)
Definition: kgrselector.cpp:635
QString
QList< KGrGameData * >
QColor
QStringList
KGrThumbNail::paintEvent
void paintEvent(QPaintEvent *event)
Definition: kgrselector.cpp:654
QFrame
KGrThumbNail::~KGrThumbNail
~KGrThumbNail()
Definition: kgrselector.cpp:630
KGrThumbNail::backgroundColor
static QColor backgroundColor
Definition: kgrselector.h:126
KGrThumbNail
Definition: kgrselector.h:117
KGrSLDialog
Definition: kgrselector.h:50
QTreeWidgetItem
KGrGameListItem
Definition: kgrselector.h:103
KGrSLDialog::selectLevel
bool selectLevel(int &selectedGame, int &selectedLevel)
Definition: kgrselector.cpp:72
QPushButton
KGrSLDialog::editNameAndHint
void editNameAndHint()
QPaintEvent
KGrThumbNail::poleColor
static QColor poleColor
Definition: kgrselector.h:129
QLabel
QObject::parent
QObject * parent() const
QTextEdit
KGrGameListItem::setId
void setId(const int internalId)
Definition: kgrselector.cpp:611
QFrame::event
virtual bool event(QEvent *e)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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