Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

LevelEditor Class Reference

Lets the user edit a level. More...

#include <level_editor.h>

Inheritance diagram for LevelEditor::

List of all members.

Public Slots

void saveAndExit ()
bool save ()
void exitWithoutSave ()
void undo ()
void redo ()
void fieldClicked (QPoint position)
void gemMoved (QPoint from, QPoint to)
void keeperMoved (QPoint from, QPoint to)
void rotateLeft ()
void rotateRight ()
void mirrorHorizontally ()
void mirrorVertically ()
void simplify ()
void fillEdges ()
void fillOutside ()
void changeProperties ()
void changeSize ()
void adjustSize ()
void createEmptyMap ()
void createGoals ()
void createGems ()
void createSolvableMap ()
void checkValidity ()
void isSolvable ()
void activeElementChanged ()
void showKeyDialog ()
void showToolbarDialog ()
void updateToolbar ()

Signals

void saveLevel (LevelEditor *level_editor)
void exited (LevelEditor *level_editor)

Public Methods

 LevelEditor (Level const &level, int collection_nr, int level_nr, Theme *theme, QWidget *parent=0, const char *name=0)
virtual ~LevelEditor ()
void setOriginalLevel (Level const &level, int collection_nr, int level_nr)
Level const & level () const
Level const & originalLevel () const
int collectionNr () const
int levelNr () const

Private Types

enum  ActiveElement {
  EMPTY, WALL, GOAL, KEEPER,
  GEM
}

Private Methods

void saveUnsavedChanges (bool cancel_possible)
void createAccels ()
void createActions ()
void showValidityMessage (Map::MapValidity validity)
void updateUndoRedoState ()
void insertMap ()
void updateOutside ()

Private Attributes

Level m_level
Level m_original_level
int m_collection_nr
int m_level_nr
Map m_map
MapWidgetm_map_widget
Theme m_theme
ActiveElement m_active_element
int m_undo_pointer
std::vector< CompressedMapm_maps
KAction * m_undo_action
KAction * m_redo_action
KRadioAction * m_empty_field_action
KRadioAction * m_wall_field_action
KRadioAction * m_keeper_field_action
KRadioAction * m_goal_field_action
KRadioAction * m_gem_field_action
bool m_was_saved
bool m_exited_signaled

Static Private Attributes

int s_pieces [65]

Detailed Description

Lets the user edit a level.

Author:
Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
Version:
0.1


Member Enumeration Documentation

enum LevelEditor::ActiveElement [private]
 

Defines the active elements.

Enumeration values:
EMPTY   An empty field.
WALL   A wall field.
GOAL   A goal field.
KEEPER   A keeper field.
GEM   A gem field.


Constructor & Destructor Documentation

LevelEditor::LevelEditor Level const & level,
int collection_nr,
int level_nr,
Theme * theme,
QWidget * parent = 0,
const char * name = 0
 

Creates the window.

Parameters:
level   The level to edit.
theme   The theme to use.
collection_nr   The original collection nr.
level_nr   The original level nr.
parent   The parent widget.
name   The internal name.

virtual LevelEditor::~LevelEditor [virtual]
 

Deletes the window an gives an opportunity to save a level if not already done.


Member Function Documentation

void LevelEditor::activeElementChanged [slot]
 

Called, whne the active element changed.

void LevelEditor::adjustSize [slot]
 

Adjusts the size of the map.

void LevelEditor::changeProperties [slot]
 

Called, when the user wants to change the level name, author, etc.

void LevelEditor::changeSize [slot]
 

Called when the user wants to change the size of the level.

void LevelEditor::checkValidity [slot]
 

Called when the user checks the validity of the map.

int LevelEditor::collectionNr const
 

Returns the collection nr.

void LevelEditor::createAccels [private]
 

Creates the accelerators.

void LevelEditor::createActions [private]
 

Creates the actions.

void LevelEditor::createEmptyMap [slot]
 

Creates a random empty map.

void LevelEditor::createGems [slot]
 

Creates random gems.

void LevelEditor::createGoals [slot]
 

Creates random goals.

void LevelEditor::createSolvableMap [slot]
 

Creates a solvable map (or at least tries so).

void LevelEditor::exitWithoutSave [slot]
 

Exits without save.

void LevelEditor::exited LevelEditor * level_editor [signal]
 

Called when the editor is exited.

Parameters:
level_editor   The level editor which has exited.

void LevelEditor::fieldClicked QPoint position [slot]
 

Called when the user has clicked a field.

Parameters:
position   The position the user has clicked.

void LevelEditor::fillEdges [slot]
 

Rounds the edges.

void LevelEditor::fillOutside [slot]
 

Fills all outside fields with walls.

void LevelEditor::gemMoved QPoint from,
QPoint to
[slot]
 

Called when the user has move a gem.

Parameters:
from   The start position of the gem.
end   The end position of the gem.

void LevelEditor::insertMap [private]
 

Inserts the new map in the map vector and updates the undo/redo stat.

void LevelEditor::isSolvable [slot]
 

Tries to solve the map.

void LevelEditor::keeperMoved QPoint from,
QPoint to
[slot]
 

Called when the user has move a keeper.

Parameters:
from   The start position of the keeper.
end   The end position of the keeper.

Level const& LevelEditor::level const
 

Returns the edited level.

int LevelEditor::levelNr const
 

Returns the level nr.

void LevelEditor::mirrorHorizontally [slot]
 

Called when the user mirrors the map horizontally.

void LevelEditor::mirrorVertically [slot]
 

Called when the user mirrors the map vertically.

Level const& LevelEditor::originalLevel const
 

Returns the original level.

void LevelEditor::redo [slot]
 

Redoes the last change.

void LevelEditor::rotateLeft [slot]
 

Called when the user rotates the map left.

void LevelEditor::rotateRight [slot]
 

Called when the user rotateLeft the map right.

bool LevelEditor::save [slot]
 

Saves the level.

Returns true, if the level was saved.

void LevelEditor::saveAndExit [slot]
 

Saves the level and exits.

void LevelEditor::saveLevel LevelEditor * level_editor [signal]
 

Called when the level of the editor should be saved.

Parameters:
level_editor   The level editor of the level which should be saved.

void LevelEditor::saveUnsavedChanges bool cancel_possible [private]
 

Ask the user to save a not saved level when exiting.

Parameters:
cancel_possible   If true, cancellation is possible.

void LevelEditor::setOriginalLevel Level const & level,
int collection_nr,
int level_nr
 

Sets a new original level and the collection and level number.

Parameters:
level   The new original level to edit.
collection_nr   The original collection nr.
level_nr   The original level nr.

void LevelEditor::showKeyDialog [slot]
 

Called when the keys should be configured.

void LevelEditor::showToolbarDialog [slot]
 

Called when the toolbar should be configured.

void LevelEditor::showValidityMessage Map::MapValidity validity [private]
 

Displays a message depending on the validity.

Parameters:
validity   The validity of the map.

void LevelEditor::simplify [slot]
 

Simpplifies the level.

void LevelEditor::undo [slot]
 

Undoes the last change.

void LevelEditor::updateOutside [private]
 

Updates the outside fields.

void LevelEditor::updateToolbar [slot]
 

Called when the toolbar should be updated.

void LevelEditor::updateUndoRedoState [private]
 

Updates the state of the undo and redo actions.


Member Data Documentation

ActiveElement LevelEditor::m_active_element [private]
 

The active element.

int LevelEditor::m_collection_nr [private]
 

The collection number.

KRadioAction* LevelEditor::m_empty_field_action [private]
 

The empty field element.

bool LevelEditor::m_exited_signaled [private]
 

If true, the exited signal was send.

KRadioAction* LevelEditor::m_gem_field_action [private]
 

The gem fields element.

KRadioAction* LevelEditor::m_goal_field_action [private]
 

The goal element.

KRadioAction* LevelEditor::m_keeper_field_action [private]
 

The keeper element.

Level LevelEditor::m_level [private]
 

The level.

int LevelEditor::m_level_nr [private]
 

The level number.

Map LevelEditor::m_map [private]
 

The map.

MapWidget* LevelEditor::m_map_widget [private]
 

The map widget.

std::vector<CompressedMap> LevelEditor::m_maps [private]
 

The maps vector.

Level LevelEditor::m_original_level [private]
 

The original level.

KAction* LevelEditor::m_redo_action [private]
 

The redo action.

Theme LevelEditor::m_theme [private]
 

The theme to use.

KAction* LevelEditor::m_undo_action [private]
 

The undo action.

int LevelEditor::m_undo_pointer [private]
 

The undo/redo pointer.

KRadioAction* LevelEditor::m_wall_field_action [private]
 

The wall element.

bool LevelEditor::m_was_saved [private]
 

If true, the actual map was saved.

int LevelEditor::s_pieces[65] [static, private]
 

The pieces of the map from which to create the images.


The documentation for this class was generated from the following file:
Generated at Sun Jan 6 18:49:11 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001