From 6b398256652a2f47491a335db27e781c67082837 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 26 Jan 2008 13:19:35 +0000 Subject: [PATCH] bug fix with init file parsing --- src/llconclientdlgbase.ui | 2 +- src/settings.cpp | 48 ++++++++++++++++++++------------------- src/settings.h | 3 --- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/llconclientdlgbase.ui b/src/llconclientdlgbase.ui index d255ab70..d5527f1c 100755 --- a/src/llconclientdlgbase.ui +++ b/src/llconclientdlgbase.ui @@ -547,8 +547,8 @@ Fader LineEditServerAddr - PushButtonConnect LineEditFaderTag + PushButtonConnect SliderAudReverb RadioButtonRevSelL RadioButtonRevSelR diff --git a/src/settings.cpp b/src/settings.cpp index 9ff4c83f..03d74870 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -30,7 +30,7 @@ void CSettings::ReadIniFile ( const QString& sFileName ) { int iValue; bool bValue; - QDomDocument IniXMLDocument ( INIT_XML_ROOT_NAME ); + QDomDocument IniXMLDocument; // load data from init-file // prepare file name for loading initialization data from XML file @@ -45,62 +45,64 @@ void CSettings::ReadIniFile ( const QString& sFileName ) QFile file ( sCurFileName ); if ( file.open ( QIODevice::ReadOnly ) ) { - IniXMLDocument.setContent ( &file ); + QTextStream in ( &file ); + IniXMLDocument.setContent ( in.readAll(), false ); + file.close(); } // actual settings data --------------------------------------------------- // IP address - pClient->strIPAddress = GetIniSetting ( IniXMLDocument, "Client", "ipaddress" ); + pClient->strIPAddress = GetIniSetting ( IniXMLDocument, "client", "ipaddress" ); // name - pClient->strName = GetIniSetting ( IniXMLDocument, "Client", "name" ); + pClient->strName = GetIniSetting ( IniXMLDocument, "client", "name" ); // audio fader - if ( GetNumericIniSet ( IniXMLDocument, "Client", "audfad", 0, AUD_FADER_IN_MAX, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "audfad", 0, AUD_FADER_IN_MAX, iValue ) ) { pClient->SetAudioInFader ( iValue ); } // reverberation level - if ( GetNumericIniSet ( IniXMLDocument, "Client", "revlev", 0, AUD_REVERB_MAX, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "revlev", 0, AUD_REVERB_MAX, iValue ) ) { pClient->SetReverbLevel ( iValue ); } // reverberation channel assignment - if ( GetFlagIniSet ( IniXMLDocument, "Client", "reverblchan", bValue ) ) + if ( GetFlagIniSet ( IniXMLDocument, "client", "reverblchan", bValue ) ) { pClient->SetReverbOnLeftChan ( bValue ); } // sound card in number of buffers - if ( GetNumericIniSet ( IniXMLDocument, "Client", "audinbuf", 0, AUD_SLIDER_LENGTH, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "audinbuf", 0, AUD_SLIDER_LENGTH, iValue ) ) { pClient->GetSndInterface()->SetInNumBuf( iValue ); } // sound card out number of buffers - if ( GetNumericIniSet ( IniXMLDocument, "Client", "audoutbuf", 0, AUD_SLIDER_LENGTH, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "audoutbuf", 0, AUD_SLIDER_LENGTH, iValue ) ) { pClient->GetSndInterface()->SetOutNumBuf ( iValue ); } // network jitter buffer size - if ( GetNumericIniSet ( IniXMLDocument, "Client", "jitbuf", 0, MAX_NET_BUF_SIZE_NUM_BL, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "jitbuf", 0, MAX_NET_BUF_SIZE_NUM_BL, iValue ) ) { pClient->SetSockBufSize ( iValue ); } // network buffer size factor in - if ( GetNumericIniSet ( IniXMLDocument, "Client", "netwbusifactin", 1, MAX_NET_BLOCK_SIZE_FACTOR, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "netwbusifactin", 1, MAX_NET_BLOCK_SIZE_FACTOR, iValue ) ) { pClient->SetNetwBufSizeFactIn ( iValue ); } // network buffer size factor out - if ( GetNumericIniSet ( IniXMLDocument, "Client", "netwbusifactout", 1, MAX_NET_BLOCK_SIZE_FACTOR, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "netwbusifactout", 1, MAX_NET_BLOCK_SIZE_FACTOR, iValue ) ) { pClient->SetNetwBufSizeFactOut ( iValue ); } @@ -109,39 +111,39 @@ void CSettings::ReadIniFile ( const QString& sFileName ) void CSettings::WriteIniFile ( const QString& sFileName ) { // create XML document for storing initialization parameters - QDomDocument IniXMLDocument ( INIT_XML_ROOT_NAME ); + QDomDocument IniXMLDocument; // actual settings data --------------------------------------------------- // IP address - PutIniSetting ( IniXMLDocument, "Client", "ipaddress", pClient->strIPAddress ); + PutIniSetting ( IniXMLDocument, "client", "ipaddress", pClient->strIPAddress ); // name - PutIniSetting ( IniXMLDocument, "Client", "name", pClient->strName ); + PutIniSetting ( IniXMLDocument, "client", "name", pClient->strName ); // audio fader - SetNumericIniSet ( IniXMLDocument, "Client", "audfad", pClient->GetAudioInFader() ); + SetNumericIniSet ( IniXMLDocument, "client", "audfad", pClient->GetAudioInFader() ); // reverberation level - SetNumericIniSet ( IniXMLDocument, "Client", "revlev", pClient->GetReverbLevel() ); + SetNumericIniSet ( IniXMLDocument, "client", "revlev", pClient->GetReverbLevel() ); // reverberation channel assignment - SetFlagIniSet ( IniXMLDocument, "Client", "reverblchan", pClient->IsReverbOnLeftChan() ); + SetFlagIniSet ( IniXMLDocument, "client", "reverblchan", pClient->IsReverbOnLeftChan() ); // sound card in number of buffers - SetNumericIniSet ( IniXMLDocument, "Client", "audinbuf", pClient->GetSndInterface()->GetInNumBuf() ); + SetNumericIniSet ( IniXMLDocument, "client", "audinbuf", pClient->GetSndInterface()->GetInNumBuf() ); // sound card out number of buffers - SetNumericIniSet ( IniXMLDocument, "Client", "audoutbuf", pClient->GetSndInterface()->GetOutNumBuf() ); + SetNumericIniSet ( IniXMLDocument, "client", "audoutbuf", pClient->GetSndInterface()->GetOutNumBuf() ); // network jitter buffer size - SetNumericIniSet ( IniXMLDocument, "Client", "jitbuf", pClient->GetSockBufSize() ); + SetNumericIniSet ( IniXMLDocument, "client", "jitbuf", pClient->GetSockBufSize() ); // network buffer size factor in - SetNumericIniSet ( IniXMLDocument, "Client", "netwbusifactin", pClient->GetNetwBufSizeFactIn() ); + SetNumericIniSet ( IniXMLDocument, "client", "netwbusifactin", pClient->GetNetwBufSizeFactIn() ); // network buffer size factor out - SetNumericIniSet ( IniXMLDocument, "Client", "netwbusifactout", pClient->GetNetwBufSizeFactOut() ); + SetNumericIniSet ( IniXMLDocument, "client", "netwbusifactout", pClient->GetNetwBufSizeFactOut() ); // prepare file name for storing initialization data in XML file diff --git a/src/settings.h b/src/settings.h index 8c9e6e55..ea8aba31 100755 --- a/src/settings.h +++ b/src/settings.h @@ -36,9 +36,6 @@ // name of the init-file #define LLCON_INIT_FILE_NAME "llcon.ini" -// XML document root name -#define INIT_XML_ROOT_NAME "Llcon Init File" - /* Classes ********************************************************************/ class CSettings