Added Support for instrument picture on fader tag

This commit is contained in:
Volker Fischer 2013-02-11 15:36:47 +00:00
parent 0f976c4c4c
commit cc3547676b
4 changed files with 116 additions and 69 deletions

View file

@ -46,8 +46,8 @@ CChannel::CChannel ( const bool bNIsServer ) :
// init the socket buffer // init the socket buffer
SetSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ); SetSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL );
// initialize channel name // initialize channel info
ResetName(); ResetInfo();
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
@ -64,16 +64,20 @@ CChannel::CChannel ( const bool bNIsServer ) :
SIGNAL ( ReqJittBufSize() ) ); SIGNAL ( ReqJittBufSize() ) );
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( ReqChanName() ), SIGNAL ( ReqChanInfo() ),
SIGNAL ( ReqChanName() ) ); SIGNAL ( ReqChanInfo() ) );
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( ReqConnClientsList() ), SIGNAL ( ReqConnClientsList() ),
SIGNAL ( ReqConnClientsList() ) ); SIGNAL ( ReqConnClientsList() ) );
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ), SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) ); SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( &Protocol,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ), QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) ); this, SLOT ( OnChangeChanGain ( int, double ) ) );
@ -81,6 +85,9 @@ CChannel::CChannel ( const bool bNIsServer ) :
QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ), QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ),
this, SLOT ( OnChangeChanName ( QString ) ) ); this, SLOT ( OnChangeChanName ( QString ) ) );
QObject::connect( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) );
QObject::connect( &Protocol, QObject::connect( &Protocol,
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
SIGNAL ( ChatTextReceived ( QString ) ) ); SIGNAL ( ChatTextReceived ( QString ) ) );
@ -220,16 +227,28 @@ double CChannel::GetGain ( const int iChanID )
} }
} }
void CChannel::SetChanInfo ( const CChannelCoreInfo& NChanInf )
{
// apply value (if different from previous one)
if ( ChannelInfo != NChanInf )
{
ChannelInfo = NChanInf;
// fire message that the channel info has changed
emit ChanInfoHasChanged();
}
}
void CChannel::SetName ( const QString strNewName ) void CChannel::SetName ( const QString strNewName )
{ {
bool bNameHasChanged = false; bool bNameHasChanged = false;
Mutex.lock(); Mutex.lock();
{ {
// apply value (if different from previous name) // apply value (if different from previous one)
if ( sName.compare ( strNewName ) ) if ( ChannelInfo.strName.compare ( strNewName ) )
{ {
sName = strNewName; ChannelInfo.strName = strNewName;
bNameHasChanged = true; bNameHasChanged = true;
} }
} }
@ -239,7 +258,7 @@ void CChannel::SetName ( const QString strNewName )
if ( bNameHasChanged ) if ( bNameHasChanged )
{ {
// the "emit" has to be done outside the mutexed region // the "emit" has to be done outside the mutexed region
emit NameHasChanged(); emit ChanInfoHasChanged();
} }
} }
QString CChannel::GetName() QString CChannel::GetName()
@ -248,7 +267,7 @@ QString CChannel::GetName()
// read here -> use mutex to secure access // read here -> use mutex to secure access
QMutexLocker locker ( &Mutex ); QMutexLocker locker ( &Mutex );
return sName; return ChannelInfo.strName;
} }
void CChannel::OnSendProtMessage ( CVector<uint8_t> vecMessage ) void CChannel::OnSendProtMessage ( CVector<uint8_t> vecMessage )
@ -301,6 +320,11 @@ void CChannel::OnChangeChanName ( QString strName )
SetName ( strName ); SetName ( strName );
} }
void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo )
{
SetChanInfo ( ChanInfo );
}
bool CChannel::GetAddress ( CHostAddress& RetAddr ) bool CChannel::GetAddress ( CHostAddress& RetAddr )
{ {
QMutexLocker locker ( &Mutex ); QMutexLocker locker ( &Mutex );

View file

@ -79,12 +79,21 @@ public:
bool GetAddress ( CHostAddress& RetAddr ); bool GetAddress ( CHostAddress& RetAddr );
CHostAddress GetAddress() const { return InetAddr; } CHostAddress GetAddress() const { return InetAddr; }
void ResetName() { sName = ""; } // reset does not emit a message void ResetInfo() { ChannelInfo = CChannelCoreInfo(); } // reset does not emit a message
void SetName ( const QString sNNa ); void SetName ( const QString sNNa );
QString GetName(); QString GetName();
void SetChanInfo ( const CChannelCoreInfo& NChanInf );
CChannelCoreInfo& GetChanInfo() { return ChannelInfo; }
void SetRemoteName ( const QString strName ) { Protocol.CreateChanNameMes ( strName ); } void SetRemoteInfo ( const CChannelCoreInfo ChInfo )
void CreateReqChanNameMes() { Protocol.CreateReqChanNameMes(); } {
// because of compatibility to old versions, we also have to send the
// channel name message extra
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
Protocol.CreateChanNameMes ( ChInfo.strName );
Protocol.CreateChanInfoMes ( ChInfo );
}
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
void SetGain ( const int iChanID, const double dNewGain ); void SetGain ( const int iChanID, const double dNewGain );
double GetGain ( const int iChanID ); double GetGain ( const int iChanID );
@ -128,10 +137,12 @@ public:
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); } void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreatePingMes ( const int iMs ) { Protocol.CreatePingMes ( iMs ); } void CreatePingMes ( const int iMs ) { Protocol.CreatePingMes ( iMs ); }
void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo ) // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
{ void CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo )
Protocol.CreateConClientListMes ( vecChanInfo ); { Protocol.CreateConClientListNameMes ( vecChanInfo ); }
}
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
{ Protocol.CreateConClientListMes ( vecChanInfo ); }
void CreateNetTranspPropsMessFromCurrentSettings(); void CreateNetTranspPropsMessFromCurrentSettings();
@ -141,8 +152,8 @@ protected:
// connection parameters // connection parameters
CHostAddress InetAddr; CHostAddress InetAddr;
// channel name // channel info
QString sName; CChannelCoreInfo ChannelInfo;
// mixer and effect settings // mixer and effect settings
CVector<double> vecdGains; CVector<double> vecdGains;
@ -176,6 +187,7 @@ public slots:
void OnJittBufSizeChange ( int iNewJitBufSize ); void OnJittBufSizeChange ( int iNewJitBufSize );
void OnChangeChanGain ( int iChanID, double dNewGain ); void OnChangeChanGain ( int iChanID, double dNewGain );
void OnChangeChanName ( QString strName ); void OnChangeChanName ( QString strName );
void OnChangeChanInfo ( CChannelCoreInfo ChanInfo );
void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps ); void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void OnReqNetTranspProps(); void OnReqNetTranspProps();
@ -186,9 +198,10 @@ signals:
void JittBufSizeChanged ( int iNewJitBufSize ); void JittBufSizeChanged ( int iNewJitBufSize );
void ServerAutoSockBufSizeChange ( int iNNumFra ); void ServerAutoSockBufSizeChange ( int iNNumFra );
void ReqConnClientsList(); void ReqConnClientsList();
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo ); void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
void NameHasChanged(); void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ReqChanName(); void ChanInfoHasChanged();
void ReqChanInfo();
void ChatTextReceived ( QString strChatText ); void ChatTextReceived ( QString strChatText );
void PingReceived ( int iMs ); void PingReceived ( int iMs );
void ReqNetTranspProps(); void ReqNetTranspProps();

View file

@ -28,7 +28,7 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CClient::CClient ( const quint16 iPortNumber ) : CClient::CClient ( const quint16 iPortNumber ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
strName ( "" ), ChannelInfo (),
Channel ( false ), /* we need a client channel -> "false" */ Channel ( false ), /* we need a client channel -> "false" */
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ), iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ), bCeltDoHighQuality ( false ),
@ -94,12 +94,16 @@ CClient::CClient ( const quint16 iPortNumber ) :
QObject::connect ( &Channel, SIGNAL ( JittBufSizeChanged ( int ) ), QObject::connect ( &Channel, SIGNAL ( JittBufSizeChanged ( int ) ),
this, SLOT ( OnJittBufSizeChanged ( int ) ) ); this, SLOT ( OnJittBufSizeChanged ( int ) ) );
QObject::connect ( &Channel, SIGNAL ( ReqChanName() ), QObject::connect ( &Channel, SIGNAL ( ReqChanInfo() ),
this, SLOT ( OnReqChanName() ) ); this, SLOT ( OnReqChanInfo() ) );
QObject::connect ( &Channel, QObject::connect ( &Channel,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ), SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) ); SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( &Channel,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( &Channel, QObject::connect ( &Channel,
SIGNAL ( Disconnected() ), SIGNAL ( Disconnected() ),
@ -172,9 +176,9 @@ void CClient::OnJittBufSizeChanged ( int iNewJitBufSize )
void CClient::OnNewConnection() void CClient::OnNewConnection()
{ {
// a new connection was successfully initiated, send name and request // a new connection was successfully initiated, send infos and request
// connected clients list // connected clients list
Channel.SetRemoteName ( strName ); Channel.SetRemoteInfo ( ChannelInfo );
// We have to send a connected clients list request since it can happen // We have to send a connected clients list request since it can happen
// that we just had connected to the server and then disconnected but // that we just had connected to the server and then disconnected but

View file

@ -369,19 +369,19 @@ CServer::CServer ( const int iNewNumChan,
QObject::connect ( &vecChannels[10], SIGNAL ( ReqConnClientsList() ), this, SLOT ( OnReqConnClientsListCh10() ) ); QObject::connect ( &vecChannels[10], SIGNAL ( ReqConnClientsList() ), this, SLOT ( OnReqConnClientsListCh10() ) );
QObject::connect ( &vecChannels[11], SIGNAL ( ReqConnClientsList() ), this, SLOT ( OnReqConnClientsListCh11() ) ); QObject::connect ( &vecChannels[11], SIGNAL ( ReqConnClientsList() ), this, SLOT ( OnReqConnClientsListCh11() ) );
// channel name has changed // channel info has changed
QObject::connect ( &vecChannels[0], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh0() ) ); QObject::connect ( &vecChannels[0], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh0() ) );
QObject::connect ( &vecChannels[1], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh1() ) ); QObject::connect ( &vecChannels[1], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh1() ) );
QObject::connect ( &vecChannels[2], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh2() ) ); QObject::connect ( &vecChannels[2], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh2() ) );
QObject::connect ( &vecChannels[3], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh3() ) ); QObject::connect ( &vecChannels[3], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh3() ) );
QObject::connect ( &vecChannels[4], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh4() ) ); QObject::connect ( &vecChannels[4], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh4() ) );
QObject::connect ( &vecChannels[5], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh5() ) ); QObject::connect ( &vecChannels[5], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh5() ) );
QObject::connect ( &vecChannels[6], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh6() ) ); QObject::connect ( &vecChannels[6], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh6() ) );
QObject::connect ( &vecChannels[7], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh7() ) ); QObject::connect ( &vecChannels[7], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh7() ) );
QObject::connect ( &vecChannels[8], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh8() ) ); QObject::connect ( &vecChannels[8], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh8() ) );
QObject::connect ( &vecChannels[9], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh9() ) ); QObject::connect ( &vecChannels[9], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh9() ) );
QObject::connect ( &vecChannels[10], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh10() ) ); QObject::connect ( &vecChannels[10], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh10() ) );
QObject::connect ( &vecChannels[11], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh11() ) ); QObject::connect ( &vecChannels[11], SIGNAL ( ChanInfoHasChanged() ), this, SLOT ( OnChanInfoHasChangedCh11() ) );
// chat text received // chat text received
QObject::connect ( &vecChannels[0], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh0 ( QString ) ) ); QObject::connect ( &vecChannels[0], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh0 ( QString ) ) );
@ -837,9 +837,9 @@ CVector<int16_t> CServer::ProcessData ( const int iCurIndex,
return vecsOutData; return vecsOutData;
} }
CVector<CChannelShortInfo> CServer::CreateChannelList() CVector<CChannelInfo> CServer::CreateChannelList()
{ {
CVector<CChannelShortInfo> vecChanInfo ( 0 ); CVector<CChannelInfo> vecChanInfo ( 0 );
// look for free channels // look for free channels
for ( int i = 0; i < iNumChannels; i++ ) for ( int i = 0; i < iNumChannels; i++ )
@ -847,10 +847,10 @@ CVector<CChannelShortInfo> CServer::CreateChannelList()
if ( vecChannels[i].IsConnected() ) if ( vecChannels[i].IsConnected() )
{ {
// append channel ID, IP address and channel name to storing vectors // append channel ID, IP address and channel name to storing vectors
vecChanInfo.Add ( CChannelShortInfo ( vecChanInfo.Add ( CChannelInfo (
i, // ID i, // ID
vecChannels[i].GetAddress().InetAddr.toIPv4Address(), // IP address vecChannels[i].GetAddress().InetAddr.toIPv4Address(), // IP address
vecChannels[i].GetName() /* name */ ) ); vecChannels[i].GetChanInfo() ) );
} }
} }
@ -860,7 +860,7 @@ CVector<CChannelShortInfo> CServer::CreateChannelList()
void CServer::CreateAndSendChanListForAllConChannels() void CServer::CreateAndSendChanListForAllConChannels()
{ {
// create channel list // create channel list
CVector<CChannelShortInfo> vecChanInfo ( CreateChannelList() ); CVector<CChannelInfo> vecChanInfo ( CreateChannelList() );
// now send connected channels list to all connected clients // now send connected channels list to all connected clients
for ( int i = 0; i < iNumChannels; i++ ) for ( int i = 0; i < iNumChannels; i++ )
@ -868,6 +868,8 @@ void CServer::CreateAndSendChanListForAllConChannels()
if ( vecChannels[i].IsConnected() ) if ( vecChannels[i].IsConnected() )
{ {
// send message // send message
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
vecChannels[i].CreateConClientListNameMes ( vecChanInfo );
vecChannels[i].CreateConClientListMes ( vecChanInfo ); vecChannels[i].CreateConClientListMes ( vecChanInfo );
} }
} }
@ -882,9 +884,11 @@ void CServer::CreateAndSendChanListForAllConChannels()
void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID ) void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID )
{ {
// create channel list // create channel list
CVector<CChannelShortInfo> vecChanInfo ( CreateChannelList() ); CVector<CChannelInfo> vecChanInfo ( CreateChannelList() );
// now send connected channels list to the channel with the ID "iCurChanID" // now send connected channels list to the channel with the ID "iCurChanID"
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
vecChannels[iCurChanID].CreateConClientListNameMes ( vecChanInfo );
vecChannels[iCurChanID].CreateConClientListMes ( vecChanInfo ); vecChannels[iCurChanID].CreateConClientListMes ( vecChanInfo );
} }
@ -894,6 +898,7 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
// Create message which is sent to all connected clients ------------------- // Create message which is sent to all connected clients -------------------
// get client name, if name is empty, use IP address instead // get client name, if name is empty, use IP address instead
QString ChanName = vecChannels[iCurChanID].GetName(); QString ChanName = vecChannels[iCurChanID].GetName();
if ( ChanName.isEmpty() ) if ( ChanName.isEmpty() )
{ {
// convert IP address to text and show it // convert IP address to text and show it
@ -904,6 +909,7 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
// add time and name of the client at the beginning of the message text and // add time and name of the client at the beginning of the message text and
// use different colors // use different colors
QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()]; QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()];
const QString strActualMessageText = const QString strActualMessageText =
"<font color=""" + sCurColor + """>(" + "<font color=""" + sCurColor + """>(" +
QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") <b>" + ChanName + QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") <b>" + ChanName +
@ -1023,8 +1029,8 @@ bool CServer::PutData ( const CVector<uint8_t>& vecbyRecBuf,
// address // address
vecChannels[iCurChanID].SetAddress ( HostAdr ); vecChannels[iCurChanID].SetAddress ( HostAdr );
// reset channel name // reset channel info
vecChannels[iCurChanID].ResetName(); vecChannels[iCurChanID].ResetInfo();
// reset the channel gains of current channel, at the same // reset the channel gains of current channel, at the same
// time reset gains of this channel ID for all other channels // time reset gains of this channel ID for all other channels
@ -1111,7 +1117,7 @@ bool CServer::PutData ( const CVector<uint8_t>& vecbyRecBuf,
// was restartet, it is important that we send the channel list // was restartet, it is important that we send the channel list
// at this place. // at this place.
vecChannels[iCurChanID].ResetTimeOutCounter(); vecChannels[iCurChanID].ResetTimeOutCounter();
vecChannels[iCurChanID].CreateReqChanNameMes(); vecChannels[iCurChanID].CreateReqChanInfoMes();
// COMPATIBILITY ISSUE // COMPATIBILITY ISSUE
// since old versions of the llcon software did not implement the channel name // since old versions of the llcon software did not implement the channel name
@ -1170,7 +1176,7 @@ void CServer::StartStatusHTMLFileWriting ( const QString& strNewFileName,
void CServer::WriteHTMLChannelList() void CServer::WriteHTMLChannelList()
{ {
// create channel list // create channel list
CVector<CChannelShortInfo> vecChanInfo ( CreateChannelList() ); CVector<CChannelInfo> vecChanInfo ( CreateChannelList() );
// prepare file and stream // prepare file and stream
QFile serverFileListFile ( strServerHTMLFileListName ); QFile serverFileListFile ( strServerHTMLFileListName );