mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-16 01:54:52 -04:00
turtle search is now working. Next task: update search gui
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
148c918ae1
commit
7b84b125df
26 changed files with 2329 additions and 118 deletions
|
@ -3,6 +3,9 @@
|
|||
#include "rsiface/rsnotify.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsphoto.h"
|
||||
#ifdef TURTLE_HOPPING
|
||||
#include <rsiface/rsturtle.h>
|
||||
#endif
|
||||
|
||||
#include "gui/NetworkDialog.h"
|
||||
#include "gui/PeersDialog.h"
|
||||
|
@ -36,6 +39,18 @@ void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef TURTLE_HOPPING
|
||||
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)
|
||||
{
|
||||
std::cerr << "in notify search result..." << std::endl ;
|
||||
|
||||
// QList<TurtleFileInfo> qfiles ;
|
||||
|
||||
for(std::list<TurtleFileInfo>::const_iterator it(files.begin());it!=files.end();++it)
|
||||
emit gotTurtleSearchResult(search_id,*it) ;
|
||||
// qfiles.push_back(*it) ;
|
||||
}
|
||||
#endif
|
||||
void NotifyQt::notifyHashingInfo(std::string fileinfo)
|
||||
{
|
||||
emit hashingInfoChanged(QString::fromStdString(fileinfo)) ;
|
||||
|
@ -56,12 +71,21 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
switch(list)
|
||||
{
|
||||
case NOTIFY_LIST_NEIGHBOURS:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received neighbrs changed" << std::endl ;
|
||||
#endif
|
||||
emit neighborsChanged();
|
||||
break;
|
||||
case NOTIFY_LIST_FRIENDS:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received friends changed" << std::endl ;
|
||||
#endif
|
||||
emit friendsChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit filesPostModChanged(false) ; /* Remote */
|
||||
emit filesPostModChanged(true) ; /* Local */
|
||||
break;
|
||||
|
@ -69,15 +93,24 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
//displaySearch();
|
||||
break;
|
||||
case NOTIFY_LIST_MESSAGELIST:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received msg changed" << std::endl ;
|
||||
#endif
|
||||
emit messagesChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
//displayChannels();
|
||||
break;
|
||||
case NOTIFY_LIST_TRANSFERLIST:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received transfer changed" << std::endl ;
|
||||
#endif
|
||||
emit transfersChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_CONFIG:
|
||||
#ifdef DEBUG
|
||||
std::cerr << "received config changed" << std::endl ;
|
||||
#endif
|
||||
emit configChanged() ;
|
||||
break ;
|
||||
default:
|
||||
|
@ -133,6 +166,8 @@ void NotifyQt::UpdateGUI()
|
|||
/* hack to force updates until we've fixed that part */
|
||||
static time_t lastTs = 0;
|
||||
|
||||
// std::cerr << "Got update signal t=" << lastTs << std::endl ;
|
||||
|
||||
if (time(NULL) > lastTs) // always update, every 1 sec.
|
||||
{
|
||||
emit transfersChanged();
|
||||
|
|
|
@ -14,8 +14,12 @@ class ChatDialog;
|
|||
class MessagesDialog;
|
||||
class ChannelsDialog;
|
||||
class MessengerWindow;
|
||||
#ifdef TURTLE_HOPPING
|
||||
#include "rsiface/rsturtle.h"
|
||||
class TurtleSearchDialog ;
|
||||
|
||||
|
||||
struct TurtleFileInfo ;
|
||||
#endif
|
||||
|
||||
//class NotifyQt: public NotifyBase, public QObject
|
||||
class NotifyQt: public QObject, public NotifyBase
|
||||
|
@ -46,6 +50,9 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
virtual void notifyChat();
|
||||
virtual void notifyHashingInfo(std::string fileinfo);
|
||||
#ifdef TURTLE_HOPPING
|
||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||
#endif
|
||||
|
||||
signals:
|
||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||
|
@ -59,6 +66,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
void neighborsChanged() const ;
|
||||
void messagesChanged() const ;
|
||||
void configChanged() const ;
|
||||
void gotTurtleSearchResult(qulonglong search_id,TurtleFileInfo file) const ;
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
|
|||
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) = 0;
|
||||
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags) = 0;
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results) = 0;
|
||||
|
||||
/***
|
||||
|
|
|
@ -35,6 +35,9 @@ class NotifyBase;
|
|||
class RsIface;
|
||||
class RsControl;
|
||||
class RsInit;
|
||||
#ifdef TURTLE_HOPPING
|
||||
struct TurtleFileInfo ;
|
||||
#endif
|
||||
|
||||
/* declare single RsIface for everyone to use! */
|
||||
|
||||
|
@ -200,6 +203,9 @@ class NotifyBase
|
|||
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
|
||||
virtual void notifyChat() { return; }
|
||||
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
||||
#ifdef TURTLE_HOPPING
|
||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
|
||||
#endif
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
|
|
@ -35,6 +35,16 @@ extern RsTurtle *rsTurtle ;
|
|||
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
// This is the structure used to send back results of the turtle search
|
||||
// to the notifyBase class.
|
||||
|
||||
struct TurtleFileInfo
|
||||
{
|
||||
std::string hash ;
|
||||
std::string name ;
|
||||
uint64_t size ;
|
||||
};
|
||||
|
||||
// Interface class for turtle hopping.
|
||||
//
|
||||
// This class mainly interacts with the turtle router, that is responsible
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue