Vidalia
0.2.15
|
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.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file ConfigPage.h 00013 ** \brief Pure-virtual class for a configuration page 00014 */ 00015 00016 #ifndef _CONFIGPAGE_H 00017 #define _CONFIGPAGE_H 00018 00019 #include <QWidget> 00020 00021 00022 class ConfigPage : public QWidget 00023 { 00024 Q_OBJECT 00025 00026 public: 00027 /** Default Constructor */ 00028 ConfigPage(QWidget *parent = 0, const QString title = QString()) 00029 : QWidget(parent), _title(title) {} 00030 00031 /** Returns the title of this configuration page. */ 00032 QString title() const { return _title; } 00033 00034 /** Pure virtual method. Subclassed pages load their config settings here. */ 00035 virtual void load() = 0; 00036 /** Pure virtual method. Subclassed pages save their config settings here 00037 * and return true if everything was saved successfully. */ 00038 virtual bool save(QString &errmsg) = 0; 00039 00040 /** Subclassed pages can overload this method to return true if they 00041 * contain settings that have been modified since they were last applied to 00042 * Tor. The default implementation always returns false. */ 00043 virtual bool changedSinceLastApply() { 00044 return false; 00045 } 00046 /** Subclassed pages can overload this method to apply any settings to 00047 * Tor that have been modified since they were last applied (e.g., the 00048 * changes were made while Tor was not running). Returns true if the changes 00049 * were applied successfully. */ 00050 virtual bool apply(QString &errmsg) { 00051 Q_UNUSED(errmsg); 00052 return true; 00053 } 00054 /** Subclassed pages can overload this method to revert any cancelled 00055 * settings. */ 00056 virtual void revert() {} 00057 00058 virtual void retranslateUi() {} 00059 00060 signals: 00061 /** Signal emitted when a ConfigPage requests help information on a given 00062 * <b>topic</b>. */ 00063 void helpRequested(const QString &topic); 00064 00065 private: 00066 QString _title; /**< Title of this configuration page. */ 00067 }; 00068 00069 #endif 00070