RemotePlugin: added QSTR_TO_STDSTR macro and use it in LVSL/ZASF

QString::toStdString() is not aware of locale specific characters (it
just converts to ASCII). Therefore added new macro QSTR_TO_STDSTR which
converts a QString to std::string with UTF8 characters.

Use this new macro in LMMS VST Support Layer and ZynAddSubFX plugin.
This fixes for example VST plugins not being loaded when the path to
the DLL contains non-ASCII (e.g. cyrillic) characters.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit f3e13c4427)
This commit is contained in:
Tobias Doerffel
2009-07-29 17:05:57 +02:00
parent 54dadfcf48
commit 42b1584cbe
3 changed files with 20 additions and 15 deletions

View File

@@ -1138,4 +1138,6 @@ void remotePluginClient::doProcessing( void )
#endif
#define QSTR_TO_STDSTR(s) std::string( s.toUtf8().constData() )
#endif

View File

@@ -111,7 +111,7 @@ vstPlugin::vstPlugin( const QString & _plugin ) :
(void) target->winId();
sendMessage( message( IdVstPluginWindowInformation ).
addString( t.toStdString() ) );
addString( QSTR_TO_STDSTR( t ) ) );
#endif
VstHostLanguages hlang = LanguageEnglish;
@@ -133,7 +133,7 @@ vstPlugin::vstPlugin( const QString & _plugin ) :
p = configManager::inst()->vstDir() + QDir::separator() + p;
}
sendMessage( message( IdVstLoadPlugin ).addString( p.toStdString() ) );
sendMessage( message( IdVstLoadPlugin ).addString( QSTR_TO_STDSTR( p ) ) );
waitForInitDone();
@@ -423,8 +423,9 @@ void vstPlugin::loadChunk( const QByteArray & _chunk )
tf.write( _chunk );
lock();
sendMessage( message( IdLoadSettingsFromFile ).
addString( QDir::toNativeSeparators(
tf.fileName() ).toStdString() ).
addString(
QSTR_TO_STDSTR(
QDir::toNativeSeparators( tf.fileName() ) ) ).
addInt( _chunk.size() ) );
waitForMessage( IdLoadSettingsFromFile );
unlock();
@@ -442,8 +443,9 @@ QByteArray vstPlugin::saveChunk( void )
{
lock();
sendMessage( message( IdSaveSettingsToFile ).
addString( QDir::toNativeSeparators(
tf.fileName() ).toStdString() ) );
addString(
QSTR_TO_STDSTR(
QDir::toNativeSeparators( tf.fileName() ) ) ) );
waitForMessage( IdSaveSettingsToFile );
unlock();
a = tf.readAll();

View File

@@ -103,8 +103,9 @@ void zynAddSubFx::saveSettings( QDomDocument & _doc,
m_plugin->lock();
m_plugin->sendMessage(
remotePlugin::message( IdSaveSettingsToFile ).
addString( QDir::toNativeSeparators(
tf.fileName() ).toStdString() ) );
addString(
QSTR_TO_STDSTR(
QDir::toNativeSeparators( tf.fileName() ) ) ) );
m_plugin->waitForMessage( IdSaveSettingsToFile );
m_plugin->unlock();
QByteArray a = tf.readAll();
@@ -144,8 +145,9 @@ void zynAddSubFx::loadSettings( const QDomElement & _this )
m_plugin->lock();
m_plugin->sendMessage(
remotePlugin::message( IdLoadSettingsFromFile ).
addString( QDir::toNativeSeparators(
tf.fileName() ).toStdString() ) );
addString(
QSTR_TO_STDSTR(
QDir::toNativeSeparators( tf.fileName() ) ) ) );
m_plugin->waitForMessage( IdLoadSettingsFromFile );
m_plugin->unlock();
@@ -161,7 +163,7 @@ void zynAddSubFx::loadFile( const QString & _file )
m_plugin->lock();
m_plugin->sendMessage(
remotePlugin::message( IdLoadPresetFromFile ).
addString( _file.toStdString() ) );
QSTR_TO_STD_STR( _file ) );
m_plugin->waitForMessage( IdLoadPresetFromFile );
m_plugin->unlock();
@@ -230,10 +232,9 @@ void zynAddSubFx::initRemotePlugin( void )
m_plugin->sendMessage(
remotePlugin::message( IdZasfPresetDirectory ).
addString(
( configManager::inst()->factoryPresetsDir() +
QDir::separator() + "ZynAddSubFX" ).
toStdString() ) );
addString(
QSTR_TO_STDSTR( configManager::inst()->factoryPresetsDir() +
QDir::separator() + "ZynAddSubFX" ) ) );
m_plugin->unlock();
}