#include <serverpage.h>
Inheritance diagram for ServerPage:
Public Member Functions | |
ServerPage (QWidget *parent=0) | |
~ServerPage () | |
bool | save (QString &errmsg) |
void | load () |
Private Slots | |
void | getServerAddress () |
void | addPolicy () |
void | removePolicy () |
void | raisePriority () |
void | lowerPriority () |
void | bandwidthHelp () |
void | exitPolicyHelp () |
void | updateServerIP () |
void | rateChanged () |
Private Member Functions | |
void | getServerPublicIP () |
int | selectedIndex () |
void | addPolicyItem (Policy policy, bool append=true) |
void | savePolicy (QTreeWidgetItem *item, ExitPolicy &exitPolicy) |
void | setAutoUpdateTimer (bool enabled) |
Private Attributes | |
TorControl * | _torControl |
ServerSettings * | _settings |
QTimer * | _autoUpdateTimer |
Ui::ServerPage | ui |
Definition at line 41 of file serverpage.h.
ServerPage::ServerPage | ( | QWidget * | parent = 0 |
) |
Default Constructor
Definition at line 61 of file serverpage.cpp.
References _autoUpdateTimer, _settings, _torControl, addPolicy(), bandwidthHelp(), exitPolicyHelp(), getServerAddress(), lowerPriority(), MAX_RATE, MIN_RATE, raisePriority(), rateChanged(), removePolicy(), Vidalia::torControl(), ui, and updateServerIP().
ServerPage::~ServerPage | ( | ) |
bool ServerPage::save | ( | QString & | errmsg | ) | [virtual] |
Saves the changes on this page
Implements ConfigPage.
Definition at line 125 of file serverpage.cpp.
References _settings, _torControl, ServerSettings::apply(), ServerSettings::changedSinceLastApply(), i(), TorControl::isConnected(), rateChanged(), ServerSettings::revert(), savePolicy(), ServerSettings::setAddress(), ServerSettings::setAutoUpdateAddress(), setAutoUpdateTimer(), ServerSettings::setBandwidthAvgRate(), ServerSettings::setBandwidthBurstRate(), ServerSettings::setContactInfo(), ServerSettings::setDirectoryMirror(), ServerSettings::setDirPort(), ServerSettings::setExitPolicy(), ServerSettings::setMiddleman(), ServerSettings::setNickname(), ServerSettings::setORPort(), ServerSettings::setServerEnabled(), and ui.
void ServerPage::load | ( | ) | [virtual] |
Loads the settings for this page
Implements ConfigPage.
Definition at line 178 of file serverpage.cpp.
References _settings, addPolicyItem(), ServerSettings::getAddress(), ServerSettings::getAutoUpdateAddress(), ServerSettings::getBandwidthAvgRate(), ServerSettings::getBandwidthBurstRate(), ServerSettings::getContactInfo(), ServerSettings::getDirPort(), ServerSettings::getExitPolicy(), ServerSettings::getNickname(), ServerSettings::getORPort(), ServerSettings::isDirectoryMirror(), ServerSettings::isMiddleman(), ServerSettings::isServerEnabled(), ExitPolicy::policyList(), setAutoUpdateTimer(), and ui.
void ServerPage::getServerAddress | ( | ) | [private, slot] |
Called when the user clicks "Get Address" to guess our local IP
Definition at line 364 of file serverpage.cpp.
References getServerPublicIP(), VMessageBox::information(), net_is_private_address(), net_local_address(), VMessageBox::No, ui, and VMessageBox::Yes.
Referenced by ServerPage().
void ServerPage::addPolicy | ( | ) | [private, slot] |
Called when the user clicks the "Add Policy" button
Definition at line 219 of file serverpage.cpp.
References addPolicyItem(), Policy::toAction(), and ui.
Referenced by ServerPage().
void ServerPage::removePolicy | ( | ) | [private, slot] |
Called when the user clicks the "Remove Policy" button
Definition at line 279 of file serverpage.cpp.
References selectedIndex(), and ui.
Referenced by ServerPage().
void ServerPage::raisePriority | ( | ) | [private, slot] |
Called when the user clicks the "Raise Priority" button
Definition at line 290 of file serverpage.cpp.
References selectedIndex(), and ui.
Referenced by ServerPage().
void ServerPage::lowerPriority | ( | ) | [private, slot] |
Called when the user clicks the "Lower Priority" button
Definition at line 302 of file serverpage.cpp.
References selectedIndex(), and ui.
Referenced by ServerPage().
void ServerPage::bandwidthHelp | ( | ) | [private, slot] |
Called when the user clicks the bandwidth help button
Definition at line 333 of file serverpage.cpp.
References BANDWIDTH_HELP, and Vidalia::help().
Referenced by ServerPage().
void ServerPage::exitPolicyHelp | ( | ) | [private, slot] |
Called when the user clicks the exit policy help button
Definition at line 326 of file serverpage.cpp.
References EXIT_POLICY_HELP, and Vidalia::help().
Referenced by ServerPage().
void ServerPage::updateServerIP | ( | ) | [private, slot] |
Called when the user's public IP address needs to be updated.
Definition at line 386 of file serverpage.cpp.
References _settings, _torControl, ServerSettings::apply(), ServerSettings::getAddress(), TorControl::isConnected(), net_get_public_ip(), net_is_private_address(), net_local_address(), ServerSettings::setAddress(), and ui.
Referenced by ServerPage().
void ServerPage::rateChanged | ( | ) | [private, slot] |
Called when the user edits the max or average bandwidth limits.
Definition at line 418 of file serverpage.cpp.
References MAX_RATE, MIN_RATE, and ui.
Referenced by save(), and ServerPage().
void ServerPage::getServerPublicIP | ( | ) | [private] |
Attempts to find the server's public IP address
Definition at line 340 of file serverpage.cpp.
References net_get_public_ip(), VMessageBox::Ok, p(), ui, and VMessageBox::warning().
Referenced by getServerAddress().
int ServerPage::selectedIndex | ( | ) | [private] |
Returns the index of the selected item in lstExitPolicies
Definition at line 315 of file serverpage.cpp.
References ui.
Referenced by lowerPriority(), raisePriority(), and removePolicy().
void ServerPage::addPolicyItem | ( | Policy | policy, | |
bool | append = true | |||
) | [private] |
Adds a new exit policy to the exit policy list
Definition at line 258 of file serverpage.cpp.
References Policy::action(), Policy::address(), COL_ACTION, COL_ADDRESS, COL_PORT, i(), Policy::ports(), and ui.
Referenced by addPolicy(), and load().
void ServerPage::savePolicy | ( | QTreeWidgetItem * | item, | |
ExitPolicy & | exitPolicy | |||
) | [private] |
Saves the policy specified in item to the exitPolicy
Definition at line 209 of file serverpage.cpp.
References ExitPolicy::addPolicy(), COL_ACTION, COL_ADDRESS, and COL_PORT.
Referenced by save().
void ServerPage::setAutoUpdateTimer | ( | bool | enabled | ) | [private] |
Enables or disables the automatic update timer.
Definition at line 114 of file serverpage.cpp.
References _autoUpdateTimer, _settings, AUTO_UPDATE_ADDR_INTERVAL, and ServerSettings::isServerEnabled().
TorControl* ServerPage::_torControl [private] |
A TorControl object used to talk to Tor
Definition at line 88 of file serverpage.h.
Referenced by save(), ServerPage(), and updateServerIP().
ServerSettings* ServerPage::_settings [private] |
A ServerSettings object used to get and set information about how a local Tor server is configured.
Definition at line 91 of file serverpage.h.
Referenced by load(), save(), ServerPage(), setAutoUpdateTimer(), updateServerIP(), and ~ServerPage().
QTimer* ServerPage::_autoUpdateTimer [private] |
A timer that tells us when it's time to check if our server IP changed.
Definition at line 93 of file serverpage.h.
Referenced by ServerPage(), and setAutoUpdateTimer().
Ui::ServerPage ServerPage::ui [private] |
Qt Designer generated object
Definition at line 96 of file serverpage.h.
Referenced by addPolicy(), addPolicyItem(), getServerAddress(), getServerPublicIP(), load(), lowerPriority(), raisePriority(), rateChanged(), removePolicy(), save(), selectedIndex(), ServerPage(), and updateServerIP().