update settings docs

This commit is contained in:
Andrei Yankovich 2022-02-22 17:01:53 +03:00
parent f466dd6437
commit b0321a2c08
3 changed files with 36 additions and 1 deletions

View File

@ -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
{

View File

@ -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();
}

View File

@ -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);