From b0321a2c089f9eebb6d49f275837cf0bfe9864f6 Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Tue, 22 Feb 2022 17:01:53 +0300
Subject: [PATCH] update settings docs

---
 isettings.h  | 13 ++++++++++++-
 settings.cpp |  4 ++++
 settings.h   | 20 ++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

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<Setting>();
+ * ```
+ *
+ * @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<Settings>();
+}
+
 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);