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