Plugin::Descriptor::SubPluginFeatures: made some methods const

We can safely make fillDescriptionWidget() and listSubPluginKeys()
const methods. Furthermore descriptor pointer to listSubPluginKeys()
can be const as well. Might allow more optimizations by the compiler.
This commit is contained in:
Tobias Doerffel
2009-08-26 01:10:07 +02:00
parent e8c3c21f7f
commit 1c76c77d22
5 changed files with 18 additions and 17 deletions

View File

@@ -133,11 +133,12 @@ public:
{
}
virtual void fillDescriptionWidget( QWidget *, const Key * )
virtual void fillDescriptionWidget( QWidget *, const Key * ) const
{
}
virtual void listSubPluginKeys( Plugin::Descriptor *, KeyList & )
virtual void listSubPluginKeys( const Plugin::Descriptor *,
KeyList & ) const
{
}

View File

@@ -25,7 +25,6 @@
*
*/
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
@@ -46,7 +45,7 @@ LadspaSubPluginFeatures::LadspaSubPluginFeatures( Plugin::PluginTypes _type ) :
void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,
const Key * _key )
const Key * _key ) const
{
const ladspa_key_t & lkey = subPluginKeyToLadspaKey( _key );
ladspa2LMMS * lm = engine::getLADSPAManager();
@@ -114,8 +113,8 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,
void LadspaSubPluginFeatures::listSubPluginKeys( Plugin::Descriptor * _desc,
KeyList & _kl )
void LadspaSubPluginFeatures::listSubPluginKeys(
const Plugin::Descriptor * _desc, KeyList & _kl ) const
{
ladspa2LMMS * lm = engine::getLADSPAManager();

View File

@@ -25,7 +25,6 @@
*
*/
#ifndef _LADSPA_SUBPLUGIN_FEATURES_H
#define _LADSPA_SUBPLUGIN_FEATURES_H
@@ -38,9 +37,11 @@ class LadspaSubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures
public:
LadspaSubPluginFeatures( Plugin::PluginTypes _type );
virtual void fillDescriptionWidget( QWidget * _parent, const Key * _key );
virtual void fillDescriptionWidget( QWidget * _parent,
const Key * _key ) const;
virtual void listSubPluginKeys( Plugin::Descriptor * _desc, KeyList & _kl );
virtual void listSubPluginKeys( const Plugin::Descriptor * _desc,
KeyList & _kl ) const;
static ladspa_key_t subPluginKeyToLadspaKey( const Key * _key );

View File

@@ -40,18 +40,17 @@ VstSubPluginFeatures::VstSubPluginFeatures( Plugin::PluginTypes _type ) :
void VstSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,
const Key * _key )
const Key * _key ) const
{
new QLabel( QWidget::tr( "Name: " ) + _key->name, _parent );
new QLabel( QWidget::tr( "File: " ) + _key->attributes["file"],
_parent );
new QLabel( QWidget::tr( "File: " ) + _key->attributes["file"], _parent );
}
void VstSubPluginFeatures::listSubPluginKeys( Plugin::Descriptor * _desc,
KeyList & _kl )
void VstSubPluginFeatures::listSubPluginKeys( const Plugin::Descriptor * _desc,
KeyList & _kl ) const
{
QStringList dlls = QDir( configManager::inst()->vstDir() ).
entryList( QStringList() << "*.dll",
@@ -64,6 +63,5 @@ void VstSubPluginFeatures::listSubPluginKeys( Plugin::Descriptor * _desc,
am["file"] = *it;
_kl.push_back( Key( _desc, QFileInfo( *it ).baseName(), am ) );
}
}

View File

@@ -35,9 +35,11 @@ class VstSubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures
public:
VstSubPluginFeatures( Plugin::PluginTypes _type );
virtual void fillDescriptionWidget( QWidget * _parent, const Key * _key );
virtual void fillDescriptionWidget( QWidget * _parent,
const Key * _key ) const;
virtual void listSubPluginKeys( Plugin::Descriptor * _desc, KeyList & _kl );
virtual void listSubPluginKeys( const Plugin::Descriptor * _desc,
KeyList & _kl ) const;
} ;