mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-29 03:04:40 +00:00
update settings docs
This commit is contained in:
parent
f466dd6437
commit
b0321a2c08
13
isettings.h
13
isettings.h
@ -27,8 +27,19 @@ enum class SettingsSaveMode: quint64 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The Settings class This is wraper of the QSettings object.
|
* @brief The Settings class base interface for implementation settings backends.
|
||||||
|
* Available implementations:
|
||||||
|
* Setting (based on QSettings backend)
|
||||||
* @note This is singleton object.
|
* @note This is singleton object.
|
||||||
|
*
|
||||||
|
* @note The all child classes should be initialized before used.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* auto settingsInstance = Setting::init<Setting>();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see ISettings::init method.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class QUASARAPPSHARED_EXPORT ISettings : public QObject
|
class QUASARAPPSHARED_EXPORT ISettings : public QObject
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,10 @@ Settings::Settings() {
|
|||||||
_settings = new QSettings(QSettings::IniFormat, QSettings::Scope::UserScope, company, name);
|
_settings = new QSettings(QSettings::IniFormat, QSettings::Scope::UserScope, company, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISettings *Settings::init() {
|
||||||
|
return ISettings::init<Settings>();
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::syncImplementation() {
|
void Settings::syncImplementation() {
|
||||||
return _settings->sync();
|
return _settings->sync();
|
||||||
}
|
}
|
||||||
|
20
settings.h
20
settings.h
@ -14,13 +14,33 @@
|
|||||||
|
|
||||||
namespace QuasarAppUtils {
|
namespace QuasarAppUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Settings class This is wraper of the QSettings object.
|
||||||
|
*
|
||||||
|
* Example of initialisation :
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* auto settingsInstance = Setting::init();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see Settings::init
|
||||||
|
*/
|
||||||
class QUASARAPPSHARED_EXPORT Settings: public ISettings
|
class QUASARAPPSHARED_EXPORT Settings: public ISettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Settings();
|
Settings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief init This is simple wrapper of the Settings::init method for convenient access to initialisation.
|
||||||
|
* @return instance of the setting.
|
||||||
|
*/
|
||||||
|
static ISettings* init();
|
||||||
|
|
||||||
// ISettings interface
|
// ISettings interface
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void syncImplementation();
|
void syncImplementation();
|
||||||
QVariant getValueImplementation(const QString &key, const QVariant &def);
|
QVariant getValueImplementation(const QString &key, const QVariant &def);
|
||||||
void setValueImplementation(const QString key, const QVariant &value);
|
void setValueImplementation(const QString key, const QVariant &value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user