QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qvshutter.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 
17 #ifndef QVSHUTTER_H
18 #define QVSHUTTER_H
19 
20 #include <QLabel>
21 #include <QHBoxLayout>
22 #include "../qvelement.h"
23 #include "../qvsvgwidget.h"
24 #include "../qvpopupframe.h"
25 #include "../qviconwidget.h"
26 
27 class QVShutter : public QVElement
28 {
29  Q_OBJECT
30 public:
31  explicit QVShutter(QDomElement xml_desc, QString container, QWidget *parent = 0);
32 
33 protected:
34  void resizeEvent(QResizeEvent * event);
35  void mousePressEvent(QMouseEvent *);
36 
37 signals:
38 
39 public slots:
40  void onValueChanged(QString,QString);
41 
42 private slots:
43  void onBtnLeft(double,double);
44  void onBtnRight(double,double);
45  void onShutterClicked();
46  void onPopupShutterClicked(double,double);
47  void onBladeClicked(double xrel, double yrel);
48  void onBladeDragged(double xrel, double yrel);
49  void onBladeReleased(double xrel, double yrel);
50 
51 
52 private:
53  QByteArray svg_icon;
54  QVIconWidget *w_icon;
55  QLabel *w_text;
56  QByteArray shutter_icon;
57  QVSvgWidget *w_shutter_icon;
58  QByteArray blade_icon;
59  QVSvgWidget *w_blade_icon;
60  QVSvgWidget *w_buttons_l, *w_buttons_r;
61  double position, position2;
62  double max_position1, max_position2;
63  double max_blade_position;
64 
65  bool has_blades;
66  bool two_halves;
67 
68  QVPopupFrame *popup_frame;
69  QLabel *popup_title;
70  QVSvgWidget *popup_shutter_icon;
71  QVSvgWidget *popup_blade_icon;
72 
73  double max_arrow_width() { return 0.3; }
74  double max_shutter_width() { return 0.5; }
75 
76  double drag_start;
77  double blade_value;
78  bool was_dragged;
79 
80  static const int padding = 5;
81 };
82 
83 #endif // QVSHUTTER_H
Definition: qvpopupframe.h:24
Definition: qviconwidget.h:26
Definition: qvelement.h:34
void resizeEvent(QResizeEvent *event)
Definition: qvshutter.cpp:169
Definition: qvshutter.h:27
Definition: qvsvgwidget.h:24
QString container
Definition: qvelement.h:73