A GUI interface to a power unit. More...
#include <powerunit_gui.h>
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... | |
A GUI interface to a power unit.
Definition at line 20 of file powerunit_gui.h.
PUInterfaceGUI::PUInterfaceGUI | ( | quint8 | id, |
const QString & | desc, | ||
QSharedPointer< MCInterface > | mc, | ||
QWidget * | parent | ||
) |
Create an object with the given information.
id | The numerical ID of the power unit (see commands.h) |
desc | A text description of this unit |
mc | The microcontroller controlling this unit |
parent | A parent widget |
Definition at line 14 of file powerunit_gui.cpp.
PUInterfaceGUI::~PUInterfaceGUI | ( | ) |
Definition at line 23 of file powerunit_gui.cpp.
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.
|
private |
Displays a message box with exception information.
Definition at line 120 of file powerunit_gui.cpp.
|
privateslot |
Called when the dimmer level slider is changed.
[in] | val | The new level |
MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 70 of file powerunit_gui.cpp.
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.
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.
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.
|
privateslot |
Called when an event should turn the power unit on.
MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 57 of file powerunit_gui.cpp.
|
privateslot |
Called when an event should turn the power unit on.
MCInterfaceException | There is a problem communicating this command to the microcontroller |
Definition at line 44 of file powerunit_gui.cpp.
|
private |
A label for the power unit.
Definition at line 22 of file powerunit_gui.h.
|
private |
A slider for displaying and controlling the dimmer level.
Definition at line 26 of file powerunit_gui.h.
|
private |
A button that will turn the power unit off.
Definition at line 28 of file powerunit_gui.h.
|
private |
A button that will turn the power unit on.
Definition at line 27 of file powerunit_gui.h.
|
private |
A parent widget.
Definition at line 29 of file powerunit_gui.h.