Vidalia
0.2.15
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 #ifndef _SERVICEPAGE_H 00012 #define _SERVICEPAGE_H 00013 00014 #include "ui_ServicePage.h" 00015 #include "ConfigPage.h" 00016 #include "TorSettings.h" 00017 #include "ServiceSettings.h" 00018 #include "ExitPolicy.h" 00019 #include "HelpBrowser.h" 00020 00021 #include "TorControl.h" 00022 00023 00024 class ServicePage : public ConfigPage 00025 { 00026 Q_OBJECT 00027 00028 public: 00029 /** Default Constructor */ 00030 ServicePage(QWidget *parent = 0); 00031 /** Default Destructor */ 00032 ~ServicePage(); 00033 /** Saves the changes on this page */ 00034 bool save(QString &errmsg); 00035 /** Loads the settings for this page */ 00036 void load(); 00037 /** Initialize the service table */ 00038 void initServiceTable(QMap<int, Service>* _services); 00039 /** Called when the user changes the UI translation. */ 00040 virtual void retranslateUi(); 00041 00042 private slots: 00043 /** Called whenever the user clicks on the 'add' button. */ 00044 void addService(); 00045 /** Called whenever the user clicks on the 'remove' button. */ 00046 void removeService(); 00047 /** Called whenever the user clicks on the 'copy' button. */ 00048 void copyToClipboard(); 00049 /** Called whenever the user clicks on the 'browse' button. */ 00050 void browseDirectory(); 00051 /** Called whenever the user selects a different service. */ 00052 void serviceSelectionChanged(); 00053 /** Returns a list of services by parsing the configuration string given 00054 * by the Tor controller. */ 00055 QList<Service> extractSingleServices(QString conf); 00056 /** Returns a Service by parsing the configuration string from Tor and 00057 * storing its values into the Service object. */ 00058 Service generateService(QString serviceString); 00059 /** Starts all services in <b>services</b>, with Tor. */ 00060 void startServicesInTor(QList<Service> services); 00061 /** Returns true if <b>service</b> is published. */ 00062 bool isServicePublished(Service service, QList<Service> torServices); 00063 /** Returns true if all services have the required minimal configuration. */ 00064 bool checkBeforeSaving(QList<Service> services); 00065 /** Called when the user finished editing a cell and checks that only valid 00066 * values are set. */ 00067 void valueChanged(); 00068 00069 private: 00070 /** A QMap, mapping from the row number in the table to the service Entity */ 00071 QMap<int, Service>* _services; 00072 /** A QList, consisting of all running services before vidalia starts */ 00073 QMap<QString, Service>* _torServices; 00074 00075 /** Qt Designer generated object */ 00076 Ui::ServicePage ui; 00077 }; 00078 00079 #endif 00080