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