Plugin: initial integration of resource framework
Replaced deprecated Plugin::loadFile(QString) method by Plugin::loadResource(ResourceItem), a future interface to be adapted by invididual plugins. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* plugin.h - class plugin, the base-class and generic interface for all plugins
|
||||
*
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -37,9 +37,9 @@
|
||||
#include "base64.h"
|
||||
|
||||
|
||||
|
||||
class QWidget;
|
||||
|
||||
class ResourceItem;
|
||||
class pixmapLoader;
|
||||
class pluginView;
|
||||
class automatableModel;
|
||||
@@ -73,12 +73,21 @@ public:
|
||||
int version;
|
||||
PluginTypes type;
|
||||
const pixmapLoader * logo;
|
||||
const char * supportedFileTypes;
|
||||
inline bool supportsFileType( const QString & _ext ) const
|
||||
const char * * supportedFileTypes;
|
||||
inline bool supportsFileType( const QString & _type ) const
|
||||
{
|
||||
return QString( supportedFileTypes ).
|
||||
split( QChar( ',' ) ).
|
||||
contains( _ext );
|
||||
if( !supportedFileTypes )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for( const char * * i = supportedFileTypes; *i; ++i )
|
||||
{
|
||||
if( *i == _type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
class EXPORT subPluginFeatures
|
||||
{
|
||||
@@ -158,7 +167,7 @@ public:
|
||||
}
|
||||
|
||||
// return plugin-type
|
||||
inline PluginTypes type( void ) const
|
||||
inline PluginTypes type() const
|
||||
{
|
||||
return m_descriptor->type;
|
||||
}
|
||||
@@ -169,9 +178,9 @@ public:
|
||||
return m_descriptor;
|
||||
}
|
||||
|
||||
// can be called if a file matching supportedFileTypes should be
|
||||
// loaded/processed with the help of this plugin
|
||||
virtual void loadFile( const QString & _file );
|
||||
// can be called if a resource supported by this plugin should be
|
||||
// loaded/processed by this plugin
|
||||
virtual void loadResource( const ResourceItem * _resourceItem );
|
||||
|
||||
// Called if external source needs to change something but we cannot
|
||||
// reference the class header. Should return null if not key not found.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* plugin.cpp - implementation of plugin-class including plugin-loader
|
||||
*
|
||||
@@ -77,7 +75,7 @@ plugin::~plugin()
|
||||
|
||||
|
||||
|
||||
void plugin::loadFile( const QString & )
|
||||
void plugin::loadResource( const ResourceItem * )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -229,4 +227,3 @@ QDomElement plugin::descriptor::subPluginFeatures::key::saveXML(
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user