Vidalia 0.2.12

AdvancedPage.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 AdvancedPage.h
00013 ** \brief Advanced Tor and Vidalia configuration options
00014 */
00015 
00016 #ifndef _ADVANCEDPAGE_H
00017 #define _ADVANCEDPAGE_H
00018 
00019 #include "ui_AdvancedPage.h"
00020 #include "ConfigPage.h"
00021 #include "TorSettings.h"
00022 
00023 #include <QFileDialog>
00024 
00025 
00026 class AdvancedPage : public ConfigPage 
00027 {
00028   Q_OBJECT
00029 
00030 public:
00031   /** Default Constructor */
00032   AdvancedPage(QWidget *parent = 0);
00033   /** Default Destructor */
00034   ~AdvancedPage();
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
00042    * and false is returned. */
00043   bool apply(QString &errmsg);
00044   /** Reverts the Tor 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 advanced Tor settings since
00048    * the 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 signals:
00054   /** Emitted when the user changes torrc file to restart Tor */
00055   void restartTor();
00056 
00057 private slots:
00058   /** Called when the user selects a different authentication method from the
00059    * combo box. */
00060   void authMethodChanged(int index);
00061   /** Called when the user clicks "Browse" to choose location of Tor config 
00062    * file */
00063   void browseTorConfig();
00064   /** Called when the user clicks "Browse" to choose the location of Tor's
00065    * data directory. */
00066   void browseTorDataDirectory();
00067   /** Called when the user clicks "Browse" to choose the location of Tor's
00068    * socket path. */
00069   void browseSocketPath();
00070   /** Called when the user changes from ControlPort to ControlSocket or
00071    * the other way aroud */
00072   void toggleControl(bool);
00073 
00074   /** Called when the user clicks "Edit current torrc" to edit Tor's config in
00075    * a more advanced way */
00076   void displayTorrcDialog();
00077 
00078 private:
00079   /** Returns the authentication method for the given <b>index</b>. */
00080   TorSettings::AuthenticationMethod indexToAuthMethod(int index);
00081   /** Returns the index in the authentication methods combo box for the given
00082    * authentication <b>method</b>. */
00083   int authMethodToIndex(TorSettings::AuthenticationMethod method);
00084  
00085 #if 0 
00086 #if defined(Q_WS_WIN)
00087   /** Installs or removes the Tor service as necessary */
00088   void setupService(bool useService);
00089 #endif
00090 #endif
00091 
00092   /** A TorSettings object used to save/load settings */
00093   TorSettings* _settings;
00094   /** Qt Designer generated object */
00095   Ui::AdvancedPage ui;
00096 };
00097 
00098 #endif
00099