Merge pull request #290 from pljones/feature/228-gui-triggered-recording-cuts

Initial Recording GUI
This commit is contained in:
Volker Fischer 2020-05-26 06:53:19 +02:00 committed by GitHub
commit b297339cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 154 additions and 4 deletions

View file

@ -8,6 +8,8 @@
- faster update of musicians list in the server list table - 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)

View file

@ -357,6 +357,8 @@ void CJamRecorder::Start() {
currentSession = new CJamSession( recordBaseDir ); currentSession = new CJamSession( recordBaseDir );
isRecording = true; isRecording = true;
emit RecordingSessionStarted ( currentSession->SessionDir().path() );
} }
@ -402,8 +404,6 @@ void CJamRecorder::OnEnd()
delete currentSession; delete currentSession;
currentSession = nullptr; currentSession = nullptr;
} }
emit RecordingSessionEnded ( reaperProjectFileName );
} }
/** /**

View file

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

View file

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

View file

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

View file

@ -267,6 +267,22 @@ lvwClients->setMinimumHeight ( 140 );
ModifyAutoStartEntry ( bCurAutoStartMinState ); ModifyAutoStartEntry ( bCurAutoStartMinState );
#endif #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 // update GUI dependencies
UpdateGUIDependencies(); UpdateGUIDependencies();
@ -319,6 +335,10 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( cbxCentServAddrType, SIGNAL ( activated ( int ) ), QObject::connect ( cbxCentServAddrType, SIGNAL ( activated ( int ) ),
this, SLOT ( OnCentServAddrTypeActivated ( int ) ) ); this, SLOT ( OnCentServAddrTypeActivated ( int ) ) );
// push buttons
QObject::connect ( pbtNewRecording, SIGNAL ( released() ),
this, SLOT ( OnNewRecordingClicked() ) );
// timers // timers
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) ); QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
@ -332,6 +352,9 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( pServer, SIGNAL ( SvrRegStatusChanged() ), QObject::connect ( pServer, SIGNAL ( SvrRegStatusChanged() ),
this, SLOT ( OnSvrRegStatusChanged() ) ); this, SLOT ( OnSvrRegStatusChanged() ) );
QObject::connect ( pServer, SIGNAL ( RecordingSessionStarted ( QString ) ),
this, SLOT ( OnRecordingSessionStarted ( QString ) ) );
QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ), QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ),
this, SLOT ( OnAboutToQuit() ) ); this, SLOT ( OnAboutToQuit() ) );
@ -451,6 +474,12 @@ void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx )
UpdateGUIDependencies(); UpdateGUIDependencies();
} }
void CServerDlg::OnServerStopped();
{
UpdateSystemTrayIcon ( false );
UpdateRecorderStatus ( QString::null );
}
void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason ) void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason )
{ {
// on double click on the icon, show window in fore ground // on double click on the icon, show window in fore ground
@ -504,6 +533,7 @@ void CServerDlg::OnTimer()
ListViewMutex.unlock(); ListViewMutex.unlock();
} }
void CServerDlg::UpdateGUIDependencies() void CServerDlg::UpdateGUIDependencies()
{ {
// get the states which define the GUI dependencies from the server // get the states which define the GUI dependencies from the server
@ -560,6 +590,9 @@ void CServerDlg::UpdateGUIDependencies()
} }
lblRegSvrStatus->setText ( strStatus ); lblRegSvrStatus->setText ( strStatus );
edtCurrentSessionDir->setText( "" );
UpdateRecorderStatus ( QString::null );
} }
void CServerDlg::UpdateSystemTrayIcon ( const bool bIsActive ) 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 ) void CServerDlg::changeEvent ( QEvent* pEvent )
{ {
// if we have a system tray icon, we make the window invisible if it is // 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 UpdateSystemTrayIcon ( const bool bIsActive );
void ShowWindowInForeground() { showNormal(); raise(); } void ShowWindowInForeground() { showNormal(); raise(); }
void ModifyAutoStartEntry ( const bool bDoAutoStart ); void ModifyAutoStartEntry ( const bool bDoAutoStart );
void UpdateRecorderStatus( QString sessionDir );
QTimer Timer; QTimer Timer;
CServer* pServer; CServer* pServer;
@ -92,7 +93,7 @@ public slots:
void OnCentServAddrTypeActivated ( int iTypeIdx ); void OnCentServAddrTypeActivated ( int iTypeIdx );
void OnTimer(); void OnTimer();
void OnServerStarted() { UpdateSystemTrayIcon ( true ); } void OnServerStarted() { UpdateSystemTrayIcon ( true ); }
void OnServerStopped() { UpdateSystemTrayIcon ( false ); } void OnServerStopped();
void OnSvrRegStatusChanged() { UpdateGUIDependencies(); } void OnSvrRegStatusChanged() { UpdateGUIDependencies(); }
void OnSysTrayMenuOpen() { ShowWindowInForeground(); } void OnSysTrayMenuOpen() { ShowWindowInForeground(); }
void OnSysTrayMenuHide() { hide(); } void OnSysTrayMenuHide() { hide(); }
@ -101,4 +102,8 @@ public slots:
void keyPressEvent ( QKeyEvent *e ) // block escape key void keyPressEvent ( QKeyEvent *e ) // block escape key
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
void OnNewRecordingClicked(); { pServer->RestartRecorder(); }
void OnRecordingSessionStarted ( QString sessionDir )
{ UpdateRecorderStatus ( sessionDir ); }
}; };

View file

@ -158,6 +158,72 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
@ -215,6 +281,11 @@
<tabstop>edtServerName</tabstop> <tabstop>edtServerName</tabstop>
<tabstop>edtLocationCity</tabstop> <tabstop>edtLocationCity</tabstop>
<tabstop>cbxLocationCountry</tabstop> <tabstop>cbxLocationCountry</tabstop>
<tabstop>chbEnableRecorder</tabstop>
<tabstop>edtCurrentSessionDir</tabstop>
<tabstop>pbtNewRecording</tabstop>
<tabstop>pbtRecordingDir</tabstop>
<tabstop>edtRecordingsDir</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="resources.qrc"/> <include location="resources.qrc"/>