use XML rather than binary blobs for saving plugin-/effect-key

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1433 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-08-04 17:59:44 +00:00
parent df86b4c81e
commit 64188a9b52
14 changed files with 148 additions and 62 deletions

View File

@@ -2,7 +2,7 @@
* base64.h - namespace base64 with methods for encoding/decoding binary data
* to/from base64
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -47,7 +47,9 @@ namespace base64
*_data = new char[*_size];
memcpy( *_data, data.constData(), *_size );
}
// deprecated!!
QString encode( const QVariant & _data );
// for compatibility-code only
QVariant decode( const QString & _b64,
QVariant::Type _force_type = QVariant::Invalid );

View File

@@ -2,7 +2,7 @@
* ladspa_base.h - basic declarations concerning LADSPA
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -74,8 +74,11 @@ inline plugin::descriptor::subPluginFeatures::key ladspaKeyToSubPluginKey(
const QString & _name,
const ladspa_key_t & _key )
{
plugin::descriptor::subPluginFeatures::key::attributeMap m;
m["file"] = _key.first;
m["plugin"] = _key.second;
return( plugin::descriptor::subPluginFeatures::key( _desc, _name,
QVariant( QStringList() << _key.first << _key.second ) ) );
m ) );
}

View File

@@ -30,6 +30,7 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtXml/QDomDocument>
#include "journalling_object.h"
#include "mv_base.h"
@@ -76,42 +77,23 @@ public:
public:
struct key
{
typedef QMap<QString, QString> attributeMap;
inline key( plugin::descriptor * _desc = NULL,
const QString & _name = QString::null,
const QVariant & _user = QVariant() )
const attributeMap & _am =
attributeMap() )
:
desc( _desc ),
name( _name ),
user( _user )
attributes( _am )
{
}
inline key( const QString & _dump_data )
:
desc( NULL )
{
const QList<QVariant> l =
base64::decode( _dump_data,
QVariant::List ).
toList();
if( l.empty() )
{
name = QString::null;
user = QVariant();
}
else
{
name = l[0].toString();
user = l[1];
}
}
key( const QDomElement & _key );
inline QString dumpBase64( void ) const
{
return( base64::encode(
QList<QVariant>()
<< name << user ) );
}
QDomElement saveXML( QDomDocument &
_doc ) const;
inline bool isValid( void ) const
{
@@ -121,8 +103,8 @@ public:
plugin::descriptor * desc;
QString name;
QVariant user;
};
attributeMap attributes;
} ;
typedef QList<key> keyList;
@@ -140,8 +122,9 @@ public:
const key * )
{
}
virtual void listSubPluginKeys( plugin::descriptor *,
keyList & )
keyList & )
{
}
@@ -154,8 +137,9 @@ public:
protected:
const plugin::PluginTypes m_type;
}
* sub_plugin_features;
} ;
subPluginFeatures * sub_plugin_features;
} ;