[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/alpha] Add missing DefaultSettings.* files
commit 384430e33087746232aa463401c01a6845eee0c1
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date: Mon Mar 12 19:14:12 2012 -0300
Add missing DefaultSettings.* files
---
src/vidalia/config/DefaultSettings.cpp | 20 +++++++++++++++++
src/vidalia/config/DefaultSettings.h | 37 ++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/vidalia/config/DefaultSettings.cpp b/src/vidalia/config/DefaultSettings.cpp
new file mode 100644
index 0000000..db89d60
--- /dev/null
+++ b/src/vidalia/config/DefaultSettings.cpp
@@ -0,0 +1,20 @@
+#include "DefaultSettings.h"
+#include "Vidalia.h"
+
+DefaultSettings::DefaultSettings()
+{
+ _settings = new QSettings(Vidalia::dataDirectory() + "/vidalia.defaults.conf",
+ QSettings::InitFormat);
+}
+
+DefaultSettings::~DefaultSettings()
+{
+ delete _settings;
+}
+
+QVariant
+DefaultSettings::getDefault(const QString &key,
+ const QVariant &defaultVal = QVariant()) const
+{
+ return _settings->value(key, defaultVal);
+}
diff --git a/src/vidalia/config/DefaultSettings.h b/src/vidalia/config/DefaultSettings.h
new file mode 100644
index 0000000..4710b98
--- /dev/null
+++ b/src/vidalia/config/DefaultSettings.h
@@ -0,0 +1,37 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file DefaultSettings.h
+** \brief
+*/
+
+#ifndef _DEFAULTSETTINGS_H
+#define _DEFAULTSETTINGS_H
+
+#include <QSettings>
+
+class DefaultSettings
+{
+ public:
+ /** Default constructor. */
+ DefaultSettings();
+ /** Default desrtuctor */
+ ~DefaultSettings();
+
+ /** Return the stored default value */
+ QVariant getDefault(const QString &key,
+ const QVariant &defaultVal = QVariant()) const;
+
+ private:
+ QSettings *_settings;
+};
+
+#endif
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits