Default some empty destructors

Moving empty destructors out of the .cpp files and into headers
allows them to be devirtualized in certain cases.
(When the compiler can't "see" a function in a header, it must largely
assume it's some black box that the linker will resolve.)

While we're at it, use C++11's `= default` to define empty virtual
desturctors for us.

For some classes (e.g., Piano), nothing is derived from it, so we can
mark the class as final and remove any explicit virtual dtor.

There are many other places where this can be done, but this is a large
enough patch as-is.
This commit is contained in:
Matt Kline
2018-05-06 16:32:10 -07:00
parent c1b2728d65
commit 68c9d227d0
35 changed files with 23 additions and 228 deletions

View File

@@ -98,16 +98,6 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) :
}
}
AutomationPattern::~AutomationPattern()
{
}
bool AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup )
{
if( _search_dup && m_objects.contains(_obj) )

View File

@@ -34,16 +34,6 @@ Instrument::Instrument( InstrumentTrack * _instrument_track,
{
}
Instrument::~Instrument()
{
}
void Instrument::play( sampleFrame * )
{
}

View File

@@ -70,19 +70,6 @@ Piano::Piano( InstrumentTrack* track ) :
}
/*! \brief Destroy this new keyboard display
*
*/
Piano::~Piano()
{
}
/*! \brief Turn a key on or off
*
* \param key the key number to change

View File

@@ -50,16 +50,6 @@ AutomatableModelView::AutomatableModelView( ::Model* model, QWidget* _this ) :
widget()->setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );
}
AutomatableModelView::~AutomatableModelView()
{
}
void AutomatableModelView::addDefaultActions( QMenu* menu )
{
AutomatableModel* model = modelUntyped();

View File

@@ -112,16 +112,6 @@ FileBrowser::FileBrowser(const QString & directories, const QString & filter,
show();
}
FileBrowser::~FileBrowser()
{
}
bool FileBrowser::filterItems( const QString & filter, QTreeWidgetItem * item )
{
// call with item=NULL to filter the entire tree
@@ -338,16 +328,6 @@ FileBrowserTreeWidget::FileBrowserTreeWidget(QWidget * parent ) :
}
FileBrowserTreeWidget::~FileBrowserTreeWidget()
{
}
void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e )
{
FileItem * f = dynamic_cast<FileItem *>( itemAt( e->pos() ) );

View File

@@ -130,19 +130,6 @@ PianoView::PianoView( QWidget * _parent ) :
}
/*! \brief Destroy this piano display view
*
*/
PianoView::~PianoView()
{
}
/*! \brief Map a keyboard key being pressed to a note in our keyboard view
*
* \param _k The keyboard scan code of the key being pressed.

View File

@@ -133,12 +133,6 @@ Fader::Fader( FloatModel * model, const QString & name, QWidget * parent, QPixma
init(model, name);
}
Fader::~Fader()
{
}
void Fader::init(FloatModel * model, QString const & name)
{
setWindowTitle( name );

View File

@@ -56,13 +56,6 @@ Graph::Graph( QWidget * _parent, graphStyle _style, int _width,
this, SLOT( updateGraph( ) ) );
}
Graph::~Graph()
{
}
void Graph::setForeground( const QPixmap &_pixmap )
{
m_foreground = _pixmap;
@@ -470,14 +463,6 @@ graphModel::graphModel( float _min, float _max, int _length,
{
}
graphModel::~graphModel()
{
}
void graphModel::setRange( float _min, float _max )
{
if( _min != m_minValue || _max != m_maxValue )

View File

@@ -58,14 +58,6 @@ LcdSpinBox::LcdSpinBox( int numDigits, const QString& style, QWidget* parent, co
{
}
LcdSpinBox::~LcdSpinBox()
{
}
void LcdSpinBox::update()
{
setValue( model()->value() + m_displayOffset );

View File

@@ -41,9 +41,8 @@ public:
m_orientation( _orientation )
{
}
virtual ~SideBarButton()
{
}
virtual ~SideBarButton() = default;
Qt::Orientation orientation() const
{

View File

@@ -41,16 +41,6 @@ TabBar::TabBar( QWidget * _parent, QBoxLayout::Direction _dir ) :
setLayout( m_layout );
}
TabBar::~TabBar()
{
}
TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id,
bool _add_stretch, bool _text_is_tooltip )
{

View File

@@ -61,12 +61,6 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap
}
TabWidget::~TabWidget()
{
}
void TabWidget::addTab( QWidget * w, const QString & name, const char *pixmap, int idx )
{
setFont( pointSize<8>( font() ) );

View File

@@ -58,17 +58,6 @@ TimeDisplayWidget::TimeDisplayWidget() :
this, SLOT( updateTime() ) );
}
TimeDisplayWidget::~TimeDisplayWidget()
{
}
void TimeDisplayWidget::setDisplayMode( DisplayMode displayMode )
{
m_displayMode = displayMode;

View File

@@ -41,10 +41,3 @@ ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
ToolTip::add( this, _tooltip );
setIcon( _pixmap );
}
ToolButton::~ToolButton()
{
}

View File

@@ -40,16 +40,6 @@ AutomationTrack::AutomationTrack( TrackContainer* tc, bool _hidden ) :
setName( tr( "Automation track" ) );
}
AutomationTrack::~AutomationTrack()
{
}
bool AutomationTrack::play( const MidiTime & time_start, const fpp_t _frames,
const f_cnt_t _frame_base, int _tco_num )
{
@@ -108,16 +98,6 @@ AutomationTrackView::AutomationTrackView( AutomationTrack * _at, TrackContainerV
setModel( _at );
}
AutomationTrackView::~AutomationTrackView()
{
}
void AutomationTrackView::dragEnterEvent( QDragEnterEvent * _dee )
{
StringPairDrag::processDragEnterEvent( _dee, "automatable_model" );

View File

@@ -61,16 +61,6 @@ BBTCO::BBTCO( Track * _track ) :
setAutoResize( false );
}
BBTCO::~BBTCO()
{
}
void BBTCO::saveSettings( QDomDocument & doc, QDomElement & element )
{
element.setAttribute( "name", name() );
@@ -168,16 +158,6 @@ BBTCOView::BBTCOView( TrackContentObject * _tco, TrackView * _tv ) :
setStyle( QApplication::style() );
}
BBTCOView::~BBTCOView()
{
}
void BBTCOView::constructContextMenu( QMenu * _cm )
{
QAction * a = new QAction( embed::getIconPixmap( "bb_track" ),

View File

@@ -616,19 +616,6 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
setStyle( QApplication::style() );
}
PatternView::~PatternView()
{
}
void PatternView::update()
{
ToolTip::add(this, m_pat->name());

View File

@@ -302,16 +302,6 @@ SampleTCOView::SampleTCOView( SampleTCO * _tco, TrackView * _tv ) :
setStyle( QApplication::style() );
}
SampleTCOView::~SampleTCOView()
{
}
void SampleTCOView::updateSample()
{
update();