Vidalia 0.3.1
ServerPage.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 ServerPage.h
13** \brief Tor server configuration options
14*/
15
16#ifndef _SERVERPAGE_H
17#define _SERVERPAGE_H
18
19#include "ui_ServerPage.h"
20#include "ConfigPage.h"
21#include "TorControl.h"
22#include "ServerSettings.h"
23#include "ExitPolicy.h"
24#include "HelpBrowser.h"
25
26#include <QMessageBox>
27#include <QTimer>
28
29
30class ServerPage : public ConfigPage
31{
32 Q_OBJECT
33
34public:
35 /** Default Constructor */
36 ServerPage(QWidget *parent = 0);
37 /** Default Destructor */
39 /** Saves the changes on this page */
40 bool save(QString &errmsg);
41 /** Loads the settings for this page */
42 void load();
43
44 /** Applies the server configuration settings to Tor. Returns true if the
45 * settings were applied successfully. Otherwise, <b>errmsg</b> is set and
46 * false is returned. */
47 bool apply(QString &errmsg);
48 /** Reverts the server configuration settings to their values at the last
49 * time they were successfully applied to Tor. */
50 void revert();
51 /** Returns true if the user has changed their server settings since the
52 * last time they were applied to Tor. */
54 /** Called when the user changes the UI translation. */
55 virtual void retranslateUi();
56
57private slots:
58 /** Called when the user toggles any one of the server mode radio buttons
59 * and hides or displays the server configuration tabs appropriately. */
60 void serverModeChanged(bool enabled);
61 /** Called when the user clicks the bandwidth help button */
62 void bandwidthHelp();
63 /** Called when the user clicks the exit policy help button */
64 void exitPolicyHelp();
65 /** Called when the user selects a new value from the rate combo box */
66 void rateChanged(int rate);
67 /** Called when the user edits the max or average bandwidth limits. */
68 void customRateChanged();
69 /** Called when Vidalia has authenticated to Tor. If the user's Tor is not
70 * recent enough, this disables the bridge server option and displays a
71 * warning if the user had previously configured Tor as a bridge. */
72 void onAuthenticated();
73 /** Called when Vidalia disconnects from Tor. This method reenables the
74 * bridge server option. */
75 void onDisconnected();
76 /** Copies the user's bridge relay identity to the clipboard. */
77 void copyBridgeIdentity();
78 /** Tests automatic port forwarding with UPnP. */
79 void testUpnp();
80 /** Called when the user clicks the UPnP test dialog's help button. */
81 void upnpHelp();
82 /** Called when the user clicks on a QLabel containing a hyperlink. */
83 void linkActivated(const QString &url);
84
85private:
86 /** Index values of rate values in the bandwidth limits dropdown box. */
88 CableDsl256 = 0, /**< Cable/DSL 256 Kbps */
89 CableDsl512, /**< Cable/DSL 512 Kbps */
90 CableDsl768, /**< Cable/DSL 768 Kbps */
91 T1CableDsl1500, /**< T1/Cable/DSL 1.5 Mbps */
92 GreaterThan1500, /**< > 1.5 Mbps */
93 CustomBwLimits /**< Custom bandwidth limits */
94 };
95
96 /** Returns the index of the selected item in lstExitPolicies */
98
99 /** Saves the server's bandwidth average and burst limits. */
100 void saveBandwidthLimits();
101 /** Loads the server's bandwidth average and burst limits. */
102 void loadBandwidthLimits();
103 /** Saves the server's exit policies. */
104 void saveExitPolicies();
105 /** Loads the server's exit policies. */
106 void loadExitPolicies();
107 /** Loads the user's bridge relay identity into the appropriate widgets. If
108 * the user's bridge is not running, then "Not Running" will be
109 * displayed. Otherwise, either the bridge's "address:port", "fingerprint",
110 * or "address:port fingerprint" will be displayed, depending on whether
111 * our GETCONF and GETINFO commands are successful. */
112 void loadBridgeIdentity();
113 /** Retrieves bridge usage history from Tor, parses and validates it, and
114 * then displays it in a new dialog. */
115 void displayBridgeUsage();
116
117 /** A ServerSettings object used to get and set information about how a
118 * local Tor server is configured. */
120
121 /** Qt Designer generated object */
122 Ui::ServerPage ui;
123
124 /** Used to store the dirport value and if the user wants to mirror the
125 * directory so that they can be emptied when selecting being a bridge and
126 * re-added when selecting relay */
127 QString _tmpDirPort;
129};
130
131#endif
132
void loadBandwidthLimits()
Definition: ServerPage.cpp:401
bool _tmpMirror
Definition: ServerPage.h:128
bool changedSinceLastApply()
Definition: ServerPage.cpp:271
void displayBridgeUsage()
Definition: ServerPage.cpp:612
void loadExitPolicies()
Definition: ServerPage.cpp:473
bool apply(QString &errmsg)
Definition: ServerPage.cpp:280
void upnpHelp()
Definition: ServerPage.cpp:594
ServerSettings * _settings
Definition: ServerPage.h:119
virtual void retranslateUi()
Definition: ServerPage.cpp:137
void onDisconnected()
Definition: ServerPage.cpp:173
Ui::ServerPage ui
Definition: ServerPage.h:122
void load()
Definition: ServerPage.cpp:350
void customRateChanged()
Definition: ServerPage.cpp:557
void loadBridgeIdentity()
Definition: ServerPage.cpp:193
void copyBridgeIdentity()
Definition: ServerPage.cpp:180
@ CustomBwLimits
Definition: ServerPage.h:93
@ GreaterThan1500
Definition: ServerPage.h:92
@ T1CableDsl1500
Definition: ServerPage.h:91
void exitPolicyHelp()
Definition: ServerPage.cpp:387
void linkActivated(const QString &url)
Definition: ServerPage.cpp:601
void bandwidthHelp()
Definition: ServerPage.cpp:394
void rateChanged(int rate)
Definition: ServerPage.cpp:546
void onAuthenticated()
Definition: ServerPage.cpp:146
void serverModeChanged(bool enabled)
Definition: ServerPage.cpp:221
int selectedIndex()
QString _tmpDirPort
Definition: ServerPage.h:127
ServerPage(QWidget *parent=0)
Definition: ServerPage.cpp:71
void saveExitPolicies()
Definition: ServerPage.cpp:500
void saveBandwidthLimits()
Definition: ServerPage.cpp:437
bool save(QString &errmsg)
Definition: ServerPage.cpp:295
void testUpnp()
Definition: ServerPage.cpp:580
void revert()
Definition: ServerPage.cpp:288