hydrogen 1.2.5
Fader Class Reference

Custom fader widget. More...

#include <Fader.h>

Inheritance diagram for Fader:
WidgetWithInput Object< Fader > MidiLearnable Base EventListener

Public Types

enum class  Type { Normal , Vertical , Master }

Public Slots

void onPreferencesChanged (H2Core::Preferences::Changes changes)

Public Member Functions

 Fader (QWidget *pParent, Type type, QString sBaseTooltip, bool bUseIntSteps=false, bool bWithoutKnob=false, float fMin=0.0, float fMax=1.0, bool bModifyOnChange=true)
 ~Fader ()
float getPeak_L () const
float getPeak_R () const
void setMaxPeak (float fMax)
void setMinPeak (float fMin)
void setPeak_L (float peak)
void setPeak_R (float peak)
Public Member Functions inherited from WidgetWithInput
 WidgetWithInput (QWidget *parent, bool bUseIntSteps, QString sBaseTooltip, int nScrollSpeed, int nScrollSpeedFast, float fMin, float fMax, bool bModifyOnChange)
 ~WidgetWithInput ()
QString getBaseTooltip () const
float getDefaultValue () const
bool getIsActive () const
float getMax () const
float getMin () const
int getScrollSpeed () const
int getScrollSpeedFast () const
float getValue () const
int getWidgetHeight () const
int getWidgetWidth () const
void resetValueToDefault ()
void setBaseTooltip (const QString &sBaseTooltip)
void setDefaultValue (float fDefaultValue)
void setIsActive (bool bIsActive)
void setMax (float fMax)
void setMin (float fMin)
void setScrollSpeed (int nScrollSpeed) const
void setScrollSpeedFast (int nScrollSpeedFast) const
virtual void setValue (float fValue, bool bTriggeredByUserInteraction=false)
void setWidgetHeight (int nWidgetHeight)
void setWidgetWidth (int nWidgetWidth)
Public Member Functions inherited from MidiLearnable
 MidiLearnable ()
 ~MidiLearnable ()
std::shared_ptr< ActiongetAction () const
void midiMapChangedEvent () override
 Update m_registeredMidiEvents since the underlying #H2Core::MidiMap changed.
void setAction (std::shared_ptr< Action > pAction)
Public Member Functions inherited from Object< Fader >
 Object ()
Public Member Functions inherited from Base
 Base ()
 Base (const Base &other)
virtual const char * class_name () const
void logBacktrace () const
 Print the current stack at point into the debug log.
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
virtual QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.

Private Member Functions

virtual void mouseMoveEvent (QMouseEvent *ev) override
virtual void mousePressEvent (QMouseEvent *ev) override
virtual void paintEvent (QPaintEvent *ev) override

Private Attributes

bool m_bWithoutKnob
float m_fMaxPeak
float m_fMinPeak
float m_fPeakValue_L
float m_fPeakValue_R
QSvgRenderer * m_pBackground
QSvgRenderer * m_pKnob
Type m_type

Additional Inherited Members

Signals inherited from WidgetWithInput
void valueChanged (WidgetWithInput *ref)
Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
static QString base_clock_in (const QString &sMsg)
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
static bool count_active ()
static int getAliveObjectCount ()
static object_map_t getObjectMap ()
static Loggerlogger ()
 return the logger instance
static int objects_count ()
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
static void set_count (bool flag)
 enable/disable class instances counting
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
static void write_objects_map_to_cerr ()
 output objects map to stderr
Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
Protected Member Functions inherited from WidgetWithInput
virtual void enterEvent (QEvent *ev) override
virtual void keyPressEvent (QKeyEvent *ev)
virtual void leaveEvent (QEvent *ev)
virtual void mouseReleaseEvent (QMouseEvent *ev)
void updateTooltip () override
 Indicates child class to recalculate its tool tip in case m_registeredMidiEvents changed.
virtual void wheelEvent (QWheelEvent *ev)
Protected Member Functions inherited from Object< Fader >
 ~Object ()
Protected Member Functions inherited from Base
 ~Base ()
Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
Protected Attributes inherited from WidgetWithInput
bool m_bEntered
bool m_bIgnoreMouseMove
bool m_bIsActive
bool m_bModifyOnChange
 Whether Hydrogen::setIsModified() is invoked with true as soon as the value of the widget does change.
bool m_bUseIntSteps
float m_fDefaultValue
float m_fMax
float m_fMin
float m_fMousePressValue
float m_fMousePressY
float m_fValue
double m_inputBufferTimeout
 Number of seconds before m_sInputBuffer will be flushed (happens asynchronically whenever the next key input occurs.)
timeval m_inputBufferTimeval
int m_nScrollSpeed
int m_nScrollSpeedFast
 Fast version used when the Control modifier is pressed.
int m_nWidgetHeight
int m_nWidgetWidth
QString m_sBaseTooltip
QString m_sInputBuffer
 All key input will be appended to this string.
Protected Attributes inherited from MidiLearnable
std::shared_ptr< Actionm_pAction
std::vector< std::pair< H2Core::MidiMessage::Event, int > > m_registeredMidiEvents
 Stores all MIDI events mapped to m_pAction.
Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
static timeval __last_clock = { 0, 0 }
static Logger__logger = nullptr
static bool bLogColors = true

Detailed Description

Custom fader widget.

The meter, outline, and slider will be loaded from a SVG file while the bars indicating the current value will be painted by Qt.

Definition at line 43 of file Fader.h.

Member Enumeration Documentation

◆ Type

enum class Type
strong
Enumerator
Normal 
Vertical 

Only used for the playback track in the SongEditorPanel.

Master 

Definition at line 48 of file Fader.h.

Constructor & Destructor Documentation

◆ Fader()

Fader ( QWidget * pParent,
Type type,
QString sBaseTooltip,
bool bUseIntSteps = false,
bool bWithoutKnob = false,
float fMin = 0.0,
float fMax = 1.0,
bool bModifyOnChange = true )

Definition at line 38 of file Fader.cpp.

◆ ~Fader()

~Fader ( )

Definition at line 112 of file Fader.cpp.

Member Function Documentation

◆ getPeak_L()

float getPeak_L ( ) const
inline

Definition at line 62 of file Fader.h.

◆ getPeak_R()

float getPeak_R ( ) const
inline

Definition at line 65 of file Fader.h.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent * ev)
overrideprivatevirtual

Reimplemented from WidgetWithInput.

Definition at line 122 of file Fader.cpp.

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent * ev)
overrideprivatevirtual

Reimplemented from WidgetWithInput.

Definition at line 151 of file Fader.cpp.

◆ onPreferencesChanged

void onPreferencesChanged ( H2Core::Preferences::Changes changes)
slot

Definition at line 115 of file Fader.cpp.

◆ paintEvent()

void paintEvent ( QPaintEvent * ev)
overrideprivatevirtual

Definition at line 180 of file Fader.cpp.

◆ setMaxPeak()

void setMaxPeak ( float fMax)

Definition at line 371 of file Fader.cpp.

◆ setMinPeak()

void setMinPeak ( float fMin)

Definition at line 403 of file Fader.cpp.

◆ setPeak_L()

void setPeak_L ( float peak)

Definition at line 321 of file Fader.cpp.

◆ setPeak_R()

void setPeak_R ( float peak)

Definition at line 346 of file Fader.cpp.

Field Documentation

◆ m_bWithoutKnob

bool m_bWithoutKnob
private

Definition at line 71 of file Fader.h.

◆ m_fMaxPeak

float m_fMaxPeak
private

Definition at line 79 of file Fader.h.

◆ m_fMinPeak

float m_fMinPeak
private

Definition at line 78 of file Fader.h.

◆ m_fPeakValue_L

float m_fPeakValue_L
private

Definition at line 76 of file Fader.h.

◆ m_fPeakValue_R

float m_fPeakValue_R
private

Definition at line 77 of file Fader.h.

◆ m_pBackground

QSvgRenderer* m_pBackground
private

Definition at line 73 of file Fader.h.

◆ m_pKnob

QSvgRenderer* m_pKnob
private

Definition at line 74 of file Fader.h.

◆ m_type

Type m_type
private

Definition at line 72 of file Fader.h.