AbstractTorSettings Class Reference

#include <abstracttorsettings.h>

Inheritance diagram for AbstractTorSettings:

VSettings NetworkSettings ServerSettings TorSettings

List of all members.

Public Member Functions

 AbstractTorSettings (const QString &group, TorControl *torControl=0)
void setChanged (bool changed)
virtual bool changedSinceLastApply () const
virtual void revert ()
virtual bool apply (QString *errmsg)=0

Protected Member Functions

virtual QVariant value (const QString &key) const
virtual QVariant localValue (const QString &key) const
virtual QVariant torValue (const QString &key) const
virtual void setValue (const QString &key, const QVariant &value)
bool isEmptyValue (const QVariant &value) const
TorControltorControl () const

Private Attributes

TorControl_torControl
QMap< QString, QVariant > _backupSettings


Detailed Description

Definition at line 24 of file abstracttorsettings.h.


Constructor & Destructor Documentation

AbstractTorSettings::AbstractTorSettings ( const QString &  group,
TorControl torControl = 0 
)

Constructor. All settings will be under the heading group and torControl will be used to getconf values from Tor.

Definition at line 26 of file abstracttorsettings.cpp.

References _backupSettings, _torControl, VSettings::allSettings(), VSettings::setDefault(), and SETTING_CHANGED.


Member Function Documentation

void AbstractTorSettings::setChanged ( bool  changed  ) 

Sets a value indicating that the server settings have changed since apply() was last called.

Definition at line 58 of file abstracttorsettings.cpp.

References _backupSettings, VSettings::allSettings(), SETTING_CHANGED, and VSettings::setValue().

Referenced by setValue().

bool AbstractTorSettings::changedSinceLastApply (  )  const [virtual]

Returns true if any settings have changed since the last time apply() was called.

Definition at line 50 of file abstracttorsettings.cpp.

References localValue(), and SETTING_CHANGED.

Referenced by ServerPage::changedSinceLastApply(), AdvancedPage::changedSinceLastApply(), ServerSettings::isServerEnabled(), and value().

void AbstractTorSettings::revert (  )  [virtual]

Reverts all settings to their values at the last time apply() was called.

Definition at line 39 of file abstracttorsettings.cpp.

References _backupSettings, and setValue().

Referenced by ServerPage::revert(), NetworkPage::revert(), and AdvancedPage::revert().

virtual bool AbstractTorSettings::apply ( QString *  errmsg  )  [pure virtual]

Subclasses must implement this to setconf values to apply them to a running Tor instance.

Implemented in NetworkSettings, ServerSettings, and TorSettings.

QVariant AbstractTorSettings::value ( const QString &  key  )  const [protected, virtual]

QVariant AbstractTorSettings::localValue ( const QString &  key  )  const [protected, virtual]

QVariant AbstractTorSettings::torValue ( const QString &  key  )  const [protected, virtual]

Returns the value associated with key by querying TOr via getconf key.

Reimplemented in ServerSettings.

Definition at line 97 of file abstracttorsettings.cpp.

References _torControl, VSettings::defaultValue(), TorControl::getConf(), isEmptyValue(), and localValue().

Referenced by ServerSettings::torValue(), and value().

void AbstractTorSettings::setValue ( const QString &  key,
const QVariant &  value 
) [protected, virtual]

bool AbstractTorSettings::isEmptyValue ( const QVariant &  value  )  const [protected]

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 an empty string.

Definition at line 69 of file abstracttorsettings.cpp.

Referenced by torValue().

TorControl* AbstractTorSettings::torControl (  )  const [inline, protected]

Returns the TorControl object used for reading settings from or writing settings to Tor, if one was specified. Returns 0 if no TorControl object was given.

Definition at line 70 of file abstracttorsettings.h.

References _torControl.

Referenced by TorSettings::apply(), ServerSettings::apply(), NetworkSettings::apply(), ServerSettings::confValues(), TorSettings::getAuthenticationMethod(), TorSettings::getTorrc(), ServerSettings::isServerEnabled(), and ServerSettings::torValue().


Member Data Documentation

TorControl object used for reading settings from or applying settings to Tor.

Definition at line 70 of file abstracttorsettings.h.

Referenced by AbstractTorSettings(), torControl(), torValue(), and value().

QMap<QString, QVariant> AbstractTorSettings::_backupSettings [private]

Collection of settings values at the last time apply() was called.

Definition at line 77 of file abstracttorsettings.h.

Referenced by AbstractTorSettings(), revert(), and setChanged().


The documentation for this class was generated from the following files:

Generated on Wed Nov 26 21:02:39 2008 for Vidalia by  doxygen 1.5.6