From ecc270036d3300d920cdf9917b9e698e8ecdcfdd Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 19 Oct 2009 07:58:22 +0000 Subject: [PATCH] show number of connected clients in window title bar --- src/audiomixerboard.cpp | 13 +++++++++++-- src/audiomixerboard.h | 1 + src/llconclientdlg.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ src/llconclientdlg.h | 5 +++-- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index e85b0e82..3cbf1b82 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -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& 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& vecCh vecpChanFader[i]->Hide(); } } + + // emit status of connected clients + emit NumClientsChanged ( iNumConnectedClients ); } void CAudioMixerBoard::OnChSoloStateChanged ( const int iChannelIdx, const int iValue ) diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 02ddb13e..5dcf87fd 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -137,6 +137,7 @@ public slots: signals: void ChangeChanGain ( int iId, double dGain ); + void NumClientsChanged ( int iNewNumClients ); }; #endif // MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_ diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 8e50adf0..6dd131c7 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -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 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 diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index c8379f3d..a7acce67 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -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 vecChanInfo ) - { MainMixerBoard->ApplyNewConClientList ( vecChanInfo ); } + void OnConClientListMesReceived ( CVector 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 ); };