mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
- Added a parent page widget (class RsAutoUpdatePage) to handle auto-update. The page updates using a timer, only wh
en visible, and each time it gets showed. I already made some RS pages derive from this page. - Modified and renamed the taskGraphPainterWidget to display info about currently selected file transfers. For know, it only shows file chunks info, but we should use it to display additional info about the transfer. Warning: in its current state, only fake chunk info is displayed. - Suppressed p3files.h, because it is not used. Remains to do (in order): - Implement a chunk map class in ft/ to properly manage which chunks should be downloaded - Display correct chunk info by requesting the transfer's chunk map - Add check-sum verification of chunks - allow RS to import a partially downloaded file by force re-checking chunks - Add chunk map exchange from file source peer id to file destination peer id. - Manage chunks from different peers. - Allow search (turtle search) for partially downloaded files git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1832 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
36c2a726fa
commit
506f14eb2f
28 changed files with 368 additions and 1215 deletions
|
@ -305,6 +305,21 @@ void ftServer::getDwlDetails(std::list<DwlDetails> & details)
|
|||
mFtDwlQueue->getDwlDetails(details);
|
||||
}
|
||||
|
||||
bool ftServer::FileChunksDetails(const std::string& hash,FileChunksInfo& info)
|
||||
{
|
||||
// for know put some dummy info. It's for display sake only.
|
||||
info.chunk_size = 1024*1024 ;
|
||||
info.file_size = 250*info.chunk_size - 123 ; // last chunk is not complete.
|
||||
info.chunks.resize(250,FileChunksInfo::CHUNK_DONE) ;
|
||||
int n = rand()%150 + 50 ;
|
||||
for(int i=0;i<10;++i)
|
||||
info.chunks[n+i] = FileChunksInfo::CHUNK_ACTIVE ;
|
||||
for(int i=n+10;i<250;++i)
|
||||
info.chunks[i] = FileChunksInfo::CHUNK_OUTSTANDING ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
/* Directory Handling */
|
||||
void ftServer::setDownloadDirectory(std::string path)
|
||||
{
|
||||
|
|
|
@ -137,6 +137,7 @@ virtual void getDwlDetails(std::list<DwlDetails> & details);
|
|||
virtual bool FileDownloads(std::list<std::string> &hashs);
|
||||
virtual bool FileUploads(std::list<std::string> &hashs);
|
||||
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info);
|
||||
virtual bool FileChunksDetails(const std::string& hash,FileChunksInfo& info) ;
|
||||
|
||||
/***
|
||||
* Extra List Access
|
||||
|
|
|
@ -128,6 +128,7 @@ virtual void getDwlDetails(std::list<DwlDetails> & details) = 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;
|
||||
virtual bool FileChunksDetails(const std::string& hash,FileChunksInfo& info) = 0 ;
|
||||
|
||||
/***
|
||||
* Extra List Access
|
||||
|
|
|
@ -208,7 +208,7 @@ class NotifyBase
|
|||
virtual void notifyOwnAvatarChanged() {}
|
||||
virtual void notifyOwnStatusMessageChanged() {}
|
||||
|
||||
virtual std::string askForPassword(const std::string& window_title,const std::string& text) {}
|
||||
virtual std::string askForPassword(const std::string& window_title,const std::string& text) { return "" ;}
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
|
|
@ -132,6 +132,7 @@ virtual bool getOthersList(std::list<std::string> &ids) = 0;
|
|||
virtual bool isOnline(std::string id) = 0;
|
||||
virtual bool isFriend(std::string id) = 0;
|
||||
virtual std::string getPeerName(std::string id) = 0;
|
||||
virtual std::string getPeerPGPName(std::string pgp_id) = 0;
|
||||
virtual bool getPeerDetails(std::string id, RsPeerDetails &d) = 0;
|
||||
|
||||
/* Using PGP Ids */
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
@ -247,6 +248,16 @@ class FileDetail
|
|||
|
||||
enum DwlPriority { Low = 0, Normal, High, Auto };
|
||||
|
||||
class FileChunksInfo
|
||||
{
|
||||
public:
|
||||
enum ChunkState { CHUNK_DONE, CHUNK_ACTIVE, CHUNK_OUTSTANDING } ;
|
||||
|
||||
uint64_t file_size ; // real size of the file
|
||||
uint32_t chunk_size ; // size of chunks
|
||||
std::vector<ChunkState> chunks ; // dl state of chunks. Only the last chunk may have size < chunk_size
|
||||
};
|
||||
|
||||
/* class which encapsulates download details */
|
||||
class DwlDetails {
|
||||
public:
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
#ifndef P3_FILES_TMP_INTERFACE_H
|
||||
#define P3_FILES_TMP_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsserver: p3files.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
class filedexserver;
|
||||
class RsServer;
|
||||
class p3AuthMgr;
|
||||
|
||||
class p3Files: public RsFiles
|
||||
{
|
||||
public:
|
||||
|
||||
p3Files(filedexserver *s, RsServer *c, p3AuthMgr *a)
|
||||
:mServer(s), mCore(c), mAuthMgr(a) { return; }
|
||||
|
||||
virtual ~p3Files() { return; }
|
||||
|
||||
/****************************************/
|
||||
/* 1) Access to downloading / uploading files. */
|
||||
|
||||
virtual bool FileDownloads(std::list<std::string> &hashs);
|
||||
virtual bool FileUploads(std::list<std::string> &hashs);
|
||||
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info);
|
||||
|
||||
/* 2) Control of Downloads. */
|
||||
virtual bool FileRequest(std::string fname, std::string hash, uint64_t size,
|
||||
std::string dest, uint32_t flags,
|
||||
std::list<std::string> srcIds);
|
||||
virtual bool FileCancel(std::string hash);
|
||||
virtual bool FileControl(std::string hash, uint32_t flags);
|
||||
virtual bool FileClearCompleted();
|
||||
|
||||
/* 3) Addition of Extra Files... From File System */
|
||||
|
||||
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
|
||||
uint32_t period, uint32_t flags);
|
||||
virtual bool ExtraFileRemove(std::string hash, uint32_t flags);
|
||||
virtual bool ExtraFileHash(std::string localpath,
|
||||
uint32_t period, uint32_t flags);
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
||||
|
||||
/* 4) Search and Listing Interface */
|
||||
|
||||
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details);
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags);
|
||||
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results);
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results);
|
||||
|
||||
/* 5) Utility Functions. */
|
||||
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
|
||||
virtual void ForceDirectoryCheck();
|
||||
virtual bool InDirectoryCheck();
|
||||
|
||||
|
||||
virtual void setDownloadDirectory(std::string path);
|
||||
virtual void setPartialsDirectory(std::string path);
|
||||
virtual std::string getDownloadDirectory();
|
||||
virtual std::string getPartialsDirectory();
|
||||
|
||||
virtual bool getSharedDirectories(std::list<std::string> &dirs);
|
||||
virtual bool addSharedDirectory(std::string dir);
|
||||
virtual bool removeSharedDirectory(std::string dir);
|
||||
|
||||
|
||||
/* Update functions! */
|
||||
int UpdateAllTransfers();
|
||||
|
||||
private:
|
||||
|
||||
void lockRsCore();
|
||||
void unlockRsCore();
|
||||
|
||||
filedexserver *mServer;
|
||||
RsServer *mCore;
|
||||
p3AuthMgr *mAuthMgr;
|
||||
|
||||
RsMutex fMutex;
|
||||
std::map<std::string, FileInfo> mTransfers;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -465,6 +465,12 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
|||
}
|
||||
|
||||
|
||||
std::string p3Peers::getPeerPGPName(std::string id)
|
||||
{
|
||||
/* get from mAuthMgr as it should have more peers? */
|
||||
return mAuthMgr->getIssuerName(id);
|
||||
}
|
||||
|
||||
std::string p3Peers::getPeerName(std::string id)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
|
|
|
@ -50,6 +50,7 @@ virtual bool getOthersList(std::list<std::string> &ids);
|
|||
|
||||
virtual bool isOnline(std::string id);
|
||||
virtual bool isFriend(std::string id);
|
||||
virtual std::string getPeerPGPName(std::string pgp_id);
|
||||
virtual std::string getPeerName(std::string id);
|
||||
virtual bool getPeerDetails(std::string id, RsPeerDetails &d);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue