Replace initializer list macros with delegating constructors (#5279)

Closes #5278
This commit is contained in:
knittl
2019-10-27 21:17:04 +01:00
committed by Johannes Lorenz
parent dbf5f47149
commit 5e4e536bf0
4 changed files with 20 additions and 44 deletions

View File

@@ -100,7 +100,7 @@ private:
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
} ;

View File

@@ -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

View File

@@ -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

View File

@@ -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 );
@@ -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()