Vidalia  0.2.21
BandwidthGraph.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file BandwidthGraph.h
13 ** \brief Displays a graph of Tor's bandwidth usage
14 */
15 
16 #ifndef _BWGRAPH_H
17 #define _BWGRAPH_H
18 
19 #include "ui_BandwidthGraph.h"
20 #include "VidaliaWindow.h"
21 #include "VidaliaSettings.h"
22 #include "TorControl.h"
23 
24 #include <QDateTime>
25 #include <QEvent>
26 
27 /** Redraw graph every 1000ms **/
28 #define REFRESH_RATE 1000
29 
30 
32 {
33  Q_OBJECT
34 
35 public:
36  /** Default constructor */
37  BandwidthGraph(QWidget *parent = 0, Qt::WFlags flags = 0);
38 
39 public slots:
40  /** Overloaded QWidget.show */
41  void showWindow();
42 
43 protected:
44  /** Called when the user changes the UI translation. */
45  virtual void retranslateUi();
46 
47 private slots:
48  /** Adds new data to the graph */
49  void updateGraph(quint64 bytesRead, quint64 bytesWritten);
50  /** Called when settings button is toggled */
51  void showSettingsFrame(bool show);
52  /** Called when the settings button is toggled */
53  void setOpacity(int value);
54  /** Called when the user saves settings */
55  void saveChanges();
56  /** Called when the user cancels changes settings */
57  void cancelChanges();
58  /** Called when the reset button is pressed */
59  void reset();
60 
61 private:
62  /** Create and bind actions to events **/
63  void createActions();
64  /** Loads the saved Bandwidth Graph settings */
65  void loadSettings();
66 
67  /** A TorControl object used to talk to Tor. */
69  /** A VidaliaSettings object that handles getting/saving settings */
71 
72  /** Qt Designer generated object */
73  Ui::BandwidthGraph ui;
74 };
75 
76 #endif
77