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

Generated on 2 Sep 2009 for Vidalia by  doxygen 1.6.1