some more work for QT4 port

This commit is contained in:
Volker Fischer 2008-01-22 21:15:04 +00:00
parent 23e9f8e3f4
commit 784383b6d5
15 changed files with 82 additions and 81 deletions

View file

@ -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<CChannelShortInfo>& 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
{

View file

@ -34,6 +34,7 @@
#include <qstring.h>
#include <qslider.h>
#include <qsizepolicy.h>
#include <qhostaddress.h>
#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<CChannelShortInfo>& vecChanInfo );
protected:
std::string GenFaderText ( CChannelShortInfo& ChanInfo );
QString GenFaderText ( CChannelShortInfo& ChanInfo );
CVector<CChannelFader*> vecpChanFader;
QHBoxLayout* pMainLayout;

View file

@ -362,7 +362,7 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
}
void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<std::string>& vecsName,
CVector<QString>& vecsName,
CVector<int>& veciJitBufSize,
CVector<int>& veciNetwOutBlSiFact,
CVector<int>& 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 ) )

View file

@ -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<double> 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<uint8_t> vecMessage );
@ -216,7 +216,7 @@ public:
CVector<CVector<double> >& vecvecdGains );
void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<std::string>& vecsName,
CVector<QString>& vecsName,
CVector<int>& veciJitBufSize,
CVector<int>& veciNetwOutBlSiFact,
CVector<int>& veciNetwInBlSiFact );

View file

@ -123,8 +123,8 @@ public:
// settings
std::string strIPAddress;
std::string strName;
QString strIPAddress;
QString strName;
protected:
virtual void run();

View file

@ -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();

View file

@ -91,7 +91,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
void CLlconServerDlg::OnTimer()
{
CVector<CHostAddress> vecHostAddresses;
CVector<std::string> vecsName;
CVector<QString> vecsName;
CVector<int> veciJitBufSize;
CVector<int> veciNetwOutBlSiFact;
CVector<int> 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,

View file

@ -515,7 +515,7 @@ void CProtocol::CreateConClientListMes ( const CVector<CChannelShortInfo>& vecCh
{
// byte-by-byte copying of the string data
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 )
{
int iData;
const int iDataLen = vecData.Size();
const unsigned int iDataLen = vecData.Size();
CVector<CChannelShortInfo> vecChanInfo ( 0 );
while ( iPos < iDataLen )
@ -541,12 +541,12 @@ void CProtocol::EvaluateConClientListMes ( unsigned int iPos, const CVector<uint
static_cast<int> ( 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<int> ( 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<ui
emit ReqConnClientsList();
}
void CProtocol::CreateChanNameMes ( const std::string strName )
void CProtocol::CreateChanNameMes ( const QString strName )
{
unsigned int iPos = 0; // init position pointer
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
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( strName[j] ), 1 );
static_cast<uint32_t> ( strName[j].toAscii() ), 1 );
}
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 ) );
// 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<int> ( 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<uint8_t>& 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<uint8_t>& 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 */;

View file

@ -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<CChannelShortInfo>& 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<CChannelShortInfo> vecChanInfo );
void ReqJittBufSize();
void ReqConnClientsList();

View file

@ -49,7 +49,7 @@ public:
bool IsRunning() { return Timer.isActive(); }
void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<std::string>& vecsName,
CVector<QString>& vecsName,
CVector<int>& veciJitBufSize, CVector<int>& veciNetwOutBlSiFact,
CVector<int>& veciNetwInBlSiFact )
{

View file

@ -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<std::string, string> ( string ( key ), string ( value ) ) );
std::pair<std::string, std::string> ( std::string ( key ), std::string ( value ) ) );
}
theINI.insert (
std::pair<string, INISection> ( string ( section ), newsection ) );
std::pair<std::string, INISection> ( std::string ( section ), newsection ) );
}
else
{
@ -299,7 +299,7 @@ void CSettings::PutIniSetting ( CSettings::INIFile &theINI, const char *section,
}
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;
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;

View file

@ -61,24 +61,24 @@ protected:
};
// 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;
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

View file

@ -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;
};

View file

@ -42,7 +42,7 @@ bool loadAsioDriver ( char *name );
bool CSound::Read ( CVector<short>& psData )
{
int i;
bool bError;
bool bError = false;
// check if device must be opened or reinitialized
if ( bChangParamIn == TRUE )

View file

@ -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