Vidalia  0.3.1
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 /** Public setting keys */
24 #define SETTING_REMEMBER_SHUTDOWN "RememberShutdown"
25 
26 /** Handles saving and restoring Vidalia's settings, such as the
27  * location of Tor, the control port, etc.
28  *
29  * NOTE: Qt 4.1 documentation states that constructing a QSettings object is
30  * "very fast", so we shouldn't need to create a global instance of this
31  * class.
32  */
33 class VidaliaSettings : public VSettings
34 {
35  Q_OBJECT
36 
37 public:
38  enum IconPosition {
42  };
43 
44  /** Default constructor. */
46 
47  /** Gets the currently preferred language code for Vidalia. */
48  QString getLanguageCode();
49  /** Saves the preferred language code. */
50  void setLanguageCode(QString languageCode);
51 
52  /** Gets the interface style key (e.g., "windows", "motif", etc.) */
53  QString getInterfaceStyle();
54  /** Sets the interface style key. */
55  void setInterfaceStyle(QString styleKey);
56 
57  /** Returns true if Vidalia should start Tor when it starts. */
58  bool runTorAtStart();
59  /** Set whether to run Tor when Vidalia starts. */
60  void setRunTorAtStart(bool run);
61 
62  /** Returns true if Vidalia's main window should be visible when the
63  * application starts. */
64  bool showMainWindowAtStart();
65  /** Sets whether to show Vidalia's main window when the application starts. */
66  void setShowMainWindowAtStart(bool show);
67 
68  /** Returns true if Vidalia should start on system boot. */
69  bool runVidaliaOnBoot();
70  /** Set whether to run Vidalia on system boot. */
71  void setRunVidaliaOnBoot(bool run);
72 
73  /** If browserDirectory is empty, returns a fully-qualified path to
74  * the web browser, including the executable name. If browserDirectory
75  * is set, then returns the basename of the configured web browser */
76  QString getBrowserExecutable() const;
77  /** Sets the location and name of the web browser executable to the given
78  * string. If set to the empty string, the browser will not be started. */
79  void setBrowserExecutable(const QString &browserExecutable);
80 
81  /** Returns a fully-qualified path to the web browser directory */
82  QString getBrowserDirectory() const;
83  /** Sets the location and name of the web browser directory to the given string.
84  * If set to the empty string, the browser will not be started. */
85  void setBrowserDirectory(const QString &browserDirectory);
86 
87  /** Returns a fully-qualified path to the IM client, including the
88  * executable name. */
89  QString getIMExecutable() const;
90  /** Sets the location and name of the IM client executable to the given
91  * string. If set to the empty string, the client will not be started. */
92  void setIMExecutable(const QString &IMExecutable);
93 
94  /** Returns true if Vidalia should start a proxy application when it
95  * starts. */
96  bool runProxyAtStart();
97  /** Set whether to run a proxy application when Vidalia starts. */
98  void setRunProxyAtStart(bool run);
99 
100  /** Returns a fully-qualified path to the proxy server, including the
101  * executable name. */
102  QString getProxyExecutable() const;
103  /** Sets the location and name of the proxy server executable to the given
104  * string. If set to the empty string, the proxy will not be started. */
105  void setProxyExecutable(const QString &proxyExecutable);
106 
107  /** Returns a list containing additional command line arguments to be
108  * passed to ProxyExecutable */
109  QString getProxyExecutableArguments() const;
110  /** Sets the additional arguments to be passed to Proxy Executable */
111  void setProxyExecutableArguments(const QString &proxyExecutableArguments);
112 
113  /** Returns true if Vidalia should automatically check for software updates.
114  */
115  bool isAutoUpdateEnabled() const;
116  /** Sets to <b>enabled</b> whether Vidalia should automatically check for
117  * software updates or not. */
118  void setAutoUpdateEnabled(bool enabled);
119 
120  /** Returns the time at which Vidalia last checked for software updates. */
121  QDateTime lastCheckedForUpdates() const;
122  /** Sets to <b>checkedAt</b> the time at which Vidalia last checked for
123  * available software updates. */
124  void setLastCheckedForUpdates(const QDateTime &checkedAt);
125 
126  /** Returns true if Vidalia is currently configured to use a local GeoIP
127  * database. */
128  bool useLocalGeoIpDatabase() const;
129  /** Enables or disables use of a local GeoIP database. */
130  void setUseLocalGeoIpDatabase(bool enabled);
131 
132  /** Returns the file, if set, to be used as the local GeoIP database. */
133  QString localGeoIpDatabase() const;
134  /** Sets the file to use as a local GeoIP database. */
135  void setLocalGeoIpDatabase(const QString &databaseFile);
136 
137  /** Returns the path where the plugins live */
138  QString pluginPath() const;
139  /** Sets the path where the plugins live */
140  void setPluginPath(const QString &path);
141 
142  /** Get the icon preference */
144 
145  /** Set the icon preference */
146  void setIconPref(const IconPosition iconPref);
147  QString toString(const IconPosition iconPref);
148  IconPosition fromString(QString iconPref);
149 
150  /** Returns true if Vidalia should skip the version check for tor */
151  bool skipVersionCheck() const;
152 
153  /** Returns true if Vidalia should not ask if the user wants to shutdown
154  * tor gracefully */
155  bool rememberShutdown();
156  /** Sets RememberShutdown to val */
157  void setRememberShutdown(bool val);
158 };
159 
160 #endif
161