|
QuasarAppLib 1.0.530.c9fba11
|
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 | |
| ~ISettings This is the destructor of the ISettings class. It removes the object from the global service list and disconnects the internal signals. | |
| 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 settings 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 () | |
| Service This is the default constructor of the Service template class. It does nothing and is used only to allow the inheritance from the Service class. | |
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 using the default constructor. If the service is already initialized then the current service object will be returned. | |
| 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 destructor method for the service. | |
Protected Member Functions | |
| ISettings (SettingsSaveMode mode=SettingsSaveMode::Auto) | |
| virtual QHash< QString, QVariant > | defaultSettings ()=0 |
| defaultSettings This method must be return default map of the settings and them values. If the default value argument in a getValue method will be skipped, then settings model try find a default value in this map. | |
| 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 |
~ISettings This is the destructor of the ISettings class. It removes the object from the global service list and disconnects the internal signals.
Definition at line 19 of file isettings.cpp.
|
explicitprotected |
|
protected |
clearCache This method clear all data from cache.
Definition at line 24 of file isettings.cpp.

|
protectedpure virtual |
defaultSettings This method must be return default map of the settings and them values. If the default value argument in a getValue method will be skipped, then settings model try find a default value in this map.
Implemented in QuasarAppUtils::Settings.

| 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.
| QString QuasarAppUtils::ISettings::getStrValue | ( | const QString & | key, |
| const QString & | def = {} ) |
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 found. If this params will be skipped, then The Settings model try find default value in the defaultSettings map. |
Definition at line 67 of file isettings.cpp.

| QVariant QuasarAppUtils::ISettings::getValue | ( | const QString & | key, |
| const QVariant & | def = {} ) |
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 found. If this params will be skipped, then The Settings 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 found. |
Implemented in QuasarAppUtils::Settings.

|
virtual |
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.

|
static |
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 bool result = initService(std::make_unique<MySettings>());
static bool initService(std::unique_ptr< ISettings > obj) initService This method initialize the global settings object. Definition isettings.cpp:47 |
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.
|
slot |
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.

|
protected |
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.


|
slot |
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 settings data on a hard disk;
Definition at line 89 of file isettings.cpp.

|
protectedpure virtual |
syncImplementation This method should save all configuration data to the hard drive;
Implemented in QuasarAppUtils::Settings.

|
signal |
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. |

|
signal |
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. |


Definition at line 225 of file isettings.h.