share of incoming directory by default

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1359 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-07-12 13:22:31 +00:00
parent 49e9066afb
commit 990ed277bd
9 changed files with 440 additions and 312 deletions

View File

@ -78,7 +78,8 @@ ftFileControl::ftFileControl(std::string fname,
} }
ftController::ftController(CacheStrapper *cs, ftDataMultiplex *dm, std::string configDir) ftController::ftController(CacheStrapper *cs, ftDataMultiplex *dm, std::string configDir)
:CacheTransfer(cs), p3Config(CONFIG_TYPE_FT_CONTROL), mDataplex(dm), mFtActive(false),mTurtle(NULL) :CacheTransfer(cs), p3Config(CONFIG_TYPE_FT_CONTROL), mDataplex(dm), mFtActive(false),
mTurtle(NULL), mShareDownloadDir(true)
{ {
/* TODO */ /* TODO */
} }
@ -1293,6 +1294,7 @@ bool ftController::CancelCacheFile(RsPeerId id, std::string path, std::string ha
const std::string download_dir_ss("DOWN_DIR"); const std::string download_dir_ss("DOWN_DIR");
const std::string partial_dir_ss("PART_DIR"); const std::string partial_dir_ss("PART_DIR");
const std::string share_dwl_dir("SHARE_DWL_DIR");
/* p3Config Interface */ /* p3Config Interface */
@ -1323,6 +1325,7 @@ std::list<RsItem *> ftController::saveList(bool &cleanup)
/* basic control parameters */ /* basic control parameters */
configMap[download_dir_ss] = getDownloadDirectory(); configMap[download_dir_ss] = getDownloadDirectory();
configMap[partial_dir_ss] = getPartialsDirectory(); configMap[partial_dir_ss] = getPartialsDirectory();
configMap[share_dwl_dir] = mShareDownloadDir ? "YES" : "NO";
RsConfigKeyValueSet *rskv = new RsConfigKeyValueSet(); RsConfigKeyValueSet *rskv = new RsConfigKeyValueSet();
@ -1462,6 +1465,27 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
setPartialsDirectory(mit->second); setPartialsDirectory(mit->second);
} }
if (configMap.end() != (mit = configMap.find(share_dwl_dir)))
{
if (mit->second == "YES")
{
setShareDownloadDirectory(true);
}
else if (mit->second == "NO")
{
setShareDownloadDirectory(false);
}
}
return true; return true;
} }
void ftController::setShareDownloadDirectory(bool value)
{
mShareDownloadDir = value;
}
bool ftController::getShareDownloadDirectory()
{
return mShareDownloadDir;
}

View File

@ -26,7 +26,7 @@
#ifndef FT_CONTROLLER_HEADER #ifndef FT_CONTROLLER_HEADER
#define FT_CONTROLLER_HEADER #define FT_CONTROLLER_HEADER
/* /*
* ftController * ftController
* *
* Top level download controller. * Top level download controller.
@ -69,8 +69,8 @@ class ftFileControl
enum {DOWNLOADING,COMPLETED,ERROR_COMPLETION}; enum {DOWNLOADING,COMPLETED,ERROR_COMPLETION};
ftFileControl(); ftFileControl();
ftFileControl(std::string fname, std::string tmppath, std::string dest, ftFileControl(std::string fname, std::string tmppath, std::string dest,
uint64_t size, std::string hash, uint32_t flags, uint64_t size, std::string hash, uint32_t flags,
ftFileCreator *fc, ftTransferModule *tm, uint32_t cb_flags); ftFileCreator *fc, ftTransferModule *tm, uint32_t cb_flags);
std::string mName; std::string mName;
@ -118,14 +118,17 @@ void setFtSearchNExtra(ftSearch *, ftExtraList *);
void setTurtleRouter(p3turtle *) ; void setTurtleRouter(p3turtle *) ;
bool activate(); bool activate();
void setShareDownloadDirectory(bool value);
bool getShareDownloadDirectory();
virtual void run(); virtual void run();
/***************************************************************/ /***************************************************************/
/********************** Controller Access **********************/ /********************** Controller Access **********************/
/***************************************************************/ /***************************************************************/
bool FileRequest(std::string fname, std::string hash, bool FileRequest(std::string fname, std::string hash,
uint64_t size, std::string dest, uint32_t flags, uint64_t size, std::string dest, uint32_t flags,
std::list<std::string> &sourceIds); std::list<std::string> &sourceIds);
bool FileCancel(std::string hash); bool FileCancel(std::string hash);
@ -151,7 +154,7 @@ bool moveFile(const std::string& source,const std::string& dest) ;
protected: protected:
virtual bool RequestCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size); virtual bool RequestCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size);
virtual bool CancelCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size); virtual bool CancelCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size);
/***************************************************************/ /***************************************************************/
@ -172,7 +175,6 @@ virtual std::list<RsItem *> saveList(bool &cleanup);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *> load);
bool loadConfigMap(std::map<std::string, std::string> &configMap); bool loadConfigMap(std::map<std::string, std::string> &configMap);
private: private:
/* RunTime Functions */ /* RunTime Functions */
@ -185,7 +187,7 @@ bool setPeerState(ftTransferModule *tm, std::string id,
/* pointers to other components */ /* pointers to other components */
ftSearch *mSearch; ftSearch *mSearch;
ftDataMultiplex *mDataplex; ftDataMultiplex *mDataplex;
ftExtraList *mExtraList; ftExtraList *mExtraList;
p3turtle *mTurtle ; p3turtle *mTurtle ;
@ -218,6 +220,9 @@ bool setPeerState(ftTransferModule *tm, std::string id,
bool mFtActive; bool mFtActive;
bool mFtPendingDone; bool mFtPendingDone;
std::list<ftPendingRequest> mPendingRequests; std::list<ftPendingRequest> mPendingRequests;
/* share incoming directory */
bool mShareDownloadDir;
}; };
#endif #endif

View File

@ -203,17 +203,17 @@ void ftServer::run()
{ {
if ((now - info.lastTS) > 10) if ((now - info.lastTS) > 10)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cout << "info.lastTS = " << info.lastTS << ", now=" << now << std::endl ; std::cout << "info.lastTS = " << info.lastTS << ", now=" << now << std::endl ;
#endif #endif
toDels.push_back(sit->first); toDels.push_back(sit->first);
} }
} }
} }
if(!toDels.empty()) if(!toDels.empty())
mFtDataplex->deleteServers(toDels) ; mFtDataplex->deleteServers(toDels) ;
#ifdef WIN32 #ifdef WIN32
Sleep(1000); Sleep(1000);
#else #else
@ -232,11 +232,11 @@ void ftServer::run()
/********************** Controller Access **********************/ /********************** Controller Access **********************/
/***************************************************************/ /***************************************************************/
bool ftServer::FileRequest(std::string fname, std::string hash, uint64_t size, bool ftServer::FileRequest(std::string fname, std::string hash, uint64_t size,
std::string dest, uint32_t flags, std::list<std::string> srcIds) std::string dest, uint32_t flags, std::list<std::string> srcIds)
{ {
std::cerr << "Requesting " << fname << std::endl ; std::cerr << "Requesting " << fname << std::endl ;
return mFtController->FileRequest(fname, hash, size, return mFtController->FileRequest(fname, hash, size,
dest, flags, srcIds); dest, flags, srcIds);
} }
@ -320,7 +320,7 @@ bool ftServer::FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)
/******************* ExtraFileList Access **********************/ /******************* ExtraFileList Access **********************/
/***************************************************************/ /***************************************************************/
bool ftServer::ExtraFileAdd(std::string fname, std::string hash, uint64_t size, bool ftServer::ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
uint32_t period, uint32_t flags) uint32_t period, uint32_t flags)
{ {
return mFtExtra->addExtraFile(fname, hash, size, period, flags); return mFtExtra->addExtraFile(fname, hash, size, period, flags);
@ -354,7 +354,7 @@ bool ftServer::ExtraFileMove(std::string fname, std::string hash, uint64_t size,
int ftServer::RequestDirDetails(std::string uid, std::string path, DirDetails &details) int ftServer::RequestDirDetails(std::string uid, std::string path, DirDetails &details)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::RequestDirDetails(uid:" << uid; std::cerr << "ftServer::RequestDirDetails(uid:" << uid;
std::cerr << ", path:" << path << ", ...) -> mFiStore"; std::cerr << ", path:" << path << ", ...) -> mFiStore";
std::cerr << std::endl; std::cerr << std::endl;
@ -367,10 +367,10 @@ int ftServer::RequestDirDetails(std::string uid, std::string path, DirDetails &d
#endif #endif
return mFiStore->RequestDirDetails(uid, path, details); return mFiStore->RequestDirDetails(uid, path, details);
} }
int ftServer::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) int ftServer::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::RequestDirDetails(ref:" << ref; std::cerr << "ftServer::RequestDirDetails(ref:" << ref;
std::cerr << ", flags:" << flags << ", ...) -> mFiStore"; std::cerr << ", flags:" << flags << ", ...) -> mFiStore";
std::cerr << std::endl; std::cerr << std::endl;
@ -384,7 +384,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags)
#endif #endif
return mFiStore->RequestDirDetails(ref, details, flags); return mFiStore->RequestDirDetails(ref, details, flags);
} }
/***************************************************************/ /***************************************************************/
/******************** Search Interface *************************/ /******************** Search Interface *************************/
/***************************************************************/ /***************************************************************/
@ -392,7 +392,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags)
int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags) int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::SearchKeywords()"; std::cerr << "ftServer::SearchKeywords()";
std::cerr << std::endl; std::cerr << std::endl;
@ -405,33 +405,33 @@ int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<FileDeta
#endif #endif
return mFiStore->SearchKeywords(keywords, results,flags); return mFiStore->SearchKeywords(keywords, results,flags);
} }
int ftServer::SearchBoolExp(Expression * exp, std::list<FileDetail> &results) int ftServer::SearchBoolExp(Expression * exp, std::list<FileDetail> &results)
{ {
return mFiStore->searchBoolExp(exp, results); return mFiStore->searchBoolExp(exp, results);
} }
/***************************************************************/ /***************************************************************/
/*************** Local Shared Dir Interface ********************/ /*************** Local Shared Dir Interface ********************/
/***************************************************************/ /***************************************************************/
bool ftServer::ConvertSharedFilePath(std::string path, std::string &fullpath) bool ftServer::ConvertSharedFilePath(std::string path, std::string &fullpath)
{ {
return mFiMon->convertSharedFilePath(path, fullpath); return mFiMon->convertSharedFilePath(path, fullpath);
} }
void ftServer::ForceDirectoryCheck() void ftServer::ForceDirectoryCheck()
{ {
mFiMon->forceDirectoryCheck(); mFiMon->forceDirectoryCheck();
return; return;
} }
bool ftServer::InDirectoryCheck() bool ftServer::InDirectoryCheck()
{ {
return mFiMon->inDirectoryCheck(); return mFiMon->inDirectoryCheck();
} }
bool ftServer::getSharedDirectories(std::list<std::string> &dirs) bool ftServer::getSharedDirectories(std::list<std::string> &dirs)
{ {
mFiMon->getSharedDirectories(dirs); mFiMon->getSharedDirectories(dirs);
@ -459,14 +459,14 @@ bool ftServer::removeSharedDirectory(std::string dir)
std::list<std::string> dirList; std::list<std::string> dirList;
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::removeSharedDirectory(" << dir << ")"; std::cerr << "ftServer::removeSharedDirectory(" << dir << ")";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
mFiMon->getSharedDirectories(dirList); mFiMon->getSharedDirectories(dirList);
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
for(it = dirList.begin(); it != dirList.end(); it++) for(it = dirList.begin(); it != dirList.end(); it++)
{ {
std::cerr << "ftServer::removeSharedDirectory()"; std::cerr << "ftServer::removeSharedDirectory()";
@ -475,10 +475,10 @@ bool ftServer::removeSharedDirectory(std::string dir)
} }
#endif #endif
if (dirList.end() == (it = if (dirList.end() == (it =
std::find(dirList.begin(), dirList.end(), dir))) std::find(dirList.begin(), dirList.end(), dir)))
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::removeSharedDirectory()"; std::cerr << "ftServer::removeSharedDirectory()";
std::cerr << " Cannot Find Directory... Fail"; std::cerr << " Cannot Find Directory... Fail";
std::cerr << std::endl; std::cerr << std::endl;
@ -488,7 +488,7 @@ bool ftServer::removeSharedDirectory(std::string dir)
} }
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::removeSharedDirectory()"; std::cerr << "ftServer::removeSharedDirectory()";
std::cerr << " Updating Directories"; std::cerr << " Updating Directories";
std::cerr << std::endl; std::cerr << std::endl;
@ -500,6 +500,27 @@ bool ftServer::removeSharedDirectory(std::string dir)
return true; return true;
} }
void ftServer::setShareDownloadDirectory(bool value)
{
mFtController->setShareDownloadDirectory(value);
}
bool ftServer::getShareDownloadDirectory()
{
return mFtController->getShareDownloadDirectory();
}
bool ftServer::shareDownloadDirectory()
{
std::string dir = mFtController->getDownloadDirectory();
return addSharedDirectory(dir);
}
bool ftServer::unshareDownloadDirectory()
{
std::string dir = mFtController->getDownloadDirectory();
return removeSharedDirectory(dir);
}
/***************************************************************/ /***************************************************************/
/****************** End of RsFiles Interface *******************/ /****************** End of RsFiles Interface *******************/
@ -538,7 +559,7 @@ bool ftServer::loadConfigMap(std::map<std::string, std::string> &configMap)
/***************************************************************/ /***************************************************************/
/* Client Send */ /* Client Send */
bool ftServer::sendDataRequest(std::string peerId, std::string hash, bool ftServer::sendDataRequest(std::string peerId, std::string hash,
uint64_t size, uint64_t offset, uint32_t chunksize) uint64_t size, uint64_t offset, uint32_t chunksize)
{ {
if(mTurtleRouter->isTurtlePeer(peerId)) if(mTurtleRouter->isTurtlePeer(peerId))
@ -579,7 +600,7 @@ bool ftServer::sendData(std::string peerId, std::string hash, uint64_t size, uin
uint64_t offset = 0; uint64_t offset = 0;
uint32_t chunk; uint32_t chunk;
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::sendData() to " << peerId << std::endl; std::cerr << "ftServer::sendData() to " << peerId << std::endl;
std::cerr << "hash: " << hash; std::cerr << "hash: " << hash;
std::cerr << " offset: " << baseoffset; std::cerr << " offset: " << baseoffset;
@ -624,7 +645,7 @@ bool ftServer::sendData(std::string peerId, std::string hash, uint64_t size, uin
mP3iface->SendFileData(rfd); mP3iface->SendFileData(rfd);
/* print the data pointer */ /* print the data pointer */
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::sendData() Packet: " << std::endl; std::cerr << "ftServer::sendData() Packet: " << std::endl;
std::cerr << " offset: " << rfd->fd.file_offset; std::cerr << " offset: " << rfd->fd.file_offset;
std::cerr << " chunk: " << chunk; std::cerr << " chunk: " << chunk;
@ -651,7 +672,7 @@ bool ftServer::sendData(std::string peerId, std::string hash, uint64_t size, uin
*/ */
int ftServer::tick() int ftServer::tick()
{ {
rslog(RSL_DEBUG_BASIC, ftserverzone, rslog(RSL_DEBUG_BASIC, ftserverzone,
"filedexserver::tick()"); "filedexserver::tick()");
if (mP3iface == NULL) if (mP3iface == NULL)
@ -661,7 +682,7 @@ int ftServer::tick()
#endif #endif
std::ostringstream out; std::ostringstream out;
rslog(RSL_DEBUG_BASIC, ftserverzone, rslog(RSL_DEBUG_BASIC, ftserverzone,
"filedexserver::tick() Invalid Interface()"); "filedexserver::tick() Invalid Interface()");
return 1; return 1;
@ -712,13 +733,13 @@ bool ftServer::handleCacheData()
int i = 0; int i = 0;
int i_init = 0; int i_init = 0;
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
//std::cerr << "ftServer::handleCacheData()" << std::endl; //std::cerr << "ftServer::handleCacheData()" << std::endl;
#endif #endif
while((ci = mP3iface -> GetSearchResult()) != NULL) while((ci = mP3iface -> GetSearchResult()) != NULL)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::handleCacheData() Recvd SearchResult (CacheResponse!)" << std::endl; std::cerr << "ftServer::handleCacheData() Recvd SearchResult (CacheResponse!)" << std::endl;
std::ostringstream out; std::ostringstream out;
if (i++ == i_init) if (i++ == i_init)
@ -747,7 +768,7 @@ bool ftServer::handleCacheData()
i_init = i; i_init = i;
while((cr = mP3iface -> RequestedSearch()) != NULL) while((cr = mP3iface -> RequestedSearch()) != NULL)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
/* just delete these */ /* just delete these */
std::ostringstream out; std::ostringstream out;
out << "Requested Search:" << std::endl; out << "Requested Search:" << std::endl;
@ -758,7 +779,7 @@ bool ftServer::handleCacheData()
} }
// Now handle it replacement (pushed cache results) // Now handle it replacement (pushed cache results)
{ {
std::list<std::pair<RsPeerId, CacheData> > cacheUpdates; std::list<std::pair<RsPeerId, CacheData> > cacheUpdates;
std::list<std::pair<RsPeerId, CacheData> >::iterator it; std::list<std::pair<RsPeerId, CacheData> >::iterator it;
@ -768,7 +789,7 @@ bool ftServer::handleCacheData()
{ {
/* construct reply */ /* construct reply */
RsCacheItem *ci = new RsCacheItem(); RsCacheItem *ci = new RsCacheItem();
/* id from incoming */ /* id from incoming */
ci -> PeerId(it->first); ci -> PeerId(it->first);
@ -779,7 +800,7 @@ bool ftServer::handleCacheData()
ci -> cacheType = (it->second).cid.type; ci -> cacheType = (it->second).cid.type;
ci -> cacheSubId = (it->second).cid.subid; ci -> cacheSubId = (it->second).cid.subid;
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::ostringstream out2; std::ostringstream out2;
out2 << "Outgoing CacheStrapper Update -> RsCacheItem:" << std::endl; out2 << "Outgoing CacheStrapper Update -> RsCacheItem:" << std::endl;
ci -> print(out2); ci -> print(out2);
@ -788,7 +809,7 @@ bool ftServer::handleCacheData()
//rslog(RSL_DEBUG_BASIC, ftserverzone, out2.str()); //rslog(RSL_DEBUG_BASIC, ftserverzone, out2.str());
mP3iface -> SendSearchResult(ci); mP3iface -> SendSearchResult(ci);
i++; i++;
} }
} }
@ -808,7 +829,7 @@ bool ftServer::handleFileData()
i_init = i; i_init = i;
while((fr = mP3iface -> GetFileRequest()) != NULL ) while((fr = mP3iface -> GetFileRequest()) != NULL )
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::handleFileData() Recvd ftFiler Request" << std::endl; std::cerr << "ftServer::handleFileData() Recvd ftFiler Request" << std::endl;
std::ostringstream out; std::ostringstream out;
if (i == i_init) if (i == i_init)
@ -820,8 +841,8 @@ bool ftServer::handleFileData()
#endif #endif
i++; /* count */ i++; /* count */
mFtDataplex->recvDataRequest(fr->PeerId(), mFtDataplex->recvDataRequest(fr->PeerId(),
fr->file.hash, fr->file.filesize, fr->file.hash, fr->file.filesize,
fr->fileoffset, fr->chunksize); fr->fileoffset, fr->chunksize);
FileInfo(ffr); FileInfo(ffr);
@ -832,7 +853,7 @@ FileInfo(ffr);
i_init = i; i_init = i;
while((fd = mP3iface -> GetFileData()) != NULL ) while((fd = mP3iface -> GetFileData()) != NULL )
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::handleFileData() Recvd ftFiler Data" << std::endl; std::cerr << "ftServer::handleFileData() Recvd ftFiler Data" << std::endl;
std::cerr << "hash: " << fd->fd.file.hash; std::cerr << "hash: " << fd->fd.file.hash;
std::cerr << " length: " << fd->fd.binData.bin_len; std::cerr << " length: " << fd->fd.binData.bin_len;
@ -851,12 +872,12 @@ FileInfo(ffr);
/* incoming data */ /* incoming data */
mFtDataplex->recvData(fd->PeerId(), mFtDataplex->recvData(fd->PeerId(),
fd->fd.file.hash, fd->fd.file.filesize, fd->fd.file.hash, fd->fd.file.filesize,
fd->fd.file_offset, fd->fd.file_offset,
fd->fd.binData.bin_len, fd->fd.binData.bin_len,
fd->fd.binData.bin_data); fd->fd.binData.bin_data);
/* we've stolen the data part -> so blank before delete /* we've stolen the data part -> so blank before delete
*/ */
fd->fd.binData.TlvShallowClear(); fd->fd.binData.TlvShallowClear();
delete fd; delete fd;
@ -882,7 +903,7 @@ bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr)
cfgmgr->addConfiguration("ft_shared.cfg", mFiMon); cfgmgr->addConfiguration("ft_shared.cfg", mFiMon);
cfgmgr->addConfiguration("ft_extra.cfg", mFtExtra); cfgmgr->addConfiguration("ft_extra.cfg", mFtExtra);
cfgmgr->addConfiguration("ft_transfers.cfg", mFtController); cfgmgr->addConfiguration("ft_transfers.cfg", mFtController);
return true; return true;
} }

View File

@ -26,7 +26,7 @@
#ifndef FT_SERVER_HEADER #ifndef FT_SERVER_HEADER
#define FT_SERVER_HEADER #define FT_SERVER_HEADER
/* /*
* ftServer. * ftServer.
* *
* Top level File Transfer interface. * Top level File Transfer interface.
@ -114,14 +114,14 @@ ftController *getController() const { return mFtController ; }
/*** /***
* Control of Downloads * Control of Downloads
***/ ***/
virtual bool FileRequest(std::string fname, std::string hash, uint64_t size, virtual bool FileRequest(std::string fname, std::string hash, uint64_t size,
std::string dest, uint32_t flags, std::list<std::string> srcIds); std::string dest, uint32_t flags, std::list<std::string> srcIds);
virtual bool FileCancel(std::string hash); virtual bool FileCancel(std::string hash);
virtual bool FileControl(std::string hash, uint32_t flags); virtual bool FileControl(std::string hash, uint32_t flags);
virtual bool FileClearCompleted(); virtual bool FileClearCompleted();
/*** /***
* Download/Upload Details * Download/Upload Details
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs); virtual bool FileDownloads(std::list<std::string> &hashs);
virtual bool FileUploads(std::list<std::string> &hashs); virtual bool FileUploads(std::list<std::string> &hashs);
@ -130,10 +130,10 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info);
/*** /***
* Extra List Access * Extra List Access
***/ ***/
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
uint32_t period, uint32_t flags); uint32_t period, uint32_t flags);
virtual bool ExtraFileRemove(std::string hash, uint32_t flags); virtual bool ExtraFileRemove(std::string hash, uint32_t flags);
virtual bool ExtraFileHash(std::string localpath, virtual bool ExtraFileHash(std::string localpath,
uint32_t period, uint32_t flags); uint32_t period, uint32_t flags);
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info); virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
@ -150,14 +150,14 @@ virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results); virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results);
/*** /***
* Utility Functions * Utility Functions
***/ ***/
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath); virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
virtual void ForceDirectoryCheck(); virtual void ForceDirectoryCheck();
virtual bool InDirectoryCheck(); virtual bool InDirectoryCheck();
/*** /***
* Directory Handling * Directory Handling
***/ ***/
virtual void setDownloadDirectory(std::string path); virtual void setDownloadDirectory(std::string path);
virtual void setPartialsDirectory(std::string path); virtual void setPartialsDirectory(std::string path);
@ -169,6 +169,10 @@ virtual bool setSharedDirectories(std::list<std::string> &dirs);
virtual bool addSharedDirectory(std::string dir); virtual bool addSharedDirectory(std::string dir);
virtual bool removeSharedDirectory(std::string dir); virtual bool removeSharedDirectory(std::string dir);
virtual void setShareDownloadDirectory(bool value);
virtual bool getShareDownloadDirectory();
virtual bool shareDownloadDirectory();
virtual bool unshareDownloadDirectory();
/***************************************************************/ /***************************************************************/
/*************** Control Interface *****************************/ /*************** Control Interface *****************************/
@ -180,7 +184,7 @@ virtual bool removeSharedDirectory(std::string dir);
public: public:
virtual bool sendData(std::string peerId, std::string hash, uint64_t size, virtual bool sendData(std::string peerId, std::string hash, uint64_t size,
uint64_t offset, uint32_t chunksize, void *data); uint64_t offset, uint32_t chunksize, void *data);
virtual bool sendDataRequest(std::string peerId, virtual bool sendDataRequest(std::string peerId,
std::string hash, uint64_t size, std::string hash, uint64_t size,
uint64_t offset, uint32_t chunksize); uint64_t offset, uint32_t chunksize);
@ -217,7 +221,7 @@ bool loadConfigMap(std::map<std::string, std::string> &configMap);
private: private:
/* no need for Mutex protection - /* no need for Mutex protection -
* as each component is protected independently. * as each component is protected independently.
*/ */

View File

@ -55,7 +55,7 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
/************************************ /************************************
* Used To indicate where to search. * Used To indicate where to search.
* *
* The Order of these is very important, * The Order of these is very important,
* it specifies the search order too. * it specifies the search order too.
* *
*/ */
@ -101,13 +101,13 @@ virtual ~RsFiles() { return; }
/*** /***
* Control of Downloads. * Control of Downloads.
***/ ***/
virtual bool FileRequest(std::string fname, std::string hash, uint64_t size, virtual bool FileRequest(std::string fname, std::string hash, uint64_t size,
std::string dest, uint32_t flags, std::list<std::string> srcIds) = 0; std::string dest, uint32_t flags, std::list<std::string> srcIds) = 0;
virtual bool FileCancel(std::string hash) = 0; virtual bool FileCancel(std::string hash) = 0;
virtual bool FileControl(std::string hash, uint32_t flags) = 0; virtual bool FileControl(std::string hash, uint32_t flags) = 0;
virtual bool FileClearCompleted() = 0; virtual bool FileClearCompleted() = 0;
/*** /***
* Download / Upload Details. * Download / Upload Details.
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs) = 0; virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
@ -121,7 +121,7 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) =
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0; virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
virtual bool ExtraFileHash(std::string localpath, virtual bool ExtraFileHash(std::string localpath,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0; virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
@ -157,6 +157,10 @@ virtual bool getSharedDirectories(std::list<std::string> &dirs) = 0;
virtual bool addSharedDirectory(std::string dir) = 0; virtual bool addSharedDirectory(std::string dir) = 0;
virtual bool removeSharedDirectory(std::string dir) = 0; virtual bool removeSharedDirectory(std::string dir) = 0;
virtual void setShareDownloadDirectory(bool value) = 0;
virtual bool getShareDownloadDirectory() = 0;
virtual bool shareDownloadDirectory() = 0;
virtual bool unshareDownloadDirectory() = 0;
}; };

View File

@ -24,6 +24,7 @@
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
#include "DirectoriesDialog.h" #include "DirectoriesDialog.h"
#include <algorithm>
/** Constructor */ /** Constructor */
DirectoriesDialog::DirectoriesDialog(QWidget *parent) DirectoriesDialog::DirectoriesDialog(QWidget *parent)
@ -39,13 +40,21 @@ DirectoriesDialog::DirectoriesDialog(QWidget *parent)
connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
ui.addButton->setToolTip(tr("Add a Share Directory")); ui.addButton->setToolTip(tr("Add a Share Directory"));
ui.removeButton->setToolTip(tr("Remove Shared Directory")); ui.removeButton->setToolTip(tr("Remove Shared Directory"));
ui.incomingButton->setToolTip(tr("Browse")); ui.incomingButton->setToolTip(tr("Browse"));
ui.partialButton->setToolTip(tr("Browse")); ui.partialButton->setToolTip(tr("Browse"));
if (rsFiles->getShareDownloadDirectory())
{
ui.checkBox->setDown(true); /* signal not emitted */
}
else
{
ui.checkBox->setDown(false); /* signal not emitted */
}
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -57,6 +66,26 @@ DirectoriesDialog::DirectoriesDialog(QWidget *parent)
bool bool
DirectoriesDialog::save(QString &errmsg) DirectoriesDialog::save(QString &errmsg)
{ {
/* this is usefull especially when shared incoming files is
* default option and when the user don't check/uncheck the
* checkBox, so no signal is emitted to update the shared list */
if (ui.checkBox->isChecked())
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
rsFiles->setShareDownloadDirectory(true);
}
else
{
rsFiles->unshareDownloadDirectory();
rsFiles->setShareDownloadDirectory(false);
}
return true; return true;
} }
@ -84,8 +113,6 @@ void DirectoriesDialog::load()
ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory())); ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory()));
listWidget->update(); /* update display */ listWidget->update(); /* update display */
} }
void DirectoriesDialog::addShareDirectory() void DirectoriesDialog::addShareDirectory()
@ -130,6 +157,17 @@ void DirectoriesDialog::setIncomingDirectory()
if (dir != "") if (dir != "")
{ {
rsFiles->setDownloadDirectory(dir); rsFiles->setDownloadDirectory(dir);
if (ui.checkBox->isChecked())
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
}
} }
load(); load();
} }
@ -147,3 +185,24 @@ void DirectoriesDialog::setPartialsDirectory()
load(); load();
} }
void DirectoriesDialog::shareDownloadDirectory(int state)
{
if (state == Qt::Checked)
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
rsFiles->setShareDownloadDirectory(true);
}
else
{
rsFiles->unshareDownloadDirectory();
rsFiles->setShareDownloadDirectory(false);
}
load();
}

View File

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -29,7 +29,7 @@
#include "configpage.h" #include "configpage.h"
#include "ui_DirectoriesDialog.h" #include "ui_DirectoriesDialog.h"
class DirectoriesDialog : public ConfigPage class DirectoriesDialog : public ConfigPage
{ {
Q_OBJECT Q_OBJECT
@ -49,8 +49,9 @@ private slots:
void removeShareDirectory(); void removeShareDirectory();
void setIncomingDirectory(); void setIncomingDirectory();
void setPartialsDirectory(); void setPartialsDirectory();
void shareDownloadDirectory(int state);
private: private:
/** A RshareSettings object used for saving/loading settings */ /** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings; RshareSettings* _settings;

View File

@ -1,7 +1,8 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DirectoriesDialog</class> <class>DirectoriesDialog</class>
<widget class="QWidget" name="DirectoriesDialog" > <widget class="QWidget" name="DirectoriesDialog">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@ -9,162 +10,162 @@
<height>349</height> <height>349</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette" > <property name="palette">
<palette> <palette>
<active> <active>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>128</blue> <blue>128</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -173,153 +174,153 @@
</colorrole> </colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>192</red> <red>192</red>
<green>192</green> <green>192</green>
<blue>192</blue> <blue>192</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -328,153 +329,153 @@
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>128</blue> <blue>128</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -484,7 +485,7 @@
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="font" > <property name="font">
<font> <font>
<family>Arial</family> <family>Arial</family>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@ -495,61 +496,50 @@
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="mouseTracking" > <property name="mouseTracking">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<property name="leftMargin" > <property name="margin">
<number>6</number> <number>6</number>
</property> </property>
<property name="topMargin" > <property name="spacing">
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<property name="horizontalSpacing" >
<number>0</number> <number>0</number>
</property> </property>
<property name="verticalSpacing" > <item row="0" column="0">
<number>0</number> <widget class="QGroupBox" name="groupBox">
</property> <property name="title">
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Shared Directories</string> <string>Shared Directories</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<item rowspan="3" row="0" column="0" > <item row="0" column="0" rowspan="3">
<widget class="QListWidget" name="dirList" /> <widget class="QListWidget" name="dirList"/>
</item> </item>
<item row="0" column="1" > <item row="0" column="1">
<widget class="QPushButton" name="addButton" > <widget class="QPushButton" name="addButton">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>34</width> <width>34</width>
<height>34</height> <height>34</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>34</width> <width>34</width>
<height>34</height> <height>34</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" >:/images/directoryadd_24x24_shadow.png</iconset> <iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
@ -557,27 +547,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" > <item row="1" column="1">
<widget class="QPushButton" name="removeButton" > <widget class="QPushButton" name="removeButton">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>34</width> <width>34</width>
<height>34</height> <height>34</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>34</width> <width>34</width>
<height>34</height> <height>34</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" >:/images/directoryremove_24x24_shadow.png</iconset> <iconset resource="../images.qrc">
<normaloff>:/images/directoryremove_24x24_shadow.png</normaloff>:/images/directoryremove_24x24_shadow.png</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
@ -585,12 +576,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" > <item row="2" column="1">
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>71</height> <height>71</height>
@ -601,40 +592,41 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2" > <widget class="QGroupBox" name="groupBox_2">
<property name="title" > <property name="title">
<string>Incoming Directory</string> <string>Incoming Directory</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="QLineEdit" name="incomingDir" > <widget class="QLineEdit" name="incomingDir">
<property name="readOnly" > <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="0" column="1">
<widget class="QPushButton" name="incomingButton" > <widget class="QPushButton" name="incomingButton">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>31</width> <width>31</width>
<height>31</height> <height>31</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>31</width> <width>31</width>
<height>31</height> <height>31</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" >:/images/directoryselect_24x24_shadow.png</iconset> <iconset resource="../images.qrc">
<normaloff>:/images/directoryselect_24x24_shadow.png</normaloff>:/images/directoryselect_24x24_shadow.png</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
@ -642,43 +634,57 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Automatically share incoming directory (Recommanded)</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3" > <widget class="QGroupBox" name="groupBox_3">
<property name="title" > <property name="title">
<string>Partials Direcrtory</string> <string>Partials Direcrtory</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="QLineEdit" name="partialsDir" > <widget class="QLineEdit" name="partialsDir">
<property name="readOnly" > <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="0" column="1">
<widget class="QPushButton" name="partialButton" > <widget class="QPushButton" name="partialButton">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>31</width> <width>31</width>
<height>31</height> <height>31</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>31</width> <width>31</width>
<height>31</height> <height>31</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" >:/images/directoryselect_24x24_shadow.png</iconset> <iconset resource="../images.qrc">
<normaloff>:/images/directoryselect_24x24_shadow.png</normaloff>:/images/directoryselect_24x24_shadow.png</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
@ -699,7 +705,7 @@
<tabstop>removeButton</tabstop> <tabstop>removeButton</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../images.qrc" /> <include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -55,7 +55,7 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
/************************************ /************************************
* Used To indicate where to search. * Used To indicate where to search.
* *
* The Order of these is very important, * The Order of these is very important,
* it specifies the search order too. * it specifies the search order too.
* *
*/ */
@ -101,13 +101,13 @@ virtual ~RsFiles() { return; }
/*** /***
* Control of Downloads. * Control of Downloads.
***/ ***/
virtual bool FileRequest(std::string fname, std::string hash, uint64_t size, virtual bool FileRequest(std::string fname, std::string hash, uint64_t size,
std::string dest, uint32_t flags, std::list<std::string> srcIds) = 0; std::string dest, uint32_t flags, std::list<std::string> srcIds) = 0;
virtual bool FileCancel(std::string hash) = 0; virtual bool FileCancel(std::string hash) = 0;
virtual bool FileControl(std::string hash, uint32_t flags) = 0; virtual bool FileControl(std::string hash, uint32_t flags) = 0;
virtual bool FileClearCompleted() = 0; virtual bool FileClearCompleted() = 0;
/*** /***
* Download / Upload Details. * Download / Upload Details.
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs) = 0; virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
@ -121,7 +121,7 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) =
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0; virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
virtual bool ExtraFileHash(std::string localpath, virtual bool ExtraFileHash(std::string localpath,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0; virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
@ -157,6 +157,10 @@ virtual bool getSharedDirectories(std::list<std::string> &dirs) = 0;
virtual bool addSharedDirectory(std::string dir) = 0; virtual bool addSharedDirectory(std::string dir) = 0;
virtual bool removeSharedDirectory(std::string dir) = 0; virtual bool removeSharedDirectory(std::string dir) = 0;
virtual void setShareDownloadDirectory(bool value) = 0;
virtual bool getShareDownloadDirectory() = 0;
virtual bool shareDownloadDirectory() = 0;
virtual bool unshareDownloadDirectory() = 0;
}; };