Skip to content

Commit

Permalink
Fader redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Umcaruje committed Sep 29, 2016
1 parent 68df69d commit 2f567d6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
Binary file modified data/themes/default/fader_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/fader_leds.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions data/themes/default/style.css
Expand Up @@ -544,8 +544,9 @@ FxLine {

/* persistent peak markers for fx peak meters */
Fader {
qproperty-peakGreen: #0BD556;
qproperty-peakRed: #660505;
qproperty-peakGreen: #0ad45c;
qproperty-peakYellow: #d6ec52;
qproperty-peakRed: #c12038;
}

TimeLineWidget {
Expand Down
9 changes: 7 additions & 2 deletions include/Fader.h
Expand Up @@ -63,6 +63,7 @@ class EXPORT Fader : public QWidget, public FloatModelView
public:
Q_PROPERTY( QColor peakGreen READ peakGreen WRITE setPeakGreen )
Q_PROPERTY( QColor peakRed READ peakRed WRITE setPeakRed )
Q_PROPERTY( QColor peakYellow READ peakYellow WRITE setPeakYellow )
Q_PROPERTY( bool levelsDisplayedInDBFS READ getLevelsDisplayedInDBFS WRITE setLevelsDisplayedInDBFS )

Fader( FloatModel * _model, const QString & _name, QWidget * _parent );
Expand All @@ -89,9 +90,12 @@ class EXPORT Fader : public QWidget, public FloatModelView
QColor const & peakRed() const;
void setPeakRed( const QColor & c );

QColor const & peakYellow() const;
void setPeakYellow( const QColor & c );

inline bool getLevelsDisplayedInDBFS() const { return m_levelsDisplayedInDBFS; }
inline void setLevelsDisplayedInDBFS(bool value = true) { m_levelsDisplayedInDBFS = value; }

void setDisplayConversion( bool b )
{
m_displayConversion = b;
Expand All @@ -113,7 +117,7 @@ class EXPORT Fader : public QWidget, public FloatModelView
virtual void wheelEvent( QWheelEvent *ev );
virtual void paintEvent( QPaintEvent *ev );

inline bool clips(float const & value) const { return value > 1.0f; }
inline bool clips(float const & value) const { return value >= 1.0f; }

void paintDBFSLevels(QPaintEvent *ev, QPainter & painter);
void paintLinearLevels(QPaintEvent *ev, QPainter & painter);
Expand Down Expand Up @@ -161,6 +165,7 @@ class EXPORT Fader : public QWidget, public FloatModelView

QColor m_peakGreen;
QColor m_peakRed;
QColor m_peakYellow;
} ;


Expand Down
9 changes: 2 additions & 7 deletions src/gui/FxMixerView.cpp
Expand Up @@ -283,8 +283,8 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,
tr( "FX Fader %1" ).arg( channelIndex ), m_fxLine );
m_fader->setLevelsDisplayedInDBFS();
// TODO dbvToAmp is really dBFSToAmp. Rename in later commit.
m_fader->setMinPeak(dbvToAmp(-40));
m_fader->setMaxPeak(dbvToAmp(12));
m_fader->setMinPeak(dbvToAmp(-42));
m_fader->setMaxPeak(dbvToAmp(9));

m_fader->move( 16-m_fader->width()/2,
m_fxLine->height()-
Expand Down Expand Up @@ -600,8 +600,3 @@ void FxMixerView::updateFaders()
}
}
}





32 changes: 27 additions & 5 deletions src/gui/widgets/Fader.cpp
Expand Up @@ -79,7 +79,8 @@ Fader::Fader( FloatModel * _model, const QString & _name, QWidget * _parent ) :
m_moveStartPoint( -1 ),
m_startValue( 0 ),
m_peakGreen( 0, 0, 0 ),
m_peakRed( 0, 0, 0 )
m_peakRed( 0, 0, 0 ),
m_peakYellow( 0, 0, 0 )
{
if( s_textFloat == NULL )
{
Expand Down Expand Up @@ -384,9 +385,16 @@ void Fader::paintDBFSLevels(QPaintEvent * ev, QPainter & painter)

float const persistentLeftPeakDBFS = ampToDbv(m_persistentPeak_L);
int persistentPeak_L = height * (1 - (persistentLeftPeakDBFS - minDB) * fullSpanReciprocal);
// the LED's have a 4px padding and we don't want the peaks
// to draw on the fader background
if( persistentPeak_L <= 4 )
{
persistentPeak_L = 4;
}
if( persistentLeftPeakDBFS > minDB )
{
QColor const & peakColor = clips(m_persistentPeak_L) ? peakRed() : peakGreen();
QColor const & peakColor = clips(m_persistentPeak_L) ? peakRed() :
persistentLeftPeakDBFS >= -6 ? peakYellow() : peakGreen();
painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), peakColor );
}

Expand All @@ -399,9 +407,16 @@ void Fader::paintDBFSLevels(QPaintEvent * ev, QPainter & painter)

float const persistentRightPeakDBFS = ampToDbv(m_persistentPeak_R);
int persistentPeak_R = height * (1 - (persistentRightPeakDBFS - minDB) * fullSpanReciprocal);
// the LED's have a 4px padding and we don't want the peaks
// to draw on the fader background
if( persistentPeak_R <= 4 )
{
persistentPeak_R = 4;
}
if( persistentRightPeakDBFS > minDB )
{
QColor const & peakColor = clips(m_persistentPeak_R) ? peakRed() : peakGreen();
QColor const & peakColor = clips(m_persistentPeak_R) ? peakRed() :
persistentRightPeakDBFS >= -6 ? peakYellow() : peakGreen();
painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), peakColor );
}
}
Expand Down Expand Up @@ -449,6 +464,11 @@ QColor const & Fader::peakRed() const
return m_peakRed;
}

QColor const & Fader::peakYellow() const
{
return m_peakYellow;
}

void Fader::setPeakGreen( const QColor & c )
{
m_peakGreen = c;
Expand All @@ -459,5 +479,7 @@ void Fader::setPeakRed( const QColor & c )
m_peakRed = c;
}



void Fader::setPeakYellow( const QColor & c )
{
m_peakYellow = c;
}

0 comments on commit 2f567d6

Please sign in to comment.