added checkbox to toggle logscale in statistics

This commit is contained in:
csoler 2016-01-16 11:30:15 -05:00
parent 63b88ecf68
commit 8296fa9f22
4 changed files with 24 additions and 14 deletions

View File

@ -25,7 +25,6 @@ public:
virtual void getValues(std::map<std::string,float>& values) const; virtual void getValues(std::map<std::string,float>& values) const;
virtual QString displayValue(float v) const; virtual QString displayValue(float v) const;
// virtual QString displayName(int i) const;
virtual QString legend(int i,float v) const; virtual QString legend(int i,float v) const;
virtual void update(); virtual void update();
QString unitName() const ; QString unitName() const ;

View File

@ -23,6 +23,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
ui.unit_CB->addItem(tr("KB/s")) ; ui.unit_CB->addItem(tr("KB/s")) ;
ui.unit_CB->addItem(tr("Count")) ; ui.unit_CB->addItem(tr("Count")) ;
ui.logScale_CB->setChecked(true) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ; ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ; ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
ui.bwgraph_BW->source()->setUnit(BWGraphSource::UNIT_KILOBYTES) ; ui.bwgraph_BW->source()->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
@ -33,6 +35,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUpDownSelection(int))) ; QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUpDownSelection(int))) ;
QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUnitSelection(int))) ; QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUnitSelection(int))) ;
QObject::connect(ui.service_CB,SIGNAL(currentIndexChanged(int)),this, SLOT(updateServiceSelection(int))) ; QObject::connect(ui.service_CB,SIGNAL(currentIndexChanged(int)),this, SLOT(updateServiceSelection(int))) ;
QObject::connect(ui.logScale_CB,SIGNAL(toggled(bool)),this, SLOT(toggleLogScale(bool))) ;
// setup one timer for auto-update // setup one timer for auto-update
@ -42,6 +45,13 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
mTimer->start(2000) ; mTimer->start(2000) ;
} }
void BandwidthStatsWidget::toggleLogScale(bool b)
{
if(b)
ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ;
else
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ;
}
void BandwidthStatsWidget::updateComboBoxes() void BandwidthStatsWidget::updateComboBoxes()
{ {
if(!isVisible()) if(!isVisible())

View File

@ -14,6 +14,7 @@ protected slots:
void updateComboBoxes() ; void updateComboBoxes() ;
void updateUpDownSelection(int n); void updateUpDownSelection(int n);
void updateUnitSelection(int n); void updateUnitSelection(int n);
void toggleLogScale(bool b);
private: private:
Ui::BwStatsWidget ui; Ui::BwStatsWidget ui;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>812</width> <width>1128</width>
<height>349</height> <height>385</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -18,14 +18,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="BWGraph" name="bwgraph_BW"> <widget class="BWGraph" name="bwgraph_BW" native="true"/>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="informationSelector_GB"> <widget class="QGroupBox" name="informationSelector_GB">
@ -110,6 +103,13 @@
<item> <item>
<widget class="QComboBox" name="unit_CB"/> <widget class="QComboBox" name="unit_CB"/>
</item> </item>
<item>
<widget class="QCheckBox" name="logScale_CB">
<property name="text">
<string>Log scale</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -131,8 +131,8 @@
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>BWGraph</class> <class>BWGraph</class>
<extends>QFrame</extends> <extends>QWidget</extends>
<header>gui/statistics/BWGraph.h</header> <header location="global">gui/statistics/BWGraph.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>