From f9b22cc5d2f6c7c86c5bf7f9f43ba34dd78567d6 Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 17 Aug 2008 16:14:03 +0000 Subject: [PATCH] Updated interface files. Added SrcIds to FileRequests(). git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@699 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MessagesDialog.cpp | 4 ++-- retroshare-gui/src/gui/SearchDialog.cpp | 3 ++- retroshare-gui/src/gui/feeds/SubFileItem.cpp | 4 +++- retroshare-gui/src/rsiface/RemoteDirModel.cpp | 8 +++++-- retroshare-gui/src/rsiface/rsfiles.h | 24 +++++++++++-------- retroshare-gui/src/rsiface/rstypes.h | 4 ++++ 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 1648657b0..5814a1aee 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -289,8 +289,8 @@ void MessagesDialog::getallrecommended() { std::cerr << "MessagesDialog::getallrecommended() Calling File Request"; std::cerr << std::endl; - - rsFiles -> FileRequest(*fit, *hit, *sit, "", 0); + std::list srcIds; + rsFiles -> FileRequest(*fit, *hit, *sit, "", 0, srcIds); } } diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index 7d27b7e36..a4c065bb8 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -229,10 +229,11 @@ void SearchDialog::download() { std::cerr << "SearchDialog::download() Calling File Request"; std::cerr << std::endl; + std::list srcIds; rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), (item->text(SR_HASH_COL)).toStdString(), (item->text(SR_SIZE_COL)).toInt(), - "", 0); + "", 0, srcIds); } else { diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index 028c7df15..f32be9c31 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -540,7 +540,9 @@ void SubFileItem::download() // TEMP std::cerr << "SubFileItem::download() Calling File Request"; std::cerr << std::endl; - rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", 0); + std::list srcIds; + srcIds.push_back(mSrcId); + rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", 0, srcIds); } diff --git a/retroshare-gui/src/rsiface/RemoteDirModel.cpp b/retroshare-gui/src/rsiface/RemoteDirModel.cpp index db2d19e78..a61bca9c9 100644 --- a/retroshare-gui/src/rsiface/RemoteDirModel.cpp +++ b/retroshare-gui/src/rsiface/RemoteDirModel.cpp @@ -152,11 +152,12 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent) return QVariant(); } +#if 0 /*if (role == Qt::BackgroundRole) {*/ /*** colour entries based on rank/age/count **/ /*** rank (0-10) ***/ - /*uint32_t r = details.rank; + / *uint32_t r = details.rank; if (r > 10) r = 10; r = 200 + r * 5; /* 0->250 */ @@ -225,6 +226,7 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent) return QVariant(); } }*/ +#endif if (role == Qt::DecorationRole) { @@ -694,8 +696,10 @@ void RemoteDirModel::downloadSelected(QModelIndexList list) { std::cerr << "RemoteDirModel::downloadSelected() Calling File Request"; std::cerr << std::endl; + std::list srcIds; + srcIds.push_back(details.id); rsFiles -> FileRequest(details.name, details.hash, - details.count, "", 0); + details.count, "", 0, srcIds); } } } diff --git a/retroshare-gui/src/rsiface/rsfiles.h b/retroshare-gui/src/rsiface/rsfiles.h index 0daca7d35..0745070d3 100644 --- a/retroshare-gui/src/rsiface/rsfiles.h +++ b/retroshare-gui/src/rsiface/rsfiles.h @@ -38,16 +38,19 @@ extern RsFiles *rsFiles; class Expression; -const uint32_t RS_FILE_CTRL_PAUSE = 0x0100; -const uint32_t RS_FILE_CTRL_START = 0x0200; +/* These are used mainly by ftController at the moment */ +const uint32_t RS_FILE_CTRL_PAUSE = 0x00000100; +const uint32_t RS_FILE_CTRL_START = 0x00000200; -const uint32_t RS_FILE_CTRL_TRICKLE = 0x0001; -const uint32_t RS_FILE_CTRL_SLOW = 0x0002; -const uint32_t RS_FILE_CTRL_STANDARD = 0x0003; -const uint32_t RS_FILE_CTRL_FAST = 0x0004; -const uint32_t RS_FILE_CTRL_STREAM_AUDIO = 0x0005; -const uint32_t RS_FILE_CTRL_STREAM_VIDEO = 0x0006; +const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001; +const uint32_t RS_FILE_RATE_SLOW = 0x00000002; +const uint32_t RS_FILE_RATE_STANDARD = 0x00000003; +const uint32_t RS_FILE_RATE_FAST = 0x00000004; +const uint32_t RS_FILE_RATE_STREAM_AUDIO = 0x00000005; +const uint32_t RS_FILE_RATE_STREAM_VIDEO = 0x00000006; +const uint32_t RS_FILE_PEER_ONLINE = 0x00001000; +const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000; /************************************ * Used To indicate where to search. @@ -67,6 +70,7 @@ const uint32_t RS_FILE_HINTS_DOWNLOAD = 0x00000010; const uint32_t RS_FILE_HINTS_UPLOAD = 0x00000020; const uint32_t RS_FILE_HINTS_SPEC_ONLY = 0x01000000; +const uint32_t RS_FILE_HINTS_NO_SEARCH = 0x02000000; const uint32_t RS_FILE_EXTRA_DELETE = 0x0010; @@ -86,8 +90,8 @@ virtual ~RsFiles() { return; } /*** * Control of Downloads. ***/ -virtual bool FileRequest(std::string fname, std::string hash, - uint32_t size, std::string dest, uint32_t flags) = 0; +virtual bool FileRequest(std::string fname, std::string hash, uint32_t size, + std::string dest, uint32_t flags, std::list srcIds) = 0; virtual bool FileCancel(std::string hash) = 0; virtual bool FileControl(std::string hash, uint32_t flags) = 0; virtual bool FileClearCompleted() = 0; diff --git a/retroshare-gui/src/rsiface/rstypes.h b/retroshare-gui/src/rsiface/rstypes.h index c350e4441..39094509f 100644 --- a/retroshare-gui/src/rsiface/rstypes.h +++ b/retroshare-gui/src/rsiface/rstypes.h @@ -105,6 +105,10 @@ class FileTransferInfo: public FileInfo FileTransferInfo() { return; } }; + +std::ostream &operator<<(std::ostream &out, const FileInfo &info); + + /* matched to the uPnP states */ #define UPNP_STATE_UNINITIALISED 0 #define UPNP_STATE_UNAVAILABILE 1