Rabbit Remote Control 0.0.30
|
Parameter interface. More...
#include <Parameter.h>
Signals | |
void | sigChanged () |
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a change event. | |
Public Member Functions | |
CParameter (QObject *parent=nullptr, const QString &szPrefix=QString()) | |
virtual int | Load (QString szFile=QString()) |
Load from file. | |
virtual int | Save (QString szFile=QString(), bool bForce=true) |
Save to file. | |
virtual int | Load (QSettings &set) |
Load from storage. | |
virtual int | Save (QSettings &set, bool bForce=true) |
Save to storage. | |
virtual bool | CheckValidity () |
Check whether the parameter is valid to decide whether to use or save the parameter. | |
Protected Member Functions | |
virtual int | OnLoad (QSettings &set)=0 |
virtual int | OnSave (QSettings &set)=0 |
virtual bool | OnCheckValidity () |
Check validity. | |
int | SetModified (bool bModified=true) |
When setting parameters, if there is a modification, it is called. | |
bool | GetModified () |
Whether the parameters have been modified. | |
Properties | |
bool | Modified |
Private Member Functions | |
int | AddCategory (CParameter *p) |
Instances of this class and its derived classes are members of the instance. | |
QString | GetPrefix () const |
int | SetPrefix (const QString &szPrefix) |
Private Attributes | |
QString | m_szPrefix |
bool | m_bModified |
If false, then don't save when save. | |
QVector< CParameter * > | m_Category |
Category. | |
Parameter interface.
Because there may be many parameters, it is necessary to classify them by parameter category. Each category can derive a separate class from this class. Each category is then used as a member variable in the derived classes of this class.
For example:
Connection parameters include the following categories:
Then the connection parameters can be a combination of the above categories:
Definition at line 168 of file Parameter.h.
|
explicit |
parent |
|
szPrefix | Prefix |
szPrefix | 前缀。 |
|
virtual |
Definition at line 19 of file Parameter.cpp.
|
private |
Instances of this class and its derived classes are members of the instance.
Definition at line 130 of file Parameter.cpp.
|
virtual |
Check whether the parameter is valid to decide whether to use or save the parameter.
Derived classes typically simply overload OnCheckValidity() to check the parameters.
For example, when setting the parameters in the dialog, you need to check whether the parameters are complete or valid before you can save them.
Definition at line 99 of file Parameter.cpp.
|
protected |
Whether the parameters have been modified.
GetModified
Definition at line 117 of file Parameter.cpp.
|
private |
Definition at line 22 of file Parameter.cpp.
|
virtual |
Load from storage.
Reimplemented in CParameterTerminal.
Definition at line 56 of file Parameter.cpp.
|
virtual |
Load from file.
Definition at line 33 of file Parameter.cpp.
|
protectedvirtual |
Check validity.
Reimplemented in CParameterVnc, and CParameterWakeOnLan.
Definition at line 111 of file Parameter.cpp.
|
protectedpure virtual |
Implemented in CParameterClient, CParameterNet, and CParameterWakeOnLan.
|
protectedpure virtual |
Implemented in CParameterClient.
|
virtual |
Save to storage.
Definition at line 77 of file Parameter.cpp.
|
virtual |
Save to file.
Definition at line 44 of file Parameter.cpp.
|
protected |
When setting parameters, if there is a modification, it is called.
bModified |
Definition at line 122 of file Parameter.cpp.
|
private |
Definition at line 27 of file Parameter.cpp.
|
private |
If false, then don't save when save.
Definition at line 296 of file Parameter.h.
|
private |
Category.
Definition at line 302 of file Parameter.h.
|
private |
Definition at line 288 of file Parameter.h.
|
readwrite |
Definition at line 171 of file Parameter.h.