Fader: add a way to disable the x100 display conversion so the fader widget can be used with arbitrary values

Also it can now be used with alternate pixmaps
This commit is contained in:
Vesa
2014-12-10 06:55:59 +02:00
parent 150b16bd15
commit 170f60c8e0
6 changed files with 90 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
/*
* AutomatableSlider.h - class automatableSlider, a QSlider with automation
* AutomatableSlider.h - class AutomatableSlider, a QSlider with automation
*
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*

View File

@@ -64,6 +64,7 @@ public:
Q_PROPERTY( QColor peakGreen READ peakGreen WRITE setPeakGreen )
Q_PROPERTY( QColor peakRed READ peakRed WRITE setPeakRed )
Fader( FloatModel * _model, const QString & _name, QWidget * _parent );
Fader( FloatModel * _model, const QString & _name, QWidget * _parent, QPixmap * back, QPixmap * leds, QPixmap * knob );
virtual ~Fader();
void setPeak_L( float fPeak );
@@ -76,6 +77,11 @@ public:
QColor peakRed() const;
void setPeakGreen( const QColor & c );
void setPeakRed( const QColor & c );
void setDisplayConversion( bool b )
{
m_displayConversion = b;
}
private:
virtual void contextMenuEvent( QContextMenuEvent * _me );
@@ -112,6 +118,12 @@ private:
static QPixmap * s_back;
static QPixmap * s_leds;
static QPixmap * s_knob;
QPixmap * m_back;
QPixmap * m_leds;
QPixmap * m_knob;
bool m_displayConversion;
int m_moveStartPoint;
float m_startValue;

View File

@@ -140,6 +140,7 @@ static inline float fastRandf( float range )
{
static const float fast_rand_ratio = 1.0f / FAST_RAND_MAX;
return fast_rand() * range * fast_rand_ratio;
}
//! @brief Takes advantage of fmal() function if present in hardware
static inline long double fastFmal( long double a, long double b, long double c )