moved a server setting in the settings class

This commit is contained in:
Volker Fischer 2020-07-04 22:20:50 +02:00
parent d479c09307
commit dc6cfe0b5a
5 changed files with 25 additions and 19 deletions

View File

@ -234,7 +234,6 @@ CServer::CServer ( const int iNewMaxNumChan,
const bool bNDisconnectAllClientsOnQuit, const bool bNDisconnectAllClientsOnQuit,
const bool bNUseDoubleSystemFrameSize, const bool bNUseDoubleSystemFrameSize,
const ELicenceType eNLicenceType ) : const ELicenceType eNLicenceType ) :
vecWindowPosMain (), // empty array
bUseDoubleSystemFrameSize ( bNUseDoubleSystemFrameSize ), bUseDoubleSystemFrameSize ( bNUseDoubleSystemFrameSize ),
iMaxNumChannels ( iNewMaxNumChan ), iMaxNumChannels ( iNewMaxNumChan ),
Socket ( this, iPortNumber ), Socket ( this, iPortNumber ),

View File

@ -264,9 +264,6 @@ public:
void SetLicenceType ( const ELicenceType NLiType ) { eLicenceType = NLiType; } void SetLicenceType ( const ELicenceType NLiType ) { eLicenceType = NLiType; }
ELicenceType GetLicenceType() { return eLicenceType; } ELicenceType GetLicenceType() { return eLicenceType; }
// window position/state settings
QByteArray vecWindowPosMain;
protected: protected:
// access functions for actual channels // access functions for actual channels
bool IsConnected ( const int iChanNum ) bool IsConnected ( const int iChanNum )

View File

@ -360,9 +360,9 @@ lvwClients->setMinimumHeight ( 140 );
// Window positions -------------------------------------------------------- // Window positions --------------------------------------------------------
// main window // main window
if ( !pServer->vecWindowPosMain.isEmpty() && !pServer->vecWindowPosMain.isNull() ) if ( !pSettings->vecWindowPosMain.isEmpty() && !pSettings->vecWindowPosMain.isNull() )
{ {
restoreGeometry ( pServer->vecWindowPosMain ); restoreGeometry ( pSettings->vecWindowPosMain );
} }
@ -443,7 +443,7 @@ lvwClients->setMinimumHeight ( 140 );
void CServerDlg::closeEvent ( QCloseEvent* Event ) void CServerDlg::closeEvent ( QCloseEvent* Event )
{ {
// store window positions // store window positions
pServer->vecWindowPosMain = saveGeometry(); pSettings->vecWindowPosMain = saveGeometry();
// default implementation of this event handler routine // default implementation of this event handler routine
Event->accept(); Event->accept();
@ -557,8 +557,8 @@ void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx )
void CServerDlg::OnServerStarted() void CServerDlg::OnServerStarted()
{ {
UpdateSystemTrayIcon ( true ); UpdateSystemTrayIcon ( true );
UpdateRecorderStatus ( QString::null ); UpdateRecorderStatus ( QString::null );
} }
void CServerDlg::OnServerStopped() void CServerDlg::OnServerStopped()
@ -575,11 +575,12 @@ void CServerDlg::OnStopRecorder()
void CServerDlg::OnRecordingDirClicked() void CServerDlg::OnRecordingDirClicked()
{ {
// get the current value from pServer // get the current value from pServer
QString currentValue = pServer->GetRecordingDir(); QString currentValue = pServer->GetRecordingDir();
QString newRecordingDir = QFileDialog::getExistingDirectory ( this, QString newRecordingDir = QFileDialog::getExistingDirectory ( this,
tr ( "Select Main Recording Directory" ), tr ( "Select Main Recording Directory" ),
currentValue, currentValue,
QFileDialog::ShowDirsOnly | QFileDialog::DontUseNativeDialog ); QFileDialog::ShowDirsOnly | QFileDialog::DontUseNativeDialog );
if ( newRecordingDir != currentValue ) if ( newRecordingDir != currentValue )
{ {
pServer->SetRecordingDir ( newRecordingDir ); pServer->SetRecordingDir ( newRecordingDir );
@ -767,21 +768,23 @@ void CServerDlg::ModifyAutoStartEntry ( const bool bDoAutoStart )
void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
{ {
QString currentSessionDir = edtCurrentSessionDir->text(); QString currentSessionDir = edtCurrentSessionDir->text();
QString errMsg = pServer->GetRecorderErrMsg(); QString errMsg = pServer->GetRecorderErrMsg();
bool bIsRecording = false; bool bIsRecording = false;
QString strRecorderStatus; QString strRecorderStatus;
QString strRecordingDir; QString strRecordingDir;
if ( pServer->GetRecorderInitialised() ) if ( pServer->GetRecorderInitialised() )
{ {
strRecordingDir = pServer->GetRecordingDir(); strRecordingDir = pServer->GetRecordingDir();
chbEnableRecorder->setEnabled ( true ); chbEnableRecorder->setEnabled ( true );
if ( pServer->GetRecordingEnabled() ) if ( pServer->GetRecordingEnabled() )
{ {
if ( pServer->IsRunning() ) if ( pServer->IsRunning() )
{ {
edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" ); edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" );
strRecorderStatus = tr ( SREC_RECORDING ); strRecorderStatus = tr ( SREC_RECORDING );
bIsRecording = true; bIsRecording = true;
} }
@ -798,6 +801,7 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
else else
{ {
strRecordingDir = pServer->GetRecorderErrMsg(); strRecordingDir = pServer->GetRecorderErrMsg();
if ( strRecordingDir == QString::null ) if ( strRecordingDir == QString::null )
{ {
strRecordingDir = pServer->GetRecordingDir(); strRecordingDir = pServer->GetRecordingDir();
@ -806,11 +810,12 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
{ {
strRecordingDir = tr ( "ERROR" ) + ": " + strRecordingDir; strRecordingDir = tr ( "ERROR" ) + ": " + strRecordingDir;
} }
chbEnableRecorder->setEnabled ( false ); chbEnableRecorder->setEnabled ( false );
strRecorderStatus = tr ( SREC_NOT_INITIALISED ); strRecorderStatus = tr ( SREC_NOT_INITIALISED );
} }
edtRecordingDir->setText( strRecordingDir ); edtRecordingDir->setText ( strRecordingDir );
edtCurrentSessionDir->setEnabled ( bIsRecording ); edtCurrentSessionDir->setEnabled ( bIsRecording );
lblRecorderStatus->setText ( strRecorderStatus ); lblRecorderStatus->setText ( strRecorderStatus );
pbtNewRecording->setEnabled ( bIsRecording ); pbtNewRecording->setEnabled ( bIsRecording );

View File

@ -814,7 +814,7 @@ if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
} }
// window position of the main window // window position of the main window
pServer->vecWindowPosMain = FromBase64ToByteArray ( vecWindowPosMain = FromBase64ToByteArray (
GetIniSetting ( IniXMLDocument, "server", "winposmain_base64" ) ); GetIniSetting ( IniXMLDocument, "server", "winposmain_base64" ) );
} }
@ -854,5 +854,5 @@ void CServerSettings::WriteToXML ( QDomDocument& IniXMLDocument )
// window position of the main window // window position of the main window
PutIniSetting ( IniXMLDocument, "server", "winposmain_base64", PutIniSetting ( IniXMLDocument, "server", "winposmain_base64",
ToBase64 ( pServer->vecWindowPosMain ) ); ToBase64 ( vecWindowPosMain ) );
} }

View File

@ -164,9 +164,14 @@ protected:
class CServerSettings : public CSettings class CServerSettings : public CSettings
{ {
public: public:
CServerSettings ( CServer* pNSerP, const QString& sNFiName ) : pServer ( pNSerP ) CServerSettings ( CServer* pNSerP, const QString& sNFiName ) :
vecWindowPosMain ( ), // empty array
pServer ( pNSerP )
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); } { SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); }
// window position/state settings
QByteArray vecWindowPosMain;
protected: protected:
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override; virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override;
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override; virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override;