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 ConfigDialog.h 00013 ** \version $Id: ConfigDialog.h 3735 2009-04-28 20:28:01Z edmanm $ 00014 ** \brief Contains a series of Vidalia and Tor configuration pages 00015 */ 00016 00017 #ifndef _CONFIGDIALOG_H 00018 #define _CONFIGDIALOG_H 00019 00020 #include "ui_ConfigDialog.h" 00021 #include "VidaliaWindow.h" 00022 00023 #include <QMainWindow> 00024 #include <QFileDialog> 00025 00026 00027 class ConfigDialog : public VidaliaWindow 00028 { 00029 Q_OBJECT 00030 00031 public: 00032 /** Config dialog pages. */ 00033 enum Page { 00034 General = 0, /** General configuration page. */ 00035 Network, /** Network configuration page. */ 00036 Server, /** Server configuration page. */ 00037 Appearance, /** Appearance configuration page. */ 00038 Advanced, /** Advanced configuration page. */ 00039 Service /** Service Configuration page */ 00040 }; 00041 00042 /** Default Constructor */ 00043 ConfigDialog(QWidget *parent = 0); 00044 00045 public slots: 00046 /** Shows the config dialog with focus set to the given page. */ 00047 void showWindow(Page page = General); 00048 00049 signals: 00050 /** Emitted when the user clicks "Check Now" to initiate a check 00051 * for software updates. */ 00052 void checkForUpdates(); 00053 00054 protected: 00055 /** Called when the user changes the UI translation. */ 00056 virtual void retranslateUi(); 00057 00058 private slots: 00059 /** Called when user clicks "Save Settings". Saves their settings to 00060 * Vidalia's configuration file. */ 00061 void saveChanges(); 00062 /** Called after Vidalia has authenticated to Tor and applies any changes 00063 * made since the last time they were applied. */ 00064 void applyChanges(); 00065 /** Sends Tor a SAVECONF to write its configuration to disk. If the 00066 * SAVECONF is successful, then all settings are considered to be 00067 * applied. */ 00068 void saveConf(); 00069 /** Called when a ConfigPage in the dialog requests help on a specific 00070 * <b>topic</b>. */ 00071 void help(const QString &topic); 00072 /** Shows general help information for whichever settings page the user is 00073 * currently viewing. */ 00074 void help(); 00075 /** Stub method that relays the checkForUpdates() signal from the General 00076 * settings page to the owner of the config dialog (MainWindow). */ 00077 void onCheckForUpdates(); 00078 00079 private: 00080 /** Loads the current configuration settings */ 00081 void loadSettings(); 00082 /** Creates a new action for a config page. */ 00083 QAction* createPageAction(const QIcon &img, const QString &text, 00084 const QString &data, QActionGroup *group); 00085 /** Adds a new action to the toolbar. */ 00086 void addAction(QAction *action, const char *slot = 0); 00087 00088 /** Qt Designer generated object */ 00089 Ui::ConfigDialog ui; 00090 }; 00091 00092 #endif 00093