00001 /**************************************************************** 00002 * Vidalia is distributed under the following license: 00003 * 00004 * Copyright (C) 2006, Matt Edman, Justin Hipple 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ****************************************************************/ 00021 00022 /** 00023 * \file serverpage.h 00024 * \version $Id: serverpage.h 1238 2006-09-25 17:50:57Z edmanm $ 00025 * \brief Tor server configuration options 00026 */ 00027 00028 #ifndef _SERVERPAGE_H 00029 #define _SERVERPAGE_H 00030 00031 #include <QMessageBox> 00032 #include <QTimer> 00033 #include <control/torcontrol.h> 00034 #include <config/serversettings.h> 00035 #include <config/exitpolicy.h> 00036 #include <gui/help/browser/helpbrowser.h> 00037 00038 #include "configpage.h" 00039 #include "ui_serverpage.h" 00040 00041 class ServerPage : public ConfigPage 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 /** Default Constructor */ 00047 ServerPage(QWidget *parent = 0); 00048 /** Default Destructor */ 00049 ~ServerPage(); 00050 /** Saves the changes on this page */ 00051 bool save(QString &errmsg); 00052 /** Loads the settings for this page */ 00053 void load(); 00054 00055 private slots: 00056 /** Called when the user clicks "Get Address" to guess our local IP */ 00057 void getServerAddress(); 00058 /** Called when the user clicks the "Add Policy" button */ 00059 void addPolicy(); 00060 /** Called when the user clicks the "Remove Policy" button */ 00061 void removePolicy(); 00062 /** Called when the user clicks the "Raise Priority" button */ 00063 void raisePriority(); 00064 /** Called when the user clicks the "Lower Priority" button */ 00065 void lowerPriority(); 00066 /** Called when the user clicks the bandwidth help button */ 00067 void bandwidthHelp(); 00068 /** Called when the user clicks the exit policy help button */ 00069 void exitPolicyHelp(); 00070 /** Called when the user's public IP address needs to be updated. */ 00071 void updateServerIP(); 00072 /** Called when the user edits the max or average bandwidth limits. */ 00073 void rateChanged(); 00074 00075 private: 00076 /** Attempts to find the server's public IP address */ 00077 void getServerPublicIP(); 00078 /** Returns the index of the selected item in lstExitPolicies */ 00079 int selectedIndex(); 00080 /** Adds a new exit policy to the exit policy list */ 00081 void addPolicyItem(Policy policy, bool append = true); 00082 /** Saves the policy specified in item to the exitPolicy */ 00083 void savePolicy(QTreeWidgetItem *item, ExitPolicy &exitPolicy); 00084 /** Enables or disables the automatic update timer. */ 00085 void setAutoUpdateTimer(bool enabled); 00086 00087 /** A TorControl object used to talk to Tor */ 00088 TorControl* _torControl; 00089 /** A ServerSettings object used to get and set information about how a 00090 * local Tor server is configured. */ 00091 ServerSettings* _settings; 00092 /** A timer that tells us when it's time to check if our server IP changed.*/ 00093 QTimer* _autoUpdateTimer; 00094 00095 /** Qt Designer generated object */ 00096 Ui::ServerPage ui; 00097 }; 00098 00099 #endif 00100