@@ -121,7 +121,7 @@ void BWGraphSource::update()
121121 if (!mTrafficHistory .empty ())
122122 {
123123 add_missing_elements (thc.out_rstcl ,mTrafficHistory .back ().out_rstcl );
124- // add_missing_elements(thc.in_rstcl ,mTrafficHistory.back().in_rstcl);
124+ add_missing_elements (thc.in_rstcl ,mTrafficHistory .back ().in_rstcl );
125125 }
126126
127127 std::cerr << " Traffic detail:" << std::endl;
@@ -510,39 +510,27 @@ void BWGraphSource::getValues(std::map<std::string,float>& values) const
510510 _total_recv += 1024 * totalRates.mRateIn * _update_period_msecs/1000 .0f ;
511511}
512512
513- QString BWGraphSource::unitName () const { return (_current_unit == UNIT_KILOBYTES)?tr (" KB/s" ):QString (); }
514-
515- // QString BWGraphSource::displayName(int i) const
516- // {
517- // int n=0;
518- // for(std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it = _points.begin();it!=_points.end() ;++it)
519- // if(n++ == i)
520- // {
521- // // find out what is displayed
522- //
523- // if(_service_graph_type == GRAPH_TYPE_SINGLE )
524- // if(_friend_graph_type != GRAPH_TYPE_ALL)
525- // return QString::fromStdString(it->first) ;// sub item
526- // else
527- // return QString::fromStdString(mVisibleFriends[RsPeerId(it->first)]) ;// peer id item
528- // else
529- //
530- //
531- // }
532- //
533- // return QString("[error]");
534- // }
513+ QString BWGraphSource::unitName () const
514+ {
515+ if (_current_timing == TIMING_CUMULATED)
516+ return tr (" KB" );
517+
518+ if (_current_unit == UNIT_KILOBYTES)
519+ return tr (" KB/s" );
520+
521+ return QString ();
522+ }
535523
536524QString BWGraphSource::displayValue (float v) const
537525{
538526 if (_current_unit == UNIT_KILOBYTES)
539527 {
540- if (v < 1000 )
541- return QString::number (v, ' f ' , 2 ) + " B/s " ;
542- else if (v < 1000 * 1024 )
543- return QString::number (v/ 1024.0 , ' f ' , 2 ) + " KB /s" ;
544- else
545- return QString::number (v/( 1024.0 * 1024 ), ' f ' , 2 ) + " MB/s " ;
528+ QString s = niceNumber (v);
529+
530+ if (_current_timing == TIMING_INSTANT )
531+ return s + " /s" ;
532+ else
533+ return s ;
546534 }
547535 else if (_current_unit == UNIT_COUNT)
548536 {
0 commit comments