new settings classes for client and server, derived from a common base class
This commit is contained in:
parent
a192acacf9
commit
059d9ef203
7 changed files with 705 additions and 675 deletions
|
@ -26,14 +26,14 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CClientDlg::CClientDlg ( CClient* pNCliP,
|
CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
CSettings* pNSetP,
|
CClientSettings* pNSetP,
|
||||||
const QString& strConnOnStartupAddress,
|
const QString& strConnOnStartupAddress,
|
||||||
const int iCtrlMIDIChannel,
|
const int iCtrlMIDIChannel,
|
||||||
const bool bNewShowComplRegConnList,
|
const bool bNewShowComplRegConnList,
|
||||||
const bool bShowAnalyzerConsole,
|
const bool bShowAnalyzerConsole,
|
||||||
QWidget* parent,
|
QWidget* parent,
|
||||||
Qt::WindowFlags f ) :
|
Qt::WindowFlags f ) :
|
||||||
QDialog ( parent, f ),
|
QDialog ( parent, f ),
|
||||||
pClient ( pNCliP ),
|
pClient ( pNCliP ),
|
||||||
pSettings ( pNSetP ),
|
pSettings ( pNSetP ),
|
||||||
|
|
|
@ -72,14 +72,14 @@ class CClientDlg : public QDialog, private Ui_CClientDlgBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CClientDlg ( CClient* pNCliP,
|
CClientDlg ( CClient* pNCliP,
|
||||||
CSettings* pNSetP,
|
CClientSettings* pNSetP,
|
||||||
const QString& strConnOnStartupAddress,
|
const QString& strConnOnStartupAddress,
|
||||||
const int iCtrlMIDIChannel,
|
const int iCtrlMIDIChannel,
|
||||||
const bool bNewShowComplRegConnList,
|
const bool bNewShowComplRegConnList,
|
||||||
const bool bShowAnalyzerConsole,
|
const bool bShowAnalyzerConsole,
|
||||||
QWidget* parent = nullptr,
|
QWidget* parent = nullptr,
|
||||||
Qt::WindowFlags f = nullptr );
|
Qt::WindowFlags f = nullptr );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
||||||
|
@ -96,7 +96,7 @@ protected:
|
||||||
void Disconnect();
|
void Disconnect();
|
||||||
|
|
||||||
CClient* pClient;
|
CClient* pClient;
|
||||||
CSettings* pSettings;
|
CClientSettings* pSettings;
|
||||||
|
|
||||||
bool bConnected;
|
bool bConnected;
|
||||||
bool bConnectDlgWasShown;
|
bool bConnectDlgWasShown;
|
||||||
|
|
|
@ -617,7 +617,7 @@ int main ( int argc, char** argv )
|
||||||
strClientName );
|
strClientName );
|
||||||
|
|
||||||
// load settings from init-file
|
// load settings from init-file
|
||||||
CSettings Settings ( &Client, strIniFileName );
|
CClientSettings Settings ( &Client, strIniFileName );
|
||||||
Settings.Load();
|
Settings.Load();
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
|
@ -670,7 +670,7 @@ int main ( int argc, char** argv )
|
||||||
if ( bUseGUI )
|
if ( bUseGUI )
|
||||||
{
|
{
|
||||||
// load settings from init-file
|
// load settings from init-file
|
||||||
CSettings Settings ( &Server, strIniFileName );
|
CServerSettings Settings ( &Server, strIniFileName );
|
||||||
Settings.Load();
|
Settings.Load();
|
||||||
|
|
||||||
// update server list AFTER restoring the settings from the
|
// update server list AFTER restoring the settings from the
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CServerDlg::CServerDlg ( CServer* pNServP,
|
CServerDlg::CServerDlg ( CServer* pNServP,
|
||||||
CSettings* pNSetP,
|
CServerSettings* pNSetP,
|
||||||
const bool bStartMinimized,
|
const bool bStartMinimized,
|
||||||
QWidget* parent,
|
QWidget* parent,
|
||||||
Qt::WindowFlags f )
|
Qt::WindowFlags f )
|
||||||
: QDialog ( parent, f ),
|
: QDialog ( parent, f ),
|
||||||
pServer ( pNServP ),
|
pServer ( pNServP ),
|
||||||
pSettings ( pNSetP ),
|
pSettings ( pNSetP ),
|
||||||
|
|
|
@ -52,11 +52,11 @@ class CServerDlg : public QDialog, private Ui_CServerDlgBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CServerDlg ( CServer* pNServP,
|
CServerDlg ( CServer* pNServP,
|
||||||
CSettings* pNSetP,
|
CServerSettings* pNSetP,
|
||||||
const bool bStartMinimized,
|
const bool bStartMinimized,
|
||||||
QWidget* parent = nullptr,
|
QWidget* parent = nullptr,
|
||||||
Qt::WindowFlags f = nullptr );
|
Qt::WindowFlags f = nullptr );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void changeEvent ( QEvent* pEvent );
|
virtual void changeEvent ( QEvent* pEvent );
|
||||||
|
@ -70,7 +70,7 @@ protected:
|
||||||
|
|
||||||
QTimer Timer;
|
QTimer Timer;
|
||||||
CServer* pServer;
|
CServer* pServer;
|
||||||
CSettings* pSettings;
|
CServerSettings* pSettings;
|
||||||
|
|
||||||
CVector<QTreeWidgetItem*> vecpListViewItems;
|
CVector<QTreeWidgetItem*> vecpListViewItems;
|
||||||
QMutex ListViewMutex;
|
QMutex ListViewMutex;
|
||||||
|
|
1269
src/settings.cpp
1269
src/settings.cpp
File diff suppressed because it is too large
Load diff
|
@ -39,18 +39,15 @@
|
||||||
class CSettings
|
class CSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettings ( CClient* pNCliP, const QString& sNFiName ) :
|
CSettings() : strFileName ( "" ) {}
|
||||||
pClient ( pNCliP ), bIsClient ( true ), strFileName ( "" )
|
|
||||||
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME ); }
|
|
||||||
|
|
||||||
CSettings ( CServer* pNSerP, const QString& sNFiName ) :
|
|
||||||
pServer ( pNSerP ), bIsClient ( false ), strFileName ( "" )
|
|
||||||
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); }
|
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) = 0;
|
||||||
|
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) = 0;
|
||||||
|
|
||||||
void SetFileName ( const QString& sNFiName,
|
void SetFileName ( const QString& sNFiName,
|
||||||
const QString& sDefaultFileName );
|
const QString& sDefaultFileName );
|
||||||
|
|
||||||
|
@ -106,10 +103,38 @@ protected:
|
||||||
const QString& sKey,
|
const QString& sKey,
|
||||||
const QString& sValue = "" );
|
const QString& sValue = "" );
|
||||||
|
|
||||||
// pointer to the client/server object which stores the various settings
|
QString strFileName;
|
||||||
CClient* pClient; // for client
|
|
||||||
CServer* pServer; // for server
|
|
||||||
|
|
||||||
bool bIsClient;
|
|
||||||
QString strFileName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CClientSettings : public CSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClientSettings ( CClient* pNCliP, const QString& sNFiName ) : pClient ( pNCliP )
|
||||||
|
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME ); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||||
|
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override;
|
||||||
|
|
||||||
|
CClient* pClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CServerSettings : public CSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CServerSettings ( CServer* pNSerP, const QString& sNFiName ) : pServer ( pNSerP )
|
||||||
|
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||||
|
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override;
|
||||||
|
|
||||||
|
CServer* pServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue