[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1528: Add a checkbox to disable plotting bandwidth as area graphs. (in trunk: doc src/gui/bwgraph)
Author: edmanm
Date: 2006-12-16 00:05:33 -0500 (Sat, 16 Dec 2006)
New Revision: 1528
Modified:
trunk/doc/TODO
trunk/src/gui/bwgraph/bwgraph.cpp
trunk/src/gui/bwgraph/bwgraph.ui
trunk/src/gui/bwgraph/graphframe.cpp
trunk/src/gui/bwgraph/graphframe.h
Log:
Add a checkbox to disable plotting bandwidth as area graphs. (I used Designer.
Consider yourself warned.)
Modified: trunk/doc/TODO
===================================================================
--- trunk/doc/TODO 2006-12-15 13:28:12 UTC (rev 1527)
+++ trunk/doc/TODO 2006-12-16 05:05:33 UTC (rev 1528)
@@ -13,8 +13,6 @@
* GeoIP requests should be compressed and then encrypted so the exit node
does not know what is being requested and cannot muck with the requests
or responses.
- * Add a checkbox for disabling the alpha-blended integrals on the bandwidth
- graph; the extra cpu usage makes some people sad.
Features planned for 0.1.x:
Modified: trunk/src/gui/bwgraph/bwgraph.cpp
===================================================================
--- trunk/src/gui/bwgraph/bwgraph.cpp 2006-12-15 13:28:12 UTC (rev 1527)
+++ trunk/src/gui/bwgraph/bwgraph.cpp 2006-12-16 05:05:33 UTC (rev 1528)
@@ -34,9 +34,11 @@
#define SETTING_FILTER "LineFilter"
#define SETTING_OPACITY "Opacity"
#define SETTING_ALWAYS_ON_TOP "AlwaysOnTop"
+#define SETTING_STYLE "GraphStyle"
#define DEFAULT_FILTER (BWGRAPH_LINE_SEND|BWGRAPH_LINE_RECV)
#define DEFAULT_ALWAYS_ON_TOP false
#define DEFAULT_OPACITY 100
+#define DEFAULT_STYLE GraphFrame::AreaGraph
#define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v))))
@@ -143,6 +145,11 @@
ui.chkReceiveRate->setChecked(filter & BWGRAPH_LINE_RECV);
ui.chkSendRate->setChecked(filter & BWGRAPH_LINE_SEND);
+ /* Set whether we are plotting bandwidth as area graphs or not */
+ uint graphStyle = getSetting(SETTING_STYLE, DEFAULT_STYLE).toUInt();
+ ui.chkAreaGraph->setChecked(graphStyle == GraphFrame::AreaGraph);
+ ui.frmGraph->setGraphStyle((GraphFrame::GraphStyle)graphStyle);
+
/* Set graph frame settings */
ui.frmGraph->setShowCounters(ui.chkReceiveRate->isChecked(),
ui.chkSendRate->isChecked());
@@ -167,8 +174,11 @@
/* Hide the settings frame and reset toggle button */
showSettingsFrame(false);
- /* Save the opacity */
+ /* Save the opacity and graph style */
saveSetting(SETTING_OPACITY, ui.sldrOpacity->value());
+ saveSetting(SETTING_STYLE, ui.chkAreaGraph->isChecked()
+ ? GraphFrame::AreaGraph
+ : GraphFrame::SolidLine);
/* Save the Always On Top setting */
saveSetting(SETTING_ALWAYS_ON_TOP, ui.chkAlwaysOnTop->isChecked());
@@ -189,7 +199,10 @@
/* Update the graph frame settings */
ui.frmGraph->setShowCounters(ui.chkReceiveRate->isChecked(),
ui.chkSendRate->isChecked());
-
+ ui.frmGraph->setGraphStyle(ui.chkAreaGraph->isChecked() ?
+ GraphFrame::AreaGraph
+ : GraphFrame::SolidLine);
+
/* A change in window flags causes the window to disappear, so make sure
* it's still visible. */
showNormal();
Modified: trunk/src/gui/bwgraph/bwgraph.ui
===================================================================
--- trunk/src/gui/bwgraph/bwgraph.ui 2006-12-15 13:28:12 UTC (rev 1527)
+++ trunk/src/gui/bwgraph/bwgraph.ui 2006-12-16 05:05:33 UTC (rev 1528)
@@ -1,7 +1,4 @@
<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
<class>BandwidthGraph</class>
<widget class="QMainWindow" name="BandwidthGraph" >
<property name="geometry" >
@@ -15,265 +12,469 @@
<property name="palette" >
<palette>
<active>
- <color>
- <red>16</red>
- <green>16</green>
- <blue>16</blue>
- </color>
- <color>
- <red>208</red>
- <green>208</green>
- <blue>208</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>160</red>
- <green>160</green>
- <blue>160</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>240</red>
- <green>240</green>
- <blue>240</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>16</red>
+ <green>16</green>
+ <blue>16</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>208</red>
+ <green>208</green>
+ <blue>208</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>160</red>
+ <green>160</green>
+ <blue>160</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
</active>
<inactive>
- <color>
- <red>16</red>
- <green>16</green>
- <blue>16</blue>
- </color>
- <color>
- <red>208</red>
- <green>208</green>
- <blue>208</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>160</red>
- <green>160</green>
- <blue>160</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>240</red>
- <green>240</green>
- <blue>240</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>16</red>
+ <green>16</green>
+ <blue>16</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>208</red>
+ <green>208</green>
+ <blue>208</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>160</red>
+ <green>160</green>
+ <blue>160</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
</inactive>
<disabled>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>208</red>
- <green>208</green>
- <blue>208</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>160</red>
- <green>160</green>
- <blue>160</blue>
- </color>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>104</red>
- <green>104</green>
- <blue>104</blue>
- </color>
- <color>
- <red>240</red>
- <green>240</green>
- <blue>240</blue>
- </color>
- <color>
- <red>240</red>
- <green>240</green>
- <blue>240</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>247</red>
- <green>247</green>
- <blue>247</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>208</red>
+ <green>208</green>
+ <blue>208</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>160</red>
+ <green>160</green>
+ <blue>160</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>104</red>
+ <green>104</green>
+ <blue>104</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>247</red>
+ <green>247</green>
+ <blue>247</blue>
+ </color>
+ </brush>
+ </colorrole>
</disabled>
</palette>
</property>
@@ -458,20 +659,17 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="chkAlwaysOnTop" >
+ <widget class="QCheckBox" name="chkAreaGraph" >
<property name="font" >
<font>
<pointsize>10</pointsize>
</font>
</property>
- <property name="contextMenuPolicy" >
- <enum>Qt::NoContextMenu</enum>
- </property>
<property name="layoutDirection" >
<enum>Qt::RightToLeft</enum>
</property>
<property name="text" >
- <string>Always On Top</string>
+ <string>Area Graph</string>
</property>
</widget>
</item>
@@ -595,6 +793,26 @@
</widget>
</item>
<item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="chkAlwaysOnTop" >
+ <property name="layoutDirection" >
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text" >
+ <string>Always on Top</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@@ -652,25 +870,13 @@
</item>
</layout>
</widget>
- <widget class="QStatusBar" name="statusbar" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>114</y>
- <width>283</width>
- <height>24</height>
- </rect>
- </property>
- </widget>
+ <widget class="QStatusBar" name="statusbar" />
</widget>
- <pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>GraphFrame</class>
<extends>QFrame</extends>
<header>gui/bwgraph/graphframe.h</header>
- <container>0</container>
- <pixmap></pixmap>
</customwidget>
</customwidgets>
<resources>
Modified: trunk/src/gui/bwgraph/graphframe.cpp
===================================================================
--- trunk/src/gui/bwgraph/graphframe.cpp 2006-12-15 13:28:12 UTC (rev 1527)
+++ trunk/src/gui/bwgraph/graphframe.cpp 2006-12-16 05:05:33 UTC (rev 1528)
@@ -38,6 +38,7 @@
_recvData = new QList<qreal>();
_sendData = new QList<qreal>();
_painter = new QPainter();
+ _graphStyle = SolidLine;
/* Initialize graph values */
_recvData->prepend(0);
@@ -46,7 +47,6 @@
_showRecv = true;
_showSend = true;
_maxValue = MIN_SCALE;
-
}
/** Default destructor */
@@ -155,27 +155,25 @@
GraphFrame::paintData()
{
QVector<QPointF> recvPoints, sendPoints;
+
+ /* Convert the bandwidth data points to graph points */
+ recvPoints = pointsFromData(_recvData);
+ sendPoints = pointsFromData(_sendData);
- /* Draw the integrals using an alpha-blending, giving the background
- * integral a little more weight than the foreground. This could probably be
- * tweaked more to make overlapping more apparent, including tweaking the
- * colors`. */
- if (_showRecv) {
- recvPoints = pointsFromData(_recvData);
- paintIntegral(recvPoints, RECV_COLOR, 0.6);
+ if (_graphStyle == AreaGraph) {
+ /* Plot the bandwidth data as area graphs */
+ if (_showRecv)
+ paintIntegral(recvPoints, RECV_COLOR, 0.6);
+ if (_showSend)
+ paintIntegral(sendPoints, SEND_COLOR, 0.4);
}
- if (_showSend) {
- sendPoints = pointsFromData(_sendData);
- paintIntegral(sendPoints, SEND_COLOR, 0.4);
- }
- /* Outline the integrals in their appropriate colors. */
- if (_showRecv) {
+ /* Plot the bandwidth as solid lines. If the graph style is currently an
+ * area graph, we end up outlining the integrals. */
+ if (_showRecv)
paintLine(recvPoints, RECV_COLOR);
- }
- if (_showSend) {
+ if (_showSend)
paintLine(sendPoints, SEND_COLOR);
- }
}
/** Returns a list of points on the bandwidth graph based on the supplied set
Modified: trunk/src/gui/bwgraph/graphframe.h
===================================================================
--- trunk/src/gui/bwgraph/graphframe.h 2006-12-15 13:28:12 UTC (rev 1527)
+++ trunk/src/gui/bwgraph/graphframe.h 2006-12-16 05:05:33 UTC (rev 1528)
@@ -48,21 +48,31 @@
#define FONT_SIZE 11
+
class GraphFrame : public QFrame
{
Q_OBJECT
public:
+ /** Bandwidth graph style. */
+ enum GraphStyle {
+ SolidLine = 0, /**< Plot bandwidth as solid lines. */
+ AreaGraph /**< Plot bandwidth as alpha blended area graphs. */
+ };
+
/** Default Constructor */
GraphFrame(QWidget *parent = 0);
/** Default Destructor */
~GraphFrame();
+
/** Add data points. */
void addPoints(qreal recv, qreal send);
/** Clears the graph. */
void resetGraph();
/** Toggles display of data counters. */
void setShowCounters(bool showRecv, bool showSend);
+ /** Sets the graph style used to display bandwidth data. */
+ void setGraphStyle(GraphStyle style) { _graphStyle = style; }
protected:
/** Overloaded QWidget::paintEvent() */
@@ -90,6 +100,8 @@
/** Paints an integral using the supplied data. */
void paintIntegral(QVector<QPointF> points, QColor color, qreal alpha = 1.0);
+ /** Style with which the bandwidth data will be graphed. */
+ GraphStyle _graphStyle;
/** A QPainter object that handles drawing the various graph elements. */
QPainter* _painter;
/** Holds the received data points. */