Save the source
This commit is contained in:
parent
c2d98c865e
commit
eef2973ae0
4 changed files with 147 additions and 65 deletions
|
@ -90,6 +90,11 @@ void CJamController::SetRecordingDir ( QString newRecordingDir,
|
||||||
strRecorderErrMsg = pJamRecorder->Init();
|
strRecorderErrMsg = pJamRecorder->Init();
|
||||||
bRecorderInitialised = ( strRecorderErrMsg == QString::null );
|
bRecorderInitialised = ( strRecorderErrMsg == QString::null );
|
||||||
bEnableRecording = bRecorderInitialised;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -97,6 +102,11 @@ void CJamController::SetRecordingDir ( QString newRecordingDir,
|
||||||
strRecorderErrMsg = QString::null;
|
strRecorderErrMsg = QString::null;
|
||||||
bRecorderInitialised = false;
|
bRecorderInitialised = false;
|
||||||
bEnableRecording = 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 )
|
if ( bRecorderInitialised )
|
||||||
|
|
|
@ -123,29 +123,64 @@ CServerDlg::CServerDlg ( CServer* pNServP,
|
||||||
cbxLocationCountry->setAccessibleName ( tr (
|
cbxLocationCountry->setAccessibleName ( tr (
|
||||||
"Country where the server is located combo box" ) );
|
"Country where the server is located combo box" ) );
|
||||||
|
|
||||||
|
// recording directory
|
||||||
|
pbtRecordingDir->setAccessibleName ( tr ( "Display dialog to select recording directory button" ) );
|
||||||
|
pbtRecordingDir->setWhatsThis ( "<b>" + tr ( "Main Recording Directory" ) + ":</b> "
|
||||||
|
+ 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 ( "<b>" + tr ( "Main Recording Directory" ) + ":</b> "
|
||||||
|
+ 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 ( "<b>" + tr ( "Clear Recording Directory" ) + ":</b> "
|
||||||
|
+ tr ( "Click the button to clear the currently selected recording directory. "
|
||||||
|
"This will prevent recording until a new value is selected.") );
|
||||||
|
|
||||||
// enable recorder
|
// enable recorder
|
||||||
chbEnableRecorder->setAccessibleName( tr ( "Checkbox to turn on or off server recording" ) );
|
chbEnableRecorder->setAccessibleName( tr ( "Checkbox to turn on or off server recording" ) );
|
||||||
chbEnableRecorder->setWhatsThis( "<b>" + tr ( "Enable Recorder" ) + ":</b>"
|
chbEnableRecorder->setWhatsThis( "<b>" + tr ( "Enable Recorder" ) + ":</b> "
|
||||||
+ tr ( "Checked when the recorder is enabled, otherwise unchecked. "
|
+ 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." ) );
|
"The recorder will run when a session is in progress, if (set up correctly and) enabled." ) );
|
||||||
|
|
||||||
// current session directory
|
// current session directory
|
||||||
edtCurrentSessionDir->setAccessibleName( tr ( "Current session directory text box (read-only)" ) );
|
edtCurrentSessionDir->setAccessibleName( tr ( "Current session directory text box (read-only)" ) );
|
||||||
edtCurrentSessionDir->setWhatsThis( "<b>" + tr ( "Current Session Directory" ) + ":</b>"
|
edtCurrentSessionDir->setWhatsThis( "<b>" + tr ( "Current Session Directory" ) + ":</b> "
|
||||||
+ tr ( "Enabled during recording and holds the current recording session directory. "
|
+ tr ( "Enabled during recording and holds the current recording session directory. "
|
||||||
"Disabled after recording or when the recorder is not enabled." ) );
|
"Disabled after recording or when the recorder is not enabled." ) );
|
||||||
|
|
||||||
// recorder status
|
// recorder status
|
||||||
lblRecorderStatus->setAccessibleName ( tr ( "Recorder status label" ) );
|
lblRecorderStatus->setAccessibleName ( tr ( "Recorder status label" ) );
|
||||||
lblRecorderStatus->setWhatsThis ( "<b>" + tr ( "Recorder Status" ) + ":</b>"
|
lblRecorderStatus->setWhatsThis ( "<b>" + tr ( "Recorder Status" ) + ":</b> "
|
||||||
+ tr ( "Displays the current status of the recorder." ) );
|
+ tr ( "Displays the current status of the recorder. The following values are possible:"
|
||||||
|
"<dl>"
|
||||||
|
"<dt>Not initialised</dt>"
|
||||||
|
"<dd>No recording directory has been set or the value is not useable</dd>"
|
||||||
|
"<dt>Not enabled</dt>"
|
||||||
|
"<dd>Recording has been switched off" )
|
||||||
|
#ifdef _WIN32
|
||||||
|
+ tr ( " by the UI checkbox</dd>" )
|
||||||
|
#else
|
||||||
|
+ tr ( ", either by the UI checkbox or SIGUSR2 being received</dd>" )
|
||||||
|
#endif
|
||||||
|
+ tr ( "<dt>Not recording</dt>"
|
||||||
|
"<dd>There is no one connected to the server to record</dd>"
|
||||||
|
"<dt>Recording</dt>"
|
||||||
|
"<dd>The performers are being recorded to the specified session directory</dd>"
|
||||||
|
"</dl>" )
|
||||||
|
+ tr ( "<br/><b>NOTE:</b> If the recording directory is not useable, "
|
||||||
|
"the problem will be displayed in place of the directory.") );
|
||||||
|
|
||||||
// new recording
|
// new recording
|
||||||
pbtNewRecording->setAccessibleName ( tr ( "Request new recording button" ) );
|
pbtNewRecording->setAccessibleName ( tr ( "Request new recording button" ) );
|
||||||
pbtNewRecording->setWhatsThis ( "<b>" + tr ( "New Recording" ) + ":</b>"
|
pbtNewRecording->setWhatsThis ( "<b>" + tr ( "New Recording" ) + ":</b> "
|
||||||
+ tr ( "During a recording session, the button can be used to start a new recording." ) );
|
+ tr ( "During a recording session, the button can be used to start a new recording." ) );
|
||||||
|
|
||||||
|
|
||||||
// init system tray icon
|
// init system tray icon
|
||||||
if ( bSystemTrayIconAvaialbe )
|
if ( bSystemTrayIconAvaialbe )
|
||||||
{
|
{
|
||||||
|
@ -289,22 +324,12 @@ lvwClients->setMinimumHeight ( 140 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Recorder controls
|
// Recorder controls
|
||||||
if ( !pServer->GetRecorderInitialised() )
|
chbEnableRecorder->setCheckState ( Qt::CheckState::Checked ); // move to settings
|
||||||
{
|
|
||||||
// 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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
edtCurrentSessionDir->setText ( "" );
|
edtCurrentSessionDir->setText ( "" );
|
||||||
pbtNewRecording->setAutoDefault ( false );
|
pbtNewRecording->setAutoDefault ( false );
|
||||||
|
pbtRecordingDir->setAutoDefault ( false );
|
||||||
// TODO: Not yet implemented, so hide them!
|
edtRecordingDir->setText( pServer->GetRecordingDir() );
|
||||||
pbtRecordingDir->setVisible ( false );
|
tbtClearRecordingDir->setText ( "(X)" ); // someone make me a nice icon?
|
||||||
edtRecordingsDir->setVisible ( false );
|
|
||||||
|
|
||||||
UpdateRecorderStatus ( QString::null );
|
UpdateRecorderStatus ( QString::null );
|
||||||
|
|
||||||
|
@ -372,9 +397,16 @@ lvwClients->setMinimumHeight ( 140 );
|
||||||
this, &CServerDlg::OnCentServAddrTypeActivated );
|
this, &CServerDlg::OnCentServAddrTypeActivated );
|
||||||
|
|
||||||
// push buttons
|
// push buttons
|
||||||
|
QObject::connect ( pbtRecordingDir, &QPushButton::released,
|
||||||
|
this, &CServerDlg::OnRecordingDirClicked );
|
||||||
|
|
||||||
QObject::connect ( pbtNewRecording, &QPushButton::released,
|
QObject::connect ( pbtNewRecording, &QPushButton::released,
|
||||||
this, &CServerDlg::OnNewRecordingClicked );
|
this, &CServerDlg::OnNewRecordingClicked );
|
||||||
|
|
||||||
|
// tool buttons
|
||||||
|
QObject::connect ( tbtClearRecordingDir, &QToolButton::released,
|
||||||
|
this, &CServerDlg::OnClearRecordingDirClicked );
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &Timer, &QTimer::timeout,
|
QObject::connect ( &Timer, &QTimer::timeout,
|
||||||
this, &CServerDlg::OnTimer );
|
this, &CServerDlg::OnTimer );
|
||||||
|
@ -539,6 +571,30 @@ void CServerDlg::OnStopRecorder()
|
||||||
UpdateRecorderStatus ( QString::null );
|
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 )
|
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
|
||||||
|
@ -710,44 +766,52 @@ void CServerDlg::ModifyAutoStartEntry ( const bool bDoAutoStart )
|
||||||
|
|
||||||
void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
|
void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
|
||||||
{
|
{
|
||||||
if ( !pServer->GetRecorderInitialised() )
|
|
||||||
{
|
|
||||||
// everything should be hidden.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::CheckState csIsEnabled;
|
|
||||||
QString currentSessionDir = edtCurrentSessionDir->text();
|
QString currentSessionDir = edtCurrentSessionDir->text();
|
||||||
|
QString errMsg = pServer->GetRecorderErrMsg();
|
||||||
bool bIsRecording = false;
|
bool bIsRecording = false;
|
||||||
QString strRecorderStatus;
|
QString strRecorderStatus;
|
||||||
|
QString strRecordingDir;
|
||||||
|
|
||||||
if ( pServer->GetRecordingEnabled() )
|
if ( pServer->GetRecorderInitialised() )
|
||||||
{
|
{
|
||||||
csIsEnabled = Qt::CheckState::Checked;
|
strRecordingDir = pServer->GetRecordingDir();
|
||||||
if ( pServer->IsRunning() )
|
chbEnableRecorder->setEnabled ( true );
|
||||||
|
if ( pServer->GetRecordingEnabled() )
|
||||||
{
|
{
|
||||||
currentSessionDir = sessionDir != QString::null ? sessionDir : "";
|
if ( pServer->IsRunning() )
|
||||||
strRecorderStatus = tr ( "Recording" );
|
{
|
||||||
bIsRecording = true;
|
edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" );
|
||||||
|
strRecorderStatus = tr ( "Recording" );
|
||||||
|
bIsRecording = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strRecorderStatus = tr ( "Not recording" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strRecorderStatus = tr ( "Not recording" );
|
strRecorderStatus = tr ( "Not enabled" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
csIsEnabled = Qt::CheckState::Unchecked;
|
strRecordingDir = pServer->GetRecorderErrMsg();
|
||||||
strRecorderStatus = tr ( "Not enabled" );
|
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->setEnabled ( bIsRecording );
|
||||||
edtCurrentSessionDir->setText ( currentSessionDir );
|
|
||||||
|
|
||||||
lblRecorderStatus->setText ( strRecorderStatus );
|
lblRecorderStatus->setText ( strRecorderStatus );
|
||||||
|
|
||||||
pbtNewRecording->setEnabled ( bIsRecording );
|
pbtNewRecording->setEnabled ( bIsRecording );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QFileDialog>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -111,6 +112,8 @@ public slots:
|
||||||
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
|
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
|
||||||
|
|
||||||
void OnNewRecordingClicked() { pServer->RequestNewRecording(); }
|
void OnNewRecordingClicked() { pServer->RequestNewRecording(); }
|
||||||
|
void OnRecordingDirClicked();
|
||||||
|
void OnClearRecordingDirClicked();
|
||||||
void OnRecordingSessionStarted ( QString sessionDir )
|
void OnRecordingSessionStarted ( QString sessionDir )
|
||||||
{ UpdateRecorderStatus ( sessionDir ); }
|
{ UpdateRecorderStatus ( sessionDir ); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -169,12 +169,34 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pbtRecordingDir">
|
||||||
|
<property name="text">
|
||||||
|
<string>Recording Directory</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edtRecordingDir">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="tbtClearRecordingDir">
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="chbEnableRecorder">
|
<widget class="QCheckBox" name="chbEnableRecorder">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable jam recorder</string>
|
<string>Enable Jam Recorder</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -195,25 +217,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pbtNewRecording">
|
<widget class="QPushButton" name="pbtNewRecording">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New recording</string>
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -276,11 +280,12 @@
|
||||||
<tabstop>edtServerName</tabstop>
|
<tabstop>edtServerName</tabstop>
|
||||||
<tabstop>edtLocationCity</tabstop>
|
<tabstop>edtLocationCity</tabstop>
|
||||||
<tabstop>cbxLocationCountry</tabstop>
|
<tabstop>cbxLocationCountry</tabstop>
|
||||||
|
<tabstop>pbtRecordingDir</tabstop>
|
||||||
|
<tabstop>edtRecordingDir</tabstop>
|
||||||
|
<tabstop>tbtClearRecordingDir</tabstop>
|
||||||
<tabstop>chbEnableRecorder</tabstop>
|
<tabstop>chbEnableRecorder</tabstop>
|
||||||
<tabstop>edtCurrentSessionDir</tabstop>
|
<tabstop>edtCurrentSessionDir</tabstop>
|
||||||
<tabstop>pbtNewRecording</tabstop>
|
<tabstop>pbtNewRecording</tabstop>
|
||||||
<tabstop>pbtRecordingDir</tabstop>
|
|
||||||
<tabstop>edtRecordingsDir</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
|
|
Loading…
Reference in a new issue