diff --git a/ChangeLog b/ChangeLog index f9ed3e4f..91855ad6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ - faster update of musicians list in the server list table +- display recorder state and latest recording directory, + allow a new recording to be requested, by pljones (#228) diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index ea79a57b..0fe05134 100755 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -357,6 +357,8 @@ void CJamRecorder::Start() { currentSession = new CJamSession( recordBaseDir ); isRecording = true; + + emit RecordingSessionStarted ( currentSession->SessionDir().path() ); } @@ -402,8 +404,6 @@ void CJamRecorder::OnEnd() delete currentSession; currentSession = nullptr; } - - emit RecordingSessionEnded ( reaperProjectFileName ); } /** diff --git a/src/recorder/jamrecorder.h b/src/recorder/jamrecorder.h index 7ebbbe54..3713162a 100755 --- a/src/recorder/jamrecorder.h +++ b/src/recorder/jamrecorder.h @@ -169,7 +169,7 @@ private: QThread* thisThread; signals: - void RecordingSessionEnded ( QString sessionDir ); + void RecordingSessionStarted ( QString sessionDir ); private slots: /** diff --git a/src/server.cpp b/src/server.cpp index ae10d6b2..3901fbb4 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -468,6 +468,10 @@ CServer::CServer ( const int iNewMaxNumChan, SIGNAL ( SvrRegStatusChanged() ), this, SLOT ( OnSvrRegStatusChanged() ) ); + QObject::connect( &JamRecorder, + SIGNAL ( RecordingSessionStarted ( QString ) ), + SIGNAL ( RecordingSessionStarted ( QString ) ) ); + QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ), this, SLOT ( OnAboutToQuit() ) ); diff --git a/src/server.h b/src/server.h index 47ee5d04..241fe119 100755 --- a/src/server.h +++ b/src/server.h @@ -197,6 +197,7 @@ public: CVector& veciJitBufNumFrames, CVector& veciNetwFrameSizeFact ); + bool GetRecordingEnabled() { return bEnableRecording; } // Server list management -------------------------------------------------- void UpdateServerList() { ServerListManager.Update(); } @@ -382,6 +383,7 @@ signals: const int iNumAudChan, const CVector vecsData ); void RestartRecorder(); + void RecordingSessionStarted ( QString sessionDir ); public slots: void OnTimer(); diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 7586bbf9..0f967d52 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -267,6 +267,22 @@ lvwClients->setMinimumHeight ( 140 ); ModifyAutoStartEntry ( bCurAutoStartMinState ); #endif + // Recorder controls + pbtNewRecording->setAutoDefault ( false ); + + if ( !pServer->GetRecordingEnabled() ) + { + // The recorder was not enabled from the command line + // TODO: Once enabling from the GUI is implemented, remove + lblRecorderStatus->setVisible ( false ); + pbtNewRecording->setVisible ( false ); + } + + // TODO: Not yet implemented, so hide them! + chbEnableRecorder->setVisible ( false ); + pbtRecordingDir->setVisible ( false ); + edtRecordingsDir->setVisible ( false ); + // update GUI dependencies UpdateGUIDependencies(); @@ -319,6 +335,10 @@ lvwClients->setMinimumHeight ( 140 ); QObject::connect ( cbxCentServAddrType, SIGNAL ( activated ( int ) ), this, SLOT ( OnCentServAddrTypeActivated ( int ) ) ); + // push buttons + QObject::connect ( pbtNewRecording, SIGNAL ( released() ), + this, SLOT ( OnNewRecordingClicked() ) ); + // timers QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) ); @@ -332,6 +352,9 @@ lvwClients->setMinimumHeight ( 140 ); QObject::connect ( pServer, SIGNAL ( SvrRegStatusChanged() ), this, SLOT ( OnSvrRegStatusChanged() ) ); + QObject::connect ( pServer, SIGNAL ( RecordingSessionStarted ( QString ) ), + this, SLOT ( OnRecordingSessionStarted ( QString ) ) ); + QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ), this, SLOT ( OnAboutToQuit() ) ); @@ -451,6 +474,12 @@ void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx ) UpdateGUIDependencies(); } +void CServerDlg::OnServerStopped(); +{ + UpdateSystemTrayIcon ( false ); + UpdateRecorderStatus ( QString::null ); +} + void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason ) { // on double click on the icon, show window in fore ground @@ -504,6 +533,7 @@ void CServerDlg::OnTimer() ListViewMutex.unlock(); } + void CServerDlg::UpdateGUIDependencies() { // get the states which define the GUI dependencies from the server @@ -560,6 +590,9 @@ void CServerDlg::UpdateGUIDependencies() } lblRegSvrStatus->setText ( strStatus ); + + edtCurrentSessionDir->setText( "" ); + UpdateRecorderStatus ( QString::null ); } void CServerDlg::UpdateSystemTrayIcon ( const bool bIsActive ) @@ -618,6 +651,39 @@ void CServerDlg::ModifyAutoStartEntry ( const bool bDoAutoStart ) } } +void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) +{ + QString currentSessionDir = edtCurrentSessionDir->text(); + QString strRecorderStatus; + bool bIsRecording = false; + + if ( pServer->GetRecordingEnabled() ) + { + if ( pServer->IsRunning() ) + { + currentSessionDir = sessionDir != QString::null ? sessionDir : ""; + strRecorderStatus = tr ( "Recording" ); + bIsRecording = true; + } + else + { + strRecorderStatus = tr ( "Not recording" ); + } + } + else + { + strRecorderStatus = tr ( "Not enabled" ); + } + + edtCurrentSessionDir->setVisible ( pServer->GetRecordingEnabled() ); + edtCurrentSessionDir->setEnabled ( bIsRecording ); + edtCurrentSessionDir->setText( currentSessionDir ); + + lblRecorderStatus->setText ( strRecorderStatus ); + + pbtNewRecording->setEnabled ( bIsRecording ); +} + void CServerDlg::changeEvent ( QEvent* pEvent ) { // if we have a system tray icon, we make the window invisible if it is diff --git a/src/serverdlg.h b/src/serverdlg.h index da06e0c4..ef80c8e4 100755 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -63,6 +63,7 @@ protected: void UpdateSystemTrayIcon ( const bool bIsActive ); void ShowWindowInForeground() { showNormal(); raise(); } void ModifyAutoStartEntry ( const bool bDoAutoStart ); + void UpdateRecorderStatus( QString sessionDir ); QTimer Timer; CServer* pServer; @@ -92,7 +93,7 @@ public slots: void OnCentServAddrTypeActivated ( int iTypeIdx ); void OnTimer(); void OnServerStarted() { UpdateSystemTrayIcon ( true ); } - void OnServerStopped() { UpdateSystemTrayIcon ( false ); } + void OnServerStopped(); void OnSvrRegStatusChanged() { UpdateGUIDependencies(); } void OnSysTrayMenuOpen() { ShowWindowInForeground(); } void OnSysTrayMenuHide() { hide(); } @@ -101,4 +102,8 @@ public slots: void keyPressEvent ( QKeyEvent *e ) // block escape key { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } + + void OnNewRecordingClicked(); { pServer->RestartRecorder(); } + void OnRecordingSessionStarted ( QString sessionDir ) + { UpdateRecorderStatus ( sessionDir ); } }; diff --git a/src/serverdlgbase.ui b/src/serverdlgbase.ui index 3e336347..6e55a0ed 100755 --- a/src/serverdlgbase.ui +++ b/src/serverdlgbase.ui @@ -158,6 +158,72 @@ + + + + + + Enable jam recorder + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + true + + + + + + + STATUS + + + + + + + New recording + + + + + + + + + + + Recordings folder + + + + + + + true + + + + + @@ -215,6 +281,11 @@ edtServerName edtLocationCity cbxLocationCountry + chbEnableRecorder + edtCurrentSessionDir + pbtNewRecording + pbtRecordingDir + edtRecordingsDir