Vidalia
0.3.1
|
#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 |
![]() | |
VSettings (const QString group=QString()) | |
virtual QVariant | value (const QString &key, const QVariant &defaultVal=QVariant()) const |
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 |
![]() | |
void | setDefault (const QString &key, const QVariant &val) |
QVariant | defaultValue (const QString &key) const |
QMap< QString, QVariant > | allSettings () const |
Private Attributes | |
TorControl * | _torControl |
QMap< QString, QVariant > | _backupSettings |
Additional Inherited Members | |
![]() | |
static QString | settingsFile () |
static bool | settingsFileExists () |
static void | reset () |
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().
|
pure virtual |
Subclasses must implement this to setconf values to apply them to a running Tor instance.
Implemented in NetworkSettings, TorSettings, and ServerSettings.
|
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().
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.
References value().
Referenced by torValue().
|
protectedvirtual |
Returns the value associated with key saved in the local configuration file.
Definition at line 88 of file AbstractTorSettings.cpp.
References VSettings::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().
|
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().
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 VSettings::setValue().
Referenced by ConfigDialog::saveConf(), and setValue().
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(), setChanged(), VSettings::setValue(), and value().
Referenced by revert(), TorSettings::setAuthenticationMethod(), TorSettings::setAutoControlPort(), ServerSettings::setBandwidthAvgRate(), ServerSettings::setBandwidthBurstRate(), TorSettings::setBootstrap(), TorSettings::setBootstrapFrom(), ServerSettings::setBridgeEnabled(), NetworkSettings::setBridgeList(), 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().
|
inlineprotected |
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().
|
protectedvirtual |
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(), localValue(), and QVariant.
Referenced by ServerSettings::torValue(), and value().
|
protectedvirtual |
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(), isEmptyValue(), ServerSettings::isNonExitEnabled(), ServerSettings::publishServerDescriptor(), and setValue().
|
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().
|
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().