#include <win.h>
Public Slots | |
void | setRailsFile (const QString &railsFile) |
void | addMap (Map *map) |
void | addMap () |
void | addRail (Rail *rail) |
void | addEnginesArea (EnginesArea *enginesArea) |
void | addEnginesArea () |
void | addEngine (Engine *engine) |
void | addEngine () |
void | addRule (QString trigger, int source, QString action, int target) |
Insert a rule. | |
void | removeMap (Map *map) |
void | removeRail (Rail *rail) |
void | removeEngine (Engine *engine) |
void | removeEnginesArea (EnginesArea *enginesArea) |
void | setRailState (int address, bool state, bool quiet=TRUE) |
void | setEngineState (int address, bool direction, int speed, bool light, bool f2, bool f3, bool f4) |
void | reportError (QString) |
Public Member Functions | |
Win (QSplashScreen *splash, QWidget *parent=0) | |
QString | railsFile () |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) |
Reimplemented to grab close event. | |
Private Slots | |
void | readSettings () |
void | writeSettings () |
void | clearModel () |
Close the current model and creates an empty model. | |
bool | save (QString fileName) |
bool | save () |
bool | saveAs () |
void | open () |
Show a file dialog and the open the .ork file. | |
void | open (QString fileName) |
bool | maybeSave () |
void | mapEdit () |
If necessary create the map editor wigdet, else show or hide the widget. | |
void | engineEdit () |
If necessary create the engine editor wigdet, else show or hide the widget. | |
void | editMode (bool edition) |
void | setDirty (bool dirty=TRUE) |
void | net (bool state) |
Handle new connection state, (de)activate the power action. | |
void | setPower (bool state) |
void | fullscreen () |
Go into fullscreen modus. | |
void | hideMenubar () |
Hide the menu bar. | |
void | zoomIn () |
Zoom in the current map. | |
void | zoomOut () |
Zoom oun the current map. | |
void | zoomBestFit () |
Fit the view to the size of the current map. | |
void | zoomOriginal () |
Reset the zoom to the original scale factor. | |
void | tileView () |
Tile the maps in the map area. This is only available in the docked window modus. | |
void | cascadeView () |
Cascade the maps in the map area. This is only available in the docked window modus. | |
void | config () |
Show the configuration dialog. | |
void | help () |
Show or open the help file. | |
void | bug () |
Go to the bug report web page. | |
void | translate () |
Go to the translation web page. | |
void | about () |
Show informations about OrK. | |
void | setMultiWinMode (bool multiWinFlag) |
void | setUserPath (QString userPath) |
Called from the config object to set the current preferred user path. | |
void | initClient (int protocol) |
void | showCloseMessage () |
Private Member Functions | |
void | mkActions () |
Create and connect all the actions for the buttons, toolsbars, and menus. | |
void | mkMenus () |
Create the memus. | |
void | mkToolBars () |
Create the toolbars. | |
void | mkStatusBar () |
Create the status bar. | |
Private Attributes | |
QList< Map * > * | _maps |
Provide a maps storage place. | |
QMultiHash< int, Rail * > * | _rails |
Provide a rails storage place. | |
QList< EnginesArea * > * | _enginesAreas |
Provide an engine areas storage place. | |
QMultiHash< int, Engine * > * | _engines |
Provide an engines storage place. | |
QSvgRenderer * | _mapRenderer |
Provide a storage for the rules with action = on. | |
QString | _railsFile |
VirtualClient * | _client |
Store the current network client. | |
MapEditor * | _mapEditor |
Store the lazy map editior widget. | |
EngineEditor * | _engineEditor |
Store the lazy engine editor widget. | |
Config * | _config |
Store the config object, which contains also a dialog. | |
QMdiArea * | _mapArea |
The area for the map windows, only for the single windows modus. | |
QString | _userPath |
Store the preferred user user path. | |
bool | _multiWinFlag |
OrK flags, true if the GUI is in multi-windows modus. | |
bool | _editModeFlag |
OrK flags, true if the GUI is in edition modus. | |
QErrorMessage * | _closeMessageDialog |
QMenu * | _removeMenu |
QMenu * | _mapsMenu |
QMenu * | _enginesAreaMenu |
QAction * | newAct |
QAction * | openAct |
QAction * | saveAct |
QAction * | saveAsAct |
QAction * | quitAct |
QAction * | addLocAct |
QAction * | addLocAreaAct |
QAction * | addMapAct |
QAction * | mapEditorAct |
QAction * | engineEditorAct |
QAction * | editModeAct |
QAction * | connectAct |
QAction * | powerAct |
QAction * | fullscreenAct |
QAction * | hideMenubarAct |
QAction * | zoomInAct |
QAction * | zoomOutAct |
QAction * | zoomBestFitAct |
QAction * | zoomOriginAct |
QAction * | cascadeViewAct |
QAction * | tileViewAct |
QAction * | configAct |
QAction * | helpAct |
QAction * | bugAct |
QAction * | translateAct |
QAction * | aboutAct |
QAction * | aboutQtAct |
This class is the core class of the OrK client. The Win class creates the OrK GUI, and provide storage for representing a railroad model. It creates a network client (as a VirtualClient).
Definition at line 42 of file win.h.
Win::Win | ( | QSplashScreen * | splash, | |
QWidget * | parent = 0 | |||
) |
Create all the OrK GUI and report the current state of initalization on the splash screen.
Definition at line 4 of file win.cpp.
References _client, _closeMessageDialog, _config, _editModeFlag, _engineEditor, _engines, _enginesAreas, _mapArea, _mapEditor, _maps, _multiWinFlag, _rails, _userPath, initClient(), mkActions(), mkMenus(), mkStatusBar(), mkToolBars(), open(), readSettings(), setEngineState(), setMultiWinMode(), setPower(), setRailsFile(), setRailState(), and setUserPath().
QString Win::railsFile | ( | ) |
Definition at line 183 of file win.cpp.
References _railsFile.
void Win::setRailsFile | ( | const QString & | railsFile | ) | [slot] |
railsFile | Set the path to the SVG file containing the rail items which will be shown on a Map |
Definition at line 177 of file win.cpp.
References _mapRenderer, and _railsFile.
Referenced by Win().
void Win::addMap | ( | Map * | map | ) | [slot] |
Add a new map to the GUI, and connects the necessary stuff.
map | The map object to insert |
Definition at line 243 of file win.cpp.
References _mapArea, _maps, _mapsMenu, _multiWinFlag, Map::name(), and showCloseMessage().
Win::addMap | ( | ) | [slot] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Create a new map on the GUI and insert it into the model
Definition at line 443 of file win.cpp.
References setDirty(), and Map::setName().
Referenced by mkActions(), open(), and setMultiWinMode().
void Win::addRail | ( | Rail * | rail | ) | [slot] |
void Win::addEnginesArea | ( | EnginesArea * | enginesArea | ) | [slot] |
Add a new engines area to the GUI, and connects the necessary stuff.
enginesArea | The engines area to insert |
Definition at line 305 of file win.cpp.
References _enginesAreaMenu, _enginesAreas, _multiWinFlag, EnginesArea::name(), setDirty(), and showCloseMessage().
Win::addEnginesArea | ( | ) | [slot] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Create a new engines area on the GUI and insert it into the model
Definition at line 428 of file win.cpp.
References setDirty(), and EnginesArea::setName().
Referenced by mkActions(), open(), and setMultiWinMode().
void Win::addEngine | ( | Engine * | engine | ) | [slot] |
Win::addEngine | ( | ) | [slot] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Create a new engine on the GUI and insert it into the model
Definition at line 368 of file win.cpp.
References _engineEditor, engineEdit(), engineEditorAct, and EngineEditor::setEngine().
Referenced by mkActions(), and open().
void Win::addRule | ( | QString | trigger, | |
int | source, | |||
QString | action, | |||
int | target | |||
) | [slot] |
void Win::removeMap | ( | Map * | map | ) | [slot] |
void Win::removeRail | ( | Rail * | rail | ) | [slot] |
Remove a rail from the model
item | Rail to remove |
Definition at line 467 of file win.cpp.
References _rails, and Rail::address().
void Win::removeEngine | ( | Engine * | engine | ) | [slot] |
Remove an engine from the model
engine | The engine to remove |
Definition at line 422 of file win.cpp.
References _engines, and Engine::address().
void Win::removeEnginesArea | ( | EnginesArea * | enginesArea | ) | [slot] |
Remove an enginesArea form the model
enginesArea | The enginesArea to remove |
Definition at line 355 of file win.cpp.
References _enginesAreas.
void Win::setRailState | ( | int | address, | |
bool | state, | |||
bool | quiet = TRUE | |||
) | [slot] |
Change the state of all rails with the given address on all available maps in the model. It is normally called according to informations received from the server.
address | The address of the rails | |
state | State (true = open) of the item |
Definition at line 111 of file win.cpp.
References _rails.
Referenced by Win().
void Win::setEngineState | ( | int | address, | |
bool | direction, | |||
int | speed, | |||
bool | light, | |||
bool | f2, | |||
bool | f3, | |||
bool | f4 | |||
) | [slot] |
Change the state of an engine. It is normally called from an info client.
address | The engine address | |
direction | Direction of the engine ( true = reversed ) | |
speed | Engine speed in percent | |
light | True if the lights are on | |
f2 | True if the second function is on | |
f3 | True if the third function is on | |
f4 | True if the fourth function is on |
Definition at line 139 of file win.cpp.
Referenced by Win().
void Win::reportError | ( | QString | error | ) | [slot] |
void Win::readSettings | ( | ) | [private, slot] |
Read the Qt settings file to restore the window(s) and toolsbars geometry
Definition at line 156 of file win.cpp.
References _config, and Config::readConfig().
Referenced by Win().
void Win::writeSettings | ( | ) | [private, slot] |
Store the window(s) and toolsbars geometry
Definition at line 165 of file win.cpp.
References _config, and Config::writeConfig().
Referenced by closeEvent().
void Win::clearModel | ( | ) | [private, slot] |
Close the current model and creates an empty model.
Definition at line 193 of file win.cpp.
References _engines, _enginesAreaMenu, _enginesAreas, _mapArea, _maps, _mapsMenu, _multiWinFlag, _rails, maybeSave(), and setDirty().
Referenced by mkActions(), and open().
bool Win::save | ( | QString | fileName | ) | [private, slot] |
Save the current model to an OrK XML file
fileName | Where we want to save the model |
Definition at line 1439 of file win.cpp.
References _enginesAreas, _maps, Engine::address(), Rail::address(), EnginesArea::count(), Engine::decoder(), Rail::decoder(), Rail::delay(), Engine::imagePath(), EnginesArea::itemAt(), OrKMap::ItemXSize, OrKMap::ItemYSize, Engine::name(), EnginesArea::name(), Map::name(), Rail::type(), OrKEngine::Version, OrKMap::Version, and OrK::Version.
Win::save | ( | ) | [private, slot] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Save the current model to an OrK XML file
Definition at line 1133 of file win.cpp.
References saveAs(), and setDirty().
Referenced by maybeSave(), mkActions(), and saveAs().
bool Win::saveAs | ( | ) | [private, slot] |
void Win::open | ( | ) | [private, slot] |
Show a file dialog and the open the .ork file.
Definition at line 1157 of file win.cpp.
References _userPath.
Referenced by mkActions(), and Win().
void Win::open | ( | QString | fileName | ) | [private, slot] |
Open and parse an OrK XML file
fileName | The OrK XML save file to open. |
Definition at line 1192 of file win.cpp.
References _mapRenderer, addEngine(), addEnginesArea(), Map::addItem(), addMap(), addRail(), addRule(), clearModel(), EnginesArea::insertWidget(), OrKMap::ItemXSize, OrKMap::ItemYSize, maybeSave(), setDirty(), EnginesArea::setName(), Map::setName(), OrKRule::Version, OrKEngine::Version, and OrKMap::Version.
bool Win::maybeSave | ( | ) | [private, slot] |
If necessary, it will ask the user if he want to save the changes in the .ork file.
Definition at line 1165 of file win.cpp.
References save().
Referenced by clearModel(), closeEvent(), and open().
void Win::mapEdit | ( | ) | [private, slot] |
If necessary create the map editor wigdet, else show or hide the widget.
Definition at line 493 of file win.cpp.
References _mapEditor, _multiWinFlag, and mapEditorAct.
Referenced by mkActions(), and setMultiWinMode().
void Win::engineEdit | ( | ) | [private, slot] |
If necessary create the engine editor wigdet, else show or hide the widget.
Definition at line 529 of file win.cpp.
References _engineEditor, _multiWinFlag, engineEditorAct, and setDirty().
Referenced by addEngine(), mkActions(), and setMultiWinMode().
void Win::editMode | ( | bool | edition | ) | [private, slot] |
Switch the edition modus
edition | The edition state |
Definition at line 573 of file win.cpp.
References _editModeFlag, _engineEditor, _mapEditor, _removeMenu, addLocAct, addLocAreaAct, addMapAct, engineEditorAct, and mapEditorAct.
Referenced by closeEvent(), and mkActions().
void Win::setDirty | ( | bool | dirty = TRUE |
) | [private, slot] |
Set the dirty flag to dirty
dirty | True if the model was modified and not saved |
Definition at line 1127 of file win.cpp.
References saveAct.
Referenced by addEnginesArea(), addMap(), clearModel(), engineEdit(), open(), and save().
void Win::net | ( | bool | state | ) | [private, slot] |
Handle new connection state, (de)activate the power action.
Definition at line 636 of file win.cpp.
References powerAct.
Referenced by mkActions().
void Win::setPower | ( | bool | state | ) | [private, slot] |
Set the power action in the state reported by the info client
Definition at line 641 of file win.cpp.
References powerAct.
Referenced by mkActions(), and Win().
void Win::fullscreen | ( | ) | [private, slot] |
void Win::hideMenubar | ( | ) | [private, slot] |
void Win::zoomIn | ( | ) | [private, slot] |
Zoom in the current map.
Definition at line 660 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::zoomOut | ( | ) | [private, slot] |
Zoom oun the current map.
Definition at line 673 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::zoomBestFit | ( | ) | [private, slot] |
Fit the view to the size of the current map.
Definition at line 687 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::zoomOriginal | ( | ) | [private, slot] |
Reset the zoom to the original scale factor.
Definition at line 701 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::tileView | ( | ) | [private, slot] |
Tile the maps in the map area. This is only available in the docked window modus.
Definition at line 715 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::cascadeView | ( | ) | [private, slot] |
Cascade the maps in the map area. This is only available in the docked window modus.
Definition at line 730 of file win.cpp.
References _mapArea, and _multiWinFlag.
Referenced by mkActions().
void Win::config | ( | ) | [private, slot] |
Show the configuration dialog.
Definition at line 744 of file win.cpp.
References _config.
Referenced by mkActions().
void Win::help | ( | ) | [private, slot] |
void Win::bug | ( | ) | [private, slot] |
void Win::translate | ( | ) | [private, slot] |
void Win::about | ( | ) | [private, slot] |
Show informations about OrK.
Definition at line 764 of file win.cpp.
References OrK::Version.
Referenced by mkActions().
void Win::setMultiWinMode | ( | bool | multiWinFlag | ) | [private, slot] |
Set the GUI to bo either in a docked modus (single window) or in a multi-windows modus (one window for each map, and engines area)
Definition at line 1049 of file win.cpp.
References _editModeFlag, _engineEditor, _mapArea, _mapEditor, _multiWinFlag, addEnginesArea(), addMap(), engineEdit(), and mapEdit().
Referenced by Win().
void Win::setUserPath | ( | QString | userPath | ) | [private, slot] |
void Win::initClient | ( | int | protocol | ) | [private, slot] |
Load the requested network client with a specific protocol
Definition at line 99 of file win.cpp.
References _client.
Referenced by Win().
void Win::showCloseMessage | ( | ) | [private, slot] |
Show an information when the user close the maps windows. The windows are not deleted, but only stored in the corresponding menu.
Definition at line 1117 of file win.cpp.
References _closeMessageDialog.
Referenced by addEnginesArea(), and addMap().
void Win::closeEvent | ( | QCloseEvent * | event | ) | [protected] |
Reimplemented to grab close event.
Definition at line 473 of file win.cpp.
References _editModeFlag, editMode(), maybeSave(), and writeSettings().
void Win::mkActions | ( | ) | [private] |
Create and connect all the actions for the buttons, toolsbars, and menus.
Definition at line 772 of file win.cpp.
References _client, about(), aboutAct, aboutQtAct, addEngine(), addEnginesArea(), addLocAct, addLocAreaAct, addMap(), addMapAct, bug(), bugAct, cascadeView(), cascadeViewAct, clearModel(), config(), configAct, connectAct, editMode(), editModeAct, engineEdit(), engineEditorAct, fullscreen(), fullscreenAct, help(), helpAct, hideMenubar(), hideMenubarAct, mapEdit(), mapEditorAct, net(), newAct, open(), openAct, powerAct, quitAct, save(), saveAct, saveAs(), saveAsAct, setPower(), tileView(), tileViewAct, translate(), translateAct, zoomBestFit(), zoomBestFitAct, zoomIn(), zoomInAct, zoomOriginAct, zoomOriginal(), zoomOut(), and zoomOutAct.
Referenced by Win().
void Win::mkMenus | ( | ) | [private] |
Create the memus.
Definition at line 928 of file win.cpp.
References _enginesAreaMenu, _mapsMenu, _removeMenu, aboutAct, aboutQtAct, addLocAct, addLocAreaAct, addMapAct, bugAct, cascadeViewAct, configAct, connectAct, editModeAct, engineEditorAct, fullscreenAct, helpAct, hideMenubarAct, mapEditorAct, newAct, openAct, powerAct, quitAct, saveAct, saveAsAct, tileViewAct, translateAct, zoomBestFitAct, zoomInAct, zoomOriginAct, and zoomOutAct.
Referenced by Win().
void Win::mkToolBars | ( | ) | [private] |
Create the toolbars.
Definition at line 988 of file win.cpp.
References addLocAct, addLocAreaAct, addMapAct, cascadeViewAct, connectAct, editModeAct, engineEditorAct, fullscreenAct, hideMenubarAct, mapEditorAct, newAct, openAct, powerAct, saveAct, saveAsAct, tileViewAct, zoomBestFitAct, zoomInAct, zoomOriginAct, and zoomOutAct.
Referenced by Win().
void Win::mkStatusBar | ( | ) | [private] |
QList<Map*>* Win::_maps [private] |
Provide a maps storage place.
Definition at line 272 of file win.h.
Referenced by addMap(), clearModel(), removeMap(), save(), and Win().
QMultiHash<int, Rail*>* Win::_rails [private] |
Provide a rails storage place.
Definition at line 275 of file win.h.
Referenced by addRail(), clearModel(), removeRail(), setRailState(), and Win().
QList<EnginesArea*>* Win::_enginesAreas [private] |
Provide an engine areas storage place.
Definition at line 278 of file win.h.
Referenced by addEnginesArea(), clearModel(), removeEnginesArea(), save(), and Win().
QMultiHash<int, Engine*>* Win::_engines [private] |
Provide an engines storage place.
Definition at line 281 of file win.h.
Referenced by addEngine(), clearModel(), removeEngine(), and Win().
QSvgRenderer* Win::_mapRenderer [private] |
Provide a storage for the rules with action = on.
Store the QSvgRenderer for all the rail
Definition at line 287 of file win.h.
Referenced by open(), and setRailsFile().
QString Win::_railsFile [private] |
Path to the SVG file containing the rail item which will be shown on a Map
Definition at line 291 of file win.h.
Referenced by railsFile(), and setRailsFile().
VirtualClient* Win::_client [private] |
Store the current network client.
Definition at line 296 of file win.h.
Referenced by addEngine(), addRail(), initClient(), mkActions(), and Win().
MapEditor* Win::_mapEditor [private] |
Store the lazy map editior widget.
Definition at line 299 of file win.h.
Referenced by editMode(), mapEdit(), setMultiWinMode(), and Win().
EngineEditor* Win::_engineEditor [private] |
Store the lazy engine editor widget.
Definition at line 302 of file win.h.
Referenced by addEngine(), editMode(), engineEdit(), setMultiWinMode(), and Win().
Config* Win::_config [private] |
Store the config object, which contains also a dialog.
Definition at line 305 of file win.h.
Referenced by config(), readSettings(), Win(), and writeSettings().
QMdiArea* Win::_mapArea [private] |
The area for the map windows, only for the single windows modus.
Definition at line 308 of file win.h.
Referenced by addMap(), cascadeView(), clearModel(), setMultiWinMode(), tileView(), Win(), zoomBestFit(), zoomIn(), zoomOriginal(), and zoomOut().
QString Win::_userPath [private] |
bool Win::_multiWinFlag [private] |
OrK flags, true if the GUI is in multi-windows modus.
Definition at line 314 of file win.h.
Referenced by addEnginesArea(), addMap(), cascadeView(), clearModel(), engineEdit(), mapEdit(), setMultiWinMode(), tileView(), Win(), zoomBestFit(), zoomIn(), zoomOriginal(), and zoomOut().
bool Win::_editModeFlag [private] |
OrK flags, true if the GUI is in edition modus.
Definition at line 317 of file win.h.
Referenced by closeEvent(), editMode(), setMultiWinMode(), and Win().
QErrorMessage* Win::_closeMessageDialog [private] |
Store the information shown by showCloseMessage()
Definition at line 321 of file win.h.
Referenced by showCloseMessage(), and Win().
QMenu* Win::_removeMenu [private] |
QMenu * Win::_mapsMenu [private] |
QMenu * Win::_enginesAreaMenu [private] |
QAction* Win::newAct [private] |
QAction * Win::openAct [private] |
QAction * Win::saveAct [private] |
Definition at line 327 of file win.h.
Referenced by mkActions(), mkMenus(), mkToolBars(), and setDirty().
QAction * Win::saveAsAct [private] |
QAction * Win::quitAct [private] |
QAction* Win::addLocAct [private] |
Definition at line 328 of file win.h.
Referenced by editMode(), mkActions(), mkMenus(), and mkToolBars().
QAction * Win::addLocAreaAct [private] |
Definition at line 328 of file win.h.
Referenced by editMode(), mkActions(), mkMenus(), and mkToolBars().
QAction * Win::addMapAct [private] |
Definition at line 328 of file win.h.
Referenced by editMode(), mkActions(), mkMenus(), and mkToolBars().
QAction * Win::mapEditorAct [private] |
Definition at line 328 of file win.h.
Referenced by editMode(), mapEdit(), mkActions(), mkMenus(), and mkToolBars().
QAction * Win::engineEditorAct [private] |
Definition at line 328 of file win.h.
Referenced by addEngine(), editMode(), engineEdit(), mkActions(), mkMenus(), and mkToolBars().
QAction * Win::editModeAct [private] |
QAction* Win::connectAct [private] |
QAction * Win::powerAct [private] |
Definition at line 329 of file win.h.
Referenced by mkActions(), mkMenus(), mkToolBars(), net(), and setPower().
QAction* Win::fullscreenAct [private] |
QAction * Win::hideMenubarAct [private] |
QAction * Win::zoomInAct [private] |
QAction * Win::zoomOutAct [private] |
QAction * Win::zoomBestFitAct [private] |
QAction * Win::zoomOriginAct [private] |
QAction* Win::cascadeViewAct [private] |
QAction * Win::tileViewAct [private] |
QAction* Win::configAct [private] |
QAction* Win::helpAct [private] |
QAction * Win::bugAct [private] |
QAction * Win::translateAct [private] |
QAction * Win::aboutAct [private] |
QAction * Win::aboutQtAct [private] |