Vidalia  0.2.21
Public Member Functions | Private Slots | Private Attributes | List of all members
ServicePage Class Reference

#include <ServicePage.h>

Inheritance diagram for ServicePage:
ConfigPage

Public Member Functions

 ServicePage (QWidget *parent=0)
 
 ~ServicePage ()
 
bool save (QString &errmsg)
 
void load ()
 
void initServiceTable (QMap< int, Service > *_services)
 
virtual void retranslateUi ()
 
- Public Member Functions inherited from ConfigPage
 ConfigPage (QWidget *parent=0, const QString title=QString())
 
QString title () const
 
virtual bool changedSinceLastApply ()
 
virtual bool apply (QString &errmsg)
 
virtual void revert ()
 

Private Slots

void addService ()
 
void removeService ()
 
void copyToClipboard ()
 
void browseDirectory ()
 
void serviceSelectionChanged ()
 
QList< ServiceextractSingleServices (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
 

Additional Inherited Members

- Signals inherited from ConfigPage
void helpRequested (const QString &topic)
 

Detailed Description

Definition at line 24 of file ServicePage.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

void ServicePage::addService ( )
privateslot

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 ( )
privateslot

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)
privateslot

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 ( )
privateslot

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)
privateslot

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)
privateslot

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 
)
privateslot

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
void ServicePage::removeService ( )
privateslot

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(), ServiceList::setServices(), ServiceSettings::setServices(), startServicesInTor(), Vidalia::torControl(), ui, and ServiceSettings::unpublishAllServices().

void ServicePage::serviceSelectionChanged ( )
privateslot

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)
privateslot

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 ( )
privateslot

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().

Member Data Documentation

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

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