adde Load/StoreFaderSettings
This commit is contained in:
parent
619b0176fc
commit
52302446c0
2 changed files with 66 additions and 21 deletions
|
@ -31,16 +31,10 @@ void CSettings::Load()
|
|||
// prepare file name for loading initialization data from XML file and read
|
||||
// data from file if possible
|
||||
QDomDocument IniXMLDocument;
|
||||
QFile file ( strFileName );
|
||||
|
||||
if ( file.open ( QIODevice::ReadOnly ) )
|
||||
{
|
||||
IniXMLDocument.setContent ( QTextStream ( &file ).readAll(), false );
|
||||
file.close();
|
||||
}
|
||||
ReadFromFile ( strFileName, IniXMLDocument );
|
||||
|
||||
// read the settings from the given XML file
|
||||
ReadFromXML ( IniXMLDocument );
|
||||
ReadSettingsFromXML ( IniXMLDocument );
|
||||
}
|
||||
|
||||
void CSettings::Save()
|
||||
|
@ -49,15 +43,33 @@ void CSettings::Save()
|
|||
QDomDocument IniXMLDocument;
|
||||
|
||||
// write the settings in the XML file
|
||||
WriteToXML ( IniXMLDocument );
|
||||
WriteSettingsToXML ( IniXMLDocument );
|
||||
|
||||
// prepare file name for storing initialization data in XML file and store
|
||||
// XML data in file
|
||||
QFile file ( strFileName );
|
||||
WriteToFile ( strFileName, IniXMLDocument );
|
||||
}
|
||||
|
||||
void CSettings::ReadFromFile ( const QString& strCurFileName,
|
||||
QDomDocument& XMLDocument )
|
||||
{
|
||||
QFile file ( strCurFileName );
|
||||
|
||||
if ( file.open ( QIODevice::ReadOnly ) )
|
||||
{
|
||||
XMLDocument.setContent ( QTextStream ( &file ).readAll(), false );
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::WriteToFile ( const QString& strCurFileName,
|
||||
const QDomDocument& XMLDocument )
|
||||
{
|
||||
QFile file ( strCurFileName );
|
||||
|
||||
if ( file.open ( QIODevice::WriteOnly ) )
|
||||
{
|
||||
QTextStream ( &file ) << IniXMLDocument.toString();
|
||||
QTextStream ( &file ) << XMLDocument.toString();
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +224,31 @@ void CSettings::PutIniSetting ( QDomDocument& xmlFile,
|
|||
|
||||
|
||||
// Client settings -------------------------------------------------------------
|
||||
void CClientSettings::ReadFromXML ( const QDomDocument& IniXMLDocument )
|
||||
void CClientSettings::LoadFaderSettings ( const QString& strCurFileName )
|
||||
{
|
||||
// prepare file name for loading initialization data from XML file and read
|
||||
// data from file if possible
|
||||
QDomDocument IniXMLDocument;
|
||||
ReadFromFile ( strCurFileName, IniXMLDocument );
|
||||
|
||||
// read the settings from the given XML file
|
||||
ReadFaderSettingsFromXML ( IniXMLDocument );
|
||||
}
|
||||
|
||||
void CClientSettings::SaveFaderSettings ( const QString& strCurFileName )
|
||||
{
|
||||
// create XML document for storing initialization parameters
|
||||
QDomDocument IniXMLDocument;
|
||||
|
||||
// write the settings in the XML file
|
||||
WriteFaderSettingsToXML ( IniXMLDocument );
|
||||
|
||||
// prepare file name for storing initialization data in XML file and store
|
||||
// XML data in file
|
||||
WriteToFile ( strCurFileName, IniXMLDocument );
|
||||
}
|
||||
|
||||
void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument )
|
||||
{
|
||||
int iIdx;
|
||||
int iValue;
|
||||
|
@ -544,7 +580,7 @@ void CClientSettings::ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocum
|
|||
}
|
||||
}
|
||||
|
||||
void CClientSettings::WriteToXML ( QDomDocument& IniXMLDocument )
|
||||
void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument )
|
||||
{
|
||||
int iIdx;
|
||||
|
||||
|
@ -744,7 +780,7 @@ void CClientSettings::WriteFaderSettingsToXML ( QDomDocument& IniXMLDocument )
|
|||
|
||||
|
||||
// Server settings -------------------------------------------------------------
|
||||
void CServerSettings::ReadFromXML ( const QDomDocument& IniXMLDocument )
|
||||
void CServerSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument )
|
||||
{
|
||||
int iValue;
|
||||
bool bValue;
|
||||
|
@ -833,7 +869,7 @@ if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
|
|||
GetIniSetting ( IniXMLDocument, "server", "winposmain_base64" ) );
|
||||
}
|
||||
|
||||
void CServerSettings::WriteToXML ( QDomDocument& IniXMLDocument )
|
||||
void CServerSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument )
|
||||
{
|
||||
// central server address
|
||||
PutIniSetting ( IniXMLDocument, "server", "centralservaddr",
|
||||
|
|
|
@ -52,8 +52,14 @@ public:
|
|||
QString strLanguage;
|
||||
|
||||
protected:
|
||||
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) = 0;
|
||||
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) = 0;
|
||||
virtual void ReadSettingsFromXML ( const QDomDocument& IniXMLDocument ) = 0;
|
||||
virtual void WriteSettingsToXML ( QDomDocument& IniXMLDocument ) = 0;
|
||||
|
||||
void ReadFromFile ( const QString& strCurFileName,
|
||||
QDomDocument& XMLDocument );
|
||||
|
||||
void WriteToFile ( const QString& strCurFileName,
|
||||
const QDomDocument& XMLDocument );
|
||||
|
||||
void SetFileName ( const QString& sNFiName,
|
||||
const QString& sDefaultFileName );
|
||||
|
@ -139,6 +145,9 @@ public:
|
|||
pClient ( pNCliP )
|
||||
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME ); }
|
||||
|
||||
void LoadFaderSettings ( const QString& strCurFileName );
|
||||
void SaveFaderSettings ( const QString& strCurFileName );
|
||||
|
||||
// general settings
|
||||
CVector<QString> vecStoredFaderTags;
|
||||
CVector<int> vecStoredFaderLevels;
|
||||
|
@ -161,8 +170,8 @@ public:
|
|||
bool bWindowWasShownConnect;
|
||||
|
||||
protected:
|
||||
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override;
|
||||
virtual void ReadSettingsFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||
virtual void WriteSettingsToXML ( QDomDocument& IniXMLDocument ) override;
|
||||
|
||||
void ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocument );
|
||||
void WriteFaderSettingsToXML ( QDomDocument& IniXMLDocument );
|
||||
|
@ -180,8 +189,8 @@ public:
|
|||
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); }
|
||||
|
||||
protected:
|
||||
virtual void ReadFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||
virtual void WriteToXML ( QDomDocument& IniXMLDocument ) override;
|
||||
virtual void ReadSettingsFromXML ( const QDomDocument& IniXMLDocument ) override;
|
||||
virtual void WriteSettingsToXML ( QDomDocument& IniXMLDocument ) override;
|
||||
|
||||
CServer* pServer;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue