#include <servicepage.h>
Public Member Functions | |
ServicePage (QWidget *parent=0) | |
~ServicePage () | |
bool | save (QString &errmsg) |
void | load () |
void | initServiceTable (QMap< int, Service > *_services) |
Private Slots | |
void | addService () |
void | removeService () |
void | copyToClipboard () |
void | browseDirectory () |
void | serviceSelectionChanged () |
QList< Service > | extractSingleServices (QString conf) |
Service | generateService (QString serviceString) |
void | startServicesInTor (QList< Service > services) |
bool | isServicePublished (Service service, QList< Service > torServices) |
bool | checkBeforeSaving (QList< Service > services) |
void | valueChanged () |
Private Attributes | |
TorControl * | _torControl |
TorSettings * | _torSettings |
ServiceSettings * | _serviceSettings |
QMap< int, Service > * | _services |
QMap< QString, Service > * | _torServices |
Ui::ServicePage | ui |
Definition at line 22 of file servicepage.h.
ServicePage::ServicePage | ( | QWidget * | parent = 0 |
) |
Default Constructor
Constructor
Definition at line 26 of file servicepage.cpp.
References _services, _serviceSettings, _torControl, _torServices, _torSettings, addService(), browseDirectory(), copyToClipboard(), removeService(), serviceSelectionChanged(), Vidalia::torControl(), ui, and valueChanged().
ServicePage::~ServicePage | ( | ) |
Default Destructor
Destructor
Definition at line 67 of file servicepage.cpp.
References _serviceSettings.
bool ServicePage::save | ( | QString & | errmsg | ) | [virtual] |
Saves the changes on this page
Saves changes made to settings on the Server settings page.
Implements ConfigPage.
Definition at line 74 of file servicepage.cpp.
References _services, _serviceSettings, checkBeforeSaving(), Service::setAdditionalServiceOptions(), ServiceSettings::setServices(), ServiceList::setServices(), startServicesInTor(), ui, and ServiceSettings::unpublishAllServices().
void ServicePage::load | ( | ) | [virtual] |
Loads the settings for this page
Loads previously saved settings
Implements ConfigPage.
Definition at line 159 of file servicepage.cpp.
References _services, _serviceSettings, _torServices, extractSingleServices(), ServiceSettings::getHiddenServiceDirectories(), ServiceSettings::getServices(), initServiceTable(), isServicePublished(), ServiceList::services(), and ui.
void ServicePage::initServiceTable | ( | QMap< int, Service > * | _services | ) |
Initialize the service table
this method creates/displays the values for each service shown in the service listing
Definition at line 309 of file servicepage.cpp.
References Service::enabled(), i(), Service::physicalAddressPort(), Service::serviceAddress(), Service::serviceDirectory(), Service::setServiceAddress(), ui, and Service::virtualPort().
Referenced by load().
void ServicePage::addService | ( | ) | [private, slot] |
Called whenever the user clicks on the 'add' button.
this method is called when the user clicks the "Add"-Button it generates a new empty table entrie(row)
Definition at line 373 of file servicepage.cpp.
References _services, Service::setEnabled(), and ui.
Referenced by ServicePage().
void ServicePage::removeService | ( | ) | [private, slot] |
Called whenever the user clicks on the 'remove' button.
this method is called when the user clicks the "Remove"-Button it removes a service/row of the service listing
Definition at line 398 of file servicepage.cpp.
References _services, i(), VMessageBox::Ok, serviceSelectionChanged(), ui, and VMessageBox::warning().
Referenced by ServicePage().
void ServicePage::copyToClipboard | ( | ) | [private, slot] |
Called whenever the user clicks on the 'copy' button.
this method is called when the user clicks on the "Copy"-Button, it copies the .onion-Address of the selected service into the clipboard
Definition at line 421 of file servicepage.cpp.
References _services, VMessageBox::Ok, ui, and VMessageBox::warning().
Referenced by ServicePage().
void ServicePage::browseDirectory | ( | ) | [private, slot] |
Called whenever the user clicks on the 'browse' button.
this method is called when the user clicks on the "Brows"-Button it opens a QFileDialog to choose a service directory
Definition at line 441 of file servicepage.cpp.
References _services, VMessageBox::Ok, Service::setServiceDirectory(), ui, and VMessageBox::warning().
Referenced by ServicePage().
void ServicePage::serviceSelectionChanged | ( | ) | [private, slot] |
Called whenever the user selects a different service.
this method is called when the selects an other tablewidgetitem
Definition at line 467 of file servicepage.cpp.
References _services, _torServices, b(), Service::enabled(), Service::setEnabled(), and ui.
Referenced by removeService(), and ServicePage().
QList< Service > ServicePage::extractSingleServices | ( | QString | conf | ) | [private, slot] |
Returns a list of services by parsing the configuration string given by the Tor controller.
this method returns a list of services by parsing the configuration string given by the tor controller
Definition at line 197 of file servicepage.cpp.
References generateService().
Referenced by load().
Service ServicePage::generateService | ( | QString | s | ) | [private, slot] |
Returns a Service by parsing the configuration string from Tor and storing its values into the Service object.
this return a Service by parseing the configuration string of Tor and storeing its values into the object
Definition at line 214 of file servicepage.cpp.
References _torServices, i(), and Service::setAdditionalServiceOptions().
Referenced by extractSingleServices().
void ServicePage::startServicesInTor | ( | QList< Service > | services | ) | [private, slot] |
Starts all services in services, with Tor.
this method generates the configuration string for a list of services
Definition at line 138 of file servicepage.cpp.
References _serviceSettings, Service::additionalServiceOptions(), ServiceSettings::applyServices(), Service::physicalAddressPort(), Service::serviceDirectory(), string_escape(), and Service::virtualPort().
Referenced by save().
bool ServicePage::isServicePublished | ( | Service | service, | |
QList< Service > | torServices | |||
) | [private, slot] |
Returns true if service is published.
this method checks either a service is published or not
Definition at line 294 of file servicepage.cpp.
References Service::serviceDirectory().
Referenced by load().
bool ServicePage::checkBeforeSaving | ( | QList< Service > | serviceList | ) | [private, slot] |
Returns true if all services have the required minimal configuration.
this method checks if either all services have minimal configuration or not
Definition at line 124 of file servicepage.cpp.
References Service::serviceDirectory(), and Service::virtualPort().
Referenced by save().
void ServicePage::valueChanged | ( | ) | [private, slot] |
Called when the user finished editing a cell and checks that only valid values are set.
this method is called when the user finished editing a cell and it provides that only valid values are set
Definition at line 520 of file servicepage.cpp.
References VMessageBox::Ok, ui, IPValidator::validate(), and VMessageBox::warning().
Referenced by ServicePage().
TorControl* ServicePage::_torControl [private] |
A TorControl object used to talk to Tor.
Definition at line 67 of file servicepage.h.
Referenced by ServicePage().
TorSettings* ServicePage::_torSettings [private] |
A TorSettings object used for saving/loading the Tor settings
Definition at line 69 of file servicepage.h.
Referenced by ServicePage().
ServiceSettings* ServicePage::_serviceSettings [private] |
A ServiceSettings object used to load/save the services.
Definition at line 71 of file servicepage.h.
Referenced by load(), save(), ServicePage(), startServicesInTor(), and ~ServicePage().
QMap<int, Service>* ServicePage::_services [private] |
A QMap, mapping from the row number in the table to the service Entity
Definition at line 73 of file servicepage.h.
Referenced by addService(), browseDirectory(), copyToClipboard(), load(), removeService(), save(), ServicePage(), and serviceSelectionChanged().
QMap<QString, Service>* ServicePage::_torServices [private] |
A QList, consisting of all running services before vidalia starts
Definition at line 75 of file servicepage.h.
Referenced by generateService(), load(), ServicePage(), and serviceSelectionChanged().
Ui::ServicePage ServicePage::ui [private] |
Qt Designer generated object
Definition at line 77 of file servicepage.h.
Referenced by addService(), browseDirectory(), copyToClipboard(), initServiceTable(), load(), removeService(), save(), ServicePage(), serviceSelectionChanged(), and valueChanged().