mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-26 17:54: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 The all child classes should be initialized before used.
|
||||
*
|
||||
* ```
|
||||
* auto settingsInstance = Setting::init<Setting>();
|
||||
* ```
|
||||
*
|
||||
* @see ISettings::init method.
|
||||
*
|
||||
*/
|
||||
class QUASARAPPSHARED_EXPORT ISettings : public QObject
|
||||
{
|
||||
|
@ -26,6 +26,10 @@ Settings::Settings() {
|
||||
_settings = new QSettings(QSettings::IniFormat, QSettings::Scope::UserScope, company, name);
|
||||
}
|
||||
|
||||
ISettings *Settings::init() {
|
||||
return ISettings::init<Settings>();
|
||||
}
|
||||
|
||||
void Settings::syncImplementation() {
|
||||
return _settings->sync();
|
||||
}
|
||||
|
20
settings.h
20
settings.h
@ -14,13 +14,33 @@
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
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
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
void syncImplementation();
|
||||
QVariant getValueImplementation(const QString &key, const QVariant &def);
|
||||
void setValueImplementation(const QString key, const QVariant &value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user