Rabbit Remote Control 0.1.0-bate14
Loading...
Searching...
No Matches
Parameter.h
1// Author: Kang Lin <kl222@126.com>
2
3#pragma once
4
5#include <QSettings>
6#include <QString>
7#include <QVector>
8#include "plugin_export.h"
9
68
113
219class PLUGIN_EXPORT CParameter : public QObject
220{
221 Q_OBJECT
222 Q_PROPERTY(bool Modified READ GetModified WRITE SetModified FINAL)
223
224public:
242 explicit CParameter(QObject *parent,
243 const QString& szPrefix = QString());
244 virtual ~CParameter();
245
247 virtual int Load(QString szFile = QString());
249 virtual int Save(QString szFile = QString(), bool bForce = true);
250
252 virtual int Load(QSettings &set);
254 virtual int Save(QSettings &set, bool bForce = true);
255
275 virtual bool CheckValidity();
276
277Q_SIGNALS:
287
288protected:
289 virtual int OnLoad(QSettings &set) = 0;
290 virtual int OnSave(QSettings &set) = 0;
304 virtual bool OnCheckValidity();
305
314 int SetModified(bool bModified = true);
324 bool GetModified();
325
326private:
332 int AddCategory(CParameter* p);
333 QString GetPrefix() const;
334 int SetPrefix(const QString& szPrefix);
335
336private:
337 QString m_szPrefix;
338
346
351 QVector<CParameter*> m_Category;
352};
QVector< CParameter * > m_Category
Category.
Definition Parameter.h:351
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.
Definition Parameter.h:345
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.
Definition Parameter.cpp:47
CParameter(QObject *parent, const QString &szPrefix=QString())
bool GetModified()
Whether the parameters have been modified.
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
virtual bool OnCheckValidity()
Check validity.
virtual int Load(QString szFile=QString())
Load from file.
Definition Parameter.cpp:35