mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
removed memory leak due to missing delete for BWGraph
This commit is contained in:
parent
0bd005657d
commit
b14e4d50cf
@ -519,7 +519,8 @@ BWGraph::BWGraph(QWidget *parent) : RSGraphWidget(parent)
|
|||||||
setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ;
|
setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
BWGraphSource *BWGraph::source()
|
BWGraph::~BWGraph()
|
||||||
{
|
{
|
||||||
return _local_source ;
|
delete _local_source ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,11 @@ class BWGraph: public RSGraphWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BWGraph(QWidget *parent);
|
BWGraph(QWidget *parent);
|
||||||
|
~BWGraph();
|
||||||
|
|
||||||
BWGraphSource *source() ;
|
void setSelector(int selector_type, int graph_type, const std::string& selector_client_string = std::string()) { _local_source->setSelector(selector_type,graph_type,selector_client_string) ; }
|
||||||
|
void setDirection(int dir) { _local_source->setDirection(dir); }
|
||||||
|
void setUnit(int unit) { _local_source->setUnit(unit) ;}
|
||||||
|
|
||||||
const std::map<RsPeerId,std::string>& visibleFriends() const { return _local_source->visibleFriends(); }
|
const std::map<RsPeerId,std::string>& visibleFriends() const { return _local_source->visibleFriends(); }
|
||||||
const std::set<uint16_t>& visibleServices() const { return _local_source->visibleServices(); }
|
const std::set<uint16_t>& visibleServices() const { return _local_source->visibleServices(); }
|
||||||
|
@ -24,9 +24,9 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
|
|||||||
|
|
||||||
ui.logScale_CB->setChecked(true) ;
|
ui.logScale_CB->setChecked(true) ;
|
||||||
|
|
||||||
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
|
ui.bwgraph_BW->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->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
|
||||||
ui.bwgraph_BW->source()->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
||||||
|
|
||||||
// Setup connections
|
// Setup connections
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void BandwidthStatsWidget::updateComboBoxes()
|
|||||||
void BandwidthStatsWidget::updateFriendSelection(int n)
|
void BandwidthStatsWidget::updateFriendSelection(int n)
|
||||||
{
|
{
|
||||||
if(n == 0)
|
if(n == 0)
|
||||||
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
|
||||||
else if(n == 1)
|
else if(n == 1)
|
||||||
{
|
{
|
||||||
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
|
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
|
||||||
@ -147,19 +147,19 @@ void BandwidthStatsWidget::updateFriendSelection(int n)
|
|||||||
if(ui.service_CB->currentIndex() == 1)
|
if(ui.service_CB->currentIndex() == 1)
|
||||||
ui.service_CB->setCurrentIndex(0) ;
|
ui.service_CB->setCurrentIndex(0) ;
|
||||||
|
|
||||||
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_ALL) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_ALL) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int ci = ui.friend_CB->currentIndex() ;
|
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()) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SINGLE,ui.friend_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void BandwidthStatsWidget::updateServiceSelection(int n)
|
void BandwidthStatsWidget::updateServiceSelection(int n)
|
||||||
{
|
{
|
||||||
if(n == 0)
|
if(n == 0)
|
||||||
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
|
||||||
else if(n == 1)
|
else if(n == 1)
|
||||||
{
|
{
|
||||||
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
|
// 1 means all. So make sure the other combo is not set on ALL. If so, switch it to sum.
|
||||||
@ -167,27 +167,27 @@ void BandwidthStatsWidget::updateServiceSelection(int n)
|
|||||||
if(ui.friend_CB->currentIndex() == 1)
|
if(ui.friend_CB->currentIndex() == 1)
|
||||||
ui.friend_CB->setCurrentIndex(0) ;
|
ui.friend_CB->setCurrentIndex(0) ;
|
||||||
|
|
||||||
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_ALL) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_ALL) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int ci = ui.service_CB->currentIndex() ;
|
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()) ;
|
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SINGLE,ui.service_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BandwidthStatsWidget::updateUpDownSelection(int n)
|
void BandwidthStatsWidget::updateUpDownSelection(int n)
|
||||||
{
|
{
|
||||||
if(n==0)
|
if(n==0)
|
||||||
ui.bwgraph_BW->source()->setDirection(BWGraphSource::DIRECTION_UP) ;
|
ui.bwgraph_BW->setDirection(BWGraphSource::DIRECTION_UP) ;
|
||||||
else
|
else
|
||||||
ui.bwgraph_BW->source()->setDirection(BWGraphSource::DIRECTION_DOWN) ;
|
ui.bwgraph_BW->setDirection(BWGraphSource::DIRECTION_DOWN) ;
|
||||||
}
|
}
|
||||||
void BandwidthStatsWidget::updateUnitSelection(int n)
|
void BandwidthStatsWidget::updateUnitSelection(int n)
|
||||||
{
|
{
|
||||||
if(n==0)
|
if(n==0)
|
||||||
ui.bwgraph_BW->source()->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
||||||
else
|
else
|
||||||
ui.bwgraph_BW->source()->setUnit(BWGraphSource::UNIT_COUNT) ;
|
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user