A simple widget for coarse level and pan control. More...

#include <LevelPanWidget.h>

Inheritance diagram for LevelPanWidget:
Inheritance graph
Collaboration diagram for LevelPanWidget:
Collaboration graph

Public Slots

void setLevel (float)
 Set level. More...
 
void setPan (float)
 Set pan in the range [-1,1]. The value will be rounded. More...
 
void setMonitoringLevels (float, float)
 Set left and right peak monitoring levels in the range [0,1]. More...
 
void setEditable (bool)
 Specify whether the widget is editable or read-only (default editable) More...
 
void setIncludeMute (bool)
 Specify whether the level range should include muting or not. More...
 
void setToDefault ()
 Reset to default values. More...
 
void wheelEvent (QWheelEvent *ev) override
 

Signals

void levelChanged (float)
 
void panChanged (float)
 
void mouseEntered ()
 
void mouseLeft ()
 

Public Member Functions

 LevelPanWidget (QWidget *parent=0)
 
 ~LevelPanWidget ()
 
float getLevel () const
 Return level as a gain value. More...
 
float getPan () const
 Return pan as a value in the range [-1,1]. More...
 
bool isEditable () const
 Find out whether the widget is editable. More...
 
bool includesMute () const
 Discover whether the level range includes muting or not. More...
 
void renderTo (QPaintDevice *, QRectF, bool asIfEditable) const
 Draw a suitably sized copy of the widget's contents to the given device. More...
 
QSize sizeHint () const override
 

Protected Member Functions

void mousePressEvent (QMouseEvent *ev) override
 
void mouseMoveEvent (QMouseEvent *ev) override
 
void mouseReleaseEvent (QMouseEvent *ev) override
 
void paintEvent (QPaintEvent *ev) override
 
void enterEvent (QEvent *) override
 
void leaveEvent (QEvent *) override
 
void emitLevelChanged ()
 
void emitPanChanged ()
 
int clampNotch (int notch) const
 
int clampPan (int pan) const
 
int audioLevelToNotch (float audioLevel) const
 
float notchToAudioLevel (int notch) const
 
int audioPanToPan (float audioPan) const
 
float panToAudioPan (int pan) const
 
int coordsToNotch (QRectF rect, QPointF pos) const
 
int coordsToPan (QRectF rect, QPointF pos) const
 
QColor cellToColour (int cell) const
 
QSizeF cellSize (QRectF) const
 
QPointF cellCentre (QRectF, int row, int col) const
 
QSizeF cellLightSize (QRectF) const
 
QRectF cellLightRect (QRectF, int row, int col) const
 
QRectF cellOutlineRect (QRectF, int row, int col) const
 
double thinLineWidth (QRectF) const
 
double cornerRadius (QRectF) const
 

Protected Attributes

int m_minNotch
 
int m_maxNotch
 
int m_notch
 
int m_pan
 
float m_monitorLeft
 
float m_monitorRight
 
bool m_editable
 
bool m_editing
 
bool m_includeMute
 
bool m_includeHalfSteps
 
WheelCounter m_wheelCounter
 

Detailed Description

A simple widget for coarse level and pan control.

Definition at line 26 of file LevelPanWidget.h.

Constructor & Destructor Documentation

LevelPanWidget::LevelPanWidget ( QWidget *  parent = 0)

Definition at line 66 of file LevelPanWidget.cpp.

References setLevel(), and setPan().

LevelPanWidget::~LevelPanWidget ( )

Definition at line 84 of file LevelPanWidget.cpp.

Member Function Documentation

float LevelPanWidget::getLevel ( ) const

Return level as a gain value.

The basic level range is [0,1] but the gain scale may go up to 4.0

Definition at line 152 of file LevelPanWidget.cpp.

References m_notch, and notchToAudioLevel().

Referenced by LevelPanToolButton::contextMenuRequested(), emitLevelChanged(), LevelPanToolButton::getLevel(), LevelPanToolButton::selfClicked(), and setLevel().

float LevelPanWidget::getPan ( ) const

Return pan as a value in the range [-1,1].

Definition at line 182 of file LevelPanWidget.cpp.

References m_pan, and panToAudioPan().

Referenced by LevelPanToolButton::contextMenuRequested(), emitPanChanged(), and LevelPanToolButton::getPan().

bool LevelPanWidget::isEditable ( ) const

Find out whether the widget is editable.

Definition at line 196 of file LevelPanWidget.cpp.

References m_editable.

bool LevelPanWidget::includesMute ( ) const

Discover whether the level range includes muting or not.

Definition at line 202 of file LevelPanWidget.cpp.

References m_includeMute.

Referenced by LevelPanToolButton::includesMute().

void LevelPanWidget::renderTo ( QPaintDevice *  dev,
QRectF  rect,
bool  asIfEditable 
) const

Draw a suitably sized copy of the widget's contents to the given device.

Definition at line 405 of file LevelPanWidget.cpp.

References audioLevelToNotch(), cellCentre(), cellLightRect(), cellOutlineRect(), cellToColour(), cornerRadius(), m_includeMute, m_maxNotch, m_monitorLeft, m_monitorRight, m_notch, m_pan, maxPan, and thinLineWidth().

Referenced by LevelPanToolButton::paintEvent(), and paintEvent().

QSize LevelPanWidget::sizeHint ( ) const
override

Definition at line 98 of file LevelPanWidget.cpp.

References WidgetScale::scaleQSize().

void LevelPanWidget::setLevel ( float  level)
slot

Set level.

The basic level range is [0,1] but the scale may go higher. The value will be rounded.

Definition at line 138 of file LevelPanWidget.cpp.

References audioLevelToNotch(), emitLevelChanged(), getLevel(), and m_notch.

Referenced by LevelPanWidget(), LevelPanToolButton::selfClicked(), LevelPanToolButton::setLevel(), and setToDefault().

void LevelPanWidget::setPan ( float  fpan)
slot

Set pan in the range [-1,1]. The value will be rounded.

Definition at line 172 of file LevelPanWidget.cpp.

References audioPanToPan(), and m_pan.

Referenced by LevelPanWidget(), LevelPanToolButton::setPan(), and setToDefault().

void LevelPanWidget::setMonitoringLevels ( float  left,
float  right 
)
slot

Set left and right peak monitoring levels in the range [0,1].

Definition at line 188 of file LevelPanWidget.cpp.

References m_monitorLeft, and m_monitorRight.

Referenced by LevelPanToolButton::setMonitoringLevels().

void LevelPanWidget::setEditable ( bool  editable)
slot

Specify whether the widget is editable or read-only (default editable)

Definition at line 208 of file LevelPanWidget.cpp.

References m_editable.

void LevelPanWidget::setIncludeMute ( bool  include)
slot

Specify whether the level range should include muting or not.

Definition at line 215 of file LevelPanWidget.cpp.

References emitLevelChanged(), m_includeMute, and m_minNotch.

Referenced by LevelPanToolButton::setIncludeMute().

void LevelPanWidget::setToDefault ( )
slot

Reset to default values.

Definition at line 89 of file LevelPanWidget.cpp.

References emitLevelChanged(), emitPanChanged(), setLevel(), and setPan().

Referenced by LevelPanToolButton::mousePressEvent(), and mousePressEvent().

void LevelPanWidget::wheelEvent ( QWheelEvent *  ev)
overrideslot
void LevelPanWidget::levelChanged ( float  )
signal

Referenced by emitLevelChanged().

void LevelPanWidget::panChanged ( float  )
signal

Referenced by emitPanChanged().

void LevelPanWidget::mouseEntered ( )
signal

Referenced by enterEvent().

void LevelPanWidget::mouseLeft ( )
signal

Referenced by leaveEvent().

void LevelPanWidget::mousePressEvent ( QMouseEvent *  ev)
overrideprotected

Definition at line 240 of file LevelPanWidget.cpp.

References m_editing, mouseMoveEvent(), and setToDefault().

void LevelPanWidget::mouseMoveEvent ( QMouseEvent *  ev)
overrideprotected
void LevelPanWidget::mouseReleaseEvent ( QMouseEvent *  ev)
overrideprotected

Definition at line 253 of file LevelPanWidget.cpp.

References m_editing, and mouseMoveEvent().

void LevelPanWidget::paintEvent ( QPaintEvent *  ev)
overrideprotected

Definition at line 575 of file LevelPanWidget.cpp.

References m_editable, and renderTo().

void LevelPanWidget::enterEvent ( QEvent *  e)
overrideprotected

Definition at line 581 of file LevelPanWidget.cpp.

References mouseEntered().

void LevelPanWidget::leaveEvent ( QEvent *  e)
overrideprotected

Definition at line 588 of file LevelPanWidget.cpp.

References mouseLeft().

void LevelPanWidget::emitLevelChanged ( )
protected

Definition at line 228 of file LevelPanWidget.cpp.

References getLevel(), and levelChanged().

Referenced by mouseMoveEvent(), setIncludeMute(), setLevel(), setToDefault(), and wheelEvent().

void LevelPanWidget::emitPanChanged ( )
protected

Definition at line 234 of file LevelPanWidget.cpp.

References getPan(), and panChanged().

Referenced by mouseMoveEvent(), setToDefault(), and wheelEvent().

int LevelPanWidget::clampNotch ( int  notch) const
protected

Definition at line 104 of file LevelPanWidget.cpp.

References m_includeHalfSteps, m_maxNotch, and m_minNotch.

Referenced by audioLevelToNotch(), coordsToNotch(), and wheelEvent().

int LevelPanWidget::clampPan ( int  pan) const
protected

Definition at line 115 of file LevelPanWidget.cpp.

References maxPan.

Referenced by audioPanToPan(), coordsToPan(), and wheelEvent().

int LevelPanWidget::audioLevelToNotch ( float  audioLevel) const
protected

Definition at line 123 of file LevelPanWidget.cpp.

References clampNotch(), and m_maxNotch.

Referenced by renderTo(), and setLevel().

float LevelPanWidget::notchToAudioLevel ( int  notch) const
protected

Definition at line 131 of file LevelPanWidget.cpp.

References m_maxNotch.

Referenced by getLevel().

int LevelPanWidget::audioPanToPan ( float  audioPan) const
protected

Definition at line 158 of file LevelPanWidget.cpp.

References clampPan(), and maxPan.

Referenced by setPan().

float LevelPanWidget::panToAudioPan ( int  pan) const
protected

Definition at line 166 of file LevelPanWidget.cpp.

References maxPan.

Referenced by getPan().

int LevelPanWidget::coordsToNotch ( QRectF  rect,
QPointF  pos 
) const
protected

Definition at line 303 of file LevelPanWidget.cpp.

References clampNotch(), and m_maxNotch.

Referenced by mouseMoveEvent().

int LevelPanWidget::coordsToPan ( QRectF  rect,
QPointF  pos 
) const
protected

Definition at line 317 of file LevelPanWidget.cpp.

References clampPan(), and maxPan.

Referenced by mouseMoveEvent().

QColor LevelPanWidget::cellToColour ( int  cell) const
protected

Definition at line 395 of file LevelPanWidget.cpp.

Referenced by renderTo().

QSizeF LevelPanWidget::cellSize ( QRectF  rect) const
protected

Definition at line 331 of file LevelPanWidget.cpp.

References m_maxNotch, and maxPan.

Referenced by cellCentre(), cellLightSize(), and cornerRadius().

QPointF LevelPanWidget::cellCentre ( QRectF  rect,
int  row,
int  col 
) const
protected

Definition at line 341 of file LevelPanWidget.cpp.

References cellSize(), and maxPan.

Referenced by cellLightRect(), and renderTo().

QSizeF LevelPanWidget::cellLightSize ( QRectF  rect) const
protected

Definition at line 351 of file LevelPanWidget.cpp.

References cellSize().

Referenced by cellLightRect().

QRectF LevelPanWidget::cellLightRect ( QRectF  rect,
int  row,
int  col 
) const
protected

Definition at line 360 of file LevelPanWidget.cpp.

References cellCentre(), and cellLightSize().

Referenced by cellOutlineRect(), and renderTo().

QRectF LevelPanWidget::cellOutlineRect ( QRectF  rect,
int  row,
int  col 
) const
protected

Definition at line 387 of file LevelPanWidget.cpp.

References cellLightRect(), and thinLineWidth().

Referenced by renderTo().

double LevelPanWidget::thinLineWidth ( QRectF  rect) const
protected

Definition at line 371 of file LevelPanWidget.cpp.

References m_maxNotch, and maxPan.

Referenced by cellOutlineRect(), and renderTo().

double LevelPanWidget::cornerRadius ( QRectF  rect) const
protected

Definition at line 379 of file LevelPanWidget.cpp.

References cellSize().

Referenced by renderTo().

Member Data Documentation

int LevelPanWidget::m_minNotch
protected

Definition at line 93 of file LevelPanWidget.h.

Referenced by clampNotch(), and setIncludeMute().

int LevelPanWidget::m_maxNotch
protected
int LevelPanWidget::m_notch
protected

Definition at line 95 of file LevelPanWidget.h.

Referenced by getLevel(), mouseMoveEvent(), renderTo(), setLevel(), and wheelEvent().

int LevelPanWidget::m_pan
protected

Definition at line 96 of file LevelPanWidget.h.

Referenced by getPan(), mouseMoveEvent(), renderTo(), setPan(), and wheelEvent().

float LevelPanWidget::m_monitorLeft
protected

Definition at line 97 of file LevelPanWidget.h.

Referenced by renderTo(), and setMonitoringLevels().

float LevelPanWidget::m_monitorRight
protected

Definition at line 98 of file LevelPanWidget.h.

Referenced by renderTo(), and setMonitoringLevels().

bool LevelPanWidget::m_editable
protected

Definition at line 99 of file LevelPanWidget.h.

Referenced by isEditable(), mouseMoveEvent(), paintEvent(), and setEditable().

bool LevelPanWidget::m_editing
protected

Definition at line 100 of file LevelPanWidget.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

bool LevelPanWidget::m_includeMute
protected

Definition at line 101 of file LevelPanWidget.h.

Referenced by includesMute(), renderTo(), and setIncludeMute().

bool LevelPanWidget::m_includeHalfSteps
protected

Definition at line 102 of file LevelPanWidget.h.

Referenced by clampNotch().

WheelCounter LevelPanWidget::m_wheelCounter
protected

Definition at line 104 of file LevelPanWidget.h.

Referenced by wheelEvent().


The documentation for this class was generated from the following files: