Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Replace initializer list macros with delegating constructors
  • Loading branch information
knittl committed Oct 27, 2019
commit 8381730f6b3c0160ab8322b0432bb36effad0de2
2 changes: 1 addition & 1 deletion include/LcdWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public slots:
int m_numDigits;
int m_marginWidth;

void initUi( const QString& name, const QString &style = QString("19green") ); //!< to be called by ctors
void initUi( const QString& name, const QString &style ); //!< to be called by ctors

} ;

Expand Down
29 changes: 11 additions & 18 deletions src/gui/widgets/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,28 @@ TextFloat * Knob::s_textFloat = NULL;



//! @todo: in C++11, we can use delegating ctors
#define DEFAULT_KNOB_INITIALIZER_LIST \
QWidget( _parent ), \
FloatModelView( new FloatModel( 0, 0, 0, 1, NULL, _name, true ), this ), \
m_label( "" ), \
m_knobPixmap( NULL ), \
m_volumeKnob( false ), \
m_volumeRatio( 100.0, 0.0, 1000000.0 ), \
m_buttonPressed( false ), \
m_angle( -10 ), \
m_lineWidth( 0 ), \
m_textColor( 255, 255, 255 )

Knob::Knob( knobTypes _knob_num, QWidget * _parent, const QString & _name ) :
DEFAULT_KNOB_INITIALIZER_LIST,
QWidget( _parent ),
FloatModelView( new FloatModel( 0, 0, 0, 1, NULL, _name, true ), this ),
m_label( "" ),
m_knobPixmap( NULL ),
m_volumeKnob( false ),
m_volumeRatio( 100.0, 0.0, 1000000.0 ),
m_buttonPressed( false ),
m_angle( -10 ),
m_lineWidth( 0 ),
m_textColor( 255, 255, 255 ),
m_knobNum( _knob_num )
{
initUi( _name );
}

Knob::Knob( QWidget * _parent, const QString & _name ) :
DEFAULT_KNOB_INITIALIZER_LIST,
m_knobNum( knobBright_26 )
Knob( knobBright_26, _parent, _name )
{
initUi( _name );
}

#undef DEFAULT_KNOB_INITIALIZER_LIST




Expand Down
22 changes: 6 additions & 16 deletions src/gui/widgets/LcdWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,32 @@



//! @todo: in C++11, we can use delegating ctors
#define DEFAULT_LCDWIDGET_INITIALIZER_LIST \
QWidget( parent ), \
m_label(), \
m_textColor( 255, 255, 255 ), \
m_textShadowColor( 64, 64, 64 )

LcdWidget::LcdWidget( QWidget* parent, const QString& name ) :
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
m_numDigits( 1 )
LcdWidget( 1, parent, name )
{
initUi( name );
}




LcdWidget::LcdWidget( int numDigits, QWidget* parent, const QString& name ) :
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
m_numDigits( numDigits )
LcdWidget( numDigits, QString("19green"), parent, name )
{
initUi( name );
}




LcdWidget::LcdWidget( int numDigits, const QString& style, QWidget* parent, const QString& name ) :
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
QWidget( parent ),
m_label(),
m_textColor( 255, 255, 255 ),
m_textShadowColor( 64, 64, 64 ),
m_numDigits( numDigits )
{
initUi( name, style );
}

#undef DEFAULT_LCDWIDGET_INITIALIZER_LIST




Expand Down
11 changes: 2 additions & 9 deletions src/gui/widgets/LedCheckbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ static const QString names[LedCheckBox::NumColors] =



//! @todo: in C++11, we can use delegating ctors
#define DEFAULT_LEDCHECKBOX_INITIALIZER_LIST \
AutomatableButton( _parent, _name )

LedCheckBox::LedCheckBox( const QString & _text, QWidget * _parent,
const QString & _name, LedColors _color ) :
DEFAULT_LEDCHECKBOX_INITIALIZER_LIST,
AutomatableButton( _parent, _name ),
m_text( _text )
{
initUi( _color );
Expand All @@ -56,13 +52,10 @@ LedCheckBox::LedCheckBox( const QString & _text, QWidget * _parent,

LedCheckBox::LedCheckBox( QWidget * _parent,
const QString & _name, LedColors _color ) :
DEFAULT_LEDCHECKBOX_INITIALIZER_LIST
LedCheckBox( QString(), _parent, _name, _color )
{
initUi( _color );
}

#undef DEFAULT_LEDCHECKBOX_INITIALIZER_LIST



LedCheckBox::~LedCheckBox()
Expand Down