router stats - mark active tunnels bold

This commit is contained in:
RetroPooh 2017-03-07 17:50:13 +03:00
parent a5182252af
commit d3f0f9dde3
2 changed files with 25 additions and 6 deletions

View File

@ -2047,7 +2047,7 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
tunnel.push_back(it->second.hash.toStdString()) ;
tunnel.push_back(printNumber(now-it->second.time_stamp) + " secs ago") ;
tunnel.push_back(printFloatNumber(it->second.speed_Bps,true)) ;
tunnel.push_back(printFloatNumber(it->second.speed_Bps,false)) ; //
}
search_reqs_info.clear();

View File

@ -134,11 +134,30 @@ void TurtleRouterDialog::updateTunnelRequests( const std::vector<std::vector<std
if(parent->text(0).left(14) == tr("Unknown hashes"))
unknown_hash_found = true ;
QString str = tr("Tunnel id") + ": " + QString::fromUtf8(tunnels_info[i][0].c_str()) + "\t [" + QString::fromUtf8(tunnels_info[i][2].c_str()) + "] --> [" + QString::fromUtf8(tunnels_info[i][1].c_str()) + "]\t\t " + tr("last transfer") + ": " + QString::fromStdString(tunnels_info[i][4]) + "\t " + tr("Speed") + ": " + QString::fromStdString(tunnels_info[i][5]) ;
float num = strtof(tunnels_info[i][5].c_str(), NULL); // printFloatNumber
char tmp[100] ;
std::string units[4] = { "B/s","KB/s","MB/s","GB/s" } ;
int k=0 ;
while(num >= 800.0f && k<4)
num /= 1024.0f,++k;
sprintf(tmp,"%3.2f %s",num,units[k].c_str()) ;
QString str = tr("Tunnel id") + ": " + QString::fromUtf8(tunnels_info[i][0].c_str()) + "\t [" + QString::fromUtf8(tunnels_info[i][2].c_str()) + "] --> [" + QString::fromUtf8(tunnels_info[i][1].c_str()) + "]\t\t " + tr("last transfer") + ": " + QString::fromStdString(tunnels_info[i][4]) + " " + "\t " + tr("Speed") + ": " + QString::fromStdString(tmp) ;
stl.clear() ;
stl.push_back(str) ;
parent->addChild(new QTreeWidgetItem(stl)) ;
QTreeWidgetItem *item = new QTreeWidgetItem(stl);
parent->addChild(item);
QFont font = item->font(0);
if(strtol(tunnels_info[i][4].c_str(), NULL, 0)>10) // stuck
{
font.setItalic(true);
item->setFont(0,font);
}
if(strtol(tunnels_info[i][5].c_str(), NULL, 0)>1000) // fast
{
font.setBold(true);
item->setFont(0,font);
}
}
for(uint i=0;i<search_reqs_info.size();++i)