bug fix: support for correct utf-8 storage of names in the ini-file
This commit is contained in:
parent
a0c318eeec
commit
9a2efd25fe
3 changed files with 36 additions and 22 deletions
|
@ -7,6 +7,8 @@
|
||||||
- the solo state of a mixer fader is not exclusive any more and the solo
|
- the solo state of a mixer fader is not exclusive any more and the solo
|
||||||
state is preserved if the number of mixer faders changes
|
state is preserved if the number of mixer faders changes
|
||||||
|
|
||||||
|
- bug fix: support for correct utf-8 storage of names in the ini-file
|
||||||
|
|
||||||
|
|
||||||
3.3.2
|
3.3.2
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,9 @@ void CSettings::Load()
|
||||||
// stored fader tags
|
// stored fader tags
|
||||||
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
|
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
|
||||||
{
|
{
|
||||||
pClient->vecStoredFaderTags[iIdx] =
|
pClient->vecStoredFaderTags[iIdx] = FromBase64ToString (
|
||||||
GetIniSetting ( IniXMLDocument, "client",
|
GetIniSetting ( IniXMLDocument, "client",
|
||||||
QString ( "storedfadertag%1" ).arg ( iIdx ), "" );
|
QString ( "storedfadertag%1_base64" ).arg ( iIdx ), "" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// stored fader levels
|
// stored fader levels
|
||||||
|
@ -81,13 +81,12 @@ void CSettings::Load()
|
||||||
0, AUD_MIX_FADER_MAX, iValue ) )
|
0, AUD_MIX_FADER_MAX, iValue ) )
|
||||||
{
|
{
|
||||||
pClient->vecStoredFaderLevels[iIdx] = iValue;
|
pClient->vecStoredFaderLevels[iIdx] = iValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// name
|
// name
|
||||||
pClient->ChannelInfo.strName =
|
pClient->ChannelInfo.strName = FromBase64ToString (
|
||||||
GetIniSetting ( IniXMLDocument, "client", "name" );
|
GetIniSetting ( IniXMLDocument, "client", "name_base64" ) );
|
||||||
|
|
||||||
// instrument
|
// instrument
|
||||||
if ( GetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
if ( GetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
||||||
|
@ -236,20 +235,20 @@ void CSettings::Load()
|
||||||
}
|
}
|
||||||
|
|
||||||
// window position of the main window
|
// window position of the main window
|
||||||
pClient->vecWindowPosMain = FromBase64 (
|
pClient->vecWindowPosMain = FromBase64ToByteArray (
|
||||||
GetIniSetting ( IniXMLDocument, "client", "winposmain" ) );
|
GetIniSetting ( IniXMLDocument, "client", "winposmain_base64" ) );
|
||||||
|
|
||||||
// window position of the settings window
|
// window position of the settings window
|
||||||
pClient->vecWindowPosSettings = FromBase64 (
|
pClient->vecWindowPosSettings = FromBase64ToByteArray (
|
||||||
GetIniSetting ( IniXMLDocument, "client", "winposset" ) );
|
GetIniSetting ( IniXMLDocument, "client", "winposset_base64" ) );
|
||||||
|
|
||||||
// window position of the chat window
|
// window position of the chat window
|
||||||
pClient->vecWindowPosChat = FromBase64 (
|
pClient->vecWindowPosChat = FromBase64ToByteArray (
|
||||||
GetIniSetting ( IniXMLDocument, "client", "winposchat" ) );
|
GetIniSetting ( IniXMLDocument, "client", "winposchat_base64" ) );
|
||||||
|
|
||||||
// window position of the connect window
|
// window position of the connect window
|
||||||
pClient->vecWindowPosConnect = FromBase64 (
|
pClient->vecWindowPosConnect = FromBase64ToByteArray (
|
||||||
GetIniSetting ( IniXMLDocument, "client", "winposcon" ) );
|
GetIniSetting ( IniXMLDocument, "client", "winposcon_base64" ) );
|
||||||
|
|
||||||
// visibility state of the settings window
|
// visibility state of the settings window
|
||||||
if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisset", bValue ) )
|
if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisset", bValue ) )
|
||||||
|
@ -335,8 +334,8 @@ void CSettings::Save()
|
||||||
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
|
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
|
||||||
{
|
{
|
||||||
PutIniSetting ( IniXMLDocument, "client",
|
PutIniSetting ( IniXMLDocument, "client",
|
||||||
QString ( "storedfadertag%1" ).arg ( iIdx ),
|
QString ( "storedfadertag%1_base64" ).arg ( iIdx ),
|
||||||
pClient->vecStoredFaderTags[iIdx] );
|
ToBase64 ( pClient->vecStoredFaderTags[iIdx] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// stored fader levels
|
// stored fader levels
|
||||||
|
@ -348,8 +347,8 @@ void CSettings::Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
// name
|
// name
|
||||||
PutIniSetting ( IniXMLDocument, "client", "name",
|
PutIniSetting ( IniXMLDocument, "client", "name_base64",
|
||||||
pClient->ChannelInfo.strName );
|
ToBase64 ( pClient->ChannelInfo.strName ) );
|
||||||
|
|
||||||
// instrument
|
// instrument
|
||||||
SetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
SetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
||||||
|
@ -428,19 +427,19 @@ void CSettings::Save()
|
||||||
pClient->GetUseDefaultCentralServerAddress() );
|
pClient->GetUseDefaultCentralServerAddress() );
|
||||||
|
|
||||||
// window position of the main window
|
// window position of the main window
|
||||||
PutIniSetting ( IniXMLDocument, "client", "winposmain",
|
PutIniSetting ( IniXMLDocument, "client", "winposmain_base64",
|
||||||
ToBase64 ( pClient->vecWindowPosMain ) );
|
ToBase64 ( pClient->vecWindowPosMain ) );
|
||||||
|
|
||||||
// window position of the settings window
|
// window position of the settings window
|
||||||
PutIniSetting ( IniXMLDocument, "client", "winposset",
|
PutIniSetting ( IniXMLDocument, "client", "winposset_base64",
|
||||||
ToBase64 ( pClient->vecWindowPosSettings ) );
|
ToBase64 ( pClient->vecWindowPosSettings ) );
|
||||||
|
|
||||||
// window position of the chat window
|
// window position of the chat window
|
||||||
PutIniSetting ( IniXMLDocument, "client", "winposchat",
|
PutIniSetting ( IniXMLDocument, "client", "winposchat_base64",
|
||||||
ToBase64 ( pClient->vecWindowPosChat ) );
|
ToBase64 ( pClient->vecWindowPosChat ) );
|
||||||
|
|
||||||
// window position of the connect window
|
// window position of the connect window
|
||||||
PutIniSetting ( IniXMLDocument, "client", "winposcon",
|
PutIniSetting ( IniXMLDocument, "client", "winposcon_base64",
|
||||||
ToBase64 ( pClient->vecWindowPosConnect ) );
|
ToBase64 ( pClient->vecWindowPosConnect ) );
|
||||||
|
|
||||||
// visibility state of the settings window
|
// visibility state of the settings window
|
||||||
|
|
|
@ -53,10 +53,23 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void SetFileName ( const QString& sNFiName );
|
void SetFileName ( const QString& sNFiName );
|
||||||
|
|
||||||
|
// The following functions implement the conversion from the general string
|
||||||
|
// to base64 (which should be used for binary data in XML files). This
|
||||||
|
// enables arbitrary utf8 characters to be used as the names in the GUI.
|
||||||
|
//
|
||||||
|
// ATTENTION: The "FromBase64[...]" functions must be used with caution!
|
||||||
|
// The reason is that if the FromBase64ToByteArray() is used to
|
||||||
|
// assign the stored value to a QString, this is incorrect but
|
||||||
|
// will not generate a compile error since there is a default
|
||||||
|
// conversion available for QByteArray to QString.
|
||||||
QString ToBase64 ( const QByteArray strIn ) const
|
QString ToBase64 ( const QByteArray strIn ) const
|
||||||
{ return QString::fromLatin1 ( strIn.toBase64() ); }
|
{ return QString::fromLatin1 ( strIn.toBase64() ); }
|
||||||
QByteArray FromBase64 ( const QString strIn ) const
|
QString ToBase64 ( const QString strIn ) const
|
||||||
|
{ return ToBase64 ( strIn.toUtf8() ); }
|
||||||
|
QByteArray FromBase64ToByteArray ( const QString strIn ) const
|
||||||
{ return QByteArray::fromBase64 ( strIn.toLatin1() ); }
|
{ return QByteArray::fromBase64 ( strIn.toLatin1() ); }
|
||||||
|
QString FromBase64ToString ( const QString strIn ) const
|
||||||
|
{ return QString::fromUtf8 ( FromBase64ToByteArray ( strIn ) ); }
|
||||||
|
|
||||||
// init file access function for read/write
|
// init file access function for read/write
|
||||||
void SetNumericIniSet ( QDomDocument& xmlFile,
|
void SetNumericIniSet ( QDomDocument& xmlFile,
|
||||||
|
|
Loading…
Reference in a new issue