Fader redesign (#3056)

This commit is contained in:
Umcaruje
2016-09-30 20:50:50 +02:00
committed by Rebecca DeField
parent 919ca8b4d7
commit d4fb937423
6 changed files with 39 additions and 16 deletions

View File

@@ -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()-
@@ -600,8 +600,3 @@ void FxMixerView::updateFaders()
}
}
}

View File

@@ -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 )
{
@@ -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 );
}
@@ -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 );
}
}
@@ -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;
@@ -459,5 +479,7 @@ void Fader::setPeakRed( const QColor & c )
m_peakRed = c;
}
void Fader::setPeakYellow( const QColor & c )
{
m_peakYellow = c;
}