Merge pull request #1037 from RetroPooh/searchspy

Searchspy
This commit is contained in:
csoler 2017-11-14 20:53:24 +01:00 committed by GitHub
commit ba7cf4995b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 8 deletions

View file

@ -795,8 +795,7 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression)
TurtleRequestId req_id = rsTurtle->turtleSearch(e) ;
// This will act before turtle results come to the interface, thanks to the signals scheduling policy.
// The text "bool exp" should be replaced by an appropriate text describing the actual search.
initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ;
initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ;
rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);

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").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id)).arg(search_reqs_info[i].age);
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) ;