Vidalia  0.2.15
VidaliaSettings.h
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file VidaliaSettings.h
00013 ** \brief General Vidalia settings, such as language and interface style
00014 */
00015 
00016 #ifndef _VIDALIASETTINGS_H
00017 #define _VIDALIASETTINGS_H
00018 
00019 #include "VSettings.h"
00020 
00021 #include <QDateTime>
00022 
00023 
00024 /** Handles saving and restoring Vidalia's settings, such as the
00025  * location of Tor, the control port, etc.
00026  *
00027  * NOTE: Qt 4.1 documentation states that constructing a QSettings object is
00028  * "very fast", so we shouldn't need to create a global instance of this
00029  * class.
00030  */
00031 class VidaliaSettings : public VSettings
00032 {
00033   Q_OBJECT
00034 
00035 public:
00036   enum IconPosition {
00037     Tray,
00038     Dock,
00039     Both,
00040   };
00041 
00042   /** Default constructor. */
00043   VidaliaSettings();
00044 
00045   /** Gets the currently preferred language code for Vidalia. */
00046   QString getLanguageCode();
00047   /** Saves the preferred language code. */
00048   void setLanguageCode(QString languageCode);
00049  
00050   /** Gets the interface style key (e.g., "windows", "motif", etc.) */
00051   QString getInterfaceStyle();
00052   /** Sets the interface style key. */
00053   void setInterfaceStyle(QString styleKey);
00054   
00055   /** Returns true if Vidalia should start Tor when it starts. */
00056   bool runTorAtStart();
00057   /** Set whether to run Tor when Vidalia starts. */
00058   void setRunTorAtStart(bool run);
00059 
00060   /** Returns true if Vidalia's main window should be visible when the
00061    * application starts. */
00062   bool showMainWindowAtStart();
00063   /** Sets whether to show Vidalia's main window when the application starts. */
00064   void setShowMainWindowAtStart(bool show);
00065   
00066   /** Returns true if Vidalia should start on system boot. */
00067   bool runVidaliaOnBoot();
00068   /** Set whether to run Vidalia on system boot. */
00069   void setRunVidaliaOnBoot(bool run);
00070 
00071   /** If browserDirectory is empty, returns a fully-qualified path to
00072    * the web browser, including the executable name. If browserDirectory
00073    * is set, then returns the basename of the configured web browser */
00074   QString getBrowserExecutable() const;
00075   /** Sets the location and name of the web browser executable to the given
00076    * string. If set to the empty string, the browser will not be started. */
00077   void setBrowserExecutable(const QString &browserExecutable);
00078 
00079   /** Returns a fully-qualified path to the web browser directory */
00080   QString getBrowserDirectory() const;
00081   /** Sets the location and name of the web browser directory to the given string.
00082    * If set to the empty string, the browser will not be started. */
00083   void setBrowserDirectory(const QString &browserDirectory);
00084 
00085   /** Returns a fully-qualified path to the IM client, including the
00086    * executable name. */
00087   QString getIMExecutable() const;
00088   /** Sets the location and name of the IM client executable to the given
00089    * string. If set to the empty string, the client will not be started. */
00090   void setIMExecutable(const QString &IMExecutable);
00091 
00092   /** Returns true if Vidalia should start a proxy application when it
00093    * starts. */
00094   bool runProxyAtStart();
00095   /** Set whether to run a proxy application when Vidalia starts. */
00096   void setRunProxyAtStart(bool run);
00097 
00098   /** Returns a fully-qualified path to the proxy server, including the
00099    * executable name. */
00100   QString getProxyExecutable() const;
00101   /** Sets the location and name of the proxy server executable to the given
00102    * string. If set to the empty string, the proxy will not be started. */
00103   void setProxyExecutable(const QString &proxyExecutable);
00104 
00105   /** Returns a list containing additional command line arguments to be
00106    * passed to ProxyExecutable */
00107   QString getProxyExecutableArguments() const;
00108   /** Sets the additional arguments to be passed to Proxy Executable */
00109   void setProxyExecutableArguments(const QString &proxyExecutableArguments);
00110   
00111   /** Returns true if Vidalia should automatically check for software updates.
00112    */
00113   bool isAutoUpdateEnabled() const;
00114   /** Sets to <b>enabled</b> whether Vidalia should automatically check for
00115    * software updates or not. */
00116   void setAutoUpdateEnabled(bool enabled);
00117 
00118   /** Returns the time at which Vidalia last checked for software updates. */
00119   QDateTime lastCheckedForUpdates() const;
00120   /** Sets to <b>checkedAt</b> the time at which Vidalia last checked for
00121    * available software updates. */
00122   void setLastCheckedForUpdates(const QDateTime &checkedAt);
00123 
00124   /** Returns true if Vidalia is currently configured to use a local GeoIP
00125    * database. */
00126   bool useLocalGeoIpDatabase() const;
00127   /** Enables or disables use of a local GeoIP database. */
00128   void setUseLocalGeoIpDatabase(bool enabled);
00129 
00130   /** Returns the file, if set, to be used as the local GeoIP database. */
00131   QString localGeoIpDatabase() const;
00132   /** Sets the file to use as a local GeoIP database. */
00133   void setLocalGeoIpDatabase(const QString &databaseFile);
00134 
00135   /** Get the icon preference */
00136   IconPosition getIconPref();
00137 
00138   /** Set the icon preference */
00139   void setIconPref(const IconPosition iconPref);
00140   QString toString(const IconPosition iconPref);
00141   IconPosition fromString(QString iconPref);
00142 };
00143 
00144 #endif
00145