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();
@ -580,6 +580,7 @@ void CServerDlg::OnRecordingDirClicked()
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 );
@ -777,11 +778,13 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir )
{ {
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;