mainwindow.h

Go to the documentation of this file.
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 mainwindow.h
00024  * \version $Id: mainwindow.h 1238 2006-09-25 17:50:57Z edmanm $
00025  * \brief Main (hidden) window. Creates tray menu and child windows
00026  */
00027 
00028 #ifndef _MAINWINDOW_H
00029 #define _MAINWINDOW_H
00030 
00031 #include <QMainWindow>
00032 
00033 #include <control/torcontrol.h>
00034 
00035 #include "tray/trayicon.h"
00036 #include "about/aboutdialog.h"
00037 #include "log/messagelog.h"
00038 #include "bwgraph/bwgraph.h"
00039 #include "config/configdialog.h"
00040 #include "help/browser/helpbrowser.h"
00041 #include "network/netviewer.h"
00042 
00043 
00044 class MainWindow : public QMainWindow
00045 {
00046   Q_OBJECT
00047 
00048 public:
00049   /** Default constructor */
00050   MainWindow();
00051   /** Destructor. */
00052   ~MainWindow();
00053 
00054 public slots:
00055   /** Called when the user exits Vidalia. */
00056   void close();
00057 
00058 private slots:
00059   /** Called when the user selects "Start" from the menu. */
00060   void start();
00061   /** Called when the Tor process fails to start. */
00062   void startFailed(QString errmsg);
00063   /** Called when the Tor process has successfully started. */
00064   void started();
00065   /** Called when the user selects "Stop" form the menu. */
00066   void stop();
00067   /** Called when the Tor process has exited, either expectedly or not. */
00068   void stopped(int errorCode, QProcess::ExitStatus exitStatus);
00069   /** Called when the control socket has connected to Tor. */
00070   void connected();
00071   /** Called when the control connection fails. */
00072   void connectFailed(QString errmsg);
00073   /** Called when the control socket has been disconnected. */
00074   void disconnected();
00075   /** Called when the user selects "About" from the menu. */
00076   void showAbout();
00077   /** Called when the user selects "Message Log" from the menu. */
00078   void showMessageLog();
00079   /** Called when the user selects "Bandwidth Graph" from the menu. */
00080   void showBandwidthGraph();
00081   /** Called when the user selects "Configuration" from the menu. */
00082   void showConfig();
00083   /** Called when the user selects "Help" from the menu. */
00084   void showHelp();
00085   /** Called when the user selects "View Network" from the menu */
00086   void showNetwork();
00087   /** Called when the user selects the "New Identity" action from the menu. */
00088   void newIdentity();
00089 
00090 private:
00091   /** Create the actions on the tray menu or menubar */
00092   void createActions();
00093   /** Create the tray popup menu and it's submenus */
00094   void createTrayMenu();
00095   /** Creates a default menubar on Mac */
00096   void createMenuBar();
00097   /** Starts a graceful server shutdown */
00098   bool initiateServerShutdown();
00099 
00100   /* Used to determine if the Tor process exiting was intentional or not */
00101   bool _isIntentionalExit;
00102   /** A MessageLog object which handles logging Tor messages */
00103   MessageLog* _messageLog;
00104   /** A BandwidthGraph object which handles monitoring Tor bandwidth usage */
00105   BandwidthGraph* _bandwidthGraph;
00106   /** A HelpBrowser object which handles displaying help files */
00107   HelpBrowser* _helpBrowser;
00108   /** A NetViewer object which displays the Tor network graphically */
00109   NetViewer* _netViewer;
00110   /** A TorControl object that handles communication with Tor */
00111   TorControl* _torControl;
00112   /** Instance of a tray icon that will appear in the system tray */
00113   TrayIcon* _trayIcon;
00114 
00115   /** Define the popup menus for the system tray icon */
00116   QMenu* _trayMenu;
00117   /** Defines the actions for the tray menu */
00118   QAction* _startAct;
00119   QAction* _stopAct;
00120   QAction* _configAct;
00121   QAction* _aboutAct;
00122   QAction* _exitAct;
00123   QAction* _bandwidthAct;
00124   QAction* _messageAct;
00125   QAction* _helpAct;
00126   QAction* _networkAct;
00127   QAction* _newIdentityAct;
00128 };
00129 
00130 #endif
00131 

Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0