mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 22:32:34 -04:00
* Switched to new rsFiles interface.
* Updated Transfers/SharedFiles/Messages.. etc Dialogs. * Disabled 'Recommendation Lists' for the moment. * updated Interface files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@631 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
be392405e8
commit
32973f0838
13 changed files with 215 additions and 213 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "RemoteDirModel.h"
|
||||
#include "rsiface.h"
|
||||
#include "rsfiles.h"
|
||||
|
||||
#include <QPalette>
|
||||
|
||||
|
||||
|
@ -35,7 +36,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
/* error */
|
||||
#ifdef RDM_DEBUG
|
||||
|
@ -82,7 +83,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "lookup failed -> 0";
|
||||
|
@ -135,7 +136,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -387,7 +388,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "lookup failed -> invalid";
|
||||
|
@ -451,7 +452,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "Failed Lookup -> invalid";
|
||||
|
@ -496,7 +497,7 @@
|
|||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
return (Qt::ItemIsSelectable); // Error.
|
||||
}
|
||||
|
@ -555,7 +556,7 @@ void RemoteDirModel::update (const QModelIndex &index )
|
|||
{
|
||||
//std::cerr << "Directory Request(" << id << ") : ";
|
||||
//std::cerr << path << std::endl;
|
||||
//rsicontrol -> RequestDirectories(id, path, 1);
|
||||
//rsFiles -> RequestDirectories(id, path, 1);
|
||||
}
|
||||
|
||||
void RemoteDirModel::downloadSelected(QModelIndexList list)
|
||||
|
@ -587,19 +588,25 @@ void RemoteDirModel::downloadSelected(QModelIndexList list)
|
|||
continue; /* don't try to download local stuff */
|
||||
}
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* only request if it is a file */
|
||||
if (details.type == DIR_TYPE_FILE)
|
||||
{
|
||||
rsicontrol -> FileRequest(details.name, details.hash,
|
||||
details.count, "");
|
||||
rsFiles -> FileRequest(details.name, details.hash,
|
||||
details.count, "", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* OLD RECOMMEND SYSTEM - DISABLED
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
void RemoteDirModel::recommendSelected(QModelIndexList list)
|
||||
{
|
||||
|
@ -626,7 +633,7 @@ void RemoteDirModel::recommendSelected(QModelIndexList list)
|
|||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -637,7 +644,7 @@ void RemoteDirModel::recommendSelected(QModelIndexList list)
|
|||
std::cerr << "Size: " << details.count << std::endl;
|
||||
std::cerr << "Path: " << details.path << std::endl;
|
||||
|
||||
rsicontrol -> FileRecommend(details.name, details.hash, details.count);
|
||||
rsFiles -> FileRecommend(details.name, details.hash, details.count);
|
||||
}
|
||||
std::cerr << "::::::::::::Done FileRecommend" << std::endl;
|
||||
}
|
||||
|
@ -650,7 +657,7 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
|
|||
{
|
||||
std::cerr << "Cannot recommend remote! (should download)" << std::endl;
|
||||
}
|
||||
rsicontrol->ClearInRecommend();
|
||||
rsFiles->ClearInRecommend();
|
||||
|
||||
/* Fire off requests */
|
||||
QModelIndexList::iterator it;
|
||||
|
@ -670,7 +677,7 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
|
|||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -681,15 +688,20 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
|
|||
std::cerr << "Size: " << details.count << std::endl;
|
||||
std::cerr << "Path: " << details.path << std::endl;
|
||||
|
||||
rsicontrol -> FileRecommend(details.name, details.hash, details.count);
|
||||
rsicontrol -> SetInRecommend(details.name, true);
|
||||
rsFiles -> FileRecommend(details.name, details.hash, details.count);
|
||||
rsFiles -> SetInRecommend(details.name, true);
|
||||
}
|
||||
std::cerr << "::::::::::::Done FileRecommend" << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* OLD RECOMMEND SYSTEM - DISABLED
|
||||
******/
|
||||
|
||||
void RemoteDirModel::openSelected(QModelIndexList list)
|
||||
{
|
||||
recommendSelected(list);
|
||||
//recommendSelected(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -711,7 +723,7 @@ void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &
|
|||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsicontrol->RequestDirDetails(ref, details, flags))
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
std::cerr << "getFilePaths() Bad Request" << std::endl;
|
||||
continue;
|
||||
|
|
|
@ -38,8 +38,12 @@ class RemoteDirModel : public QAbstractItemModel
|
|||
|
||||
/* Callback from GUI */
|
||||
void downloadSelected(QModelIndexList list);
|
||||
|
||||
#if 0 /****** REMOVED ******/
|
||||
void recommendSelected(QModelIndexList list);
|
||||
void recommendSelectedOnly(QModelIndexList list);
|
||||
#endif
|
||||
|
||||
void openSelected(QModelIndexList list);
|
||||
|
||||
void getFilePaths(QModelIndexList list, std::list<std::string> &fullpaths);
|
||||
|
|
|
@ -345,23 +345,6 @@ void NotifyQt::displayChannels()
|
|||
|
||||
void NotifyQt::displayTransfers()
|
||||
{
|
||||
iface->lockData(); /* Lock Interface */
|
||||
|
||||
std::list<FileTransferInfo>::const_iterator it;
|
||||
const std::list<FileTransferInfo> &tlist = iface->getTransferList();
|
||||
|
||||
for(it = tlist.begin(); it != tlist.end(); it++)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Transfer: ";
|
||||
out << it ->fname << " ";
|
||||
out << it ->path << " ";
|
||||
out << std::endl;
|
||||
std::cerr << out.str();
|
||||
}
|
||||
|
||||
iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
/* Do the GUI */
|
||||
if (tDialog)
|
||||
tDialog->insertTransfers();
|
||||
|
|
|
@ -33,12 +33,10 @@
|
|||
|
||||
#include "rsiface/rstypes.h"
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
|
||||
class RsFiles;
|
||||
extern RsFiles *rsFiles;
|
||||
|
||||
class Expression;
|
||||
|
||||
const uint32_t RS_FILE_CTRL_PAUSE = 0x0100;
|
||||
const uint32_t RS_FILE_CTRL_START = 0x0200;
|
||||
|
@ -70,9 +68,9 @@ virtual ~RsFiles() { return; }
|
|||
*/
|
||||
|
||||
/* get Details of File Transfers */
|
||||
virtual bool FileDownloads(std::list<std::string> &hashs)= 0;
|
||||
virtual bool FileUploads(std::list<std::string> &hashs)= 0;
|
||||
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)= 0;
|
||||
virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
|
||||
virtual bool FileUploads(std::list<std::string> &hashs) = 0;
|
||||
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) = 0;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -81,11 +79,11 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)=
|
|||
*/
|
||||
|
||||
|
||||
virtual int FileRequest(std::string fname, std::string hash,
|
||||
uint32_t size, std::string dest, uint32_t flags)= 0;
|
||||
virtual int FileCancel(std::string hash)= 0;
|
||||
virtual int FileControl(std::string hash, uint32_t flags)= 0;
|
||||
virtual int FileClearCompleted()= 0;
|
||||
virtual bool FileRequest(std::string fname, std::string hash,
|
||||
uint32_t size, std::string dest, uint32_t flags) = 0;
|
||||
virtual bool FileCancel(std::string hash) = 0;
|
||||
virtual bool FileControl(std::string hash, uint32_t flags) = 0;
|
||||
virtual bool FileClearCompleted() = 0;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -101,12 +99,12 @@ virtual int FileClearCompleted()= 0;
|
|||
*/
|
||||
|
||||
/* Access ftExtraList - Details */
|
||||
virtual int ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
|
||||
uint32_t period, uint32_t flags)= 0;
|
||||
virtual int ExtraFileRemove(std::string hash, uin32_t flags)= 0;
|
||||
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
|
||||
uint32_t period, uint32_t flags) = 0;
|
||||
virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
|
||||
virtual bool ExtraFileHash(std::string localpath,
|
||||
uint32_t period, uint32_t flags)= 0;
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info)= 0;
|
||||
uint32_t period, uint32_t flags) = 0;
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -114,20 +112,29 @@ virtual bool ExtraFileStatus(std::string localpath, FileInfo &info)= 0;
|
|||
*/
|
||||
|
||||
/* Directory Listing / Search Interface */
|
||||
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 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 SearchBoolExp(Expression * exp, std::list<FileDetail> &results)= 0;
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results) = 0;
|
||||
|
||||
/*
|
||||
* 5) Utility Functions.
|
||||
* 5) Directory Control / Shared Files Utility Functions.
|
||||
*/
|
||||
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
|
||||
virtual void setDownloadDirectory(std::string path) = 0;
|
||||
virtual void setPartialsDirectory(std::string path) = 0;
|
||||
virtual std::string getDownloadDirectory() = 0;
|
||||
virtual std::string getPartialsDirectory() = 0;
|
||||
|
||||
virtual bool getSharedDirectories(std::list<std::string> &dirs) = 0;
|
||||
virtual bool addSharedDirectory(std::string dir) = 0;
|
||||
virtual bool removeSharedDirectory(std::string dir) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
class NotifyBase;
|
||||
class RsIface;
|
||||
class RsControl;
|
||||
//class RsServer;
|
||||
class RsInit;
|
||||
class Expression;
|
||||
|
||||
/* declare single RsIface for everyone to use! */
|
||||
|
||||
|
@ -88,9 +86,6 @@ public:
|
|||
virtual void lockData() = 0;
|
||||
virtual void unlockData() = 0;
|
||||
|
||||
const std::list<FileTransferInfo> &getTransferList()
|
||||
{ return mTransferList; }
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
|
||||
|
@ -129,7 +124,6 @@ bool hasChanged(DataFlags set); /* resets it */
|
|||
void fillLists(); /* create some dummy data to display */
|
||||
|
||||
/* Internals */
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
bool mChanged[NumOfFlags];
|
||||
|
@ -156,34 +150,6 @@ virtual ~RsControl() { return; }
|
|||
/* Real Startup Fn */
|
||||
virtual int StartupRetroShare(RsInit *config) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Directory Actions */
|
||||
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) = 0;
|
||||
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Search Actions */
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
|
||||
virtual int SearchBoolExp(Expression *exp, std::list<FileDetail> &results) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Actions For Upload/Download */
|
||||
|
||||
//virtual int FileDelete(std::string uId, std::string fname) = 0;
|
||||
//virtual int FileMove(std::string uId, std::string src, std::string dest) = 0;
|
||||
|
||||
virtual int FileRecommend(std::string fname, std::string hash, int size) = 0;
|
||||
virtual int FileRequest(std::string fname, std::string hash, uint32_t size, std::string dest) = 0;
|
||||
virtual int FileCancel(std::string fname, std::string hash, uint32_t size) = 0;
|
||||
|
||||
// Transfer control.
|
||||
virtual int FileClearCompleted() = 0;
|
||||
virtual int FileSetBandwidthTotals(float outkB, float inkB) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
|
@ -201,16 +167,8 @@ virtual int ClearInRecommend() = 0;
|
|||
virtual bool IsInChat(std::string id) = 0; /* friend : chat msgs */
|
||||
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/
|
||||
|
||||
/****************************************/
|
||||
/* RsIface Networking */
|
||||
//virtual int NetworkDHTActive(bool active) = 0;
|
||||
//virtual int NetworkUPnPActive(bool active) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Config */
|
||||
virtual int ConfigAddSharedDir( std::string dir ) = 0;
|
||||
virtual int ConfigRemoveSharedDir( std::string dir ) = 0;
|
||||
virtual int ConfigSetIncomingDir( std::string dir ) = 0;
|
||||
|
||||
virtual int ConfigSetDataRates( int total, int indiv ) = 0;
|
||||
virtual int ConfigGetDataRates( float &inKb, float &outKb) = 0;
|
||||
|
|
|
@ -105,9 +105,6 @@ class RsConfig
|
|||
std::string ownId;
|
||||
std::string ownName;
|
||||
|
||||
std::list<std::string> sharedDirList;
|
||||
std::string incomingDir;
|
||||
|
||||
std::string localAddr;
|
||||
int localPort;
|
||||
std::string extAddr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue