sort by time, nicer look

This commit is contained in:
RetroPooh 2017-11-14 00:14:16 +03:00
parent 3416a6d5c9
commit 5d6225ab98

View File

@ -5,6 +5,7 @@
#include "TurtleRouterDialog.h"
#include <QPainter>
#include <QStylePainter>
#include <algorithm> // for sort
#include "gui/settings/rsharesettings.h"
@ -70,6 +71,10 @@ void TurtleRouterDialog::processSettings(bool bLoad)
}
bool sr_Compare( TurtleRequestDisplayInfo m1, TurtleRequestDisplayInfo m2)
{
return m1.age < m2.age;
}
void TurtleRouterDialog::updateDisplay()
{
@ -79,7 +84,9 @@ void TurtleRouterDialog::updateDisplay()
std::vector<TurtleRequestDisplayInfo > tunnel_reqs_info ;
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
std::sort(search_reqs_info.begin(),search_reqs_info.end(),sr_Compare) ;
updateTunnelRequests(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
}
@ -162,8 +169,8 @@ void TurtleRouterDialog::updateTunnelRequests( const std::vector<std::vector<std
for(uint i=0;i<search_reqs_info.size();++i)
{
QString str = tr("Request id: %1\t from [%2]\t %3 secs ago\t\t %4").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id)).arg(search_reqs_info[i].age).arg(QString::fromUtf8(search_reqs_info[i].keywords.c_str(),search_reqs_info[i].keywords.length()));
QString str = tr("Request id: %1\t %3 secs ago\t from %2\t %4").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id), -25).arg(search_reqs_info[i].age).arg(QString::fromUtf8(search_reqs_info[i].keywords.c_str(),search_reqs_info[i].keywords.length()));
stl.clear() ;
stl.push_back(str) ;