GraphFrame Class Reference

#include <graphframe.h>

List of all members.

Public Member Functions

 GraphFrame (QWidget *parent=0)
 ~GraphFrame ()
void addPoints (qreal recv, qreal send)
void resetGraph ()
void setShowCounters (bool showRecv, bool showSend)

Protected Member Functions

void paintEvent (QPaintEvent *event)

Private Member Functions

int getNumPoints ()
void paintData ()
void paintTotals ()
void paintScale ()
QString totalToStr (qreal total)
void paintLine (QList< qreal > *list, QColor color, Qt::PenStyle lineStyle=Qt::SolidLine)
void paintIntegral (QList< qreal > *list, QColor color, qreal alpha=1.0)

Private Attributes

QPainter * _painter
QList< qreal > * _recvData
QList< qreal > * _sendData
QRect _rec
qreal _maxValue
int _maxPoints
qreal _totalSend
qreal _totalRecv
bool _showRecv
bool _showSend


Detailed Description

Definition at line 51 of file graphframe.h.


Constructor & Destructor Documentation

GraphFrame::GraphFrame ( QWidget *  parent = 0  ) 

Default Constructor

Definition at line 34 of file graphframe.cpp.

References _maxPoints, _maxValue, _painter, _recvData, _sendData, _showRecv, _showSend, getNumPoints(), and MIN_SCALE.

GraphFrame::~GraphFrame (  ) 

Default Destructor

Definition at line 53 of file graphframe.cpp.

References _painter, _recvData, and _sendData.


Member Function Documentation

void GraphFrame::addPoints ( qreal  recv,
qreal  send 
)

Add data points.

Definition at line 72 of file graphframe.cpp.

References _maxPoints, _maxValue, _recvData, _sendData, _totalRecv, and _totalSend.

void GraphFrame::resetGraph (  ) 

Clears the graph.

Definition at line 97 of file graphframe.cpp.

References _maxValue, _recvData, _sendData, _totalRecv, _totalSend, and MIN_SCALE.

void GraphFrame::setShowCounters ( bool  showRecv,
bool  showSend 
)

Toggles display of data counters.

Definition at line 111 of file graphframe.cpp.

References _showRecv, and _showSend.

void GraphFrame::paintEvent ( QPaintEvent *  event  )  [protected]

Overloaded QWidget::paintEvent()

Definition at line 121 of file graphframe.cpp.

References _painter, _rec, BACK_COLOR, paintData(), paintScale(), and paintTotals().

int GraphFrame::getNumPoints (  )  [private]

Gets the width of the desktop, the max # of points.

Definition at line 63 of file graphframe.cpp.

Referenced by GraphFrame().

void GraphFrame::paintData (  )  [private]

Paints an integral and an outline of that integral for each data set (send and/or receive) that is to be displayed.

Definition at line 155 of file graphframe.cpp.

References _recvData, _sendData, _showRecv, _showSend, paintIntegral(), paintLine(), RECV_COLOR, and SEND_COLOR.

Referenced by paintEvent().

void GraphFrame::paintTotals (  )  [private]

Paints the send/receive totals.

Definition at line 248 of file graphframe.cpp.

References _painter, _recvData, _sendData, _showRecv, _showSend, _totalRecv, _totalSend, FONT_SIZE, RECV_COLOR, SCALE_WIDTH, SEND_COLOR, and totalToStr().

Referenced by paintEvent().

void GraphFrame::paintScale (  )  [private]

Paints the scale in the graph.

Definition at line 296 of file graphframe.cpp.

References _maxValue, _painter, _rec, FONT_SIZE, GRID_COLOR, i(), SCALE_COLOR, and SCALE_WIDTH.

Referenced by paintEvent().

QString GraphFrame::totalToStr ( qreal  total  )  [private]

Returns a formatted string representation of total.

Definition at line 279 of file graphframe.cpp.

Referenced by paintTotals().

void GraphFrame::paintLine ( QList< qreal > *  list,
QColor  color,
Qt::PenStyle  lineStyle = Qt::SolidLine 
) [private]

Paints a line with the data in list.

Definition at line 214 of file graphframe.cpp.

References _maxValue, _painter, _rec, i(), SCALE_WIDTH, and SCROLL_STEP.

Referenced by paintData().

void GraphFrame::paintIntegral ( QList< qreal > *  list,
QColor  color,
qreal  alpha = 1.0 
) [private]

Paints an integral using the supplied data.

Definition at line 182 of file graphframe.cpp.

References _maxValue, _painter, _rec, i(), SCALE_WIDTH, and SCROLL_STEP.

Referenced by paintData().


Member Data Documentation

QPainter* GraphFrame::_painter [private]

A QPainter object that handles drawing the various graph elements.

Definition at line 91 of file graphframe.h.

Referenced by GraphFrame(), paintEvent(), paintIntegral(), paintLine(), paintScale(), paintTotals(), and ~GraphFrame().

QList<qreal>* GraphFrame::_recvData [private]

Holds the received data points.

Definition at line 93 of file graphframe.h.

Referenced by addPoints(), GraphFrame(), paintData(), paintTotals(), resetGraph(), and ~GraphFrame().

QList<qreal>* GraphFrame::_sendData [private]

Holds the sent data points.

Definition at line 95 of file graphframe.h.

Referenced by addPoints(), GraphFrame(), paintData(), paintTotals(), resetGraph(), and ~GraphFrame().

QRect GraphFrame::_rec [private]

The current dimensions of the graph.

Definition at line 97 of file graphframe.h.

Referenced by paintEvent(), paintIntegral(), paintLine(), and paintScale().

qreal GraphFrame::_maxValue [private]

The maximum data value plotted.

Definition at line 99 of file graphframe.h.

Referenced by addPoints(), GraphFrame(), paintIntegral(), paintLine(), paintScale(), and resetGraph().

int GraphFrame::_maxPoints [private]

The maximum number of points to store.

Definition at line 101 of file graphframe.h.

Referenced by addPoints(), and GraphFrame().

qreal GraphFrame::_totalSend [private]

The total data sent/recv.

Definition at line 103 of file graphframe.h.

Referenced by addPoints(), paintTotals(), and resetGraph().

qreal GraphFrame::_totalRecv [private]

Definition at line 104 of file graphframe.h.

Referenced by addPoints(), paintTotals(), and resetGraph().

bool GraphFrame::_showRecv [private]

Show the respective lines and counters.

Definition at line 106 of file graphframe.h.

Referenced by GraphFrame(), paintData(), paintTotals(), and setShowCounters().

bool GraphFrame::_showSend [private]

Definition at line 107 of file graphframe.h.

Referenced by GraphFrame(), paintData(), paintTotals(), and setShowCounters().


The documentation for this class was generated from the following files:
Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0