Started implementing flags to handle the sharing mode.

What works:
- the gui shows the flags in ShareManager
- the flags are loaded/saved to ft_shared.cfg and passed on to FileIndexMonitor
What does not work yet:
- the flags are not accounted for yet by FileIndexMonitor

In addition:
- simplified the directories dialog in Preferences, so that it calls the ShareManager instead of dupplicating the directories management 
code that becomes larger.
- setup the ShareManager to be a singleton, so as to coherently call it from different places.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1486 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-08-03 19:43:52 +00:00
parent aa1658245c
commit f9dc3b223b
19 changed files with 512 additions and 313 deletions

View file

@ -62,14 +62,19 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
const uint32_t RS_FILE_HINTS_MASK = 0x00ffffff;
const uint32_t RS_FILE_HINTS_CACHE = 0x00000001;
const uint32_t RS_FILE_HINTS_EXTRA = 0x00000002;
const uint32_t RS_FILE_HINTS_LOCAL = 0x00000004;
const uint32_t RS_FILE_HINTS_REMOTE = 0x00000008;
const uint32_t RS_FILE_HINTS_DOWNLOAD= 0x00000010;
const uint32_t RS_FILE_HINTS_UPLOAD = 0x00000020;
const uint32_t RS_FILE_HINTS_TURTLE = 0x00000040;
const uint32_t RS_FILE_HINTS_CACHE = 0x00000001;
const uint32_t RS_FILE_HINTS_EXTRA = 0x00000002;
const uint32_t RS_FILE_HINTS_LOCAL = 0x00000004;
const uint32_t RS_FILE_HINTS_REMOTE = 0x00000008;
const uint32_t RS_FILE_HINTS_DOWNLOAD = 0x00000010;
const uint32_t RS_FILE_HINTS_UPLOAD = 0x00000020;
const uint32_t RS_FILE_HINTS_TURTLE = 0x00000040;
const uint32_t RS_FILE_HINTS_NETWORK_WIDE = 0x00000080; // anonymously shared over network
const uint32_t RS_FILE_HINTS_BROWSABLE = 0x00000100; // browsable by friends
//const uint32_t RS_SHARED_DIR_ANONYMOUS = 0x01 ;
//const uint32_t RS_SHARED_DIR_BROWSABLE = 0x02 ;
//const uint32_t RS_SHARED_DIR_UNIVERSAL = 0x03 ;
const uint32_t RS_FILE_HINTS_SPEC_ONLY = 0x01000000;
const uint32_t RS_FILE_HINTS_NO_SEARCH = 0x02000000;
@ -86,6 +91,11 @@ const uint32_t CB_CODE_CACHE = 0x0001;
const uint32_t CB_CODE_EXTRA = 0x0002;
const uint32_t CB_CODE_MEDIA = 0x0004;
struct SharedDirInfo
{
std::string filename ;
uint32_t shareflags ; // RS_FILE_HINTS_ANONYMOUS | RS_FILE_HINTS_BROWSABLE
};
class RsFiles
{
@ -161,8 +171,9 @@ 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 getSharedDirectories(std::list<SharedDirInfo> &dirs) = 0;
virtual bool addSharedDirectory(SharedDirInfo dir) = 0;
virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; // updates the flags. The directory should already exist !
virtual bool removeSharedDirectory(std::string dir) = 0;
virtual void setShareDownloadDirectory(bool value) = 0;