Vidalia 0.2.12

NetworkPage.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 NetworkPage.h
00013 ** \brief Network and firewall configuration options
00014 */
00015 
00016 #ifndef _NETWORKPAGE_H
00017 #define _NETWORKPAGE_H
00018 
00019 #include "ui_NetworkPage.h"
00020 #include "ConfigPage.h"
00021 #include "Vidalia.h"
00022 #include "BridgeDownloader.h"
00023 
00024 #include <QPoint>
00025 
00026 
00027 class NetworkPage : public ConfigPage
00028 {
00029   Q_OBJECT
00030 
00031 public:
00032   /** Default Constructor */
00033   NetworkPage(QWidget *parent = 0);
00034   
00035   /** Saves the changes on this page */
00036   bool save(QString &errmsg);
00037   /** Loads the settings for this page */
00038   void load();
00039 
00040   /** Applies the network configuration settings to Tor. Returns true if the
00041    * settings were applied successfully. Otherwise, <b>errmsg</b> is set and
00042    * false is returned. */
00043   bool apply(QString &errmsg);
00044   /** Reverts the server configuration settings to their values at the last
00045    * time they were successfully applied to Tor. */
00046   void revert();
00047   /** Returns true if the user has changed their server settings since the
00048    * last time they were applied to Tor. */
00049   bool changedSinceLastApply();
00050   /** Called when the user changes the UI translation. */
00051   virtual void retranslateUi();
00052 
00053 private slots:
00054   /** Adds a bridge to the bridge list box. */
00055   void addBridge();
00056   /** Removes one or more selected bridges from the bridge list box. */
00057   void removeBridge();
00058   /** Copies all selected bridges to the clipboard. */
00059   void copySelectedBridgesToClipboard();
00060   /** Called when the user right-clicks on a bridge and displays a context
00061    * menu. */
00062   void bridgeContextMenuRequested(const QPoint &pos);
00063   /** Called when the user changes which bridges they have selected. */
00064   void bridgeSelectionChanged();
00065   /** Called when a link in a label is clicked. <b>url</b> is the target of
00066    * the clicked link.*/
00067   void onLinkActivated(const QString &url);
00068   /** Called when the user clicks the "Find Bridges Now" button. Calls
00069    * startBridgeRequest() to start a new request for additional bridge
00070    * addresses, and displays a progress dialog for the user. */
00071   void findBridges();
00072   /** Starts a new request for additional bridge addresses. */
00073   void startBridgeRequest();
00074   /** Called when a previous bridge request initiated by the findBridges()
00075    * method has completed. <b>bridges</b> contains a list of all bridges
00076    * received. */
00077   void bridgeRequestFinished(const QStringList &bridges);
00078 
00079   /** Disable proxy username and password fields when the user wants to use
00080    * a SOCKS 4 proxy. */
00081   void proxyTypeChanged(int selection);
00082 
00083 private:
00084   /** Verifies that <b>bridge</b> is a valid bridge identifier and places a 
00085    * normalized identifier in <b>out</b>. The normalized identifier will have
00086    * all spaces removed from the fingerprint portion (if any) and all
00087    * hexadecimal characters converted to uppercase. Returns true if
00088    * <b>bridge</b> is a valid bridge identifier, false otherwise. */
00089   bool validateBridge(const QString &bridge, QString *out);
00090 
00091   /** Helper class used to facilitate downloading one or more bridge
00092    * addresses. */
00093   BridgeDownloader* _bridgeDownloader;
00094 
00095   /** Qt Designer generated object */
00096   Ui::NetworkPage ui;
00097 };
00098 
00099 #endif
00100