From fc320cf1a61529bfc2924bc46e3162b525202425 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 6 Oct 2010 00:08:20 +0000 Subject: [PATCH] Fixed drag'n'drop of shared files from the SharedFilesDialog to the CreateChannelMsg. Enabled the usage of remote files. Added some small const& to the code. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3619 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/channels/CreateChannelMsg.cpp | 10 +++------- retroshare-gui/src/gui/channels/CreateChannelMsg.h | 9 +++------ retroshare-gui/src/gui/feeds/SubFileItem.cpp | 6 ++---- retroshare-gui/src/gui/feeds/SubFileItem.h | 3 +-- retroshare-gui/src/gui/settings/ServerPage.cpp | 9 +++++---- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp b/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp index 142926fb8..de98d4226 100644 --- a/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp +++ b/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp @@ -152,7 +152,6 @@ void CreateChannelMsg::dropEvent(QDropEvent *event) std::cerr << "CreateChannelMsg::dropEvent() Application/x-rsfilelist"; std::cerr << std::endl; - QByteArray data = event->mimeData()->data("application/x-rsfilelist"); std::cerr << "Data Len:" << data.length(); std::cerr << std::endl; @@ -162,13 +161,12 @@ void CreateChannelMsg::dropEvent(QDropEvent *event) std::string newattachments(data.data()); parseRsFileListAttachments(newattachments); } - event->setDropAction(Qt::CopyAction); event->accept(); } -void CreateChannelMsg::parseRsFileListAttachments(std::string attachList) +void CreateChannelMsg::parseRsFileListAttachments(const std::string &attachList) { /* split into lines */ QString input = QString::fromStdString(attachList); @@ -244,7 +242,7 @@ void CreateChannelMsg::parseRsFileListAttachments(std::string attachList) } -void CreateChannelMsg::addAttachment(std::string hash, std::string fname, uint64_t size, bool local, std::string srcId) +void CreateChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId) { /* add a SubFileItem to the attachment section */ std::cerr << "CreateChannelMsg::addAttachment()"; @@ -260,8 +258,6 @@ void CreateChannelMsg::addAttachment(std::string hash, std::string fname, uint64 else { flags |= SFI_STATE_REMOTE; - // TMP REMOVED REMOTE ADD FOR DEMONSTRATOR - return; } SubFileItem *file = new SubFileItem(hash, fname, "", size, flags, srcId); // destroyed when fileFrame (this subfileitem) is destroyed @@ -296,7 +292,7 @@ void CreateChannelMsg::addExtraFile() } -void CreateChannelMsg::addAttachment(std::string path) +void CreateChannelMsg::addAttachment(const std::string &path) { /* add a SubFileItem to the attachment section */ std::cerr << "CreateChannelMsg::addAttachment()"; diff --git a/retroshare-gui/src/gui/channels/CreateChannelMsg.h b/retroshare-gui/src/gui/channels/CreateChannelMsg.h index 6df189ee2..964420db8 100644 --- a/retroshare-gui/src/gui/channels/CreateChannelMsg.h +++ b/retroshare-gui/src/gui/channels/CreateChannelMsg.h @@ -37,9 +37,8 @@ public: CreateChannelMsg(std::string cId); /** Default Destructor */ - void addAttachment(std::string path); - void addAttachment(std::string hash, std::string fname, uint64_t size, - bool local, std::string srcId); + void addAttachment(const std::string &path); + void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId); void newChannelMsg(); @@ -60,7 +59,7 @@ private slots: private: - void parseRsFileListAttachments(std::string attachList); + void parseRsFileListAttachments(const std::string &attachList); void sendMessage(std::wstring subject, std::wstring msg, std::list &files); @@ -71,7 +70,5 @@ private: bool mCheckAttachment; }; - - #endif diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index 8824d6079..8725cb893 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -66,8 +66,7 @@ const uint32_t SFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */ /** Constructor */ -SubFileItem::SubFileItem(std::string hash, std::string name, std::string path, uint64_t size, - uint32_t flags, std::string srcId) +SubFileItem::SubFileItem(const std::string &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const std::string &srcId) :QWidget(NULL), mPath(path), mFileHash(hash), mFileName(name), mFileSize(size), mSrcId(srcId) { /* Invoke the Qt Designer generated object setup routine */ @@ -182,8 +181,7 @@ void SubFileItem::updateItemStatic() if (mPath == "") { FileInfo fi; - uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL - | RS_FILE_HINTS_SPEC_ONLY; + uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE; /* look up path */ if (!rsFiles->FileDetails(mFileHash, hintflags, fi)) diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.h b/retroshare-gui/src/gui/feeds/SubFileItem.h index 16b8a3ab6..e6df56157 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.h +++ b/retroshare-gui/src/gui/feeds/SubFileItem.h @@ -52,8 +52,7 @@ class SubFileItem : public QWidget, private Ui::SubFileItem public: /** Default Constructor */ - SubFileItem(std::string hash, std::string name, std::string path, uint64_t size, - uint32_t flags, std::string srcId); + SubFileItem(const std::string &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const std::string &srcId); /** Default Destructor */ diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 1eff8ff9a..eb423f535 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -260,13 +260,14 @@ void ServerPage::saveAddresses() if (saveAddr) { - rsPeers->setLocalAddress(rsPeers->getOwnId(), ui.localAddress->text().toStdString(), ui.localPort->value()); - rsPeers->setExtAddress(rsPeers->getOwnId(), ui.extAddress->text().toStdString(), ui.extPort->value()); + rsPeers->setLocalAddress(ownId, ui.localAddress->text().toStdString(), ui.localPort->value()); + rsPeers->setExtAddress(ownId, ui.extAddress->text().toStdString(), ui.extPort->value()); } - rsPeers->setDynDNS(rsPeers->getOwnId(), ui.dynDNS->text().toStdString()); + rsPeers->setDynDNS(ownId, ui.dynDNS->text().toStdString()); + + rsicontrol->ConfigSetDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() ); - rsicontrol->ConfigSetDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() ); load(); }