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