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

[vidalia-svn] r1965: Give ConfigPage a virtual method for returning whether they (in trunk: . src/gui/config)



Author: edmanm
Date: 2007-10-02 23:34:32 -0400 (Tue, 02 Oct 2007)
New Revision: 1965

Modified:
   trunk/
   trunk/src/gui/config/configpage.h
Log:
 r1998@lysithea:  edmanm | 2007-10-02 23:30:07 -0400
 Give ConfigPage a virtual method for returning whether they contain Tor
 settings that have been changed since the last time they were applied, and
 another virtual method for applying those settings. Also add an extra optional
 parameter to the constructor to give a config page a title.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r1998] on dc66be73-d13e-47ba-a267-8dc7cda68c65

Modified: trunk/src/gui/config/configpage.h
===================================================================
--- trunk/src/gui/config/configpage.h	2007-10-03 03:34:24 UTC (rev 1964)
+++ trunk/src/gui/config/configpage.h	2007-10-03 03:34:32 UTC (rev 1965)
@@ -35,13 +35,35 @@
 {
 public:
   /** Default Constructor */
-  ConfigPage(QWidget *parent = 0) : QWidget(parent) {}
+  ConfigPage(QWidget *parent = 0, const QString title = QString()) 
+   : QWidget(parent), _title(title) {}
 
+  /** Returns the title of this configuration page. */
+  QString title() const { return _title; }
+
   /** Pure virtual method. Subclassed pages load their config settings here. */
   virtual void load() = 0;
   /** Pure virtual method. Subclassed pages save their config settings here
    * and return true if everything was saved successfully. */
   virtual bool save(QString &errmsg) = 0;
+
+  /** Subclassed pages should overload this method to return true if they
+   * contain settings that have been modified since they were last applied to
+   * Tor. The default implementation always returns false. */
+  virtual bool changedSinceLastApply() {
+    return false;
+  }
+  /** Subclassed pages should overload this method to apply any settings to
+   * Tor that have been modified since they were last applied (e.g., the
+   * changes were made while Tor was not running). Returns true if the changes
+   * were applied successfully. */
+  virtual bool apply(QString &errmsg) {
+    Q_UNUSED(errmsg);
+    return true;
+  }
+
+private:
+  QString _title; /**< Title of this configuration page. */
 };
 
 #endif