Initial Recording GUI

Issue #228.

Display the recorder state and latest recording directory and
allow a new recording to be requested.
This commit is contained in:
Peter L Jones 2020-05-15 22:04:55 +01:00
parent a95b1ad964
commit 0f8d15f343
7 changed files with 170 additions and 5 deletions

View File

@ -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 );
}
/**

View File

@ -169,7 +169,7 @@ private:
QThread* thisThread;
signals:
void RecordingSessionEnded ( QString sessionDir );
void RecordingSessionStarted ( QString sessionDir );
private slots:
/**

View File

@ -468,6 +468,10 @@ CServer::CServer ( const int iNewMaxNumChan,
SIGNAL ( SvrRegStatusChanged() ),
this, SLOT ( OnSvrRegStatusChanged() ) );
QObject::connect( &JamRecorder,
SIGNAL ( RecordingSessionStarted ( QString ) ),
this, SLOT ( OnRecordingSessionStarted ( QString ) ) );
QObject::connect ( QCoreApplication::instance(),
SIGNAL ( aboutToQuit() ),
this, SLOT ( OnAboutToQuit() ) );

View File

@ -197,6 +197,7 @@ public:
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact );
bool GetRecordingEnabled() { return bEnableRecording; }
// Server list management --------------------------------------------------
void UpdateServerList() { ServerListManager.Update(); }
@ -382,6 +383,7 @@ signals:
const int iNumAudChan,
const CVector<int16_t> vecsData );
void RestartRecorder();
void RecordingSessionStarted ( QString sessionDir );
public slots:
void OnTimer();
@ -457,6 +459,11 @@ public slots:
void OnCLDisconnection ( CHostAddress InetAddr );
void OnRecordingSessionStarted ( QString sessionDir )
{
emit RecordingSessionStarted ( sessionDir );
}
void OnAboutToQuit();
void OnHandledSignal ( int sigNum );

View File

@ -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,11 @@ void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx )
UpdateGUIDependencies();
}
void CServerDlg::OnNewRecordingClicked()
{
pServer->RestartRecorder();
}
void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason )
{
// on double click on the icon, show window in fore ground
@ -504,6 +532,18 @@ void CServerDlg::OnTimer()
ListViewMutex.unlock();
}
void CServerDlg::OnServerStarted()
{
UpdateSystemTrayIcon ( true );
}
void CServerDlg::OnServerStopped()
{
UpdateSystemTrayIcon ( false );
UpdateRecorderStatus ( QString::null );
}
void CServerDlg::UpdateGUIDependencies()
{
// get the states which define the GUI dependencies from the server
@ -560,6 +600,9 @@ void CServerDlg::UpdateGUIDependencies()
}
lblRegSvrStatus->setText ( strStatus );
edtCurrentSessionDir->setText( "" );
UpdateRecorderStatus ( QString::null );
}
void CServerDlg::UpdateSystemTrayIcon ( const bool bIsActive )
@ -618,6 +661,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

View File

@ -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;
@ -90,9 +91,10 @@ public slots:
void OnLocationCityTextChanged ( const QString& strNewCity );
void OnLocationCountryActivated ( int iCntryListItem );
void OnCentServAddrTypeActivated ( int iTypeIdx );
void OnNewRecordingClicked();
void OnTimer();
void OnServerStarted() { UpdateSystemTrayIcon ( true ); }
void OnServerStopped() { UpdateSystemTrayIcon ( false ); }
void OnServerStarted();
void OnServerStopped();
void OnSvrRegStatusChanged() { UpdateGUIDependencies(); }
void OnSysTrayMenuOpen() { ShowWindowInForeground(); }
void OnSysTrayMenuHide() { hide(); }
@ -101,4 +103,9 @@ public slots:
void keyPressEvent ( QKeyEvent *e ) // block escape key
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
void OnRecordingSessionStarted ( QString sessionDir )
{
UpdateRecorderStatus ( sessionDir );
}
};

View File

@ -158,6 +158,72 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="chbEnableRecorder">
<property name="text">
<string>Enable jam recorder</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="edtCurrentSessionDir">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblRecorderStatus">
<property name="text">
<string>STATUS</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtNewRecording">
<property name="text">
<string>New recording</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="pbtRecordingDir">
<property name="text">
<string>Recordings folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="edtRecordingsDir">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
@ -215,6 +281,11 @@
<tabstop>edtServerName</tabstop>
<tabstop>edtLocationCity</tabstop>
<tabstop>cbxLocationCountry</tabstop>
<tabstop>chbEnableRecorder</tabstop>
<tabstop>edtCurrentSessionDir</tabstop>
<tabstop>pbtNewRecording</tabstop>
<tabstop>pbtRecordingDir</tabstop>
<tabstop>edtRecordingsDir</tabstop>
</tabstops>
<resources>
<include location="resources.qrc"/>