QuasarAppLib
|
The Settings class This is wraper of the QSettings object. More...
#include <settings.h>
Public Member Functions | |
Settings () | |
const QSet< QString > & | boolOptions () const |
boolOptions returns current map with keys that has a bool type. | |
void | setBoolOptions (const QSet< QString > &newBoolOptions) |
setBoolOptions This method sets new map of the boolean options. | |
Public Member Functions inherited from QuasarAppUtils::ISettings | |
~ISettings () override | |
Q_INVOKABLE QVariant | getValue (const QString &key, const QVariant &def={}) |
getValue This method return the value of the settings. | |
Q_INVOKABLE QString | getStrValue (const QString &key, const QString &def={}) |
getStrValue some as getValue but convert result object to QString type. | |
Q_INVOKABLE void | resetToDefault () |
resetToDefault This method reset all settings to default values. | |
void | sync () |
sync This method save all setings data on a hard disk; | |
void | forceReloadCache () |
forceReloadCache This method force reload settings data from disk. | |
SettingsSaveMode | getMode () const |
getMode This method return the current mode of the settings. | |
void | setMode (const SettingsSaveMode &mode) |
setMode This method sets a new value of the settings mode. | |
Public Member Functions inherited from QuasarAppUtils::Service< ISettings > | |
Service () | |
Static Public Member Functions | |
static bool | initService () |
initService This method initialize default object of the QuasarAppUtils::Settings type. | |
Static Public Member Functions inherited from QuasarAppUtils::ISettings | |
static ISettings * | instance () |
instance This method returns pointer to current settings object. | |
static bool | initService (std::unique_ptr< ISettings > obj) |
initService This method initialize the global settings object. | |
Static Public Member Functions inherited from QuasarAppUtils::Service< ISettings > | |
static std::unique_ptr< ISettings > & | initService () |
initService This method initialize the Base object as a service. | |
static bool | initService (std::unique_ptr< ISettings > obj) |
initService This is overrided static method of initialization cross libraryes object. | |
static ISettings * | instance () |
instance This method return pointerer to current service object. | |
static ISettings * | autoInstance () |
autoInstance This method return pointerer to current service object and if it is not inited try to initialize it use default constructor. | |
static void | deinitService () |
deinitService This is distructor method for the service. | |
Protected Member Functions | |
void | syncImplementation () override |
syncImplementation This method should save all configuration data to the hard drive; | |
QVariant | getValueImplementation (const QString &key, const QVariant &def) override |
getValueImplementation This method will return the value of the settings. | |
void | setValueImplementation (const QString key, const QVariant &value) override |
setValueImplementation This slot will set a new value for the key parameter. | |
bool | ignoreToRest (const QString &) const override |
ignoreToRest This method should be returns true if the key setting is not be reset on the resetToDefault method. | |
QHash< QString, QVariant > | defaultSettings () override |
virtual bool | isBool (const QString &key) const |
isBool This method should be return true if the key's type is bool. This is needed because QVariant will be converted alvays to true value in a qml code. | |
void | setGroup (const QString &) |
Protected Member Functions inherited from QuasarAppUtils::ISettings | |
ISettings (SettingsSaveMode mode=SettingsSaveMode::Auto) | |
void | clearCache () |
clearCache This method clear all data from cache. | |
QHash< QString, QVariant > & | settingsMap () |
settingsMap This method returns initialized settings map. Settings map contains pairs with settings key and default value. | |
Additional Inherited Members | |
Public Slots inherited from QuasarAppUtils::ISettings | |
void | setValue (const QString &key, const QVariant &value) |
setValue This slot sets new value for a key setting | |
void | setStrValue (const QString &key, const QString &value) |
setStrValue This is some as setValue but working with the QString type. | |
Signals inherited from QuasarAppUtils::ISettings | |
void | valueChanged (QString key, QVariant value) |
valueChanged This signal when value of the key settings changed | |
void | valueStrChanged (QString key, QString value) |
valueStrChanged some as valueChanged(QString key, QVariant value) but value has ben converted to the QString type. | |
The Settings class This is wraper of the QSettings object.
Example of initialisation :
Or you can use the Settings::autoInstance method.
Definition at line 41 of file settings.h.
QuasarAppUtils::Settings::Settings | ( | ) |
boolOptions returns current map with keys that has a bool type.
Definition at line 58 of file settings.cpp.
Implements QuasarAppUtils::ISettings.
Definition at line 50 of file settings.cpp.
|
overrideprotectedvirtual |
getValueImplementation This method will return the value of the settings.
key | This is name of the required settings value. |
def | This is default value if a value is not finded. |
Implements QuasarAppUtils::ISettings.
Definition at line 34 of file settings.cpp.
ignoreToRest This method should be returns true if the key setting is not be reset on the resetToDefault method.
key | This is keuy value. |
Reimplemented from QuasarAppUtils::ISettings.
Definition at line 46 of file settings.cpp.
|
static |
initService This method initialize default object of the QuasarAppUtils::Settings type.
Definition at line 68 of file settings.cpp.
isBool This method should be return true if the key's type is bool. This is needed because QVariant will be converted alvays to true value in a qml code.
key | This is key of checks setting. |
Definition at line 54 of file settings.cpp.
setBoolOptions This method sets new map of the boolean options.
newBoolOptions | This is new map of the boolean options. |
Definition at line 63 of file settings.cpp.
|
overrideprotectedvirtual |
setValueImplementation This slot will set a new value for the key parameter.
key | This is name of the changed setting. |
value | This is a new value of the setting |
Implements QuasarAppUtils::ISettings.
Definition at line 42 of file settings.cpp.
|
overrideprotectedvirtual |
syncImplementation This method should save all configuration data to the hard drive;
Implements QuasarAppUtils::ISettings.
Definition at line 30 of file settings.cpp.