2#include "RabbitCommonDir.h"
4#include <QLoggingCategory>
6static Q_LOGGING_CATEGORY(log,
"Client.Parameter")
10 , m_szPrefix(szPrefix)
13 CParameter* p = qobject_cast<CParameter*>(parent);
16 bool check = connect(
this, SIGNAL(sigChanged()), p, SIGNAL(sigChanged()));
21CParameter::~CParameter()
24QString CParameter::GetPrefix()
const
29int CParameter::SetPrefix(
const QString& szName)
38 szFile = RabbitCommon::CDir::Instance()->GetFileUserConfigure();
39 qDebug(log) <<
"Load configure file:" << szFile;
40 if(szFile.isEmpty())
return -1;
41 QSettings set(szFile, QSettings::IniFormat);
51 szFile = RabbitCommon::CDir::Instance()->GetFileUserConfigure();
52 qDebug(log) <<
"Save configure file:" << szFile;
53 if(szFile.isEmpty())
return -1;
54 QSettings set(szFile, QSettings::IniFormat);
64 if(!GetPrefix().isEmpty())
65 set.beginGroup(GetPrefix());
76 if(!GetPrefix().isEmpty())
86 if(!GetPrefix().isEmpty())
87 set.beginGroup(GetPrefix());
98 if(!GetPrefix().isEmpty())
117 qDebug(log) <<
" Not implemented CParameter::onCheckValidity()";
QVector< CParameter * > m_Category
Category.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.
bool m_bModified
If false, then don't save when save.
virtual bool CheckValidity()
Check whether the parameter is valid to decide whether to use or save the parameter.
int AddCategory(CParameter *p)
Instances of this class and its derived classes are members of the instance.
virtual int Save(QString szFile=QString(), bool bForce=true)
Save to file.
bool GetModified()
Whether the parameters have been modified.
virtual bool OnCheckValidity()
Check validity.
virtual int Load(QString szFile=QString())
Load from file.