Move the fader of the selected channel
Move the fader of the selected channel instead of the fader that has focus when the up/plus or down/minus keys are pressed. Doing so also feels more natural because users can already change the selected channel via the left and right keys and now they can immediately adjust the volume of the currently selected channel while doing so. Key events are now handled in `MixerView::keyPressEvent` instead of `Fader::keyPressEvent` and the latter is removed. `MixerChannelView` now has a method called `fader` which provides the associated fader. This is needed so that the event handler of `MixerView` can act upon the currently selected fader. ## Changes in Fader The `Fader` class provides two new public methods. The `adjust` method takes the modifier key(s) and the adjustment direction and then decides internally how the modifier keys are mapped to increment values. This is done to keep the mapping between modifier keys and increment values consistent across different clients, e.g. the key event of the `MixerView` and the wheel event of the `Fader` itself. The direction is provided by the client because the means to determine the direction can differ between clients and cases, e.g. a wheel event determines the direction differently than a key event does. The method `adjustByDecibelDelta` simply adjusts the fader by the given delta amount. It currently is not really used in a public way but it still makes sense to provide this functionality in case a parent class or client wants to manipulate the faders by its very own logic. Because the `Fader` class does not react itself to key press events anymore the call to `setFocusPolicy` is removed again.
This commit is contained in:
@@ -93,6 +93,15 @@ public:
|
||||
inline bool getRenderUnityLine() const { return m_renderUnityLine; }
|
||||
inline void setRenderUnityLine(bool value = true) { m_renderUnityLine = value; }
|
||||
|
||||
enum class AdjustmentDirection
|
||||
{
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
void adjust(const Qt::KeyboardModifiers & modifiers, AdjustmentDirection direction);
|
||||
void adjustByDecibelDelta(float value);
|
||||
|
||||
void setDisplayConversion(bool b)
|
||||
{
|
||||
m_conversionFactor = b ? 100.0 : 1.0;
|
||||
@@ -115,7 +124,6 @@ private:
|
||||
void mouseMoveEvent(QMouseEvent* ev) override;
|
||||
void mouseReleaseEvent(QMouseEvent* me) override;
|
||||
void wheelEvent(QWheelEvent* ev) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void paintEvent(QPaintEvent* ev) override;
|
||||
|
||||
void paintLevels(QPaintEvent* ev, QPainter& painter, bool linear = false);
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
QColor strokeInnerInactive() const { return m_strokeInnerInactive; }
|
||||
void setStrokeInnerInactive(const QColor& c) { m_strokeInnerInactive = c; }
|
||||
|
||||
Fader* fader() const { return m_fader; }
|
||||
|
||||
public slots:
|
||||
void renameChannel();
|
||||
void resetColor();
|
||||
|
||||
Reference in New Issue
Block a user