| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef QUTEMETER_H |
| 24 |
#define QUTEMETER_H |
| 25 |
|
| 26 |
#include "qutewidget.h" |
| 27 |
#include "selectcolorbutton.h" |
| 28 |
|
| 29 |
|
| 30 |
|
| 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 |
|
| 43 |
virtual QString getWidgetLine(); |
| 44 |
virtual QString getWidgetXmlText(); |
| 45 |
virtual QString getWidgetType(); |
| 46 |
virtual QString getCabbageLine(); |
| 47 |
virtual QString getQml(); |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 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 |
|
| 68 |
SelectColorButton *colorButton; |
| 69 |
|
| 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 |
|
| 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 |
|
| 134 |
|
| 135 |
private: |
| 136 |
double m_value, m_value2; |
| 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 |
|
| 160 |
|
| 161 |
}; |
| 162 |
|
| 163 |
#endif |