QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qvdimmer.h
1 /* QVisu (c) 2015 Maximilian Gauger mgauger@kalassi.de
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
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  * Alle Icons sind unter einer Creative Commons Lizenz vom Typ Namensnennung -
17  * Weitergabe unter gleichen Bedingungen 3.0 Deutschland zugänglich.
18  * Um eine Kopie dieser Lizenz einzusehen, konsultieren Sie
19  * http://creativecommons.org/licenses/by-sa/3.0/de/ oder wenden Sie
20  * sich brieflich an
21  * Creative Commons, Postfach 1866, Mountain View, California, 94042, USA.
22  */
23 
24 #ifndef QVDIMMER_H
25 #define QVDIMMER_H
26 
27 #include <QByteArray>
28 #include <QLabel>
29 #include <QGridLayout>
30 #include "../qvsvgwidget.h"
31 #include "../qvswitchicon.h"
32 #include "../qvelement.h"
33 
35 class QVDimmer : public QVElement {
36  Q_OBJECT
37 public:
38  explicit QVDimmer(QDomElement xml_desc, QString container, QWidget *parent = 0);
39 
40 protected:
41  void resizeEvent(QResizeEvent * event);
43  void mousePressEvent(QMouseEvent *);
44 
45 signals:
46 
47 public slots:
48  void onValueChanged(QString,QString);
49 
50 private slots:
52  void svgPressed();
54  void dimmerClicked(double xrel, double yrel);
56  void dimmerDragged(double xrel, double yrel);
57 
58 private:
59  void updateDimmerWidget(double value);
60 
61  QByteArray svg_icon;
62  QByteArray svg_dimmer;
63  QVIconWidget *w_icon;
64  QVSwitchIcon *w_sw_icon;
65  QVSvgWidget *w_dimmer;
66  QLabel *w_text;
67 
68  bool switch_value;
69  double dim_value;
70 
71  double display_ratio;
72  enum {
73  type_int,
74  type_float
75  } data_type;
76  double max_value;
77 
78  double max_dimmer_height() { return 0.3; }
79 };
80 
81 #endif // QVDIMMER_H
void mousePressEvent(QMouseEvent *)
Definition: qvdimmer.cpp:184
Definition: qvswitchicon.h:24
Definition: qviconwidget.h:26
void resizeEvent(QResizeEvent *event)
Definition: qvdimmer.cpp:101
Definition: qvdimmer.h:35
Definition: qvelement.h:34
Definition: qvsvgwidget.h:24
QString container
Definition: qvelement.h:73