Debian Codegraph @

src/qutemeter.h

raw symbols SCIP
1 /*
2 Copyright (C) 2008, 2009 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #ifndef QUTEMETER_H
24 #define QUTEMETER_H
25
26 #include "qutewidget.h"
27 #include "selectcolorbutton.h"
28
29 // This class is named "meter" internally, following MacCsound's name
30 // It is called "Controller" for the user of CsoundQt
31
32 class QuteMeter : public QuteWidget
33 {
34 Q_OBJECT
35 public:
36 QuteMeter(QWidget *parent);
37
38 ~QuteMeter();
39
40 virtual void setMidiValue(int value);
41 virtual bool acceptsMidi() {return true;}
42 // virtual void setMidiValue2(int value);
43 virtual QString getWidgetLine();
44 virtual QString getWidgetXmlText();
45 virtual QString getWidgetType();
46 virtual QString getCabbageLine();
47 virtual QString getQml();
48
49 // void setChannel2Name(QString name);
50 // void setColor(QColor color);
51 // void setType(QString type);
52 // void setPointSize(int size);
53 // void setFadeSpeed(int speed);
54 // void setBehavior(QString behavior);
55 virtual void setWidgetGeometry(int x,int y,int width,int height);
56
57 virtual void createPropertiesDialog();
58
59 virtual void refreshWidget();
60 virtual void applyProperties();
61 void applyInternalProperties();
62
63 protected:
64
65 private:
66 QLineEdit* name2LineEdit;
67 // QPushButton* colorButton;
68 SelectColorButton *colorButton;
69 // QPushButton* bgColorButton;
70 SelectColorButton *bgColorButton;
71 SelectColorButton *borderColorButton;
72
73 QComboBox* typeComboBox;
74 QSpinBox* pointSizeSpinBox;
75 QSpinBox* fadeSpeedSpinBox;
76 QComboBox* behaviorComboBox;
77 QDoubleSpinBox* m_xMinBox;
78 QDoubleSpinBox* m_xMaxBox;
79 QDoubleSpinBox* m_yMinBox;
80 QDoubleSpinBox* m_yMaxBox;
81 QCheckBox *flatCheckBox;
82 QCheckBox *borderCheckBox;
83 QCheckBox *bgColorCheckBox;
84
85 private slots:
86 void valueChanged(double value1);
87 void value2Changed(double value2);
88
89 void checkTypeComboBox();
90 // void setValuesFromWidget(double value1, double value2);
91 };
92
93 enum class MeterWidgetType { Fill, Llif, Line, Crosshair, Point };
94
95 class MeterWidget : public QGraphicsView
96 {
97 Q_OBJECT
98 public:
99 MeterWidget(QWidget *parent);
100 ~MeterWidget();
101
102 void setValue(double value);
103 void setValue2(double value2);
104 void setValues(double value1, double value2);
105 void setType(QString type);
106 void setRanges(double minx,double maxx,double miny,double maxy);
107 void setPointSize(int size);
108 void setColor(QColor color);
109 void setBgColor(QColor color);
110 void setBorderColor(QColor color);
111 void showBackground(bool show);
112 void showBorder(bool show) {
113 if(show)
114 m_border->show();
115 else
116 m_border->hide();
117 }
118
119 void setWidgetGeometry(int x,int y,int width,int height);
120
121 QColor getColor();
122 QColor getBgColor();
123 QColor getBorderColor();
124
125 QString getType() {return m_type;}
126 MeterWidgetType getMeterType() { return m_metertype; }
127 int getPointSize() {return m_pointSize;}
128 bool m_vertical;
129
130 protected:
131 virtual void mouseMoveEvent(QMouseEvent* event);
132 virtual void mousePressEvent(QMouseEvent* event);
133 // virtual void mouseReleaseEvent(QMouseEvent* event);
134
135 private:
136 double m_value, m_value2; // value1 is vertical, value2 is horizontal
137 double m_xmin, m_xmax, m_ymin, m_ymax;
138 MeterWidgetType m_metertype;
139 QString m_type;
140 int m_pointSize;
141 bool m_mouseDown;
142 bool m_showBackground;
143 QColor m_bgcolor;
144
145 QGraphicsScene* m_scene;
146
147 QGraphicsRectItem* m_block;
148 QGraphicsRectItem* m_border;
149
150 QGraphicsEllipseItem* m_point;
151 QGraphicsLineItem* m_vline;
152 QGraphicsLineItem* m_hline;
153
154 QMutex mutex;
155
156 signals:
157 void newValue1(double value1);
158 void newValue2(double value2);
159 // void valueChanged(double value);
160 // void value2Changed(double value);
161 };
162
163 #endif