WIP: backup checkin of new feature "show mute state of others"
This commit is contained in:
parent
017796919c
commit
4b8c7de166
10 changed files with 129 additions and 11 deletions
|
@ -84,16 +84,20 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
|
|||
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 ) ) );
|
||||
|
||||
QObject::connect( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
|
||||
QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
|
||||
this, SLOT ( OnChangeChanPan ( int, double ) ) );
|
||||
|
||||
QObject::connect( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
||||
QObject::connect ( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
|
||||
this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) );
|
||||
|
||||
QObject::connect( &Protocol,
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
SIGNAL ( ChatTextReceived ( QString ) ) );
|
||||
|
||||
|
@ -105,7 +109,7 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
|
|||
SIGNAL ( ReqNetTranspProps() ),
|
||||
this, SLOT ( OnReqNetTranspProps() ) );
|
||||
|
||||
QObject::connect( &Protocol,
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( LicenceRequired ( ELicenceType ) ),
|
||||
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
|
||||
|
||||
|
@ -258,6 +262,16 @@ void CChannel::SetGain ( const int iChanID,
|
|||
// set value (make sure channel ID is in range)
|
||||
if ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) )
|
||||
{
|
||||
// signal mute change
|
||||
if ( ( vecdGains[iChanID] == 0 ) && ( dNewGain > 0 ) )
|
||||
{
|
||||
emit MuteStateHasChanged ( iChanID, false );
|
||||
}
|
||||
if ( ( vecdGains[iChanID] > 0 ) && ( dNewGain == 0 ) )
|
||||
{
|
||||
emit MuteStateHasChanged ( iChanID, true );
|
||||
}
|
||||
|
||||
vecdGains[iChanID] = dNewGain;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
|
||||
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
|
||||
void CreateVersionAndOSMes() { Protocol.CreateVersionAndOSMes(); }
|
||||
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted ) { Protocol.CreateMuteStateHasChangedMes ( iChanID, bIsMuted ); }
|
||||
|
||||
void SetGain ( const int iChanID, const double dNewGain );
|
||||
double GetGain ( const int iChanID );
|
||||
|
@ -277,6 +278,8 @@ signals:
|
|||
void ReqConnClientsList();
|
||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void ChanInfoHasChanged();
|
||||
void MuteStateHasChanged ( int iChanID, bool bIsMuted );
|
||||
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||
void ReqChanInfo();
|
||||
void ChatTextReceived ( QString strChatText );
|
||||
void ReqNetTranspProps();
|
||||
|
|
|
@ -156,7 +156,11 @@ CClient::CClient ( const quint16 iPortNumber,
|
|||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
SIGNAL ( ChatTextReceived ( QString ) ) );
|
||||
|
||||
QObject::connect( &Channel,
|
||||
QObject::connect ( &Channel,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
||||
QObject::connect ( &Channel,
|
||||
SIGNAL ( LicenceRequired ( ELicenceType ) ),
|
||||
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
|
||||
|
||||
|
|
|
@ -420,6 +420,7 @@ public slots:
|
|||
signals:
|
||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void ChatTextReceived ( QString strChatText );
|
||||
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||
void LicenceRequired ( ELicenceType eLicenceType );
|
||||
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );
|
||||
void PingTimeReceived ( int iPingTime );
|
||||
|
|
|
@ -466,6 +466,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
this, SLOT ( OnChatTextReceived ( QString ) ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
this, SLOT ( OnMuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
||||
// This connection is a special case. On receiving a licence required message via the
|
||||
// protocol, a modal licence dialog is opened. Since this blocks the thread, we need
|
||||
// a queued connection to make sure the core protocol mechanism is not blocked, too.
|
||||
|
@ -776,6 +780,14 @@ void CClientDlg::OnChatTextReceived ( QString strChatText )
|
|||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void CClientDlg::OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted )
|
||||
{
|
||||
|
||||
// TEST
|
||||
qDebug() << "mute state changed: iChanID " << iChanID << " bIsMuted " << bIsMuted;
|
||||
|
||||
}
|
||||
|
||||
void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
|
||||
{
|
||||
// right now only the creative common licence is supported
|
||||
|
|
|
@ -167,6 +167,7 @@ public slots:
|
|||
|
||||
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void OnChatTextReceived ( QString strChatText );
|
||||
void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||
void OnLicenceRequired ( ELicenceType eLicenceType );
|
||||
|
||||
void OnChangeChanGain ( int iId, double dGain )
|
||||
|
|
|
@ -71,6 +71,13 @@ MESSAGES (with connection)
|
|||
+-------------------+-----------------+
|
||||
|
||||
|
||||
- PROTMESSID_MUTE_STATE_CHANGED: Mute state of your signal at another client has changed
|
||||
|
||||
+-------------------+-----------------+
|
||||
| 1 byte channel ID | 1 byte is muted |
|
||||
+-------------------+-----------------+
|
||||
|
||||
|
||||
- PROTMESSID_CONN_CLIENTS_LIST: Information about connected clients
|
||||
|
||||
for each connected client append following data:
|
||||
|
@ -590,6 +597,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
|
|||
bRet = EvaluateChanPanMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
||||
case PROTMESSID_MUTE_STATE_CHANGED:
|
||||
bRet = EvaluateMuteStateHasChangedMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
||||
case PROTMESSID_CONN_CLIENTS_LIST:
|
||||
bRet = EvaluateConClientListMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
@ -872,6 +883,43 @@ bool CProtocol::EvaluateChanPanMes ( const CVector<uint8_t> &vecData )
|
|||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted )
|
||||
{
|
||||
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// build data vector
|
||||
// channel ID
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
|
||||
|
||||
// mute state
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( bIsMuted ), 1 );
|
||||
|
||||
CreateAndSendMessage ( PROTMESSID_MUTE_STATE_CHANGED, vecData );
|
||||
}
|
||||
|
||||
bool CProtocol::EvaluateMuteStateHasChangedMes ( const CVector<uint8_t> &vecData )
|
||||
{
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// check size
|
||||
if ( vecData.Size() != 2 )
|
||||
{
|
||||
return true; // return error code
|
||||
}
|
||||
|
||||
// channel ID
|
||||
const int iCurID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
|
||||
// mute state
|
||||
const bool bIsMuted = static_cast<bool> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
|
||||
// invoke message action
|
||||
emit MuteStateHasChangedReceived ( iCurID, bIsMuted );
|
||||
|
||||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
|
||||
{
|
||||
const int iNumClients = vecChanInfo.Size();
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#define PROTMESSID_REQ_CHANNEL_LEVEL_LIST 28 // request the channel level list
|
||||
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
|
||||
#define PROTMESSID_CHANNEL_PAN 30 // set channel pan for mix
|
||||
#define PROTMESSID_MUTE_STATE_CHANGED 31 // mute state of your signal at another client has changed
|
||||
|
||||
// message IDs of connection less messages (CLM)
|
||||
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
void CreateReqJitBufMes();
|
||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||
void CreateChanPanMes ( const int iChanID, const double dPan );
|
||||
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted );
|
||||
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo );
|
||||
void CreateReqConnClientsList();
|
||||
void CreateChanInfoMes ( const CChannelCoreInfo ChanInfo );
|
||||
|
@ -223,6 +225,7 @@ protected:
|
|||
bool EvaluateReqJitBufMes();
|
||||
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateMuteStateHasChangedMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateConClientListMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateReqConnClientsList();
|
||||
bool EvaluateChanInfoMes ( const CVector<uint8_t>& vecData );
|
||||
|
@ -283,6 +286,7 @@ signals:
|
|||
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
||||
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||
void ChangeChanPan ( int iChanID, double dNewPan );
|
||||
void MuteStateHasChangedReceived ( int iCurID, bool bIsMuted );
|
||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void ServerFullMesReceived();
|
||||
void ReqConnClientsList();
|
||||
|
|
|
@ -497,6 +497,9 @@ inline void CServer::connectChannelSignalsToServerSlots()
|
|||
void ( CServer::* pOnChatTextReceivedCh )( QString ) =
|
||||
&CServerSlots<slotId>::OnChatTextReceivedCh;
|
||||
|
||||
void ( CServer::* pOnMuteStateHasChangedCh )( int, bool ) =
|
||||
&CServerSlots<slotId>::OnMuteStateHasChangedCh;
|
||||
|
||||
void ( CServer::* pOnServerAutoSockBufSizeChangeCh )( int ) =
|
||||
&CServerSlots<slotId>::OnServerAutoSockBufSizeChangeCh;
|
||||
|
||||
|
@ -516,6 +519,10 @@ inline void CServer::connectChannelSignalsToServerSlots()
|
|||
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ChatTextReceived,
|
||||
this, pOnChatTextReceivedCh );
|
||||
|
||||
// other mute state has changed
|
||||
QObject::connect ( &vecChannels[iCurChanID], &CChannel::MuteStateHasChanged,
|
||||
this, pOnMuteStateHasChangedCh );
|
||||
|
||||
// auto socket buffer size change
|
||||
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ServerAutoSockBufSizeChange,
|
||||
this, pOnServerAutoSockBufSizeChangeCh );
|
||||
|
@ -1310,6 +1317,17 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
|
|||
}
|
||||
}
|
||||
|
||||
void CServer::CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||
const int iOtherChanID,
|
||||
const bool bIsMuted )
|
||||
{
|
||||
if ( vecChannels[iCurChanID].IsConnected() )
|
||||
{
|
||||
// send message
|
||||
vecChannels[iCurChanID].CreateMuteStateHasChangedMes ( iOtherChanID, bIsMuted );
|
||||
}
|
||||
}
|
||||
|
||||
int CServer::GetFreeChan()
|
||||
{
|
||||
// look for a free channel
|
||||
|
|
23
src/server.h
23
src/server.h
|
@ -117,22 +117,27 @@ signals:
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
template<unsigned int slotId>
|
||||
class CServerSlots : public CServerSlots<slotId - 1>
|
||||
{
|
||||
|
||||
public:
|
||||
void OnSendProtMessCh( CVector<uint8_t> mess ) { SendProtMessage ( slotId - 1, mess ); }
|
||||
void OnSendProtMessCh ( CVector<uint8_t> mess ) { SendProtMessage ( slotId - 1, mess ); }
|
||||
void OnReqConnClientsListCh() { CreateAndSendChanListForThisChan ( slotId - 1 ); }
|
||||
|
||||
void OnChatTextReceivedCh( QString strChatText )
|
||||
void OnChatTextReceivedCh ( QString strChatText )
|
||||
{
|
||||
CreateAndSendChatTextForAllConChannels ( slotId - 1, strChatText );
|
||||
}
|
||||
|
||||
void OnServerAutoSockBufSizeChangeCh( int iNNumFra )
|
||||
void OnMuteStateHasChangedCh ( int iChanID, bool bIsMuted )
|
||||
{
|
||||
CreateAndSendJitBufMessage( slotId - 1, iNNumFra );
|
||||
CreateOtherMuteStateChanged ( slotId - 1, iChanID, bIsMuted );
|
||||
}
|
||||
|
||||
void OnServerAutoSockBufSizeChangeCh ( int iNNumFra )
|
||||
{
|
||||
CreateAndSendJitBufMessage ( slotId - 1, iNNumFra );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -144,6 +149,10 @@ protected:
|
|||
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||
const QString& strChatText ) = 0;
|
||||
|
||||
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||
const int iOtherChanID,
|
||||
const bool bIsMuted ) = 0;
|
||||
|
||||
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
||||
const int iNNumFra ) = 0;
|
||||
};
|
||||
|
@ -256,6 +265,10 @@ protected:
|
|||
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||
const QString& strChatText );
|
||||
|
||||
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||
const int iOtherChanID,
|
||||
const bool bIsMuted );
|
||||
|
||||
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
||||
const int iNNumFra );
|
||||
|
||||
|
|
Loading…
Reference in a new issue