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

kgoldrunner

Public Slots | Signals | Public Member Functions | List of all members
KGrEditor Class Reference

#include <kgreditor.h>

Inheritance diagram for KGrEditor:
Inheritance graph
[legend]

Public Slots

void editNameAndHint ()
 

Signals

void getMousePos (int &i, int &j)
 

Public Member Functions

 KGrEditor (KGrView *theView, const QString &theSystemDir, const QString &theUserDir, QList< KGrGameData * > &pGameList)
 
 ~KGrEditor ()
 
bool createLevel (int pGameIndex)
 
bool deleteLevelFile (int pGameIndex, int pLevel)
 
bool editGame (int pGameIndex)
 
void getGameAndLevel (int &game, int &lev)
 
bool moveLevelFile (int pGameIndex, int pLevel)
 
bool saveLevelFile ()
 
bool saveOK ()
 
void setEditObj (char newEditObj)
 
bool updateLevel (int pGameIndex, int pLevel)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

This class is the game-editor for KGoldrunner.

It loads KGrGameData and KGrLevelData objects from files, operates directly on the data in those objects and saves them back to files. In particular, the layout of a level is edited by selecting objects such as bricks, ladders, etc. from a toolbar and using mouse-clicks and drags to show where those objects are required. As this happens, the corresponding character-codes are stored directly in the QByteArray of layout-data and the corresponding visual objects (tiles) are displayed on the screen by the KGrScene and KGrView objects.

Game-editor class

Definition at line 42 of file kgreditor.h.

Constructor & Destructor Documentation

KGrEditor::KGrEditor ( KGrView *  theView,
const QString &  theSystemDir,
const QString &  theUserDir,
QList< KGrGameData * > &  pGameList 
)

The constructor of KGrEditor.

Parameters
theViewThe canvas on which the editor paints the layout. Also the object that owns the editor and will destroy it if the KGoldrunner application is terminated.
theSystemDirThe directory-path where the games and levels released with KGoldrunner are stored. This data is read-only, but can be copied, edited and saved in the user's area.
theUserDirThe directory-path where the user's composed or edited games and levels are stored.
pGameListThe current list of system and user game-data. The user can add a game to the list and add levels to that game or any other game in the user's area.

Definition at line 32 of file kgreditor.cpp.

KGrEditor::~KGrEditor ( )

Definition at line 63 of file kgreditor.cpp.

Member Function Documentation

bool KGrEditor::createLevel ( int  pGameIndex)

Set up a blank level-layout, ready for editing.

Parameters
pGameIndexThe list-index of the game which will contain the new level: assumed for now, but can change at save time.
Returns
If false, the action failed or was cancelled.

Definition at line 72 of file kgreditor.cpp.

bool KGrEditor::deleteLevelFile ( int  pGameIndex,
int  pLevel 
)

Delete a level from a game.

Parameters
pGameIndexThe list-index of the game that contains the level to be deleted: verified by a dialog and may change.
pLevelThe number of the level to be deleted: verified by a dialog and may change.
Returns
If false, the action failed or was cancelled.

Definition at line 425 of file kgreditor.cpp.

bool KGrEditor::editGame ( int  pGameIndex)

Create a new game (a collection point for levels) or load the details of an existing game, ready for editing.

Parameters
pGameIndexThe list-index of the game to be created or edited: 0 = create, >0 = edit (verified by a dialog and may change).
Returns
If false, the action failed or was cancelled.

Definition at line 496 of file kgreditor.cpp.

void KGrEditor::editNameAndHint ( )
slot

Run a dialog in which the name and hint of a level can be edited.

Definition at line 200 of file kgreditor.cpp.

void KGrEditor::getGameAndLevel ( int &  game,
int &  lev 
)
inline

Definition at line 166 of file kgreditor.h.

void KGrEditor::getMousePos ( int &  i,
int &  j 
)
signal

Get the next grid-position at which to paint an object in the layout.

Parameters
iThe row-number of the cell (return by reference).
jThe column-number of the cell (return by reference).
bool KGrEditor::moveLevelFile ( int  pGameIndex,
int  pLevel 
)

Move a level to another game or level number.

Can be used to arrange levels in order of difficulty within a game.

Parameters
pGameIndexThe list-index of the game that contains the level to be moved: a dialog selects the game to move to.
pLevelThe number of the level to be moved: a dialog selects the number to move to. Other numbers may be changed, to preserve the sequential numbering of levels.
Returns
If false, the action failed or was cancelled.

Definition at line 326 of file kgreditor.cpp.

bool KGrEditor::saveLevelFile ( )

Save an edited level in a text file (*.grl) in the user's area.

The required game and level number are obtained from a dialog. These are the same as the original game and level number by default, but can be altered so as to get a Save As effect. For example, a system level can be loaded and edited, then saved in one of the user's own games.

Returns
If true, the level was successfully saved. If false, the user cancelled the save or the file I/O failed.

Definition at line 214 of file kgreditor.cpp.

bool KGrEditor::saveOK ( )

Check if there are any unsaved edits and, if so, ask the user what to do.

It will call saveLevelFile() if the user wants to save.

Returns
If true, the level was successfully saved or there was nothing to save or the user decided not to save, so it is OK to do something new or close KGoldrunner. If false, the user decided to continue editing or the file I/O failed.

Definition at line 646 of file kgreditor.cpp.

void KGrEditor::setEditObj ( char  newEditObj)

Set the next object for the editor to paint, e.g.

brick, enemy, ladder.

Parameters
newEditObjA character-code for the type of object.

Definition at line 67 of file kgreditor.cpp.

bool KGrEditor::updateLevel ( int  pGameIndex,
int  pLevel 
)

Load and display an existing level, ready for editing.

This can be a released level, but the changes must be saved in the user's area.

Parameters
pGameIndexThe list-index of the game that contains the level to be edited: verified by a dialog and may change.
pLevelThe number of the level to be edited: verified by a dialog and may change.
Returns
If false, the action failed or was cancelled.

Definition at line 120 of file kgreditor.cpp.


The documentation for this class was generated from the following files:
  • kgreditor.h
  • kgreditor.cpp
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