Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
Parameter.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CPARAMETER_H_KL_2022_07_27
4#define CPARAMETER_H_KL_2022_07_27
5
6#pragma once
7
8#include <QSettings>
9#include <QString>
10#include <QVector>
11#include "client_export.h"
12
168class CLIENT_EXPORT CParameter : public QObject
169{
170 Q_OBJECT
171 Q_PROPERTY(bool Modified READ GetModified WRITE SetModified FINAL)
172
173public:
191 explicit CParameter(QObject *parent = nullptr,
192 const QString& szPrefix = QString());
193 virtual ~CParameter();
194
196 virtual int Load(QString szFile = QString());
198 virtual int Save(QString szFile = QString(), bool bForce = true);
199
201 virtual int Load(QSettings &set);
203 virtual int Save(QSettings &set, bool bForce = true);
204
226 virtual bool CheckValidity();
227
228Q_SIGNALS:
238
239protected:
240 virtual int OnLoad(QSettings &set) = 0;
241 virtual int OnSave(QSettings &set) = 0;
255 virtual bool OnCheckValidity();
256
265 int SetModified(bool bModified = true);
275 bool GetModified();
276
277private:
283 int AddCategory(CParameter* p);
284 QString GetPrefix() const;
285 int SetPrefix(const QString& szPrefix);
286
287private:
288 QString m_szPrefix;
289
297
302 QVector<CParameter*> m_Category;
303};
304
305#endif // CPARAMETER_H_KL_2022_07_27
Parameter interface.
Definition Parameter.h:169
QVector< CParameter * > m_Category
Category.
Definition Parameter.h:302
bool m_bModified
If false, then don't save when save.
Definition Parameter.h:296
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
CParameter(QObject *parent=nullptr, const QString &szPrefix=QString())