serverpage.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 /*
00012 ** \file serverpage.h
00013 ** \version $Id: serverpage.h 2684 2008-06-10 04:50:15Z edmanm $
00014 ** \brief Tor server configuration options
00015 */
00016 
00017 #ifndef _SERVERPAGE_H
00018 #define _SERVERPAGE_H
00019 
00020 #include <QMessageBox>
00021 #include <QTimer>
00022 #include <torcontrol.h>
00023 #include <serversettings.h>
00024 #include <exitpolicy.h>
00025 #include <helpbrowser.h>
00026 
00027 #include "configpage.h"
00028 #include "ui_serverpage.h"
00029 
00030 
00031 class ServerPage : public ConfigPage
00032 {
00033   Q_OBJECT
00034 
00035 public:
00036   /** Default Constructor */
00037   ServerPage(QWidget *parent = 0);
00038   /** Default Destructor */
00039   ~ServerPage();
00040   /** Saves the changes on this page */
00041   bool save(QString &errmsg);
00042   /** Loads the settings for this page */
00043   void load();
00044   
00045   /** Applies the server configuration settings to Tor. Returns true if the
00046    * settings were applied successfully. Otherwise, <b>errmsg</b> is set and
00047    * false is returned. */
00048   bool apply(QString &errmsg);
00049   /** Reverts the server configuration settings to their values at the last
00050    * time they were successfully applied to Tor. */
00051   void revert();
00052   /** Returns true if the user has changed their server settings since the
00053    * last time they were applied to Tor. */
00054   bool changedSinceLastApply();
00055 
00056 private slots:
00057   /** Called when the user toggles any one of the server mode radio buttons
00058    * and hides or displays the server configuration tabs appropriately. */
00059   void serverModeChanged(bool enabled);
00060   /** Called when the user clicks the bandwidth help button */
00061   void bandwidthHelp();
00062   /** Called when the user clicks the exit policy help button */
00063   void exitPolicyHelp();
00064   /** Called when the user selects a new value from the rate combo box */
00065   void rateChanged(int rate);
00066   /** Called when the user edits the max or average bandwidth limits. */
00067   void customRateChanged();
00068   /** Called when Vidalia has authenticated to Tor. If the user's Tor is not
00069    * recent enough, this disables the bridge server option and displays a
00070    * warning if the user had previously configured Tor as a bridge. */
00071   void onAuthenticated();
00072   /** Called when Vidalia disconnects from Tor. This method reenables the
00073    * bridge server option. */
00074   void onDisconnected();
00075   /** Copies the user's bridge relay identity to the clipboard. */
00076   void copyBridgeIdentity();
00077   /** Tests automatic port forwarding with UPnP. */
00078   void testUpnp();
00079   /** Called when the user clicks the UPnP test dialog's help button. */
00080   void upnpHelp();
00081 
00082 private:
00083   /** Index values of rate values in the bandwidth limits dropdown box. */
00084   enum BwRateIndex {
00085     CableDsl256 = 0, /**< Cable/DSL 256 Kbps */
00086     CableDsl512,     /**< Cable/DSL 512 Kbps */
00087     CableDsl768,     /**< Cable/DSL 768 Kbps */
00088     T1CableDsl1500,  /**< T1/Cable/DSL 1.5 Mbps */
00089     GreaterThan1500, /**< > 1.5 Mbps */
00090     CustomBwLimits   /**< Custom bandwidth limits */
00091   };
00092   
00093   /** Returns the index of the selected item in lstExitPolicies */
00094   int selectedIndex();
00095   
00096   /** Saves the server's bandwidth average and burst limits. */
00097   void saveBandwidthLimits();
00098   /** Loads the server's bandwidth average and burst limits. */
00099   void loadBandwidthLimits();
00100   /** Saves the server's exit policies. */
00101   void saveExitPolicies();
00102   /** Loads the server's exit policies. */
00103   void loadExitPolicies();
00104   /** Loads the user's bridge relay identity into the appropriate widgets. If
00105    *  the user's bridge is not running, then "Not Running" will be
00106    *  displayed. Otherwise, either the bridge's "address:port", "fingerprint",
00107    *  or "address:port fingerprint" will be displayed, depending on whether
00108    *  our GETCONF and GETINFO commands are successful. */
00109   void loadBridgeIdentity();
00110 
00111   /** A ServerSettings object used to get and set information about how a
00112    * local Tor server is configured. */
00113   ServerSettings*  _settings;
00114 
00115   /** Qt Designer generated object */
00116   Ui::ServerPage ui;
00117 };
00118 
00119 #endif
00120 

Generated on Wed Dec 23 21:11:09 2009 for Vidalia by  doxygen 1.6.1