Mercurial > hg > svgui
comparison widgets/LevelPanWidget.h @ 1216:dc2af6616c83
Merge from branch 3.0-integration
author | Chris Cannam |
---|---|
date | Fri, 13 Jan 2017 10:29:50 +0000 |
parents | a68c25ba1153 |
children | 8ef67917c301 |
comparison
equal
deleted
inserted
replaced
1048:e8102ff5573b | 1216:dc2af6616c83 |
---|---|
27 | 27 |
28 public: | 28 public: |
29 LevelPanWidget(QWidget *parent = 0); | 29 LevelPanWidget(QWidget *parent = 0); |
30 ~LevelPanWidget(); | 30 ~LevelPanWidget(); |
31 | 31 |
32 /// Return level as a gain value in the range [0,1] | 32 /// Return level as a gain value. The basic level range is [0,1] but the |
33 /// gain scale may go up to 4.0 | |
33 float getLevel() const; | 34 float getLevel() const; |
34 | 35 |
35 /// Return pan as a value in the range [-1,1] | 36 /// Return pan as a value in the range [-1,1] |
36 float getPan() const; | 37 float getPan() const; |
37 | 38 |
45 void renderTo(QPaintDevice *, QRectF, bool asIfEditable) const; | 46 void renderTo(QPaintDevice *, QRectF, bool asIfEditable) const; |
46 | 47 |
47 QSize sizeHint() const; | 48 QSize sizeHint() const; |
48 | 49 |
49 public slots: | 50 public slots: |
50 /// Set level in the range [0,1] -- will be rounded | 51 /// Set level. The basic level range is [0,1] but the scale may go |
52 /// higher. The value will be rounded. | |
51 void setLevel(float); | 53 void setLevel(float); |
52 | 54 |
53 /// Set pan in the range [-1,1] -- will be rounded | 55 /// Set pan in the range [-1,1]. The value will be rounded |
54 void setPan(float); | 56 void setPan(float); |
55 | 57 |
58 /// Set left and right peak monitoring levels in the range [0,1] | |
59 void setMonitoringLevels(float, float); | |
60 | |
56 /// Specify whether the widget is editable or read-only (default editable) | 61 /// Specify whether the widget is editable or read-only (default editable) |
57 void setEditable(bool); | 62 void setEditable(bool); |
58 | 63 |
59 /// Specify whether the level range should include muting or not | 64 /// Specify whether the level range should include muting or not |
60 void setIncludeMute(bool); | 65 void setIncludeMute(bool); |
61 | 66 |
67 // public so it can be called from LevelPanToolButton (ew) | |
68 virtual void wheelEvent(QWheelEvent *ev); | |
69 | |
62 signals: | 70 signals: |
63 void levelChanged(float); | 71 void levelChanged(float); // range [0,1] |
64 void panChanged(float); | 72 void panChanged(float); // range [-1,1] |
65 | 73 |
74 void mouseEntered(); | |
75 void mouseLeft(); | |
76 | |
66 protected: | 77 protected: |
67 virtual void mousePressEvent(QMouseEvent *ev); | 78 virtual void mousePressEvent(QMouseEvent *ev); |
68 virtual void mouseMoveEvent(QMouseEvent *ev); | 79 virtual void mouseMoveEvent(QMouseEvent *ev); |
69 virtual void mouseReleaseEvent(QMouseEvent *ev); | 80 virtual void mouseReleaseEvent(QMouseEvent *ev); |
70 virtual void wheelEvent(QWheelEvent *ev); | |
71 virtual void paintEvent(QPaintEvent *ev); | 81 virtual void paintEvent(QPaintEvent *ev); |
82 virtual void enterEvent(QEvent *); | |
83 virtual void leaveEvent(QEvent *); | |
72 | 84 |
73 void emitLevelChanged(); | 85 void emitLevelChanged(); |
74 void emitPanChanged(); | 86 void emitPanChanged(); |
75 | 87 |
76 int m_level; | 88 int m_level; |
77 int m_pan; | 89 int m_pan; |
90 float m_monitorLeft; | |
91 float m_monitorRight; | |
78 bool m_editable; | 92 bool m_editable; |
79 bool m_includeMute; | 93 bool m_includeMute; |
80 | 94 |
95 static int audioLevelToLevel(float audioLevel, bool withMute); | |
96 static float levelToAudioLevel(int level, bool withMute); | |
97 | |
98 static int audioPanToPan(float audioPan); | |
99 static float panToAudioPan(int pan); | |
100 | |
81 QSizeF cellSize(QRectF) const; | 101 QSizeF cellSize(QRectF) const; |
82 QPointF cellCentre(QRectF, int level, int pan) const; | 102 QPointF cellCentre(QRectF, int level, int pan) const; |
83 QSizeF cellLightSize(QRectF) const; | 103 QSizeF cellLightSize(QRectF) const; |
84 QRectF cellLightRect(QRectF, int level, int pan) const; | 104 QRectF cellLightRect(QRectF, int level, int pan) const; |
85 double thinLineWidth(QRectF) const; | 105 double thinLineWidth(QRectF) const; |