2
* plugin.h - class plugin, the base-class and generic interface for all plugins
4
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public
19
* License along with this program (see COPYING); if not, write to the
20
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301 USA.
30
#include <QtCore/QString>
31
#include <QtCore/QStringList>
32
#include <QtCore/QVector>
33
#include <QtXml/QDomDocument>
35
#include "journalling_object.h"
45
class automatableModel;
48
class EXPORT plugin : public journallingObject, public model
53
Instrument, // instrument being used in channel-track
54
Effect, // effect-plugin for effect-board
55
ImportFilter, // filter for importing a file
56
ExportFilter, // filter for exporting a file
57
Tool, // additional tool (level-meter etc)
58
Library, // simple library holding a code-base for
59
// several other plugins (e.g. VST-support)
64
// descriptor holds information about a plugin - every external plugin
65
// has to instantiate such a descriptor in an extern "C"-section so that
66
// the plugin-loader is able to access information about the plugin
70
const char * displayName;
71
const char * description;
75
const pixmapLoader * logo;
76
const char * supportedFileTypes;
77
inline bool supportsFileType( const QString & _ext ) const
79
return QString( supportedFileTypes ).
80
split( QChar( ',' ) ).
83
class EXPORT subPluginFeatures
88
typedef QMap<QString, QString> attributeMap;
90
inline key( plugin::descriptor * _desc = NULL,
91
const QString & _name = QString(),
92
const attributeMap & _am =
101
key( const QDomElement & _key );
103
QDomElement saveXML( QDomDocument &
106
inline bool isValid( void ) const
108
return desc != NULL &&
109
name != QString::null;
112
plugin::descriptor * desc;
114
attributeMap attributes;
117
typedef QList<key> keyList;
120
subPluginFeatures( plugin::PluginTypes _type ) :
125
virtual ~subPluginFeatures()
129
virtual void fillDescriptionWidget( QWidget *,
134
virtual void listSubPluginKeys( plugin::descriptor *,
141
const plugin::PluginTypes m_type;
144
subPluginFeatures * sub_plugin_features;
148
// contructor of a plugin
149
plugin( const descriptor * _descriptor, model * _parent );
152
// returns display-name out of descriptor
153
virtual QString displayName( void ) const
155
return model::displayName().isEmpty() ?
156
m_descriptor->displayName :
157
model::displayName();
160
// return plugin-type
161
inline PluginTypes type( void ) const
163
return m_descriptor->type;
166
// return plugin-descriptor for further information
167
inline const descriptor * getDescriptor( void ) const
172
// can be called if a file matching supportedFileTypes should be
173
// loaded/processed with the help of this plugin
174
virtual void loadFile( const QString & _file );
176
// Called if external source needs to change something but we cannot
177
// reference the class header. Should return null if not key not found.
178
virtual automatableModel * getChildModel( const QString & _modelName );
180
// returns an instance of a plugin whose name matches to given one
181
// if specified plugin couldn't be loaded, it creates a dummy-plugin
182
static plugin * instantiate( const QString & _plugin_name,
186
// fills given vector with descriptors of all available plugins
187
static void getDescriptorsOfAvailPlugins(
188
QVector<descriptor> & _plugin_descs );
190
// create a view for the model
191
pluginView * createView( QWidget * _parent );
195
// create a view for the model
196
virtual pluginView * instantiateView( QWidget * ) = 0;
200
const descriptor * m_descriptor;
202
// pointer to instantiation-function in plugin
203
typedef plugin * ( * instantiationHook )( model *, void * );