diff --git a/isettings.h b/isettings.h index 20b8830..27f3a97 100644 --- a/isettings.h +++ b/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(); + * ``` + * + * @see ISettings::init method. + * */ class QUASARAPPSHARED_EXPORT ISettings : public QObject { diff --git a/settings.cpp b/settings.cpp index 1f86982..18a122f 100644 --- a/settings.cpp +++ b/settings.cpp @@ -26,6 +26,10 @@ Settings::Settings() { _settings = new QSettings(QSettings::IniFormat, QSettings::Scope::UserScope, company, name); } +ISettings *Settings::init() { + return ISettings::init(); +} + void Settings::syncImplementation() { return _settings->sync(); } diff --git a/settings.h b/settings.h index b7b1097..6faf7ba 100644 --- a/settings.h +++ b/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);