diff -r db677d321cf4 -r 2c368cf5cc19 src/cfg.cpp --- a/src/cfg.cpp Fri Jun 05 19:13:44 2015 +0300 +++ b/src/cfg.cpp Sat Jun 06 22:03:00 2015 +0300 @@ -25,11 +25,19 @@ typedef QMap DefaultsMap; +// +// ------------------------------------------------------------------------------------------------- +// + static QSettings* getSettingsObject() { return new QSettings; } +// +// ------------------------------------------------------------------------------------------------- +// + static DefaultsMap& getDefaults() { static DefaultsMap defaults; @@ -42,6 +50,10 @@ return defaults; } +// +// ------------------------------------------------------------------------------------------------- +// + void Config::reset() { DefaultsMap& defaults = getDefaults(); @@ -50,6 +62,10 @@ set (it.key(), it.value()); } +// +// ------------------------------------------------------------------------------------------------- +// + QVariant Config::get (const QString& name) { QSettings* settings = getSettingsObject(); @@ -61,10 +77,25 @@ return value; } +// +// ------------------------------------------------------------------------------------------------- +// + bool Config::set (const QString& name, const QVariant& value) { QSettings* settings = getSettingsObject(); settings->setValue (name, value); settings->deleteLater(); return settings->status() == QSettings::NoError; -} \ No newline at end of file +} + +// +// ------------------------------------------------------------------------------------------------- +// + +void Config::sync() +{ + QSettings* settings = getSettingsObject(); + settings->sync(); + settings->deleteLater(); +}