Vidalia  0.2.21
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 #include "HelpBrowser.h"
20 
21 #include "TorControl.h"
22 
23 
24 class ServicePage : public ConfigPage
25 {
26  Q_OBJECT
27 
28 public:
29  /** Default Constructor */
30  ServicePage(QWidget *parent = 0);
31  /** Default Destructor */
32  ~ServicePage();
33  /** Saves the changes on this page */
34  bool save(QString &errmsg);
35  /** Loads the settings for this page */
36  void load();
37  /** Initialize the service table */
38  void initServiceTable(QMap<int, Service>* _services);
39  /** Called when the user changes the UI translation. */
40  virtual void retranslateUi();
41 
42 private slots:
43  /** Called whenever the user clicks on the 'add' button. */
44  void addService();
45  /** Called whenever the user clicks on the 'remove' button. */
46  void removeService();
47  /** Called whenever the user clicks on the 'copy' button. */
48  void copyToClipboard();
49  /** Called whenever the user clicks on the 'browse' button. */
50  void browseDirectory();
51  /** Called whenever the user selects a different service. */
53  /** Returns a list of services by parsing the configuration string given
54  * by the Tor controller. */
55  QList<Service> extractSingleServices(QString conf);
56  /** Returns a Service by parsing the configuration string from Tor and
57  * storing its values into the Service object. */
58  Service generateService(QString serviceString);
59  /** Starts all services in <b>services</b>, with Tor. */
60  void startServicesInTor(QList<Service> services);
61  /** Returns true if <b>service</b> is published. */
62  bool isServicePublished(Service service, QList<Service> torServices);
63  /** Returns true if all services have the required minimal configuration. */
64  bool checkBeforeSaving(QList<Service> services);
65  /** Called when the user finished editing a cell and checks that only valid
66  * values are set. */
67  void valueChanged();
68 
69 private:
70  /** A QMap, mapping from the row number in the table to the service Entity */
71  QMap<int, Service>* _services;
72  /** A QList, consisting of all running services before vidalia starts */
73  QMap<QString, Service>* _torServices;
74 
75  /** Qt Designer generated object */
76  Ui::ServicePage ui;
77 };
78 
79 #endif
80