on bionic help sign in
75 lines 2.0 kB history raw
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17 */
19#ifndef UNITY_LIGHTS_H
20#define UNITY_LIGHTS_H
22#include <QtCore/QObject>
23#include <QtGui/QColor>
25struct light_device_t;
27class Lights: public QObject
29 Q_OBJECT
30 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
31 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
32 Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
33 Q_PROPERTY(int offMillisec READ offMillisec WRITE setOffMillisec NOTIFY offMillisecChanged)
35public:
36 enum State {
37 Off,
38 On,
39 };
40 Q_ENUM(State)
42 explicit Lights(QObject *parent = 0);
43 ~Lights();
45 void setState(State newState);
46 State state() const;
48 void setColor(const QColor &color);
49 QColor color() const;
51 int onMillisec() const;
52 void setOnMillisec(int onMs);
54 int offMillisec() const;
55 void setOffMillisec(int offMs);
57Q_SIGNALS:
58 void stateChanged(State newState);
59 void colorChanged(const QColor &color);
60 void onMillisecChanged(int onMs);
61 void offMillisecChanged(int offMs);
63private:
64 light_device_t* m_lightDevice;
65 QColor m_color;
66 State m_state;
67 int m_onMs;
68 int m_offMs;
70 bool init();
71 void turnOff();
72 void turnOn();
73};
75#endif