Vidalia  0.3.1
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 "VidaliaTab.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 
31 class BandwidthGraph : public VidaliaTab
32 {
33  Q_OBJECT
34 
35 public:
36  /** Default constructor */
37  BandwidthGraph(QStatusBar *st = 0, QWidget *parent = 0);
38 
39 protected:
40  /** Called when the user changes the UI translation. */
41  virtual void retranslateUi();
42 
43 private slots:
44  /** Adds new data to the graph */
45  void updateGraph(quint64 bytesRead, quint64 bytesWritten);
46  /** Called when settings button is toggled */
47  void showSettingsFrame(bool show);
48  /** Called when the settings button is toggled */
49  void setOpacity(int value);
50  /** Called when the user saves settings */
51  void saveChanges();
52  /** Called when the user cancels changes settings */
53  void cancelChanges();
54  /** Called when the reset button is pressed */
55  void reset();
56 
57 private:
58  /** Create and bind actions to events **/
59  void createActions();
60  /** Loads the saved Bandwidth Graph settings */
61  void loadSettings();
62 
63  /** A TorControl object used to talk to Tor. */
65  /** A VidaliaSettings object that handles getting/saving settings */
67 
68  QStatusBar *_statusBar;
69 
70  /** Qt Designer generated object */
71  Ui::BandwidthGraph ui;
72 };
73 
74 #endif
75 
TorControl
Definition: TorControl.h:49
BandwidthGraph::showSettingsFrame
void showSettingsFrame(bool show)
Definition: BandwidthGraph.cpp:214
BandwidthGraph::setOpacity
void setOpacity(int value)
Definition: BandwidthGraph.cpp:242
BandwidthGraph
Definition: BandwidthGraph.h:31
BandwidthGraph::loadSettings
void loadSettings()
Definition: BandwidthGraph.cpp:118
BandwidthGraph::updateGraph
void updateGraph(quint64 bytesRead, quint64 bytesWritten)
Definition: BandwidthGraph.cpp:110
VidaliaTab
Definition: VidaliaTab.h:23
TorControl.h
BandwidthGraph::ui
Ui::BandwidthGraph ui
Definition: BandwidthGraph.h:71
BandwidthGraph::saveChanges
void saveChanges()
Definition: BandwidthGraph.cpp:166
BandwidthGraph::reset
void reset()
Definition: BandwidthGraph.cpp:153
BandwidthGraph::createActions
void createActions()
Definition: BandwidthGraph.cpp:90
BandwidthGraph::_settings
VidaliaSettings * _settings
Definition: BandwidthGraph.h:66
BandwidthGraph::_torControl
TorControl * _torControl
Definition: BandwidthGraph.h:64
BandwidthGraph::BandwidthGraph
BandwidthGraph(QStatusBar *st=0, QWidget *parent=0)
Definition: BandwidthGraph.cpp:41
VidaliaSettings
Definition: VidaliaSettings.h:33
VidaliaTab.h
VidaliaSettings.h
BandwidthGraph::_statusBar
QStatusBar * _statusBar
Definition: BandwidthGraph.h:68
BandwidthGraph::retranslateUi
virtual void retranslateUi()
Definition: BandwidthGraph.cpp:82
BandwidthGraph::cancelChanges
void cancelChanges()
Definition: BandwidthGraph.cpp:203