From eef2973ae02cc3e1581f57832e917b777dca59f6 Mon Sep 17 00:00:00 2001 From: Peter L Jones Date: Sat, 20 Jun 2020 17:21:53 +0100 Subject: [PATCH 1/2] Save the source --- src/recorder/jamcontroller.cpp | 10 +++ src/serverdlg.cpp | 150 +++++++++++++++++++++++---------- src/serverdlg.h | 3 + src/serverdlgbase.ui | 49 ++++++----- 4 files changed, 147 insertions(+), 65 deletions(-) diff --git a/src/recorder/jamcontroller.cpp b/src/recorder/jamcontroller.cpp index e6a4f335..e0b439f8 100755 --- a/src/recorder/jamcontroller.cpp +++ b/src/recorder/jamcontroller.cpp @@ -90,6 +90,11 @@ void CJamController::SetRecordingDir ( QString newRecordingDir, strRecorderErrMsg = pJamRecorder->Init(); bRecorderInitialised = ( strRecorderErrMsg == QString::null ); bEnableRecording = bRecorderInitialised; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) +// TODO we should use the ConsoleWriterFactory() instead of qInfo() + qInfo() << "Recording state" << ( bEnableRecording ? "enabled" : "disabled" ); +#endif } else { @@ -97,6 +102,11 @@ void CJamController::SetRecordingDir ( QString newRecordingDir, strRecorderErrMsg = QString::null; bRecorderInitialised = false; bEnableRecording = false; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) +// TODO we should use the ConsoleWriterFactory() instead of qInfo() + qInfo() << "Recording state not initialised"; +#endif } if ( bRecorderInitialised ) diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 8aac767e..76a4b8a6 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -123,29 +123,64 @@ CServerDlg::CServerDlg ( CServer* pNServP, cbxLocationCountry->setAccessibleName ( tr ( "Country where the server is located combo box" ) ); + // recording directory + pbtRecordingDir->setAccessibleName ( tr ( "Display dialog to select recording directory button" ) ); + pbtRecordingDir->setWhatsThis ( "" + tr ( "Main Recording Directory" ) + ": " + + tr ( "Click the button to open the dialog that allows the main recording directory to be selected." + "The chosen value must exist and be writeable (allow creation of sub-directories " + "by the user Jamulus is running as). " ) ); + + edtRecordingDir->setAccessibleName ( tr ( "Main recording directory text box (read-only)" ) ); + edtRecordingDir->setWhatsThis ( "" + tr ( "Main Recording Directory" ) + ": " + + tr ( "The current value of the main recording directory. " + "The chosen value must exist and be writeable (allow creation of sub-directories " + "by the user Jamulus is running as). " + "Click the button to open the dialog that allows the main recording directory to be selected." ) ); + + tbtClearRecordingDir->setAccessibleName ( tr ( "Clear the recording directory button" ) ); + tbtClearRecordingDir->setWhatsThis ( "" + tr ( "Clear Recording Directory" ) + ": " + + tr ( "Click the button to clear the currently selected recording directory. " + "This will prevent recording until a new value is selected.") ); + // enable recorder chbEnableRecorder->setAccessibleName( tr ( "Checkbox to turn on or off server recording" ) ); - chbEnableRecorder->setWhatsThis( "" + tr ( "Enable Recorder" ) + ":" + chbEnableRecorder->setWhatsThis( "" + tr ( "Enable Recorder" ) + ": " + tr ( "Checked when the recorder is enabled, otherwise unchecked. " "The recorder will run when a session is in progress, if (set up correctly and) enabled." ) ); // current session directory edtCurrentSessionDir->setAccessibleName( tr ( "Current session directory text box (read-only)" ) ); - edtCurrentSessionDir->setWhatsThis( "" + tr ( "Current Session Directory" ) + ":" - + tr ( "Enabled during recording and holds the current recording session directory. " - "Disabled after recording or when the recorder is not enabled." ) ); + edtCurrentSessionDir->setWhatsThis( "" + tr ( "Current Session Directory" ) + ": " + + tr ( "Enabled during recording and holds the current recording session directory. " + "Disabled after recording or when the recorder is not enabled." ) ); // recorder status lblRecorderStatus->setAccessibleName ( tr ( "Recorder status label" ) ); - lblRecorderStatus->setWhatsThis ( "" + tr ( "Recorder Status" ) + ":" - + tr ( "Displays the current status of the recorder." ) ); + lblRecorderStatus->setWhatsThis ( "" + tr ( "Recorder Status" ) + ": " + + tr ( "Displays the current status of the recorder. The following values are possible:" + "
" + "
Not initialised
" + "
No recording directory has been set or the value is not useable
" + "
Not enabled
" + "
Recording has been switched off" ) +#ifdef _WIN32 + + tr ( " by the UI checkbox
" ) +#else + + tr ( ", either by the UI checkbox or SIGUSR2 being received" ) +#endif + + tr ( "
Not recording
" + "
There is no one connected to the server to record
" + "
Recording
" + "
The performers are being recorded to the specified session directory
" + "
" ) + + tr ( "
NOTE: If the recording directory is not useable, " + "the problem will be displayed in place of the directory.") ); // new recording pbtNewRecording->setAccessibleName ( tr ( "Request new recording button" ) ); - pbtNewRecording->setWhatsThis ( "" + tr ( "New Recording" ) + ":" + pbtNewRecording->setWhatsThis ( "" + tr ( "New Recording" ) + ": " + tr ( "During a recording session, the button can be used to start a new recording." ) ); - // init system tray icon if ( bSystemTrayIconAvaialbe ) { @@ -289,22 +324,12 @@ lvwClients->setMinimumHeight ( 140 ); #endif // Recorder controls - if ( !pServer->GetRecorderInitialised() ) - { - // The recorder was not initialised successfully from the command line - // TODO: Once initialising from the GUI is implemented, remove - chbEnableRecorder->setVisible ( false ); - edtCurrentSessionDir->setVisible ( false ); - lblRecorderStatus->setVisible ( false ); - pbtNewRecording->setVisible ( false ); - } - + chbEnableRecorder->setCheckState ( Qt::CheckState::Checked ); // move to settings edtCurrentSessionDir->setText ( "" ); pbtNewRecording->setAutoDefault ( false ); - - // TODO: Not yet implemented, so hide them! - pbtRecordingDir->setVisible ( false ); - edtRecordingsDir->setVisible ( false ); + pbtRecordingDir->setAutoDefault ( false ); + edtRecordingDir->setText( pServer->GetRecordingDir() ); + tbtClearRecordingDir->setText ( "(X)" ); // someone make me a nice icon? UpdateRecorderStatus ( QString::null ); @@ -372,9 +397,16 @@ lvwClients->setMinimumHeight ( 140 ); this, &CServerDlg::OnCentServAddrTypeActivated ); // push buttons + QObject::connect ( pbtRecordingDir, &QPushButton::released, + this, &CServerDlg::OnRecordingDirClicked ); + QObject::connect ( pbtNewRecording, &QPushButton::released, this, &CServerDlg::OnNewRecordingClicked ); + // tool buttons + QObject::connect ( tbtClearRecordingDir, &QToolButton::released, + this, &CServerDlg::OnClearRecordingDirClicked ); + // timers QObject::connect ( &Timer, &QTimer::timeout, this, &CServerDlg::OnTimer ); @@ -539,6 +571,30 @@ void CServerDlg::OnStopRecorder() UpdateRecorderStatus ( QString::null ); } +void CServerDlg::OnRecordingDirClicked() +{ + // get the current value from pServer + QString currentValue = pServer->GetRecordingDir(); + QString newRecordingDir = QFileDialog::getExistingDirectory ( this, + tr ( "Select Main Recording Directory" ), + currentValue, + QFileDialog::ShowDirsOnly | QFileDialog::DontUseNativeDialog ); + if ( newRecordingDir != currentValue ) + { + pServer->SetRecordingDir ( newRecordingDir ); + UpdateRecorderStatus ( QString::null ); + } +} + +void CServerDlg::OnClearRecordingDirClicked() +{ + if ( pServer->GetRecorderErrMsg() != QString::null || pServer->GetRecordingDir() != "" ) + { + pServer->SetRecordingDir ( "" ); + UpdateRecorderStatus ( QString::null ); + } +} + void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason ) { // on double click on the icon, show window in fore ground @@ -710,44 +766,52 @@ void CServerDlg::ModifyAutoStartEntry ( const bool bDoAutoStart ) void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) { - if ( !pServer->GetRecorderInitialised() ) - { - // everything should be hidden. - return; - } - - Qt::CheckState csIsEnabled; QString currentSessionDir = edtCurrentSessionDir->text(); + QString errMsg = pServer->GetRecorderErrMsg(); bool bIsRecording = false; QString strRecorderStatus; + QString strRecordingDir; - if ( pServer->GetRecordingEnabled() ) + if ( pServer->GetRecorderInitialised() ) { - csIsEnabled = Qt::CheckState::Checked; - if ( pServer->IsRunning() ) + strRecordingDir = pServer->GetRecordingDir(); + chbEnableRecorder->setEnabled ( true ); + if ( pServer->GetRecordingEnabled() ) { - currentSessionDir = sessionDir != QString::null ? sessionDir : ""; - strRecorderStatus = tr ( "Recording" ); - bIsRecording = true; + if ( pServer->IsRunning() ) + { + edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" ); + strRecorderStatus = tr ( "Recording" ); + bIsRecording = true; + } + else + { + strRecorderStatus = tr ( "Not recording" ); + } } else { - strRecorderStatus = tr ( "Not recording" ); + strRecorderStatus = tr ( "Not enabled" ); } } else { - csIsEnabled = Qt::CheckState::Unchecked; - strRecorderStatus = tr ( "Not enabled" ); + strRecordingDir = pServer->GetRecorderErrMsg(); + if ( strRecordingDir == QString::null ) + { + strRecordingDir = pServer->GetRecordingDir(); + } + else + { + strRecordingDir = tr ( "ERROR" ) + ": " + strRecordingDir; + } + chbEnableRecorder->setEnabled ( false ); + strRecorderStatus = tr ( "Not initialised" ); } - chbEnableRecorder->setCheckState ( csIsEnabled ); - + edtRecordingDir->setText( strRecordingDir ); edtCurrentSessionDir->setEnabled ( bIsRecording ); - edtCurrentSessionDir->setText ( currentSessionDir ); - lblRecorderStatus->setText ( strRecorderStatus ); - pbtNewRecording->setEnabled ( bIsRecording ); } diff --git a/src/serverdlg.h b/src/serverdlg.h index 47c56b09..e4f7e603 100755 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "global.h" #include "server.h" #include "settings.h" @@ -111,6 +112,8 @@ public slots: { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } void OnNewRecordingClicked() { pServer->RequestNewRecording(); } + void OnRecordingDirClicked(); + void OnClearRecordingDirClicked(); void OnRecordingSessionStarted ( QString sessionDir ) { UpdateRecorderStatus ( sessionDir ); } }; diff --git a/src/serverdlgbase.ui b/src/serverdlgbase.ui index 418a07c3..9a57988a 100755 --- a/src/serverdlgbase.ui +++ b/src/serverdlgbase.ui @@ -169,12 +169,34 @@ + + + + + + Recording Directory + + + + + + + true + + + + + + + + + - Enable jam recorder + Enable Jam Recorder @@ -195,25 +217,7 @@ - New recording - - - - - - - - - - - Recordings folder - - - - - - - true + New Recording @@ -276,11 +280,12 @@ edtServerName edtLocationCity cbxLocationCountry + pbtRecordingDir + edtRecordingDir + tbtClearRecordingDir chbEnableRecorder edtCurrentSessionDir pbtNewRecording - pbtRecordingDir - edtRecordingsDir From 3b93e67f931275aa5f7271653bbadbfeda89d65a Mon Sep 17 00:00:00 2001 From: Peter L Jones Date: Wed, 1 Jul 2020 16:13:42 +0100 Subject: [PATCH 2/2] Changes for recorder status and whatsthis --- ChangeLog | 2 ++ src/serverdlg.cpp | 39 ++++++++++++++++++++------------------- src/serverdlg.h | 6 ++++++ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dc7efff..da33eba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ 3.5.9git +- update server UI to allow setting the jam recorder directory (like -R) (#228, #405) + - new app icon for Jamulus, created by geheimerEichkater (#410) - bug fix: grouping faders in the client should be proportional (see discussion in #202, #419) diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 76a4b8a6..e80000d4 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -157,24 +157,25 @@ CServerDlg::CServerDlg ( CServer* pNServP, // recorder status lblRecorderStatus->setAccessibleName ( tr ( "Recorder status label" ) ); lblRecorderStatus->setWhatsThis ( "" + tr ( "Recorder Status" ) + ": " - + tr ( "Displays the current status of the recorder. The following values are possible:" - "
" - "
Not initialised
" - "
No recording directory has been set or the value is not useable
" - "
Not enabled
" - "
Recording has been switched off" ) + + tr ( "Displays the current status of the recorder. The following values are possible:" ) + + "
" + + "
" + tr ( SREC_NOT_INITIALISED ) + "
" + + "
" + tr ( "No recording directory has been set or the value is not useable" ) + "
" + + "
" + tr ( SREC_NOT_ENABLED ) + "
" + + "
" + tr ( "Recording has been switched off" ) #ifdef _WIN32 - + tr ( " by the UI checkbox
" ) + + tr ( " by the UI checkbox" ) #else - + tr ( ", either by the UI checkbox or SIGUSR2 being received
" ) + + tr ( ", either by the UI checkbox or SIGUSR2 being received" ) #endif - + tr ( "
Not recording
" - "
There is no one connected to the server to record
" - "
Recording
" - "
The performers are being recorded to the specified session directory
" - "
" ) - + tr ( "
NOTE: If the recording directory is not useable, " - "the problem will be displayed in place of the directory.") ); + + "" + + "
" + tr ( SREC_NOT_RECORDING ) + "
" + + "
" + tr ( "There is no one connected to the server to record" ) + "
" + + "
" + tr ( SREC_RECORDING ) + "
" + + "
" + tr ( "The performers are being recorded to the specified session directory" ) + "
" + + "" + + "
" + tr ( "NOTE" ) + ": " + + tr ( "If the recording directory is not useable, the problem will be displayed in place of the directory." ) ); // new recording pbtNewRecording->setAccessibleName ( tr ( "Request new recording button" ) ); @@ -781,17 +782,17 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) if ( pServer->IsRunning() ) { edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" ); - strRecorderStatus = tr ( "Recording" ); + strRecorderStatus = tr ( SREC_RECORDING ); bIsRecording = true; } else { - strRecorderStatus = tr ( "Not recording" ); + strRecorderStatus = tr ( SREC_NOT_RECORDING ); } } else { - strRecorderStatus = tr ( "Not enabled" ); + strRecorderStatus = tr ( SREC_NOT_ENABLED ); } } else @@ -806,7 +807,7 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) strRecordingDir = tr ( "ERROR" ) + ": " + strRecordingDir; } chbEnableRecorder->setEnabled ( false ); - strRecorderStatus = tr ( "Not initialised" ); + strRecorderStatus = tr ( SREC_NOT_INITIALISED ); } edtRecordingDir->setText( strRecordingDir ); diff --git a/src/serverdlg.h b/src/serverdlg.h index e4f7e603..3313a011 100755 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -46,6 +46,12 @@ // update time for GUI controls #define GUI_CONTRL_UPDATE_TIME 1000 // ms +// Strings used in multiple places +#define SREC_NOT_INITIALISED "Not initialised" +#define SREC_NOT_ENABLED "Not enabled" +#define SREC_NOT_RECORDING "Not recording" +#define SREC_RECORDING "Recording" + /* Classes ********************************************************************/ class CServerDlg : public QDialog, private Ui_CServerDlgBase