VidaliaSettings Class Reference

#include <vidaliasettings.h>

Inheritance diagram for VidaliaSettings:

ServerSettings TorSettings List of all members.

Public Member Functions

 VidaliaSettings ()
void setDefault (QString key, QVariant val)
QVariant defaultValue (QString key)
void setValue (QString key, QVariant val)
QVariant value (QString key)
QVariant value (QString key, QVariant defaultValue)
QString getLanguageCode ()
void setLanguageCode (QString languageCode)
QString getInterfaceStyle ()
void setInterfaceStyle (QString styleKey)
bool runTorAtStart ()
void setRunTorAtStart (bool run)
bool runVidaliaOnBoot ()
void setRunVidaliaOnBoot (bool run)

Static Public Member Functions

static void reset ()

Private Attributes

QHash< QString, QVariant > _defaults

Detailed Description

Handles saving and restoring Vidalia's settings, such as the location of Tor, the control port, etc.

NOTE: Qt 4.1 documentation states that constructing a QSettings object is "very fast", so we shouldn't need to create a global instance of this class.

Definition at line 43 of file vidaliasettings.h.


Constructor & Destructor Documentation

VidaliaSettings::VidaliaSettings (  ) 

Default constructor.

Definition at line 62 of file vidaliasettings.cpp.

References DEFAULT_STYLE, LanguageSupport::defaultLanguageCode(), setDefault(), SETTING_LANGUAGE, SETTING_RUN_TOR_AT_START, and SETTING_STYLE.


Member Function Documentation

void VidaliaSettings::reset (  )  [static]

Resets all of Vidalia's settings.

Definition at line 115 of file vidaliasettings.cpp.

References SETTINGS_FILE.

Referenced by Vidalia::Vidalia().

void VidaliaSettings::setDefault ( QString  key,
QVariant  val 
)

Sets the default value of key to be val.

Definition at line 72 of file vidaliasettings.cpp.

References _defaults.

Referenced by ServerSettings::ServerSettings(), TorSettings::TorSettings(), and VidaliaSettings().

QVariant VidaliaSettings::defaultValue ( QString  key  ) 

Returns the default value for key.

Definition at line 79 of file vidaliasettings.cpp.

References _defaults.

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

void VidaliaSettings::setValue ( QString  key,
QVariant  val 
)

Save val to the configuration file for the setting key, if val is different than key's current value.

Reimplemented in ServerSettings.

Definition at line 90 of file vidaliasettings.cpp.

References value().

Referenced by VidaliaWindow::saveSetting(), TorSettings::setAuthToken(), TorSettings::setControlAddress(), TorSettings::setControlPort(), TorSettings::setExecutable(), TorSettings::setGroup(), setInterfaceStyle(), setLanguageCode(), setRunTorAtStart(), TorSettings::setTorrc(), TorSettings::setUser(), TorSettings::setUseService(), and ServerSettings::setValue().

QVariant VidaliaSettings::value ( QString  key  ) 

Returns the value for key. If no value is currently saved, then the default value for key will be returned.

Reimplemented in ServerSettings.

Definition at line 100 of file vidaliasettings.cpp.

References defaultValue().

Referenced by ServerSettings::changedSinceLastApply(), ServerSettings::confValues(), TorSettings::getAuthToken(), ServerSettings::getAutoUpdateAddress(), TorSettings::getControlAddress(), TorSettings::getControlPort(), TorSettings::getExecutable(), TorSettings::getGroup(), getInterfaceStyle(), getLanguageCode(), VidaliaWindow::getSetting(), TorSettings::getTorrc(), TorSettings::getUser(), TorSettings::getUseService(), ServerSettings::isDirectoryMirror(), ServerSettings::isServerEnabled(), runTorAtStart(), setValue(), ServerSettings::setValue(), and ServerSettings::value().

QVariant VidaliaSettings::value ( QString  key,
QVariant  defaultValue 
)

Returns the value for key. If no value is currently saved, then defaultValue will be returned.

Definition at line 108 of file vidaliasettings.cpp.

QString VidaliaSettings::getLanguageCode (  ) 

Gets the currently preferred language code for Vidalia.

Definition at line 123 of file vidaliasettings.cpp.

References SETTING_LANGUAGE, and value().

Referenced by AppearancePage::load(), and Vidalia::setLanguage().

void VidaliaSettings::setLanguageCode ( QString  languageCode  ) 

Saves the preferred language code.

Definition at line 130 of file vidaliasettings.cpp.

References SETTING_LANGUAGE, and setValue().

Referenced by AppearancePage::save().

QString VidaliaSettings::getInterfaceStyle (  ) 

Gets the interface style key (e.g., "windows", "motif", etc.)

Definition at line 137 of file vidaliasettings.cpp.

References SETTING_STYLE, and value().

Referenced by Vidalia::setStyle().

void VidaliaSettings::setInterfaceStyle ( QString  styleKey  ) 

Sets the interface style key.

Definition at line 144 of file vidaliasettings.cpp.

References SETTING_STYLE, and setValue().

Referenced by AppearancePage::save().

bool VidaliaSettings::runTorAtStart (  ) 

Returns true if Vidalia should start Tor when it starts.

Definition at line 151 of file vidaliasettings.cpp.

References SETTING_RUN_TOR_AT_START, and value().

Referenced by GeneralPage::load(), and MainWindow::MainWindow().

void VidaliaSettings::setRunTorAtStart ( bool  run  ) 

Set whether to run Tor when Vidalia starts.

Definition at line 158 of file vidaliasettings.cpp.

References SETTING_RUN_TOR_AT_START, and setValue().

Referenced by GeneralPage::save().

bool VidaliaSettings::runVidaliaOnBoot (  ) 

Returns true if Vidalia should start on system boot.

Definition at line 165 of file vidaliasettings.cpp.

References win32_registry_get_key_value().

Referenced by GeneralPage::load().

void VidaliaSettings::setRunVidaliaOnBoot ( bool  run  ) 

Set whether to run Vidalia on system boot.

Definition at line 181 of file vidaliasettings.cpp.

References win32_registry_remove_key(), and win32_registry_set_key_value().

Referenced by GeneralPage::save().


Member Data Documentation

QHash<QString,QVariant> VidaliaSettings::_defaults [private]

Definition at line 88 of file vidaliasettings.h.

Referenced by defaultValue(), and setDefault().


The documentation for this class was generated from the following files:
Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0