#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 | |
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, _torServices, addService(), browseDirectory(), copyToClipboard(), removeService(), serviceSelectionChanged(), ui, and valueChanged().
ServicePage::~ServicePage | ( | ) |
Default Destructor
Destructor
Definition at line 60 of file servicepage.cpp.
References _services, and _torServices.
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 372 of file servicepage.cpp.
References _services, Service::setEnabled(), and ui.
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 440 of file servicepage.cpp.
References _services, VMessageBox::Ok, Service::setServiceDirectory(), ui, and VMessageBox::warning().
Referenced by ServicePage().
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 120 of file servicepage.cpp.
References Service::serviceDirectory(), and Service::virtualPort().
Referenced by save().
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 420 of file servicepage.cpp.
References _services, VMessageBox::Ok, ui, and VMessageBox::warning().
Referenced by 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 196 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 213 of file servicepage.cpp.
References _torServices, i(), and Service::setAdditionalServiceOptions().
Referenced by extractSingleServices().
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 308 of file servicepage.cpp.
References Service::enabled(), i(), Service::physicalAddressPort(), Service::serviceAddress(), Service::serviceDirectory(), Service::setServiceAddress(), ui, and Service::virtualPort().
Referenced by load().
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 293 of file servicepage.cpp.
References Service::serviceDirectory().
Referenced by load().
void ServicePage::load | ( | ) | [virtual] |
Loads the settings for this page
Loads previously saved settings
Implements ConfigPage.
Definition at line 156 of file servicepage.cpp.
References _services, _torServices, extractSingleServices(), ServiceSettings::getHiddenServiceDirectories(), ServiceSettings::getServices(), initServiceTable(), isServicePublished(), ServiceList::services(), Vidalia::torControl(), and ui.
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 397 of file servicepage.cpp.
References _services, i(), VMessageBox::Ok, serviceSelectionChanged(), ui, and VMessageBox::warning().
Referenced by ServicePage().
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 68 of file servicepage.cpp.
References _services, checkBeforeSaving(), Service::setAdditionalServiceOptions(), ServiceSettings::setServices(), ServiceList::setServices(), startServicesInTor(), Vidalia::torControl(), ui, and ServiceSettings::unpublishAllServices().
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 466 of file servicepage.cpp.
References _services, _torServices, b(), Service::enabled(), Service::setEnabled(), and ui.
Referenced by removeService(), and ServicePage().
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 134 of file servicepage.cpp.
References Service::additionalServiceOptions(), ServiceSettings::applyServices(), Service::physicalAddressPort(), Service::serviceDirectory(), string_escape(), Vidalia::torControl(), 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 519 of file servicepage.cpp.
References VMessageBox::Ok, ui, IPValidator::validate(), and VMessageBox::warning().
Referenced by ServicePage().
QMap<int, Service>* ServicePage::_services [private] |
A QMap, mapping from the row number in the table to the service Entity
Definition at line 67 of file servicepage.h.
Referenced by addService(), browseDirectory(), copyToClipboard(), load(), removeService(), save(), ServicePage(), serviceSelectionChanged(), and ~ServicePage().
QMap<QString, Service>* ServicePage::_torServices [private] |
A QList, consisting of all running services before vidalia starts
Definition at line 69 of file servicepage.h.
Referenced by generateService(), load(), ServicePage(), serviceSelectionChanged(), and ~ServicePage().
Ui::ServicePage ServicePage::ui [private] |
Qt Designer generated object
Definition at line 72 of file servicepage.h.
Referenced by addService(), browseDirectory(), copyToClipboard(), initServiceTable(), load(), removeService(), save(), ServicePage(), serviceSelectionChanged(), and valueChanged().