[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [vidalia/alpha] Handle volatiles from the AbstractTorSettings



commit e02be82611aadb48a6ed4d37c9eace40f26bbc0c
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Fri Feb 3 22:09:55 2012 -0300

    Handle volatiles from the AbstractTorSettings
---
 src/vidalia/config/AbstractTorSettings.cpp |   10 ++++++++++
 src/vidalia/config/AbstractTorSettings.h   |    6 ++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/vidalia/config/AbstractTorSettings.cpp b/src/vidalia/config/AbstractTorSettings.cpp
index 5f1b8aa..e1941f9 100644
--- a/src/vidalia/config/AbstractTorSettings.cpp
+++ b/src/vidalia/config/AbstractTorSettings.cpp
@@ -128,3 +128,13 @@ AbstractTorSettings::setValue(const QString &key, const QVariant &value)
   }
 }
 
+/** Saves the value <b>val</b> for the setting <b>key</b> to the local
+ * settings file. */
+void
+AbstractTorSettings::setVolatileValue(const QString &key, const QVariant &value)
+{
+  if (value != volatileValue(key)) {
+    setChanged(true);
+    VSettings::setVolatileValue(key, value);
+  }
+}
diff --git a/src/vidalia/config/AbstractTorSettings.h b/src/vidalia/config/AbstractTorSettings.h
index 4c5d1b7..676d01a 100644
--- a/src/vidalia/config/AbstractTorSettings.h
+++ b/src/vidalia/config/AbstractTorSettings.h
@@ -19,6 +19,10 @@
 #include "VSettings.h"
 #include "TorControl.h"
 
+#define with_torrc_value(VAL) \
+  QStringList ret = Vidalia::torrc()->value((VAL)); \
+  if(ret.size() > 0)
+
 class AbstractTorSettings : public VSettings
 {
   Q_OBJECT
@@ -55,6 +59,8 @@ protected:
   /** Saves the value <b>val</b> for the setting <b>key</b> to the local
    * settings file. */
   virtual void setValue(const QString &key, const QVariant &value);
+
+  virtual void setVolatileValue(const QString &key, const QVariant &value);
   
   /** Returns true if the given QVariant contains an empty value, depending on
    * the data type. For example, 0 is considered an empty integer and "" is



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits