Vidalia 0.3.1
ServicePage.h
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If you
4** did not receive the LICENSE file with this file, you may obtain it from the
5** Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11#ifndef _SERVICEPAGE_H
12#define _SERVICEPAGE_H
13
14#include "ui_ServicePage.h"
15#include "ConfigPage.h"
16#include "TorSettings.h"
17#include "ServiceSettings.h"
18#include "ExitPolicy.h"
19
20#include "TorControl.h"
21
22
23class ServicePage : public ConfigPage
24{
25 Q_OBJECT
26
27public:
28 /** Default Constructor */
29 ServicePage(QWidget *parent = 0);
30 /** Default Destructor */
32 /** Saves the changes on this page */
33 bool save(QString &errmsg);
34 /** Loads the settings for this page */
35 void load();
36 /** Initialize the service table */
37 void initServiceTable(QMap<int, Service>* _services);
38 /** Called when the user changes the UI translation. */
39 virtual void retranslateUi();
40
41private slots:
42 /** Called whenever the user clicks on the 'add' button. */
43 void addService();
44 /** Called whenever the user clicks on the 'remove' button. */
45 void removeService();
46 /** Called whenever the user clicks on the 'copy' button. */
47 void copyToClipboard();
48 /** Called whenever the user clicks on the 'browse' button. */
49 void browseDirectory();
50 /** Called whenever the user selects a different service. */
52 /** Returns a list of services by parsing the configuration string given
53 * by the Tor controller. */
54 QList<Service> extractSingleServices(QString conf);
55 /** Returns a Service by parsing the configuration string from Tor and
56 * storing its values into the Service object. */
57 Service generateService(QString serviceString);
58 /** Starts all services in <b>services</b>, with Tor. */
59 void startServicesInTor(QList<Service> services);
60 /** Returns true if <b>service</b> is published. */
61 bool isServicePublished(Service service, QList<Service> torServices);
62 /** Returns true if all services have the required minimal configuration. */
63 bool checkBeforeSaving(QList<Service> services);
64 /** Called when the user finished editing a cell and checks that only valid
65 * values are set. */
66 void valueChanged();
67
68private:
69 /** A QMap, mapping from the row number in the table to the service Entity */
70 QMap<int, Service>* _services;
71 /** A QList, consisting of all running services before vidalia starts */
72 QMap<QString, Service>* _torServices;
73
74 /** Qt Designer generated object */
75 Ui::ServicePage ui;
76};
77
78#endif
79
bool save(QString &errmsg)
Definition: ServicePage.cpp:79
virtual void retranslateUi()
Definition: ServicePage.cpp:72
void initServiceTable(QMap< int, Service > *_services)
bool isServicePublished(Service service, QList< Service > torServices)
QMap< int, Service > * _services
Definition: ServicePage.h:70
Service generateService(QString serviceString)
void copyToClipboard()
Ui::ServicePage ui
Definition: ServicePage.h:75
bool checkBeforeSaving(QList< Service > services)
void browseDirectory()
void valueChanged()
QMap< QString, Service > * _torServices
Definition: ServicePage.h:72
void startServicesInTor(QList< Service > services)
void removeService()
ServicePage(QWidget *parent=0)
Definition: ServicePage.cpp:30
QList< Service > extractSingleServices(QString conf)
void serviceSelectionChanged()
void addService()