Engine Class Reference

Engine widget based on QGroupBox. More...

#include <engine.h>

List of all members.

Public Slots

void stop ()
void restart ()
void askForDelete ()

Signals

void stateChanged ()
void clicked ()
 Emitted if the user right clicked on the engine.

Public Member Functions

 Engine (QString decoder="", int address=0, QString imagePath="", QString name="", QWidget *parent=0)
 ~Engine ()
QString name ()
void setName (QString name)
int address ()
void setAddress (int address)
QString imagePath ()
void setImage (QString path)
void setDecoder (QString decoder)
QString decoder ()
int speed ()
bool light ()
bool f2 ()
bool f3 ()
bool f4 ()
bool isReversed ()

Protected Member Functions

void mousePressEvent (QMouseEvent *event)
 Reimplemented form QObject for drag and drop.
void mouseMoveEvent (QMouseEvent *event)
 Reimplemented form QObject for drag and drop.

Private Slots

void setColor (int speed)

Private Attributes

int _address
 Engine address.
QString _decoder
 Engine decoder type.
QString _imagePath
 Path to the engine picture.
QLabel * _image
 Engine picture widget.
QPixmap * _picture
 Engine picture pixmap.
QPushButton * _btnLight
QPushButton * _btnReverse
QPushButton * _btnStop
QPushButton * _btnF2
QPushButton * _btnF3
QPushButton * _btnF4
 User input buttons.
QSlider * _speedSlider
 Slider to set the engine speed.
QProgressBar * _speedBar
 Speed status bar.
QPalette _palette
 Handle the speed status bar color.
QPoint _dragStartPosition
 Drag start position, for drag and drop.
int _oldSpeed
 Store the actual speed after stop.


Detailed Description

Engine widget based on QGroupBox.

Definition at line 33 of file engine.h.


Constructor & Destructor Documentation

Engine::Engine ( QString  decoder = "",
int  address = 0,
QString  imagePath = "",
QString  name = "",
QWidget *  parent = 0 
)

Create an engine widget for OrK

Parameters:
decoder Decoder name according to SRCP
address Engine address
imagePath Path to the engine picture
name The engine name

Definition at line 5 of file engine.cpp.

References _address, _btnF2, _btnF3, _btnF4, _btnLight, _btnReverse, _btnStop, _decoder, _image, _imagePath, _oldSpeed, _palette, _picture, _speedBar, _speedSlider, clicked(), setColor(), stateChanged(), and stop().

Engine::~Engine (  ) 

Destroy the engine after stopping it

See also:
stop()

Definition at line 87 of file engine.cpp.

References stop().


Member Function Documentation

QString Engine::name (  ) 

Returns:
The engine name
See also:
setName()

Definition at line 100 of file engine.cpp.

Referenced by EngineEditor::deleteEngine(), Win::save(), and EngineEditor::setEngine().

void Engine::setName ( QString  name  ) 

Set the engine name

Parameters:
name Engine name
See also:
name()

Definition at line 105 of file engine.cpp.

Referenced by EngineEditor::applyChanges().

int Engine::address (  ) 

Returns:
The engine address
See also:
setAddress()

Definition at line 111 of file engine.cpp.

References _address.

Referenced by Win::addEngine(), Win::removeEngine(), Win::save(), EngineEditor::setEngine(), and Srcp083Client::setNewEngineState().

void Engine::setAddress ( int  address  ) 

Set the engine address

Parameters:
address The engine address
See also:
address()

Definition at line 116 of file engine.cpp.

References _address.

Referenced by EngineEditor::applyChanges().

QString Engine::imagePath (  ) 

Returns:
The path to the engine picture
See also:
setImage()

Definition at line 121 of file engine.cpp.

References _imagePath.

Referenced by Win::save(), and EngineEditor::setEngine().

void Engine::setImage ( QString  path  ) 

Set the engine image

Parameters:
path The path to the engine picture
See also:
imagePath()

Definition at line 126 of file engine.cpp.

References _image, _imagePath, and _picture.

Referenced by EngineEditor::applyChanges().

void Engine::setDecoder ( QString  decoder  ) 

Set the engine decoder

Parameters:
decoder The engine decoder according to SRCP
See also:
decoder(), http://srcpd.sourceforge.net/srcp

Definition at line 136 of file engine.cpp.

References _decoder.

Referenced by EngineEditor::applyChanges().

QString Engine::decoder (  ) 

Returns:
The engine decoder according to SRCP
See also:
setDecoder(), http://srcpd.sourceforge.net/srcp

Definition at line 141 of file engine.cpp.

References _decoder.

Referenced by Win::save(), EngineEditor::setEngine(), and Srcp083Client::setNewEngineState().

int Engine::speed (  ) 

Returns:
The actual engine speed in percent

Definition at line 146 of file engine.cpp.

References _speedSlider.

Referenced by Srcp083Client::setNewEngineState().

bool Engine::light (  ) 

Returns:
True if the ligth is turned on

Definition at line 151 of file engine.cpp.

References _btnLight.

Referenced by Srcp083Client::setNewEngineState().

bool Engine::f2 (  ) 

Returns:
True if the second function is on

Definition at line 156 of file engine.cpp.

References _btnF2.

Referenced by Srcp083Client::setNewEngineState().

bool Engine::f3 (  ) 

Returns:
True if the third function is on

Definition at line 161 of file engine.cpp.

References _btnF3.

Referenced by Srcp083Client::setNewEngineState().

bool Engine::f4 (  ) 

Returns:
True if the fourth function is on

Definition at line 166 of file engine.cpp.

References _btnF4.

Referenced by Srcp083Client::setNewEngineState().

bool Engine::isReversed (  ) 

Returns:
True if the engine direction is reversed

Definition at line 171 of file engine.cpp.

References _btnReverse.

Referenced by Srcp083Client::setNewEngineState().

void Engine::stateChanged (  )  [signal]

stateChanged() is emitted if the user change a value on the engine widget

See also:
model.h

Referenced by Engine().

void Engine::clicked (  )  [signal]

Emitted if the user right clicked on the engine.

Referenced by Engine(), and mousePressEvent().

void Engine::stop (  )  [slot]

Set the speed to zero and store the actual speed

See also:
restart()

Definition at line 182 of file engine.cpp.

References _oldSpeed, and _speedSlider.

Referenced by Engine(), and ~Engine().

void Engine::restart (  )  [slot]

Reset the speed stored after stop was called

See also:
stop()

Definition at line 188 of file engine.cpp.

References _oldSpeed, and _speedSlider.

void Engine::askForDelete (  )  [slot]

Ask the user if he want really to delete engine.

Definition at line 176 of file engine.cpp.

void Engine::mousePressEvent ( QMouseEvent *  event  )  [protected]

Reimplemented form QObject for drag and drop.

Definition at line 194 of file engine.cpp.

References _dragStartPosition, and clicked().

void Engine::mouseMoveEvent ( QMouseEvent *  event  )  [protected]

Reimplemented form QObject for drag and drop.

Definition at line 203 of file engine.cpp.

References _dragStartPosition, and OrKEngine::MimeType.

void Engine::setColor ( int  speed  )  [private, slot]

Set the color of the speed status bar

Parameters:
speed Engine speed in percent

Definition at line 92 of file engine.cpp.

References _palette, and _speedBar.

Referenced by Engine().


Member Data Documentation

int Engine::_address [private]

Engine address.

Definition at line 146 of file engine.h.

Referenced by address(), Engine(), and setAddress().

QString Engine::_decoder [private]

Engine decoder type.

Definition at line 148 of file engine.h.

Referenced by decoder(), Engine(), and setDecoder().

QString Engine::_imagePath [private]

Path to the engine picture.

Definition at line 150 of file engine.h.

Referenced by Engine(), imagePath(), and setImage().

QLabel* Engine::_image [private]

Engine picture widget.

Definition at line 152 of file engine.h.

Referenced by Engine(), and setImage().

QPixmap* Engine::_picture [private]

Engine picture pixmap.

Definition at line 153 of file engine.h.

Referenced by Engine(), and setImage().

QPushButton* Engine::_btnLight [private]

Definition at line 155 of file engine.h.

Referenced by Engine(), and light().

QPushButton * Engine::_btnReverse [private]

Definition at line 155 of file engine.h.

Referenced by Engine(), and isReversed().

QPushButton * Engine::_btnStop [private]

Definition at line 155 of file engine.h.

Referenced by Engine().

QPushButton * Engine::_btnF2 [private]

Definition at line 155 of file engine.h.

Referenced by Engine(), and f2().

QPushButton * Engine::_btnF3 [private]

Definition at line 155 of file engine.h.

Referenced by Engine(), and f3().

QPushButton * Engine::_btnF4 [private]

User input buttons.

Definition at line 155 of file engine.h.

Referenced by Engine(), and f4().

QSlider* Engine::_speedSlider [private]

Slider to set the engine speed.

Definition at line 157 of file engine.h.

Referenced by Engine(), restart(), speed(), and stop().

QProgressBar* Engine::_speedBar [private]

Speed status bar.

Definition at line 158 of file engine.h.

Referenced by Engine(), and setColor().

QPalette Engine::_palette [private]

Handle the speed status bar color.

Definition at line 159 of file engine.h.

Referenced by Engine(), and setColor().

QPoint Engine::_dragStartPosition [private]

Drag start position, for drag and drop.

Definition at line 161 of file engine.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

int Engine::_oldSpeed [private]

Store the actual speed after stop.

Definition at line 163 of file engine.h.

Referenced by Engine(), restart(), and stop().


The documentation for this class was generated from the following files:

Generated on Sun Jun 22 23:46:29 2008 for OrK by  doxygen 1.5.6