ConfigPage.h

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file ConfigPage.h
00013 ** \version $Id: ConfigPage.h 3735 2009-04-28 20:28:01Z edmanm $
00014 ** \brief Pure-virtual class for a configuration page
00015 */
00016 
00017 #ifndef _CONFIGPAGE_H
00018 #define _CONFIGPAGE_H
00019 
00020 #include <QWidget>
00021 
00022 
00023 class ConfigPage : public QWidget
00024 {
00025   Q_OBJECT
00026 
00027 public:
00028   /** Default Constructor */
00029   ConfigPage(QWidget *parent = 0, const QString title = QString()) 
00030    : QWidget(parent), _title(title) {}
00031 
00032   /** Returns the title of this configuration page. */
00033   QString title() const { return _title; }
00034 
00035   /** Pure virtual method. Subclassed pages load their config settings here. */
00036   virtual void load() = 0;
00037   /** Pure virtual method. Subclassed pages save their config settings here
00038    * and return true if everything was saved successfully. */
00039   virtual bool save(QString &errmsg) = 0;
00040 
00041   /** Subclassed pages can overload this method to return true if they
00042    * contain settings that have been modified since they were last applied to
00043    * Tor. The default implementation always returns false. */
00044   virtual bool changedSinceLastApply() {
00045     return false;
00046   }
00047   /** Subclassed pages can overload this method to apply any settings to
00048    * Tor that have been modified since they were last applied (e.g., the
00049    * changes were made while Tor was not running). Returns true if the changes
00050    * were applied successfully. */
00051   virtual bool apply(QString &errmsg) {
00052     Q_UNUSED(errmsg);
00053     return true;
00054   }
00055   /** Subclassed pages can overload this method to revert any cancelled
00056    * settings. */
00057   virtual void revert() {}
00058   
00059   virtual void retranslateUi() {}
00060 
00061 signals:
00062   /** Signal emitted when a ConfigPage requests help information on a given
00063    * <b>topic</b>. */
00064   void helpRequested(const QString &topic);
00065 
00066 private:
00067   QString _title; /**< Title of this configuration page. */
00068 };
00069 
00070 #endif
00071 

Generated on Mon Aug 30 19:09:59 2010 for Vidalia by  doxygen 1.5.9