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 2362 2008-02-29 04:30:11Z 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 signals: 00060 /** Signal emitted when a ConfigPage requests help information on a given 00061 * <b>topic</b>. */ 00062 void helpRequested(const QString &topic); 00063 00064 private: 00065 QString _title; /**< Title of this configuration page. */ 00066 }; 00067 00068 #endif 00069