bwgraph.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 bwgraph.h
00024  * \version $Id: bwgraph.h 1238 2006-09-25 17:50:57Z edmanm $
00025  * \brief Displays a graph of Tor's bandwidth usage
00026  */
00027 
00028 #ifndef _BWGRAPH_H
00029 #define _BWGRAPH_H
00030 
00031 #include <QDateTime>
00032 #include <QEvent>
00033 
00034 #include <config/vidaliasettings.h>
00035 #include <control/torcontrol.h>
00036 #include <gui/common/vidaliawindow.h>
00037 
00038 #include "ui_bwgraph.h"
00039 
00040 /** Redraw graph every 1000ms **/
00041 #define REFRESH_RATE    1000
00042 
00043 
00044 class BandwidthGraph : public VidaliaWindow
00045 {
00046   Q_OBJECT
00047 
00048 public:
00049   /** Default constructor */
00050   BandwidthGraph(QWidget *parent = 0, Qt::WFlags flags = 0);
00051 
00052 public slots:
00053   /** Overloaded QWidget.show */
00054   void show();
00055 
00056 protected:
00057   /** Called to deliver a bandwidth update event from Tor. */
00058   void customEvent(QEvent *event);
00059   
00060 private slots:
00061   /** Adds new data to the graph */
00062   void updateGraph(quint64 bytesRead, quint64 bytesWritten);
00063   /** Called when settings button is toggled */
00064   void showSettingsFrame(bool show);
00065   /** Called when the settings button is toggled */
00066   void setOpacity(int value);
00067   /** Called when the user saves settings */
00068   void saveChanges();
00069   /** Called when the user cancels changes settings */
00070   void cancelChanges();
00071   /** Called when the reset button is pressed */
00072   void reset();
00073   
00074 private:
00075   /** Create and bind actions to events **/
00076   void createActions();
00077   /** Loads the saved Bandwidth Graph settings */
00078   void loadSettings();
00079 
00080   /** A TorControl object used to talk to Tor. */
00081   TorControl* _torControl;
00082   /** A VidaliaSettings object that handles getting/saving settings */
00083   VidaliaSettings* _settings;
00084   
00085   /** Qt Designer generated object */
00086   Ui::BandwidthGraph ui;
00087 };
00088 
00089 #endif
00090 

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