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 showMainWindowAtStart ()
void setShowMainWindowAtStart (bool show)
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.

Default Constructor

Definition at line 63 of file vidaliasettings.cpp.

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


Member Function Documentation

void VidaliaSettings::reset (  )  [static]

Resets all of Vidalia's settings.

Definition at line 117 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 74 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 81 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 92 of file vidaliasettings.cpp.

References value().

Referenced by VidaliaWindow::saveSetting(), TorSettings::setAuthenticationMethod(), ServerSettings::setChanged(), TorSettings::setControlAddress(), TorSettings::setControlPassword(), TorSettings::setControlPort(), TorSettings::setDataDirectory(), TorSettings::setExecutable(), TorSettings::setGroup(), setInterfaceStyle(), setLanguageCode(), setRunTorAtStart(), setShowMainWindowAtStart(), TorSettings::setTorrc(), TorSettings::setUser(), TorSettings::setUseRandomPassword(), 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.

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 102 of file vidaliasettings.cpp.

References defaultValue().

Referenced by ServerSettings::changedSinceLastApply(), ServerSettings::confValues(), TorSettings::getAuthenticationMethod(), TorSettings::getControlAddress(), TorSettings::getControlPassword(), TorSettings::getControlPort(), TorSettings::getDataDirectory(), TorSettings::getExecutable(), TorSettings::getGroup(), getInterfaceStyle(), getLanguageCode(), VidaliaWindow::getSetting(), TorSettings::getTorrc(), TorSettings::getUser(), ServerSettings::isDirectoryMirror(), ServerSettings::isServerEnabled(), runTorAtStart(), setValue(), ServerSettings::setValue(), showMainWindowAtStart(), TorSettings::useRandomPassword(), 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 110 of file vidaliasettings.cpp.

QString VidaliaSettings::getLanguageCode (  ) 

Gets the currently preferred language code for Vidalia.

Definition at line 125 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.

Sets the preferred language code.

Definition at line 132 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 139 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 146 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.

Returns true if Tor is to be run when Vidalia starts.

Definition at line 153 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.

If run is set to true, then Tor will be run when Vidalia starts.

Definition at line 160 of file vidaliasettings.cpp.

References SETTING_RUN_TOR_AT_START, and setValue().

Referenced by GeneralPage::save().

bool VidaliaSettings::showMainWindowAtStart (  ) 

Returns true if Vidalia's main window should be visible when the application starts.

Definition at line 168 of file vidaliasettings.cpp.

References SETTING_SHOW_MAINWINDOW_AT_START, and value().

Referenced by MainWindow::MainWindow().

void VidaliaSettings::setShowMainWindowAtStart ( bool  show  ) 

Sets whether to show Vidalia's main window when the application starts.

Definition at line 175 of file vidaliasettings.cpp.

References SETTING_SHOW_MAINWINDOW_AT_START, and setValue().

Referenced by MainWindow::toggleShowOnStartup().

bool VidaliaSettings::runVidaliaOnBoot (  ) 

Returns true if Vidalia should start on system boot.

Returns true if Vidalia is set to run on system boot.

Definition at line 183 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.

If run is set to true, then Vidalia will run on system boot.

Definition at line 199 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 94 of file vidaliasettings.h.

Referenced by defaultValue(), and setDefault().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 15:49:29 2007 for Vidalia by  doxygen 1.5.3