added last relay (a.k.a which direct friend) of search results in sources column

This commit is contained in:
csoler 2018-08-28 23:57:16 +02:00
parent c9b30f5a72
commit 65304a301a
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
10 changed files with 14 additions and 13 deletions

View File

@ -50,7 +50,7 @@ FileSearchHandler::~FileSearchHandler()
mStateTokenServer->discardToken(mSearchesStateToken);
}
void FileSearchHandler::notifyTurtleSearchResult(uint32_t search_id, const std::list<TurtleFileInfo>& files)
void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id, const std::list<TurtleFileInfo>& files)
{
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
std::map<uint32_t, Search>::iterator mit = mSearches.find(search_id);

View File

@ -37,7 +37,7 @@ public:
virtual ~FileSearchHandler();
// from NotifyClient
virtual void notifyTurtleSearchResult(uint32_t search_id, const std::list<TurtleFileInfo>& files);
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& files);
private:
void handleWildcard(Request& req, Response& resp);
void handleCreateSearch(Request& req, Response& resp);

View File

@ -225,7 +225,7 @@ void p3Notify::notifyChatCleared (const ChatId& chat_id)
void p3Notify::notifyChatLobbyTimeShift (int time_shift) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyTimeShift(time_shift) ; }
void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; }
void p3Notify::notifyHashingInfo (uint32_t type , const std::string& fileinfo ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHashingInfo (type,fileinfo) ; }
void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list<TurtleFileInfo>& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,files) ; }
void p3Notify::notifyTurtleSearchResult (const RsPeerId& pid , uint32_t search_id , const std::list<TurtleFileInfo>& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(pid,search_id,files) ; }
#warning MISSING CODE HERE
//void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list<TurtleGxsInfo>& groups ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,groups) ; }
void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; }

View File

@ -101,7 +101,7 @@ class p3Notify: public RsNotify
void notifyChatLobbyTimeShift (int /* time_shift*/) ;
void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ;
void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ;
void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) ;
void notifyTurtleSearchResult (const RsPeerId &pid, uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) ;
#warning MISSING CODE HERE
// void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleGxsInfo >& /* groups */) ;
void notifyPeerHasNewAvatar (std::string /* peer_id */) ;

View File

@ -222,7 +222,7 @@ public:
virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {}
virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {}
virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {}
virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) {}
virtual void notifyTurtleSearchResult (const RsPeerId& /* pid */, uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) {}
#warning MISSING CODE HERE
// virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleGxsInfo >& /* groups */) {}
virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {}

View File

@ -977,9 +977,7 @@ void SearchDialog::processResultQueue()
while(!searchResultsQueue.empty() && nb_treated_elements++ < 250)
{
qulonglong search_id = searchResultsQueue.back().first ;
FileDetail file = searchResultsQueue.back().second ;
searchResultsQueue.pop_back() ;
FileDetail& file = searchResultsQueue.back().second ;
#ifdef DEBUG
std::cout << "Updating file detail:" << std::endl ;
@ -989,6 +987,8 @@ void SearchDialog::processResultQueue()
#endif
insertFile(search_id,file);
searchResultsQueue.pop_back() ;
}
ui.searchResultWidget->setSortingEnabled(true);
if(!searchResultsQueue.empty())
@ -1323,6 +1323,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
modifiedResult =QString::number(friendSource) + "/" + QString::number(anonymousSource);
float fltRes = friendSource + (float)anonymousSource/1000;
item->setText(SR_SOURCES_COL,modifiedResult);
item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) );
item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes);
item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
item->setText(SR_SEARCH_ID_COL, sid_hexa);

View File

@ -568,7 +568,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turtl
std::cerr << "(EE) missing code to handle GXS turtle search result." << std::endl;
}
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)
void NotifyQt::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list<TurtleFileInfo>& files)
{
{
QMutexLocker m(&_mutex) ;
@ -588,7 +588,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turtl
det.name = (*it).name ;
det.hash = (*it).hash ;
det.size = (*it).size ;
det.id.clear() ;
det.id = pid ;
emit gotTurtleSearchResult(search_id,det) ;
}

View File

@ -48,7 +48,7 @@ class NotifyQt: public QObject, public NotifyClient
virtual void notifyChatCleared(const ChatId &chat_id);
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
virtual void notifyOwnAvatarChanged() ;

View File

@ -219,7 +219,7 @@ void NotifyTxt::displayTransfers()
/******************* Turtle Search Interface **********/
void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files)
void NotifyTxt::notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files)
{
// std::cerr << "NotifyTxt::notifyTurtleSearchResult() " << found_files.size();
// std::cerr << " new results for Id: " << search_id;

View File

@ -44,7 +44,7 @@ class NotifyTxt: public NotifyClient
virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel);
virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash,bool first_time);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
virtual void notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
/* interface for handling SearchResults */
void getSearchIds(std::list<uint32_t> &searchIds);