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