QuasarAppLib
|
The Settings class base interface for implementation settings backends. Available implementations: Setting (based on QSettings backend) More...
#include <isettings.h>
Public Slots | |
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 | |
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. | |
Public Member Functions | |
~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. | |
virtual bool | ignoreToRest (const QString &key) const |
ignoreToRest This method should be returns true if the key setting is not be reset on the resetToDefault method. | |
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 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 | |
ISettings (SettingsSaveMode mode=SettingsSaveMode::Auto) | |
virtual QHash< QString, QVariant > | defaultSettings ()=0 |
virtual void | syncImplementation ()=0 |
syncImplementation This method should save all configuration data to the hard drive; | |
virtual QVariant | getValueImplementation (const QString &key, const QVariant &def)=0 |
getValueImplementation This method will return the value of the settings. | |
virtual void | setValueImplementation (const QString key, const QVariant &value)=0 |
setValueImplementation This slot will set a new value for the key parameter. | |
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. | |
Friends | |
class | Service< ISettings > |
The Settings class base interface for implementation settings backends. Available implementations: Setting (based on QSettings backend)
Definition at line 45 of file isettings.h.
|
override |
Definition at line 19 of file isettings.cpp.
|
explicitprotected |
Definition at line 15 of file isettings.cpp.
|
protected |
clearCache This method clear all data from cache.
Definition at line 24 of file isettings.cpp.
void QuasarAppUtils::ISettings::forceReloadCache | ( | ) |
forceReloadCache This method force reload settings data from disk.
Definition at line 97 of file isettings.cpp.
SettingsSaveMode QuasarAppUtils::ISettings::getMode | ( | ) | const |
getMode This method return the current mode of the settings.
Definition at line 35 of file isettings.cpp.
getStrValue some as getValue but convert result object to QString type.
key | This is name of the required settings value. |
def | This is default value if a value is not finded. If this params will be skipped, then The Settngs model try find default value in the defaultSettings map. |
Definition at line 67 of file isettings.cpp.
getValue This method 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. If this params will be skipped, then The Settngs model try find default value in the defaultSettings map. |
Definition at line 51 of file isettings.cpp.
|
protectedpure virtual |
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. |
Implemented in QuasarAppUtils::Settings.
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 in QuasarAppUtils::Settings.
Definition at line 85 of file isettings.cpp.
initService This method initialize the global settings object.
obj | This is prepared settings object. You should create a your object monyaly, and add to initialization static std::unique_ptr< ISettings > & initService() initService This method initialize the Base object as a service. Definition qaservice.h:81 |
Definition at line 47 of file isettings.cpp.
|
static |
instance This method returns pointer to current settings object.
Definition at line 43 of file isettings.cpp.
void QuasarAppUtils::ISettings::resetToDefault | ( | ) |
resetToDefault This method reset all settings to default values.
Definition at line 76 of file isettings.cpp.
void QuasarAppUtils::ISettings::setMode | ( | const SettingsSaveMode & | mode | ) |
setMode This method sets a new value of the settings mode.
mode | This is a new value of the settings mode. |
Definition at line 39 of file isettings.cpp.
setStrValue This is some as setValue but working with the QString type.
key | This is name of the changed setting. |
value | This is a new value of the setting |
Definition at line 124 of file isettings.cpp.
settingsMap This method returns initialized settings map. Settings map contains pairs with settings key and default value.
Definition at line 28 of file isettings.cpp.
setValue This slot sets new value for a key setting
key | This is name of the changed setting. |
value | This is a new value of the setting |
Definition at line 105 of file isettings.cpp.
|
protectedpure virtual |
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 |
Implemented in QuasarAppUtils::Settings.
void QuasarAppUtils::ISettings::sync | ( | ) |
sync This method save all setings data on a hard disk;
Definition at line 89 of file isettings.cpp.
syncImplementation This method should save all configuration data to the hard drive;
Implemented in QuasarAppUtils::Settings.
valueChanged This signal when value of the key settings changed
key | This is name of change setting. |
value | This is a new value of key. |
valueStrChanged some as valueChanged(QString key, QVariant value) but value has ben converted to the QString type.
key | This is name of change setting. |
value | This is a new value of key. |