forked from IldeMartAhu/LED
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled.h
57 lines (46 loc) · 1.08 KB
/
led.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef LED_H
#define LED_H
#include <QWidget>
#include <QTimer>
#include <QLabel>
namespace LED{
const quint8 GREEN = 0;
const quint8 RED = 1;
const quint8 ORANGE = 2;
const quint8 BLUE = 3;
}
class led : public QObject
{
Q_OBJECT
public:
explicit led(QObject *parent = nullptr);
~led();
bool state();
bool isBlinking();
int blinkingRate();
void setLabel(QLabel* LED);
public slots:
void setOn();
void setOff();
void toggleState();
void setBlinkingRate(int rate);
void startBlinking();
void stopBlinking();
void changeColor();
private:
void setState(bool state);
void setBlinking(bool blinking);
void stateUpdate();
void setColor(int color);
signals:
private:
bool initialState_;
bool state_;
int blinkingRate_;
bool blinking_;
QString OnStyle = "image: url(:/ICONS/LED_GREEN_FRAME_ON.png)";
QString OffStyle = "image: url(:/ICONS/LED_GREEN_FRAME_OFF.png)";
QTimer* timer_;
QLabel* LED;
};
#endif // LED_H