Vidalia
0.2.17
|
#include <AbstractTorSettings.h>
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 |
TorControl * | torControl () const |
Private Attributes | |
TorControl * | _torControl |
QMap< QString, QVariant > | _backupSettings |
Definition at line 22 of file AbstractTorSettings.h.
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 25 of file AbstractTorSettings.cpp.
References _backupSettings, _torControl, VSettings::allSettings(), VSettings::setDefault(), SETTING_CHANGED, and torControl().
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, TorSettings, and ServerSettings.
bool AbstractTorSettings::changedSinceLastApply | ( | ) | const [virtual] |
Returns true if any settings have changed since the last time apply() was called.
Definition at line 49 of file AbstractTorSettings.cpp.
References localValue(), and SETTING_CHANGED.
Referenced by AdvancedPage::changedSinceLastApply(), NetworkPage::changedSinceLastApply(), ServerPage::changedSinceLastApply(), ServerSettings::isServerEnabled(), and value().
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 68 of file AbstractTorSettings.cpp.
Referenced by torValue().
QVariant AbstractTorSettings::localValue | ( | const QString & | key | ) | const [protected, virtual] |
Returns the value associated with key saved in the local configuration file.
Definition at line 88 of file AbstractTorSettings.cpp.
References value().
Referenced by TorSettings::apply(), NetworkSettings::apply(), changedSinceLastApply(), ServerSettings::confValues(), TorSettings::getAuthenticationMethod(), TorSettings::getControlAddress(), TorSettings::getControlMethod(), TorSettings::getControlPassword(), TorSettings::getExecutable(), NetworkSettings::getFascistFirewall(), TorSettings::getTorrc(), ServerSettings::isDirectoryMirror(), ServerSettings::isServerEnabled(), ServerSettings::isUpnpEnabled(), setValue(), torValue(), TorSettings::useRandomPassword(), and value().
void AbstractTorSettings::revert | ( | ) | [virtual] |
Reverts all settings to their values at the last time apply() was called.
Definition at line 38 of file AbstractTorSettings.cpp.
References _backupSettings, and setValue().
Referenced by AdvancedPage::revert(), NetworkPage::revert(), and ServerPage::revert().
void AbstractTorSettings::setChanged | ( | bool | changed | ) |
Sets a value indicating that the server settings have changed since apply() was last called.
Definition at line 57 of file AbstractTorSettings.cpp.
References _backupSettings, VSettings::allSettings(), SETTING_CHANGED, and setValue().
Referenced by ConfigDialog::saveConf(), and setValue().
void AbstractTorSettings::setValue | ( | const QString & | key, |
const QVariant & | value | ||
) | [protected, virtual] |
Saves the value val for the setting key to the local settings file.
Reimplemented from VSettings.
Definition at line 123 of file AbstractTorSettings.cpp.
References localValue(), and setChanged().
Referenced by revert(), TorSettings::setAuthenticationMethod(), TorSettings::setAutoControlPort(), ServerSettings::setBandwidthAvgRate(), ServerSettings::setBandwidthBurstRate(), TorSettings::setBootstrap(), TorSettings::setBootstrapFrom(), ServerSettings::setBridgeEnabled(), NetworkSettings::setBridgeList(), setChanged(), ServerSettings::setContactInfo(), TorSettings::setControlAddress(), TorSettings::setControlMethod(), TorSettings::setControlPassword(), TorSettings::setControlPort(), TorSettings::setDataDirectory(), ServerSettings::setDirectoryMirror(), ServerSettings::setDirPort(), TorSettings::setExecutable(), ServerSettings::setExitPolicy(), NetworkSettings::setFascistFirewall(), ServerSettings::setNickname(), ServerSettings::setNonExitEnabled(), ServerSettings::setORPort(), NetworkSettings::setProxyAddress(), NetworkSettings::setProxyPassword(), NetworkSettings::setProxyType(), NetworkSettings::setProxyUsername(), ServerSettings::setPublishServerDescriptor(), NetworkSettings::setReachablePorts(), TorSettings::setRejectPlaintextPorts(), ServerSettings::setServerEnabled(), TorSettings::setSocketPath(), TorSettings::setTorrc(), ServerSettings::setUpnpEnabled(), NetworkSettings::setUseBridges(), TorSettings::setUseRandomPassword(), and TorSettings::setWarnPlaintextPorts().
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 68 of file AbstractTorSettings.h.
References _torControl.
Referenced by AbstractTorSettings(), ServerSettings::apply(), TorSettings::apply(), NetworkSettings::apply(), ServerSettings::confValues(), TorSettings::getAuthenticationMethod(), TorSettings::getTorrc(), ServerSettings::isServerEnabled(), and ServerSettings::torValue().
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 96 of file AbstractTorSettings.cpp.
References _torControl, VSettings::defaultValue(), TorControl::getConf(), isEmptyValue(), and localValue().
Referenced by value().
QVariant AbstractTorSettings::value | ( | const QString & | key | ) | const [protected, virtual] |
If Vidalia is connected to Tor, this returns the value associated with key by calling torValue(). Otherwise, this calls localValue() to get the locally saved value associated with key.
Definition at line 113 of file AbstractTorSettings.cpp.
References _torControl, changedSinceLastApply(), TorControl::isConnected(), localValue(), and torValue().
Referenced by TorSettings::autoControlPort(), TorSettings::bootstrap(), TorSettings::bootstrapFrom(), ServerSettings::getBandwidthAvgRate(), ServerSettings::getBandwidthBurstRate(), NetworkSettings::getBridgeList(), ServerSettings::getContactInfo(), TorSettings::getControlPort(), TorSettings::getDataDirectory(), ServerSettings::getDirPort(), ServerSettings::getExitPolicy(), ServerSettings::getNickname(), ServerSettings::getORPort(), NetworkSettings::getProxyAddress(), NetworkSettings::getProxyPassword(), NetworkSettings::getProxyType(), NetworkSettings::getProxyUsername(), NetworkSettings::getReachablePorts(), TorSettings::getRejectPlaintextPorts(), TorSettings::getSocketPath(), NetworkSettings::getTunnelDirConns(), NetworkSettings::getUseBridges(), TorSettings::getWarnPlaintextPorts(), ServerSettings::isBridgeEnabled(), ServerSettings::isNonExitEnabled(), localValue(), and ServerSettings::publishServerDescriptor().
QMap<QString, QVariant> AbstractTorSettings::_backupSettings [private] |
Collection of settings values at the last time apply() was called.
Definition at line 75 of file AbstractTorSettings.h.
Referenced by AbstractTorSettings(), revert(), and setChanged().
TorControl* AbstractTorSettings::_torControl [private] |
TorControl object used for reading settings from or applying settings to Tor.
Definition at line 68 of file AbstractTorSettings.h.
Referenced by AbstractTorSettings(), torControl(), torValue(), and value().