show number of connected clients in window title bar

This commit is contained in:
Volker Fischer 2009-10-19 07:58:22 +00:00
parent 6287a70e3d
commit ecc270036d
4 changed files with 56 additions and 4 deletions

View File

@ -346,22 +346,28 @@ void CAudioMixerBoard::SetGUIDesign ( const EGUIDesign eNewDesign )
void CAudioMixerBoard::HideAll()
{
// make old controls invisible
// make all controls invisible
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{
vecpChanFader[i]->Hide();
}
// emit status of connected clients
emit NumClientsChanged ( 0 ); // -> no clients connected
}
void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelShortInfo>& vecChanInfo )
{
// get number of connected clients
const int iNumConnectedClients = vecChanInfo.Size();
// search for channels with are already present and preserver their gain
// setting, for all other channels, reset gain
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{
bool bFaderIsUsed = false;
for ( int j = 0; j < vecChanInfo.Size(); j++ )
for ( int j = 0; j < iNumConnectedClients; j++ )
{
// check if current fader is used
if ( vecChanInfo[j].iChanID == i )
@ -395,6 +401,9 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelShortInfo>& vecCh
vecpChanFader[i]->Hide();
}
}
// emit status of connected clients
emit NumClientsChanged ( iNumConnectedClients );
}
void CAudioMixerBoard::OnChSoloStateChanged ( const int iChannelIdx, const int iValue )

View File

@ -137,6 +137,7 @@ public slots:
signals:
void ChangeChanGain ( int iId, double dGain );
void NumClientsChanged ( int iNewNumClients );
};
#endif // MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_

View File

@ -138,6 +138,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// init GUI design
SetGUIDesign ( pClient->GetGUIDesign() );
// reset mixer board
MainMixerBoard->HideAll();
// init fader tag line edit
LineEditFaderTag->setText ( pClient->strName );
@ -294,6 +297,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) );
QObject::connect ( MainMixerBoard, SIGNAL ( NumClientsChanged ( int ) ),
this, SLOT ( OnNumClientsChanged ( int ) ) );
QObject::connect ( &ChatDlg, SIGNAL ( NewLocalInputText ( QString ) ),
this, SLOT ( OnNewLocalInputText ( QString ) ) );
@ -435,6 +441,41 @@ void CLlconClientDlg::OnDisconnected()
MainMixerBoard->HideAll();
}
void CLlconClientDlg::OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo )
{
// update mixer board
MainMixerBoard->ApplyNewConClientList ( vecChanInfo );
}
void CLlconClientDlg::OnNumClientsChanged ( int iNewNumClients )
{
// update window title
SetMyWindowTitle ( iNewNumClients );
}
void CLlconClientDlg::SetMyWindowTitle ( const int iNumClients )
{
// show number of connected clients in window title (and therefore also in
// the task bar of the OS)
if ( iNumClients == 0 )
{
// only application name
setWindowTitle ( APP_NAME );
}
else
{
if ( iNumClients == 1 )
{
setWindowTitle ( QString ( APP_NAME ) + " (1 client)" );
}
else
{
setWindowTitle ( QString ( APP_NAME ) +
QString ( " (%1 clients)" ).arg ( iNumClients ) );
}
}
}
void CLlconClientDlg::ShowChatWindow()
{
// open chat dialog

View File

@ -72,6 +72,7 @@ public:
protected:
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetMyWindowTitle ( const int iNumClients );
void ShowChatWindow();
void UpdateAudioFaderSlider();
void ConnectDisconnect ( const bool bDoStart );
@ -102,8 +103,7 @@ public slots:
void OnSliderAudReverb ( int value ) { pClient->SetReverbLevel ( value ); }
void OnRevSelL() { pClient->SetReverbOnLeftChan ( true ); }
void OnRevSelR() { pClient->SetReverbOnLeftChan ( false ); }
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo )
{ MainMixerBoard->ApplyNewConClientList ( vecChanInfo ); }
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void OnChangeChanGain ( int iId, double dGain )
{ pClient->SetRemoteChanGain ( iId, dGain ); }
void OnFaderTagTextChanged ( const QString& strNewName );
@ -115,4 +115,5 @@ public slots:
void OnDisconnected();
void OnStopped();
void OnGUIDesignChanged() { SetGUIDesign ( pClient->GetGUIDesign() ); }
void OnNumClientsChanged ( int iNewNumClients );
};