BPLightContraption
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
PUInterfaceGUI Class Reference

A GUI interface to a power unit. More...

#include <powerunit_gui.h>

Inheritance diagram for PUInterfaceGUI:
Inheritance graph
[legend]
Collaboration diagram for PUInterfaceGUI:
Collaboration graph
[legend]

Public Member Functions

 PUInterfaceGUI (quint8 id, const QString &desc, QSharedPointer< MCInterface > mc, QWidget *parent)
 Create an object with the given information. More...
 
 ~PUInterfaceGUI ()
 
void AttachToGui (QLabel *label, QPushButton *onbutton, QPushButton *offbutton, QSlider *levelslider)
 Attaches this PUInterfaceGUI object to the interface elements. More...
 
void SyncGUI (void)
 Synchronizes the GUI elements with the state of the underlying PUInterface object. More...
 
void Reset (void)
 Resets the state of the power unit. More...
 
void SyncState (char state, quint8 level)
 Changes the state and dimmer level to the passed values. More...
 
- Public Member Functions inherited from PUInterface
 PUInterface (char id, const QString &desc, QSharedPointer< MCInterface > mc)
 Constructor. More...
 
 ~PUInterface ()
 
quint8 GetLevel (void)
 Returns the current dimmer level. More...
 
QString GetDescription (void)
 Returns the description of the power unit. More...
 
char GetID (void)
 Returns the ID of the power unit. More...
 
quint8 GetState (void)
 Returns the state of the power unit (see commands.h) More...
 
void SyncState (char state, quint8 level)
 Syncs the state of the class with the given state and dimmer level. More...
 
bool Toggle (void)
 Toggles the power unit between on and off. More...
 
quint8 SetLevel (quint8 level)
 Dims the powerunit to the given level. More...
 
void TurnOff (void)
 Turns off the power unit. More...
 
void TurnOn (void)
 Turns on the power unit. More...
 
void Reset (void)
 Resets the power unit state. More...
 
bool MCIsOpen (void)
 Returns true if the microcontroller controlling this power unit is open. More...
 

Private Slots

void LevelSliderChange (int val)
 Called when the dimmer level slider is changed. More...
 
void TurnOn (void)
 Called when an event should turn the power unit on. More...
 
void TurnOff (void)
 Called when an event should turn the power unit on. More...
 

Private Member Functions

void ExceptionBox (const MCInterfaceException &e)
 Displays a message box with exception information. More...
 

Private Attributes

QLabel * _label
 A label for the power unit. More...
 
QSlider * _levelslider
 A slider for displaying and controlling the dimmer level. More...
 
QPushButton * _onbutton
 A button that will turn the power unit on. More...
 
QPushButton * _offbutton
 A button that will turn the power unit off. More...
 
QWidget * _parent
 A parent widget. More...
 

Detailed Description

A GUI interface to a power unit.

Definition at line 20 of file powerunit_gui.h.

Constructor & Destructor Documentation

PUInterfaceGUI::PUInterfaceGUI ( quint8  id,
const QString &  desc,
QSharedPointer< MCInterface mc,
QWidget *  parent 
)

Create an object with the given information.

Parameters
idThe numerical ID of the power unit (see commands.h)
descA text description of this unit
mcThe microcontroller controlling this unit
parentA parent widget

Definition at line 14 of file powerunit_gui.cpp.

PUInterfaceGUI::~PUInterfaceGUI ( )

Definition at line 23 of file powerunit_gui.cpp.

Member Function Documentation

void PUInterfaceGUI::AttachToGui ( QLabel *  label,
QPushButton *  onbutton,
QPushButton *  offbutton,
QSlider *  levelslider 
)

Attaches this PUInterfaceGUI object to the interface elements.

Definition at line 28 of file powerunit_gui.cpp.

Here is the call graph for this function:

void PUInterfaceGUI::ExceptionBox ( const MCInterfaceException e)
private

Displays a message box with exception information.

Definition at line 120 of file powerunit_gui.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PUInterfaceGUI::LevelSliderChange ( int  val)
privateslot

Called when the dimmer level slider is changed.

Parameters
[in]valThe new level
Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 70 of file powerunit_gui.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PUInterfaceGUI::Reset ( void  )

Resets the state of the power unit.

This does not send or receive any information from the microcontroller

Definition at line 103 of file powerunit_gui.cpp.

Here is the call graph for this function:

void PUInterfaceGUI::SyncGUI ( void  )

Synchronizes the GUI elements with the state of the underlying PUInterface object.

This does not obtain any information from the microcontroller

Definition at line 88 of file powerunit_gui.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PUInterfaceGUI::SyncState ( char  state,
quint8  level 
)

Changes the state and dimmer level to the passed values.

This does not send or receive any information from the microcontroller

Definition at line 114 of file powerunit_gui.cpp.

Here is the call graph for this function:

void PUInterfaceGUI::TurnOff ( void  )
privateslot

Called when an event should turn the power unit on.

Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 57 of file powerunit_gui.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PUInterfaceGUI::TurnOn ( void  )
privateslot

Called when an event should turn the power unit on.

Exceptions
MCInterfaceExceptionThere is a problem communicating this command to the microcontroller

Definition at line 44 of file powerunit_gui.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QLabel* PUInterfaceGUI::_label
private

A label for the power unit.

Definition at line 22 of file powerunit_gui.h.

QSlider* PUInterfaceGUI::_levelslider
private

A slider for displaying and controlling the dimmer level.

Definition at line 26 of file powerunit_gui.h.

QPushButton* PUInterfaceGUI::_offbutton
private

A button that will turn the power unit off.

Definition at line 28 of file powerunit_gui.h.

QPushButton* PUInterfaceGUI::_onbutton
private

A button that will turn the power unit on.

Definition at line 27 of file powerunit_gui.h.

QWidget* PUInterfaceGUI::_parent
private

A parent widget.

Definition at line 29 of file powerunit_gui.h.


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