added basic functions to collect bandwidth info in pqistreamer both ways; added a sorting method in BWGraphSource to create curves from extracted BW info. Still not yet functional

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8600 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-07-12 04:04:18 +00:00
parent 090148cea2
commit 9471a91795
23 changed files with 551 additions and 94 deletions

View file

@ -0,0 +1,55 @@
#include <QComboBox>
#include "BandwidthStatsWidget.h"
BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this) ;
QObject::connect(ui.friend_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateFriendSelection(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.service_CB,SIGNAL(currentIndexChanged(int)),this, SLOT(updateServiceSelection(int))) ;
}
void BandwidthStatsWidget::updateFriendSelection(int n)
{
if(n == 0)
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
else if(n == 1)
{
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
if(ui.service_CB->currentIndex() == 1)
ui.service_CB->setCurrentIndex(0) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_ALL) ;
}
else
{
int ci = ui.friend_CB->currentIndex() ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SINGLE,ui.friend_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ;
}
}
void BandwidthStatsWidget::updateServiceSelection(int n)
{
if(n == 0)
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
else if(n == 1)
{
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
if(ui.friend_CB->currentIndex() == 1)
ui.friend_CB->setCurrentIndex(0) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_ALL) ;
}
else
{
int ci = ui.service_CB->currentIndex() ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SINGLE,ui.service_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ;
}
}