diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index d34a2718..0fe9b578 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -80,13 +80,13 @@ void CChannelFader::OnValueChanged ( int value ) emit valueChanged ( dCurGain ); } -void CChannelFader::SetText ( const std::string sText ) +void CChannelFader::SetText ( const QString sText ) { const int iBreakPos = 7; // break text at predefined position, if text is too short, break anyway to // make sure we have two lines for fader tag - QString sModText = sText.c_str(); + QString sModText = sText; if ( sModText.length() > iBreakPos ) { @@ -187,14 +187,14 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecCh } } -std::string CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo ) +QString CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo ) { // if text is empty, show IP address instead - if ( ChanInfo.strName.empty() ) + if ( ChanInfo.strName.isEmpty() ) { // convert IP address to text and show it const QHostAddress addrTest ( ChanInfo.iIpAddr ); - return std::string ( addrTest.toString().toStdString() ); + return addrTest.toString(); } else { diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 6bd3a004..558e1c1b 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -34,6 +34,7 @@ #include #include #include +#include #include "global.h" #include "util.h" @@ -58,7 +59,7 @@ public: // TODO get rid of pMainGrid } - void SetText ( const std::string sText ); + void SetText ( const QString sText ); void Show() { pLabel->show(); pFader->show(); } void Hide() { pLabel->hide(); pFader->hide(); } bool IsVisible() { return pLabel->isVisible(); } @@ -90,7 +91,7 @@ public: void ApplyNewConClientList ( CVector& vecChanInfo ); protected: - std::string GenFaderText ( CChannelShortInfo& ChanInfo ); + QString GenFaderText ( CChannelShortInfo& ChanInfo ); CVector vecpChanFader; QHBoxLayout* pMainLayout; diff --git a/src/channel.cpp b/src/channel.cpp index bd532b13..9ca4776e 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -362,7 +362,7 @@ void CChannelSet::GetBlockAllConC ( CVector& vecChanID, } void CChannelSet::GetConCliParam ( CVector& vecHostAddresses, - CVector& vecsName, + CVector& vecsName, CVector& veciJitBufSize, CVector& veciNetwOutBlSiFact, CVector& veciNetwInBlSiFact ) @@ -449,8 +449,8 @@ CChannel::CChannel() : sName ( "" ), QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ), this, SLOT ( OnChangeChanGain ( int, double ) ) ); - QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( std::string ) ), - this, SLOT ( OnChangeChanName ( std::string ) ) ); + QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ), + this, SLOT ( OnChangeChanName ( QString ) ) ); } void CChannel::SetEnable ( const bool bNEnStat ) @@ -555,7 +555,7 @@ void CChannel::OnChangeChanGain ( int iChanID, double dNewGain ) vecdGains[iChanID] = dNewGain; } -void CChannel::OnChangeChanName ( std::string strName ) +void CChannel::OnChangeChanName ( QString strName ) { // apply value (if different from previous name) if ( sName.compare ( strName ) ) diff --git a/src/channel.h b/src/channel.h index 31181af4..4d594567 100755 --- a/src/channel.h +++ b/src/channel.h @@ -87,10 +87,10 @@ public: bool GetAddress ( CHostAddress& RetAddr ); CHostAddress GetAddress() { return InetAddr; } - void SetName ( const std::string sNNa ) { sName = sNNa; } - std::string GetName() { return sName; } + void SetName ( const QString sNNa ) { sName = sNNa; } + QString GetName() { return sName; } - void SetRemoteName ( const std::string strName ) + void SetRemoteName ( const QString strName ) { Protocol.CreateChanNameMes ( strName ); } void SetGain ( const int iNID, const double dNG ) { vecdGains[iNID] = dNG; } @@ -150,7 +150,7 @@ protected: CHostAddress InetAddr; // channel name - std::string sName; + QString sName; // mixer and effect settings CVector vecdGains; @@ -182,7 +182,7 @@ public slots: void OnJittBufSizeChange ( int iNewJitBufSize ); void OnNetwBlSiFactChange ( int iNewNetwBlSiFact ); void OnChangeChanGain ( int iChanID, double dNewGain ); - void OnChangeChanName ( std::string strName ); + void OnChangeChanName ( QString strName ); signals: void MessReadyForSending ( CVector vecMessage ); @@ -216,7 +216,7 @@ public: CVector >& vecvecdGains ); void GetConCliParam ( CVector& vecHostAddresses, - CVector& vecsName, + CVector& vecsName, CVector& veciJitBufSize, CVector& veciNetwOutBlSiFact, CVector& veciNetwInBlSiFact ); diff --git a/src/client.h b/src/client.h index b7564c7f..858c1347 100755 --- a/src/client.h +++ b/src/client.h @@ -123,8 +123,8 @@ public: // settings - std::string strIPAddress; - std::string strName; + QString strIPAddress; + QString strName; protected: virtual void run(); diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 0039d0c1..86db18ae 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -88,10 +88,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent ) "red color." ) ); // init fader tag line edit - LineEditFaderTag->setText ( pClient->strName.c_str() ); + LineEditFaderTag->setText ( pClient->strName ); // init server address line edit - LineEditServerAddr->setText ( pClient->strIPAddress.c_str() ); + LineEditServerAddr->setText ( pClient->strIPAddress ); // we want the cursor to be at IP address line edit at startup LineEditServerAddr->setFocus(); @@ -208,10 +208,10 @@ CLlconClientDlg::~CLlconClientDlg() void CLlconClientDlg::closeEvent ( QCloseEvent * Event ) { // store IP address - pClient->strIPAddress = LineEditServerAddr->text().toStdString(); + pClient->strIPAddress = LineEditServerAddr->text(); // store fader tag - pClient->strName = LineEditFaderTag->text().toStdString(); + pClient->strName = LineEditFaderTag->text(); // default implementation of this event handler routine Event->accept(); @@ -276,7 +276,7 @@ void CLlconClientDlg::OnOpenGeneralSettings() void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName ) { // refresh internal name parameter - pClient->strName = strNewName.toStdString(); + pClient->strName = strNewName; // update name at server pClient->SetRemoteName(); diff --git a/src/llconserverdlg.cpp b/src/llconserverdlg.cpp index 685a3889..40e294f2 100755 --- a/src/llconserverdlg.cpp +++ b/src/llconserverdlg.cpp @@ -91,7 +91,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent ) void CLlconServerDlg::OnTimer() { CVector vecHostAddresses; - CVector vecsName; + CVector vecsName; CVector veciJitBufSize; CVector veciNetwOutBlSiFact; CVector veciNetwInBlSiFact; @@ -113,7 +113,7 @@ void CLlconServerDlg::OnTimer() vecHostAddresses[i].iPort ) /* IP, port */); // name - vecpListViewItems[i]->setText ( 1, vecsName[i].c_str() ); + vecpListViewItems[i]->setText ( 1, vecsName[i] ); // jitter buffer size (polling for updates) vecpListViewItems[i]->setText ( 4, diff --git a/src/protocol.cpp b/src/protocol.cpp index 5cb8ff4c..75201a38 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -515,7 +515,7 @@ void CProtocol::CreateConClientListMes ( const CVector& vecCh { // byte-by-byte copying of the string data PutValOnStream ( vecData, iPos, - static_cast ( vecChanInfo[i].strName[j] ), 1 ); + static_cast ( vecChanInfo[i].strName[j].toAscii() ), 1 ); } } @@ -525,7 +525,7 @@ void CProtocol::CreateConClientListMes ( const CVector& vecCh void CProtocol::EvaluateConClientListMes ( unsigned int iPos, const CVector& vecData ) { int iData; - const int iDataLen = vecData.Size(); + const unsigned int iDataLen = vecData.Size(); CVector vecChanInfo ( 0 ); while ( iPos < iDataLen ) @@ -541,12 +541,12 @@ void CProtocol::EvaluateConClientListMes ( unsigned int iPos, const CVector ( GetValFromStream ( vecData, iPos, 2 ) ); // name string (n bytes) - std::string strCurStr = ""; + QString strCurStr = ""; for ( int j = 0; j < iStringLen; j++ ) { // byte-by-byte copying of the string data iData = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); - strCurStr += std::string ( (char*) &iData ); + strCurStr += QString ( (char*) &iData ); } // add channel information to vector @@ -568,7 +568,7 @@ void CProtocol::EvaluateReqConnClientsList ( unsigned int iPos, const CVector ( strName[j] ), 1 ); + static_cast ( strName[j].toAscii() ), 1 ); } CreateAndSendMessage ( PROTMESSID_CHANNEL_NAME, vecData ); @@ -600,12 +600,12 @@ void CProtocol::EvaluateChanNameMes ( unsigned int iPos, const CVector& static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); // name string (n bytes) - std::string strName = ""; + QString strName = ""; for ( int j = 0; j < iStrLen; j++ ) { // byte-by-byte copying of the string data int iData = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); - strName += std::string ( (char*) &iData ); + strName += QString ( (char*) &iData ); } // invoke message action @@ -706,7 +706,7 @@ uint32_t CProtocol::GetValFromStream ( const CVector& vecIn, Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); uint32_t iRet = 0; - for ( int i = 0; i < iNumOfBytes; i++ ) + for ( unsigned int i = 0; i < iNumOfBytes; i++ ) { iRet |= vecIn[iPos] << ( i * 8 /* size of byte */ ); iPos++; @@ -784,7 +784,7 @@ void CProtocol::PutValOnStream ( CVector& vecIn, Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) ); Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); - for ( int i = 0; i < iNumOfBytes; i++ ) + for ( unsigned int i = 0; i < iNumOfBytes; i++ ) { vecIn[iPos] = ( iVal >> ( i * 8 /* size of byte */ ) ) & 255 /* 11111111 */; diff --git a/src/protocol.h b/src/protocol.h index 522cd1d7..b194a807 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -69,7 +69,7 @@ public: void CreateServerFullMes(); void CreateNetwBlSiFactMes ( const int iNetwBlSiFact ); void CreateChanGainMes ( const int iChanID, const double dGain ); - void CreateChanNameMes ( const std::string strName ); + void CreateChanNameMes ( const QString strName ); void CreateConClientListMes ( const CVector& vecChanInfo ); @@ -160,7 +160,7 @@ signals: void ChangeJittBufSize ( int iNewJitBufSize ); void ChangeNetwBlSiFact ( int iNewNetwBlSiFact ); void ChangeChanGain ( int iChanID, double dNewGain ); - void ChangeChanName ( std::string strName ); + void ChangeChanName ( QString strName ); void ConClientListMesReceived ( CVector vecChanInfo ); void ReqJittBufSize(); void ReqConnClientsList(); diff --git a/src/server.h b/src/server.h index eeb3813d..e9538f36 100755 --- a/src/server.h +++ b/src/server.h @@ -49,7 +49,7 @@ public: bool IsRunning() { return Timer.isActive(); } void GetConCliParam ( CVector& vecHostAddresses, - CVector& vecsName, + CVector& vecsName, CVector& veciJitBufSize, CVector& veciNetwOutBlSiFact, CVector& veciNetwInBlSiFact ) { diff --git a/src/settings.cpp b/src/settings.cpp index e9660194..16d07b99 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -58,10 +58,10 @@ void CSettings::ReadIniFile ( std::string sFileName ) } // IP address - pClient->strIPAddress = GetIniSetting ( ini, "Client", "ipaddress" ); + pClient->strIPAddress = GetIniSetting ( ini, "Client", "ipaddress" ).c_str(); // name - pClient->strName = GetIniSetting ( ini, "Client", "name" ); + pClient->strName = GetIniSetting ( ini, "Client", "name" ).c_str(); // audio fader if ( GetNumericIniSet ( ini, "Client", "audfad", 0, AUD_FADER_IN_MAX, iValue ) == TRUE ) @@ -117,10 +117,10 @@ void CSettings::WriteIniFile ( std::string sFileName ) INIFile ini; // IP address - PutIniSetting ( ini, "Client", "ipaddress", pClient->strIPAddress.c_str() ); + PutIniSetting ( ini, "Client", "ipaddress", pClient->strIPAddress.toStdString().c_str() ); // name - PutIniSetting ( ini, "Client", "name", pClient->strName.c_str() ); + PutIniSetting ( ini, "Client", "name", pClient->strName.toStdString().c_str() ); // audio fader SetNumericIniSet ( ini, "Client", "audfad", pClient->GetAudioInFader() ); @@ -248,15 +248,15 @@ void CSettings::SetFlagIniSet ( INIFile& theINI, string strSection, string strKe #pragma warning ( disable : 4786 4503 ) #endif -string CSettings::GetIniSetting ( CSettings::INIFile& theINI, const char* section, - const char* key, const char* defaultval ) +std::string CSettings::GetIniSetting ( CSettings::INIFile& theINI, const char* section, + const char* key, const char* defaultval ) { - string result ( defaultval ); - INIFile::iterator iSection = theINI.find ( string ( section ) ); + std::string result ( defaultval ); + INIFile::iterator iSection = theINI.find ( std::string ( section ) ); if ( iSection != theINI.end() ) { - INISection::iterator apair = iSection->second.find ( string ( key ) ); + INISection::iterator apair = iSection->second.find ( std::string ( key ) ); if ( apair != iSection->second.end() ) { @@ -273,18 +273,18 @@ void CSettings::PutIniSetting ( CSettings::INIFile &theINI, const char *section, INIFile::iterator iniSection; INISection::iterator apair; - if ( ( iniSection = theINI.find ( string ( section ) ) ) == theINI.end() ) + if ( ( iniSection = theINI.find ( std::string ( section ) ) ) == theINI.end() ) { - /* No such section? Then add one */ + // no such section? Then add one INISection newsection; if (key) { newsection.insert ( - std::pair ( string ( key ), string ( value ) ) ); + std::pair ( std::string ( key ), std::string ( value ) ) ); } theINI.insert ( - std::pair ( string ( section ), newsection ) ); + std::pair ( std::string ( section ), newsection ) ); } else { @@ -299,7 +299,7 @@ void CSettings::PutIniSetting ( CSettings::INIFile &theINI, const char *section, } iniSection->second.insert ( - std::pair ( string ( key ), string ( value ) ) ); + std::pair ( std::string ( key ), std::string ( value ) ) ); } } } @@ -308,7 +308,7 @@ CSettings::INIFile CSettings::LoadIni ( const char* filename ) { INIFile theINI; char *value, *temp; - string section; + std::string section; char buffer[MAX_INI_LINE]; std::fstream file ( filename, std::ios::in ); @@ -319,35 +319,35 @@ CSettings::INIFile CSettings::LoadIni ( const char* filename ) if ( ( temp = strchr ( buffer, '\n' ) ) ) { - *temp = '\0'; /* Cut off at newline */ + *temp = '\0'; // cut off at newline } if ( ( temp = strchr ( buffer, '\r' ) ) ) { - *temp = '\0'; /* Cut off at linefeeds */ + *temp = '\0'; // cut off at linefeeds } if ( ( buffer[0] == '[' ) && ( temp = strrchr ( buffer, ']' ) ) ) - { /* if line is like --> [section name] */ - *temp = '\0'; /* Chop off the trailing ']' */ + { // if line is like --> [section name] + *temp = '\0'; // chop off the trailing ']' section = &buffer[1]; - PutIniSetting ( theINI, &buffer[1] ); /* Start new section */ + PutIniSetting ( theINI, &buffer[1] ); // start new section } else { if ( buffer[0] && ( value = strchr ( buffer, '=' ) ) ) { - /* Assign whatever follows = sign to value, chop at "=" */ + // assign whatever follows = sign to value, chop at "=" *value++ = '\0'; - /* And add both sides to INISection */ + // and add both sides to INISection PutIniSetting ( theINI, section.c_str(), buffer, value ); } else { if ( buffer[0] ) { - /* Must be a comment or something */ + // must be a comment or something PutIniSetting ( theINI, section.c_str(), buffer, "" ); } } @@ -359,7 +359,7 @@ CSettings::INIFile CSettings::LoadIni ( const char* filename ) void CSettings::SaveIni ( CSettings::INIFile &theINI, const char* filename ) { - bool bFirstSection = TRUE; /* Init flag */ + bool bFirstSection = TRUE; // init flag std::fstream file ( filename, std::ios::out ); if ( !file.good() ) @@ -367,7 +367,7 @@ void CSettings::SaveIni ( CSettings::INIFile &theINI, const char* filename ) return; } - /* Just iterate the hashes and values and dump them to a file */ + // just iterate the hashes and values and dump them to a file INIFile::iterator section = theINI.begin(); while ( section != theINI.end() ) { @@ -375,10 +375,10 @@ void CSettings::SaveIni ( CSettings::INIFile &theINI, const char* filename ) { if ( bFirstSection == TRUE ) { - /* Don't put a newline at the beginning of the first section */ + // do not put a newline at the beginning of the first section file << "[" << section->first << "]" << std::endl; - /* Reset flag */ + // reset flag bFirstSection = FALSE; } else @@ -408,8 +408,8 @@ void CSettings::SaveIni ( CSettings::INIFile &theINI, const char* filename ) /* Return true or false depending on whether the first string is less than the second */ -bool CSettings::StlIniCompareStringNoCase::operator() ( const string& x, - const string& y ) const +bool CSettings::StlIniCompareStringNoCase::operator() ( const std::string& x, + const std::string& y ) const { #ifdef WIN32 return ( stricmp ( x.c_str(), y.c_str() ) < 0 ) ? true : false; diff --git a/src/settings.h b/src/settings.h index 1ffe1612..ea2edb21 100755 --- a/src/settings.h +++ b/src/settings.h @@ -61,24 +61,24 @@ protected: }; // these typedefs just make the code a bit more readable - typedef std::map INISection; + typedef std::map INISection; typedef std::map INIFile; - string GetIniSetting( INIFile& theINI, const char* pszSection, - const char* pszKey, const char* pszDefaultVal = "" ); + std::string GetIniSetting( INIFile& theINI, const char* pszSection, + const char* pszKey, const char* pszDefaultVal = "" ); void PutIniSetting ( INIFile &theINI, const char *pszSection, const char* pszKey = NULL, const char* pszValue = "" ); void SaveIni ( INIFile& theINI, const char* pszFilename ); INIFile LoadIni ( const char* pszFilename ); - void SetNumericIniSet ( INIFile& theINI, string strSection, string strKey, + void SetNumericIniSet ( INIFile& theINI, std::string strSection, std::string strKey, int iValue ); - bool GetNumericIniSet ( INIFile& theINI, string strSection, string strKey, + bool GetNumericIniSet ( INIFile& theINI, string strSection, std::string strKey, int iRangeStart, int iRangeStop, int& iValue ); - void SetFlagIniSet ( INIFile& theINI, string strSection, string strKey, + void SetFlagIniSet ( INIFile& theINI, std::string strSection, std::string strKey, bool bValue ); - bool GetFlagIniSet ( INIFile& theINI, string strSection, string strKey, + bool GetFlagIniSet ( INIFile& theINI, std::string strSection, std::string strKey, bool& bValue ); // pointer to the client object needed for the various settings diff --git a/src/util.h b/src/util.h index b8186319..a91b8971 100755 --- a/src/util.h +++ b/src/util.h @@ -381,12 +381,12 @@ class CChannelShortInfo { public: CChannelShortInfo() : iChanID ( 0 ), iIpAddr ( 0 ), strName ( "" ) {} - CChannelShortInfo ( const int iNID, const uint32_t nIP, const std::string nN ) : + CChannelShortInfo ( const int iNID, const quint32 nIP, const QString nN ) : iChanID ( iNID ), iIpAddr ( nIP ), strName ( nN ) {} - int iChanID; - uint32_t iIpAddr; - std::string strName; + int iChanID; + quint32 iIpAddr; + QString strName; }; diff --git a/windows/sound.cpp b/windows/sound.cpp index ae5c4235..4387d5ce 100755 --- a/windows/sound.cpp +++ b/windows/sound.cpp @@ -42,7 +42,7 @@ bool loadAsioDriver ( char *name ); bool CSound::Read ( CVector& psData ) { int i; - bool bError; + bool bError = false; // check if device must be opened or reinitialized if ( bChangParamIn == TRUE ) diff --git a/windows/sound.h b/windows/sound.h index f5e0b660..0863d08c 100755 --- a/windows/sound.h +++ b/windows/sound.h @@ -35,7 +35,7 @@ /* Definitions ****************************************************************/ // switch here between ASIO (Steinberg) or native Windows(TM) sound interface -#undef USE_ASIO_SND_INTERFACE +//#undef USE_ASIO_SND_INTERFACE #define USE_ASIO_SND_INTERFACE