From 3f4125fe9dd3f71913138571f4a9563353c56671 Mon Sep 17 00:00:00 2001 From: Peter L Jones Date: Sun, 14 Jun 2020 22:02:13 +0100 Subject: [PATCH] Client side changes for recorder state --- src/audiomixerboard.cpp | 32 ++++++++++++++++++++++++++++++-- src/audiomixerboard.h | 5 +++++ src/channel.cpp | 3 +++ src/channel.h | 1 + src/client.cpp | 3 +++ src/client.h | 1 + src/clientdlg.cpp | 3 +++ src/clientdlg.h | 3 +++ src/server.cpp | 2 +- 9 files changed, 50 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/audiomixerboard.cpp mode change 100644 => 100755 src/audiomixerboard.h diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp old mode 100644 new mode 100755 index 021b6e22..581408c0 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -619,7 +619,8 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : bIsPanSupported ( false ), bNoFaderVisible ( true ), iMyChannelID ( INVALID_INDEX ), - strServerName ( "" ) + strServerName ( "" ), + eRecorderState ( RS_UNDEFINED ) { // add group box and hboxlayout QHBoxLayout* pGroupBoxLayout = new QHBoxLayout ( this ); @@ -627,6 +628,14 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : pScrollArea = new CMixerBoardScrollArea ( this ); pMainLayout = new QHBoxLayout ( pMixerWidget ); + + setAccessibleName ( "Personal Mix at the Server groupbox" ); + setWhatsThis ( "" + tr( "Personal Mix at the Server" ) + ": " + + tr ( "When connected to a server, the controls here allow you to set " ) + + tr ( "your local mix without affecting what others hear from you.") + "
" + + tr ( "The title shows the server name and, when known, " + "whether it is actively recording." ) ); + // set title text (default: no server given) SetServerName ( "" ); @@ -807,13 +816,32 @@ void CAudioMixerBoard::ChangeFaderOrder ( const bool bDoSort, } } +QString CAudioMixerBoard::GetTitle() +{ + QString myTitle = ""; + if ( eRecorderState == RS_RECORDING ) + { + myTitle = "[" + tr ( "RECORDING ACTIVE" ) + "] "; + } + return myTitle + tr ( "Personal Mix at: " ) + strServerName; +} + +void CAudioMixerBoard::SetRecorderState ( const ERecorderState newRecorderState ) +{ + eRecorderState = newRecorderState; + if ( !strServerName.isEmpty() && !bNoFaderVisible ) + { + setTitle ( GetTitle() ); + } +} + void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInfo ) { // we want to set the server name only if the very first faders appear // in the audio mixer board to show a "try to connect" before if ( bNoFaderVisible ) { - setTitle ( tr ( "Personal Mix at the Server: " ) + strServerName ); + setTitle ( GetTitle() ); } // get number of connected clients diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h old mode 100644 new mode 100755 index a3321a34..9415453b --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -164,6 +164,8 @@ public: void SetChannelLevels ( const CVector& vecChannelLevel ); + void SetRecorderState ( const ERecorderState newRecorderState ); + // settings CVector vecStoredFaderTags; CVector vecStoredFaderLevels; @@ -188,6 +190,8 @@ protected: } }; + QString GetTitle(); + bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo, int& iStoredFaderLevel, int& iStoredPanValue, @@ -209,6 +213,7 @@ protected: bool bNoFaderVisible; int iMyChannelID; QString strServerName; + ERecorderState eRecorderState; virtual void UpdateGainValue ( const int iChannelIdx, const double dValue, diff --git a/src/channel.cpp b/src/channel.cpp index f5c7419d..924f74d5 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -108,6 +108,9 @@ qRegisterMetaType ( "CHostAddress" ); QObject::connect ( &Protocol, &CProtocol::VersionAndOSReceived, this, &CChannel::VersionAndOSReceived ); + QObject::connect ( &Protocol, &CProtocol::RecorderStateReceived, + this, &CChannel::RecorderStateReceived ); + QObject::connect ( &Protocol, &CProtocol::ReqChannelLevelList, this, &CChannel::OnReqChannelLevelList ); } diff --git a/src/channel.h b/src/channel.h index dd34736b..723d9ad4 100755 --- a/src/channel.h +++ b/src/channel.h @@ -290,6 +290,7 @@ signals: void ReqNetTranspProps(); void LicenceRequired ( ELicenceType eLicenceType ); void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion ); + void RecorderStateReceived ( ERecorderState eRecorderState ); void Disconnected(); void DetectedCLMessage ( CVector vecbyMesBodyData, diff --git a/src/client.cpp b/src/client.cpp index 13b42cf2..35b8fea5 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -165,6 +165,9 @@ CClient::CClient ( const quint16 iPortNumber, QObject::connect ( &Channel, &CChannel::VersionAndOSReceived, this, &CClient::VersionAndOSReceived ); + QObject::connect ( &Channel, &CChannel::RecorderStateReceived, + this, &CClient::RecorderStateReceived ); + QObject::connect ( &ConnLessProtocol, &CProtocol::CLMessReadyForSending, this, &CClient::OnSendCLProtMessage ); diff --git a/src/client.h b/src/client.h index b8497bbf..0a576068 100755 --- a/src/client.h +++ b/src/client.h @@ -424,6 +424,7 @@ signals: void LicenceRequired ( ELicenceType eLicenceType ); void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion ); void PingTimeReceived ( int iPingTime ); + void RecorderStateReceived ( ERecorderState eRecorderState ); void CLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 89c3d59a..9c73e8e5 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -472,6 +472,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( pClient, &CClient::MuteStateHasChangedReceived, this, &CClientDlg::OnMuteStateHasChangedReceived ); + QObject::connect ( pClient, &CClient::RecorderStateReceived, + this, &CClientDlg::OnRecorderStateReceived ); + // 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. diff --git a/src/clientdlg.h b/src/clientdlg.h index 7b2e9dfa..4058b6de 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -221,6 +221,9 @@ public slots: void OnDisplayChannelLevelsChanged() { MainMixerBoard->SetDisplayChannelLevels ( pClient->GetDisplayChannelLevels() ); } + void OnRecorderStateReceived ( ERecorderState eRecorderState ) + { MainMixerBoard->SetRecorderState ( eRecorderState ); } + void OnAudioChannelsChanged() { UpdateRevSelection(); } void OnNumClientsChanged ( int iNewNumClients ); void OnNewClientLevelChanged() { MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel; } diff --git a/src/server.cpp b/src/server.cpp index b14c8e82..8c449e8b 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -740,7 +740,7 @@ void CServer::SetEnableRecording ( bool bNewEnableRecording ) #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) // TODO we should use the ConsoleWriterFactory() instead of qInfo() - qInfo() << "Recording state " << ( bEnableRecording ? "enabled" : "disabled" ); + qInfo() << "Recording state" << ( bEnableRecording ? "enabled" : "disabled" ); #endif if ( !bEnableRecording )