~ubuntu-branches/debian/sid/chessx/sid

« back to all changes in this revision

Viewing changes to src/gui/qled.h

  • Committer: Package Import Robot
  • Author(s): Niklas Fiekas
  • Date: 2013-10-31 17:02:37 UTC
  • Revision ID: package-import@ubuntu.com-20131031170237-wghf5j9jlv28gmls
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2010 by P. Sereno                                       *
 
3
 *   http://www.sereno-online.com                                          *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU Lesser General Public License           *
 
7
 *   version 2.1 as published by the Free Software Foundation              *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU Lesser General Public License for more details.                   *
 
13
 *   http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.               *
 
14
 ***************************************************************************/
 
15
 
 
16
#ifndef QLED_H
 
17
#define QLED_H
 
18
 
 
19
#include <Qt>
 
20
#include <QWidget>
 
21
 
 
22
class QColor;
 
23
class QSvgRenderer;
 
24
 
 
25
class QLed : public QWidget
 
26
{
 
27
    Q_OBJECT
 
28
    Q_ENUMS(ledColor)
 
29
    Q_ENUMS(ledShape)
 
30
    Q_PROPERTY(bool value READ value WRITE setValue);
 
31
    Q_PROPERTY(ledColor onColor READ onColor WRITE setOnColor);
 
32
    Q_PROPERTY(ledColor offColor READ offColor WRITE setOffColor);
 
33
    Q_PROPERTY(ledShape shape READ shape WRITE setShape)
 
34
 
 
35
public:
 
36
    QLed(QWidget *parent = 0);
 
37
    virtual ~QLed();
 
38
    bool value() const
 
39
    {
 
40
        return m_value;
 
41
    }
 
42
    enum ledColor { Red = 0, Green, Yellow, Grey, Orange, Blue, Black };
 
43
    enum ledShape { Circle = 0};
 
44
    ledColor onColor() const
 
45
    {
 
46
        return m_onColor;
 
47
    }
 
48
    ledColor offColor() const
 
49
    {
 
50
        return m_offColor;
 
51
    }
 
52
    ledShape shape() const
 
53
    {
 
54
        return m_shape;
 
55
    }
 
56
 
 
57
public slots:
 
58
    void setValue(bool);
 
59
    void setOnColor(ledColor);
 
60
    void setOffColor(ledColor);
 
61
    void setShape(ledShape);
 
62
    void toggleValue();
 
63
 
 
64
protected:
 
65
    bool m_value;
 
66
    ledColor m_onColor, m_offColor;
 
67
    int id_Timer;
 
68
    ledShape m_shape;
 
69
    QStringList shapes;
 
70
    QStringList colors;
 
71
    void paintEvent(QPaintEvent *event);
 
72
    void resizeEvent(QResizeEvent*);
 
73
 
 
74
private:
 
75
    QSvgRenderer *renderer ;
 
76
};
 
77
 
 
78
#endif