servicepage.h

Go to the documentation of this file.
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.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 #ifndef _SERVICEPAGE_H
00012 #define _SERVICEPAGE_H
00013 
00014 #include <torcontrol.h>
00015 #include <torsettings.h>
00016 #include <servicesettings.h>
00017 #include <exitpolicy.h>
00018 #include <helpbrowser.h>
00019 #include "configpage.h"
00020 #include "ui_servicepage.h"
00021 
00022 class ServicePage : public ConfigPage
00023 {
00024   Q_OBJECT
00025 
00026 public:
00027   /** Default Constructor */
00028   ServicePage(QWidget *parent = 0);
00029   /** Default Destructor */
00030   ~ServicePage();
00031   /** Saves the changes on this page */
00032   bool save(QString &errmsg);
00033   /** Loads the settings for this page */
00034   void load();
00035   /** Initialize the service table */
00036   void initServiceTable(QMap<int, Service>* _services);
00037 
00038 private slots:
00039   /** Called whenever the user clicks on the 'add' button. */
00040   void addService();
00041   /** Called whenever the user clicks on the 'remove' button. */
00042   void removeService();
00043   /** Called whenever the user clicks on the 'copy' button. */
00044   void copyToClipboard();
00045   /** Called whenever the user clicks on the 'browse' button. */
00046   void browseDirectory();
00047   /** Called whenever the user selects a different service. */
00048   void serviceSelectionChanged();
00049   /** Returns a list of services by parsing the configuration string given
00050    * by the Tor controller. */
00051   QList<Service> extractSingleServices(QString conf);
00052   /** Returns a Service by parsing the configuration string from Tor and
00053    * storing its values into the Service object. */
00054   Service generateService(QString serviceString);
00055   /** Starts all services in <b>services</b>, with Tor. */
00056   void startServicesInTor(QList<Service> services);
00057   /** Returns true if <b>service</b> is published. */
00058   bool isServicePublished(Service service, QList<Service> torServices);
00059   /** Returns true if all services have the required minimal configuration. */
00060   bool checkBeforeSaving(QList<Service> services);
00061   /** Called when the user finished editing a cell and checks that only valid
00062    * values are set. */
00063   void valueChanged();
00064 
00065 private:
00066   /** A QMap, mapping from the row number in the table to the service Entity */
00067   QMap<int, Service>* _services;
00068   /** A QList, consisting of all running services before vidalia starts */
00069   QMap<QString, Service>* _torServices;
00070 
00071   /** Qt Designer generated object */
00072   Ui::ServicePage ui;
00073 };
00074 
00075 #endif
00076 

Generated on 2 Sep 2009 for Vidalia by  doxygen 1.6.1