mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
added dynamic menu for choosing download directory for files being transfered, and change the name of the destination file
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6156 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a086fd6d88
commit
5b4739352e
7 changed files with 180 additions and 10 deletions
|
@ -1619,6 +1619,43 @@ std::string ftController::getPartialsDirectory()
|
|||
return mPartialsPath;
|
||||
}
|
||||
|
||||
bool ftController::setDestinationDirectory(const std::string& hash,const std::string& dest_dir)
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
std::map<std::string, ftFileControl*>::iterator it = mDownloads.find(hash);
|
||||
|
||||
if (it == mDownloads.end())
|
||||
return false;
|
||||
|
||||
std::cerr << "(II) Changing destination of file " << it->second->mDestination << std::endl;
|
||||
|
||||
it->second->mDestination = dest_dir + '/' + it->second->mName ;
|
||||
|
||||
std::cerr << "(II) ...to " << it->second->mDestination << std::endl;
|
||||
|
||||
return true ;
|
||||
}
|
||||
bool ftController::setDestinationName(const std::string& hash,const std::string& dest_name)
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
std::map<std::string, ftFileControl*>::iterator it = mDownloads.find(hash);
|
||||
|
||||
if (it == mDownloads.end())
|
||||
return false;
|
||||
|
||||
std::cerr << "(II) Changing destination of file " << it->second->mDestination << std::endl;
|
||||
|
||||
std::string dest_path ;
|
||||
RsDirUtil::removeTopDir(it->second->mDestination, dest_path); /* remove fname */
|
||||
|
||||
it->second->mDestination = dest_path + '/' + dest_name ;
|
||||
it->second->mName = dest_name ;
|
||||
|
||||
std::cerr << "(II) ...to " << it->second->mDestination << std::endl;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool ftController::FileDetails(const std::string &hash, FileInfo &info)
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
|
|
|
@ -146,6 +146,8 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
|
|||
bool FileClearCompleted();
|
||||
bool FlagFileComplete(std::string hash);
|
||||
bool getFileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info);
|
||||
bool setDestinationName(const std::string& hash,const std::string& dest_name) ;
|
||||
bool setDestinationDirectory(const std::string& hash,const std::string& dest_name) ;
|
||||
|
||||
// Download speed
|
||||
bool getPriority(const std::string& hash,DwlSpeed& p);
|
||||
|
|
|
@ -288,6 +288,14 @@ bool ftServer::FileRequest(const std::string& fname, const std::string& hash, ui
|
|||
return true ;
|
||||
}
|
||||
|
||||
bool ftServer::setDestinationName(const std::string& hash,const std::string& name)
|
||||
{
|
||||
return mFtController->setDestinationName(hash,name);
|
||||
}
|
||||
bool ftServer::setDestinationDirectory(const std::string& hash,const std::string& directory)
|
||||
{
|
||||
return mFtController->setDestinationDirectory(hash,directory);
|
||||
}
|
||||
bool ftServer::setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStrategy s)
|
||||
{
|
||||
return mFtController->setChunkStrategy(hash,s);
|
||||
|
|
|
@ -129,6 +129,8 @@ virtual bool FileRequest(const std::string& fname, const std::string& hash, uint
|
|||
virtual bool FileCancel(const std::string& hash);
|
||||
virtual bool FileControl(const std::string& hash, uint32_t flags);
|
||||
virtual bool FileClearCompleted();
|
||||
virtual bool setDestinationDirectory(const std::string& hash,const std::string& new_path) ;
|
||||
virtual bool setDestinationName(const std::string& hash,const std::string& new_name) ;
|
||||
virtual bool setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStrategy s) ;
|
||||
virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) ;
|
||||
virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue