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 
23 class ServicePage : public ConfigPage
24 {
25  Q_OBJECT
26 
27 public:
28  /** Default Constructor */
29  ServicePage(QWidget *parent = 0);
30  /** Default Destructor */
31  ~ServicePage();
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 
41 private 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 
68 private:
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 
ServicePage::ServicePage
ServicePage(QWidget *parent=0)
Definition: ServicePage.cpp:30
ServicePage::isServicePublished
bool isServicePublished(Service service, QList< Service > torServices)
Definition: ServicePage.cpp:304
ServicePage::initServiceTable
void initServiceTable(QMap< int, Service > *_services)
Definition: ServicePage.cpp:319
ServiceSettings.h
Service
Definition: Service.h:19
ServicePage::checkBeforeSaving
bool checkBeforeSaving(QList< Service > services)
Definition: ServicePage.cpp:131
TorControl.h
ServicePage::retranslateUi
virtual void retranslateUi()
Definition: ServicePage.cpp:72
ServicePage::extractSingleServices
QList< Service > extractSingleServices(QString conf)
Definition: ServicePage.cpp:207
ServicePage::browseDirectory
void browseDirectory()
Definition: ServicePage.cpp:451
ServicePage::ui
Ui::ServicePage ui
Definition: ServicePage.h:75
ConfigPage
Definition: ConfigPage.h:22
ServicePage::load
void load()
Definition: ServicePage.cpp:167
ServicePage::copyToClipboard
void copyToClipboard()
Definition: ServicePage.cpp:431
ServicePage::valueChanged
void valueChanged()
Definition: ServicePage.cpp:530
ServicePage::serviceSelectionChanged
void serviceSelectionChanged()
Definition: ServicePage.cpp:477
ServicePage::startServicesInTor
void startServicesInTor(QList< Service > services)
Definition: ServicePage.cpp:145
ServicePage::_services
QMap< int, Service > * _services
Definition: ServicePage.h:70
TorSettings.h
ServicePage::save
bool save(QString &errmsg)
Definition: ServicePage.cpp:79
ServicePage::removeService
void removeService()
Definition: ServicePage.cpp:408
ServicePage::~ServicePage
~ServicePage()
Definition: ServicePage.cpp:64
ServicePage::generateService
Service generateService(QString serviceString)
Definition: ServicePage.cpp:224
ConfigPage.h
ServicePage
Definition: ServicePage.h:23
ExitPolicy.h
ServicePage::_torServices
QMap< QString, Service > * _torServices
Definition: ServicePage.h:72
ServicePage::addService
void addService()
Definition: ServicePage.cpp:383