BPLightContraption
 All Classes Namespaces Files Functions Variables Macros Pages
triaclight.h
Go to the documentation of this file.
1 /*! \file
2  * \brief Main Qt GUI class
3  * \author Benjamin Pritchard (ben@bennyp.org)
4  * \copyright 2013 Benjamin Pritchard. Released under the MIT License
5  */
6 
7 #ifndef TRIACLIGHT_H
8 #define TRIACLIGHT_H
9 
10 #include <QMainWindow>
11 #include <QVector>
12 #include <QLCDNumber>
13 #include <QTimer>
14 #include <QStandardItemModel>
15 
16 #include "microcont.h"
17 #include "microcontexception.h"
18 #include "powerunit_gui.h"
19 
20 namespace Ui {
21 class BPLightContraption;
22 }
23 
24 //! The main window of the BPLightContraption program
25 class BPLightContraption : public QMainWindow
26 {
27  Q_OBJECT
28 
29 public:
30  explicit BPLightContraption(QWidget *parent = 0);
32 
33  //! Displays a message box with exception information
34  void ExceptionBox(const MCInterfaceException & e);
35 
36 private slots:
37  //! Called when the button to open the port is clicked
38  void OpenPort(void);
39 
40  //! Called when the button to close the port is clicked
41  void ClosePort(void);
42 
43  //! Called when the button to reset the port is clicked
44  void ResetPort(void);
45 
46  //! Called when the button to force an update is pressed
47  void UpdateInfo(void);
48 
49 private:
50  Ui::BPLightContraption *ui;
51 
52  //! Used to refresh the information at certain intervals
53  QTimer * updatetimer;
54 
55  //! Microcontrollers used by this program
56  QSharedPointer<MCInterface> mc;
57 
58  //! Power units controlled by this program
59  QVector<QSharedPointer<PUInterfaceGUI> > pus;
60 
61  //! Information about all the dimmers
62  QStandardItemModel *dimmerData;
63 
64  //! Converts two separate bytes into a 16 bit value and displays it on a QLCDNumber
65  double Display16BitValue(QLCDNumber * display, quint8 low, quint8 high);
66 
67  //! Converts two separate bytes into a 16 bit value
68  double Convert16BitValue(quint8 low, quint8 high);
69 
70  //! Resets all the displays to zero
71  void ZeroDisplays(void);
72 };
73 
74 #endif // TRIACLIGHT_H
75