Vidalia 0.2.15
Public Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes
ServerPage Class Reference

#include <ServerPage.h>

Inheritance diagram for ServerPage:
ConfigPage

List of all members.

Public Member Functions

 ServerPage (QWidget *parent=0)
 ~ServerPage ()
bool save (QString &errmsg)
void load ()
bool apply (QString &errmsg)
void revert ()
bool changedSinceLastApply ()
virtual void retranslateUi ()

Private Types

enum  BwRateIndex {
  CableDsl256 = 0, CableDsl512, CableDsl768, T1CableDsl1500,
  GreaterThan1500, CustomBwLimits
}

Private Slots

void serverModeChanged (bool enabled)
void bandwidthHelp ()
void exitPolicyHelp ()
void rateChanged (int rate)
void customRateChanged ()
void onAuthenticated ()
void onDisconnected ()
void copyBridgeIdentity ()
void testUpnp ()
void upnpHelp ()
void linkActivated (const QString &url)

Private Member Functions

int selectedIndex ()
void saveBandwidthLimits ()
void loadBandwidthLimits ()
void saveExitPolicies ()
void loadExitPolicies ()
void loadBridgeIdentity ()
void displayBridgeUsage ()

Private Attributes

ServerSettings_settings
Ui::ServerPage ui
QString _tmpDirPort
bool _tmpMirror

Detailed Description

Definition at line 30 of file ServerPage.h.


Member Enumeration Documentation

enum ServerPage::BwRateIndex [private]

Index values of rate values in the bandwidth limits dropdown box.

Enumerator:
CableDsl256 

Cable/DSL 256 Kbps

CableDsl512 

Cable/DSL 512 Kbps

CableDsl768 

Cable/DSL 768 Kbps

T1CableDsl1500 

T1/Cable/DSL 1.5 Mbps

GreaterThan1500 

> 1.5 Mbps

CustomBwLimits 

Custom bandwidth limits

Definition at line 87 of file ServerPage.h.


Constructor & Destructor Documentation

ServerPage::ServerPage ( QWidget *  parent = 0)
ServerPage::~ServerPage ( )

Default Destructor

Destructor

Definition at line 130 of file ServerPage.cpp.

References _settings.


Member Function Documentation

bool ServerPage::apply ( QString &  errmsg) [virtual]

Applies the server configuration settings to Tor. Returns true if the settings were applied successfully. Otherwise, errmsg is set and false is returned.

Reimplemented from ConfigPage.

Definition at line 279 of file ServerPage.cpp.

References _settings, and ServerSettings::apply().

void ServerPage::bandwidthHelp ( ) [private, slot]

Called when the user clicks the bandwidth help button

Shows the bandwidth rate limiting help information

Definition at line 387 of file ServerPage.cpp.

References ConfigPage::helpRequested().

Referenced by ServerPage().

bool ServerPage::changedSinceLastApply ( ) [virtual]

Returns true if the user has changed their server settings since the last time they were applied to Tor.

Reimplemented from ConfigPage.

Definition at line 270 of file ServerPage.cpp.

References _settings, and AbstractTorSettings::changedSinceLastApply().

void ServerPage::copyBridgeIdentity ( ) [private, slot]

Copies the user's bridge relay identity to the clipboard.

Definition at line 180 of file ServerPage.cpp.

References ui, and vApp.

Referenced by ServerPage().

void ServerPage::customRateChanged ( ) [private, slot]

Called when the user edits the max or average bandwidth limits.

Called when the user edits the long-term average or maximum bandwidth limit. This ensures that the average bandwidth rate is greater than MIN_RATE (20KB/s) and that the max rate is greater than the average rate.

Definition at line 551 of file ServerPage.cpp.

References MAX_BANDWIDTH_RATE, MIN_BANDWIDTH_RATE, and ui.

Referenced by save(), and ServerPage().

void ServerPage::displayBridgeUsage ( ) [private]

Retrieves bridge usage history from Tor, parses and validates it, and then displays it in a new dialog.

Definition at line 606 of file ServerPage.cpp.

References err(), TorControl::getInfo(), string_parse_keyvals(), Vidalia::torControl(), and BridgeUsageDialog::update().

Referenced by linkActivated().

void ServerPage::exitPolicyHelp ( ) [private, slot]

Called when the user clicks the exit policy help button

Shows exit policy related help information

Definition at line 380 of file ServerPage.cpp.

References ConfigPage::helpRequested().

Referenced by ServerPage().

void ServerPage::linkActivated ( const QString &  url) [private, slot]

Called when the user clicks on a QLabel containing a hyperlink.

Definition at line 595 of file ServerPage.cpp.

References displayBridgeUsage(), and ConfigPage::helpRequested().

Referenced by ServerPage().

void ServerPage::load ( ) [virtual]
void ServerPage::loadBandwidthLimits ( ) [private]
void ServerPage::loadBridgeIdentity ( ) [private]

Loads the user's bridge relay identity into the appropriate widgets. If the user's bridge is not running, then "Not Running" will be displayed. Otherwise, either the bridge's "address:port", "fingerprint", or "address:port fingerprint" will be displayed, depending on whether our GETCONF and GETINFO commands are successful.

Definition at line 193 of file ServerPage.cpp.

References TorControl::getConf(), TorControl::getInfo(), TorControl::isConnected(), Vidalia::torControl(), and ui.

Referenced by load().

void ServerPage::loadExitPolicies ( ) [private]
void ServerPage::onAuthenticated ( ) [private, slot]

Called when Vidalia has authenticated to Tor. If the user's Tor is not recent enough, this disables the bridge server option and displays a warning if the user had previously configured Tor as a bridge.

Definition at line 146 of file ServerPage.cpp.

References VMessageBox::Cancel, TorControl::getTorVersion(), p(), ConfigDialog::Server, VMessageBox::ShowSettings, ConfigDialog::showWindow(), Vidalia::torControl(), ui, and VMessageBox::warning().

Referenced by ServerPage().

void ServerPage::onDisconnected ( ) [private, slot]

Called when Vidalia disconnects from Tor. This method reenables the bridge server option.

Definition at line 173 of file ServerPage.cpp.

References ui.

Referenced by ServerPage().

void ServerPage::rateChanged ( int  index) [private, slot]

Called when the user selects a new value from the rate combo box

Called when the user selects a new value from the rate combo box.

Definition at line 540 of file ServerPage.cpp.

References CustomBwLimits, and ui.

Referenced by ServerPage().

void ServerPage::retranslateUi ( ) [virtual]

Called when the user changes the UI translation.

Reimplemented from ConfigPage.

Definition at line 137 of file ServerPage.cpp.

References ui.

void ServerPage::revert ( ) [virtual]

Reverts the server configuration settings to their values at the last time they were successfully applied to Tor.

Returns true if the user has changed their server settings since the last time they were applied to Tor.

Reimplemented from ConfigPage.

Definition at line 287 of file ServerPage.cpp.

References _settings, and AbstractTorSettings::revert().

bool ServerPage::save ( QString &  errmsg) [virtual]
void ServerPage::saveBandwidthLimits ( ) [private]
void ServerPage::saveExitPolicies ( ) [private]
int ServerPage::selectedIndex ( ) [private]

Returns the index of the selected item in lstExitPolicies

void ServerPage::serverModeChanged ( bool  enabled) [private, slot]

Called when the user toggles any one of the server mode radio buttons and hides or displays the server configuration tabs appropriately.

Definition at line 221 of file ServerPage.cpp.

References _tmpDirPort, _tmpMirror, Vidalia::torControl(), and ui.

Referenced by ServerPage().

void ServerPage::testUpnp ( ) [private, slot]

Tests automatic port forwarding with UPnP.

Tests automatic port forwarding using UPnP.

Definition at line 574 of file ServerPage.cpp.

References ui, and upnpHelp().

Referenced by ServerPage().

void ServerPage::upnpHelp ( ) [private, slot]

Called when the user clicks the UPnP test dialog's help button.

Definition at line 588 of file ServerPage.cpp.

References ConfigPage::helpRequested().

Referenced by ServerPage(), and testUpnp().


Member Data Documentation

A ServerSettings object used to get and set information about how a local Tor server is configured.

Definition at line 119 of file ServerPage.h.

Referenced by apply(), changedSinceLastApply(), load(), loadBandwidthLimits(), loadExitPolicies(), revert(), save(), saveBandwidthLimits(), saveExitPolicies(), ServerPage(), and ~ServerPage().

QString ServerPage::_tmpDirPort [private]

Used to store the dirport value and if the user wants to mirror the directory so that they can be emptied when selecting being a bridge and re-added when selecting relay

Definition at line 127 of file ServerPage.h.

Referenced by serverModeChanged(), and ServerPage().

bool ServerPage::_tmpMirror [private]

Definition at line 128 of file ServerPage.h.

Referenced by serverModeChanged(), and ServerPage().

Ui::ServerPage ServerPage::ui [private]

The documentation for this class was generated from the following files: