src/cfg.cpp

changeset 39
2c368cf5cc19
parent 37
c82a86ea87be
child 42
9528f8d06962
--- 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<QString, QVariant> 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();
+}

mercurial