Vidalia  0.2.21
VidaliaSettings.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file VidaliaSettings.h
13 ** \brief General Vidalia settings, such as language and interface style
14 */
15 
16 #ifndef _VIDALIASETTINGS_H
17 #define _VIDALIASETTINGS_H
18 
19 #include "VSettings.h"
20 
21 #include <QDateTime>
22 
23 
24 /** Handles saving and restoring Vidalia's settings, such as the
25  * location of Tor, the control port, etc.
26  *
27  * NOTE: Qt 4.1 documentation states that constructing a QSettings object is
28  * "very fast", so we shouldn't need to create a global instance of this
29  * class.
30  */
31 class VidaliaSettings : public VSettings
32 {
33  Q_OBJECT
34 
35 public:
36  enum IconPosition {
40  };
41 
42  /** Default constructor. */
44 
45  /** Gets the currently preferred language code for Vidalia. */
46  QString getLanguageCode();
47  /** Saves the preferred language code. */
48  void setLanguageCode(QString languageCode);
49 
50  /** Gets the interface style key (e.g., "windows", "motif", etc.) */
51  QString getInterfaceStyle();
52  /** Sets the interface style key. */
53  void setInterfaceStyle(QString styleKey);
54 
55  /** Returns true if Vidalia should start Tor when it starts. */
56  bool runTorAtStart();
57  /** Set whether to run Tor when Vidalia starts. */
58  void setRunTorAtStart(bool run);
59 
60  /** Returns true if Vidalia's main window should be visible when the
61  * application starts. */
62  bool showMainWindowAtStart();
63  /** Sets whether to show Vidalia's main window when the application starts. */
64  void setShowMainWindowAtStart(bool show);
65 
66  /** Returns true if Vidalia should start on system boot. */
67  bool runVidaliaOnBoot();
68  /** Set whether to run Vidalia on system boot. */
69  void setRunVidaliaOnBoot(bool run);
70 
71  /** If browserDirectory is empty, returns a fully-qualified path to
72  * the web browser, including the executable name. If browserDirectory
73  * is set, then returns the basename of the configured web browser */
74  QString getBrowserExecutable() const;
75  /** Sets the location and name of the web browser executable to the given
76  * string. If set to the empty string, the browser will not be started. */
77  void setBrowserExecutable(const QString &browserExecutable);
78 
79  /** Returns a fully-qualified path to the web browser directory */
80  QString getBrowserDirectory() const;
81  /** Sets the location and name of the web browser directory to the given string.
82  * If set to the empty string, the browser will not be started. */
83  void setBrowserDirectory(const QString &browserDirectory);
84 
85  /** Browser directories */
86  QString getDefaultProfileDirectory() const;
87  void setDefaultProfileDirectory(const QString &dir);
88  QString getProfileDirectory() const;
89  void setProfileDirectory(const QString &dir);
90  QString getPluginsDirectory() const;
91  void setPluginsDirectory(const QString &dir);
92  QString getDefaultPluginsDirectory() const;
93  void setDefaultPluginsDirectory(const QString &dir);
94 
95  /** Returns a fully-qualified path to the IM client, including the
96  * executable name. */
97  QString getIMExecutable() const;
98  /** Sets the location and name of the IM client executable to the given
99  * string. If set to the empty string, the client will not be started. */
100  void setIMExecutable(const QString &IMExecutable);
101 
102  /** Returns true if Vidalia should start a proxy application when it
103  * starts. */
104  bool runProxyAtStart();
105  /** Set whether to run a proxy application when Vidalia starts. */
106  void setRunProxyAtStart(bool run);
107 
108  /** Returns a fully-qualified path to the proxy server, including the
109  * executable name. */
110  QString getProxyExecutable() const;
111  /** Sets the location and name of the proxy server executable to the given
112  * string. If set to the empty string, the proxy will not be started. */
113  void setProxyExecutable(const QString &proxyExecutable);
114 
115  /** Returns a list containing additional command line arguments to be
116  * passed to ProxyExecutable */
117  QString getProxyExecutableArguments() const;
118  /** Sets the additional arguments to be passed to Proxy Executable */
119  void setProxyExecutableArguments(const QString &proxyExecutableArguments);
120 
121  /** Returns true if Vidalia should automatically check for software updates.
122  */
123  bool isAutoUpdateEnabled() const;
124  /** Sets to <b>enabled</b> whether Vidalia should automatically check for
125  * software updates or not. */
126  void setAutoUpdateEnabled(bool enabled);
127 
128  /** Returns the time at which Vidalia last checked for software updates. */
129  QDateTime lastCheckedForUpdates() const;
130  /** Sets to <b>checkedAt</b> the time at which Vidalia last checked for
131  * available software updates. */
132  void setLastCheckedForUpdates(const QDateTime &checkedAt);
133 
134  /** Returns true if Vidalia is currently configured to use a local GeoIP
135  * database. */
136  bool useLocalGeoIpDatabase() const;
137  /** Enables or disables use of a local GeoIP database. */
138  void setUseLocalGeoIpDatabase(bool enabled);
139 
140  /** Returns the file, if set, to be used as the local GeoIP database. */
141  QString localGeoIpDatabase() const;
142  /** Sets the file to use as a local GeoIP database. */
143  void setLocalGeoIpDatabase(const QString &databaseFile);
144 
145  /** Get the icon preference */
147 
148  /** Set the icon preference */
149  void setIconPref(const IconPosition iconPref);
150  QString toString(const IconPosition iconPref);
151  IconPosition fromString(QString iconPref);
152 
153  /** Returns true if Vidalia should skip the version check for tor */
154  bool skipVersionCheck() const;
155 };
156 
157 #endif
158