Vidalia 0.2.12
|
#include <ServicePage.h>
Public Member Functions | |
ServicePage (QWidget *parent=0) | |
~ServicePage () | |
bool | save (QString &errmsg) |
void | load () |
void | initServiceTable (QMap< int, Service > *_services) |
virtual void | retranslateUi () |
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 24 of file ServicePage.h.
ServicePage::ServicePage | ( | QWidget * | parent = 0 | ) |
Default Constructor
Constructor
Definition at line 30 of file ServicePage.cpp.
References _services, _torServices, addService(), browseDirectory(), copyToClipboard(), removeService(), serviceSelectionChanged(), ui, and valueChanged().
ServicePage::~ServicePage | ( | ) |
Default Destructor
Destructor
Definition at line 64 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 383 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 451 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 131 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 431 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 207 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 224 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 319 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 304 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 167 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 408 of file ServicePage.cpp.
References _services, i(), VMessageBox::Ok, serviceSelectionChanged(), ui, and VMessageBox::warning().
Referenced by ServicePage().
void ServicePage::retranslateUi | ( | ) | [virtual] |
Called when the user changes the UI translation.
Reimplemented from ConfigPage.
Definition at line 72 of file ServicePage.cpp.
References ui.
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 79 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 477 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 145 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 530 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 71 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 73 of file ServicePage.h.
Referenced by generateService(), load(), ServicePage(), serviceSelectionChanged(), and ~ServicePage().
Ui::ServicePage ServicePage::ui [private] |
Qt Designer generated object
Definition at line 76 of file ServicePage.h.
Referenced by addService(), browseDirectory(), copyToClipboard(), initServiceTable(), load(), removeService(), retranslateUi(), save(), ServicePage(), serviceSelectionChanged(), and valueChanged().