diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index 7950bb5dd..2fd96e9d0 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -359,6 +359,7 @@ void ChunkMap::getChunksInfo(FileChunksInfo& info) const info.file_size = _file_size ; info.chunk_size = _chunk_size ; info.chunks = _map ; + info.strategy = _strategy ; info.active_chunks.clear() ; diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 707f300b5..d74112e87 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -112,6 +112,7 @@ bool ftController::getFileDownloadChunksDetails(const std::string& hash,FileChun return false ; it->second.mCreator->getChunkMap(info) ; + info.flags = it->second.mFlags ; return true ; } @@ -481,9 +482,11 @@ bool ftController::completeFile(std::string hash) callbackCode = fc->mCallbackCode; mDataplex->removeTransferModule(hash_to_suppress) ; + uint32_t flgs = fc->mFlags ; mDownloads.erase(it); - mTurtle->stopMonitoringFileTunnels(hash_to_suppress) ; + if(flgs & RS_FILE_HINTS_NETWORK_WIDE) + mTurtle->stopMonitoringFileTunnels(hash_to_suppress) ; } /******* UNLOCKED ********/ @@ -773,7 +776,9 @@ bool ftController::FileRequest(std::string fname, std::string hash, else { /* do a source search - for any extra sources */ - if (mSearch->search(hash, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info)) + // add sources only in direct mode + // + if ((!(flags & RS_FILE_HINTS_NETWORK_WIDE)) && mSearch->search(hash, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info)) { /* do something with results */ #ifdef CONTROL_DEBUG @@ -840,7 +845,10 @@ bool ftController::FileRequest(std::string fname, std::string hash, if(flags & RS_FILE_HINTS_NETWORK_WIDE) mTurtle->monitorFileTunnels(fname,hash,size) ; else + { + std::cerr << "Warning: no flags supplied. Assuming availability. This is probably a bug." << std::endl ; flags |= RS_FILE_HINTS_ASSUME_AVAILABILITY ; + } bool assume_source_availability = (flags & RS_FILE_HINTS_ASSUME_AVAILABILITY) > 0 ; @@ -1498,7 +1506,7 @@ std::list ftController::saveList(bool &cleanup) rft->file.hash = fit->second.mHash; rft->file.filesize = fit->second.mSize; rft->file.path = RsDirUtil::removeTopDir(fit->second.mDestination); /* remove fname */ - //rft->flags = fit->second.mFlags; + rft->flags = fit->second.mFlags; fit->second.mTransfer->getFileSources(rft->allPeerIds.ids); @@ -1560,7 +1568,7 @@ bool ftController::loadList(std::list load) /* This will get stored on a waiting list - until the * config files are fully loaded */ - FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, 0, rsft->allPeerIds.ids); + FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, rsft->flags, rsft->allPeerIds.ids); { RsStackMutex mtx(ctrlMutex) ; diff --git a/libretroshare/src/rsiface/rstypes.h b/libretroshare/src/rsiface/rstypes.h index 91a7f030c..77d5ceba9 100644 --- a/libretroshare/src/rsiface/rstypes.h +++ b/libretroshare/src/rsiface/rstypes.h @@ -264,6 +264,8 @@ class FileChunksInfo uint64_t file_size ; // real size of the file uint32_t chunk_size ; // size of chunks + uint32_t flags ; + uint32_t strategy ; // dl state of chunks. Only the last chunk may have size < chunk_size std::vector chunks ; diff --git a/libretroshare/src/serialiser/rsconfigitems.cc b/libretroshare/src/serialiser/rsconfigitems.cc index 0e8228ef1..7cdfaf68d 100644 --- a/libretroshare/src/serialiser/rsconfigitems.cc +++ b/libretroshare/src/serialiser/rsconfigitems.cc @@ -197,6 +197,7 @@ uint32_t RsFileConfigSerialiser::sizeTransfer(RsFileTransfer *item) s += 4; /* lrate */ s += 4; /* ltransfer */ s += 4; // chunk_strategy + s += 4; // flags s += 4; // chunk map size s += 4*item->compressed_chunk_map._map.size(); // compressed_chunk_map @@ -241,6 +242,7 @@ bool RsFileConfigSerialiser::serialiseTransfer(RsFileTransfer *item, void *d ok &= setRawUInt32(data, tlvsize, &offset, item->lrate); ok &= setRawUInt32(data, tlvsize, &offset, item->ltransfer); + ok &= setRawUInt32(data, tlvsize, &offset, item->flags); ok &= setRawUInt32(data, tlvsize, &offset, item->chunk_strategy); ok &= setRawUInt32(data, tlvsize, &offset, item->compressed_chunk_map._map.size()); @@ -306,6 +308,7 @@ RsFileTransfer *RsFileConfigSerialiser::deserialiseTransfer(void *data, uint32_t ok &= getRawUInt32(data, rssize, &offset, &(item->lrate)); ok &= getRawUInt32(data, rssize, &offset, &(item->ltransfer)); + ok &= getRawUInt32(data, rssize, &offset, &(item->flags)); ok &= getRawUInt32(data, rssize, &offset, &(item->chunk_strategy)); uint32_t map_size = 0 ; ok &= getRawUInt32(data, rssize, &offset, &map_size); diff --git a/libretroshare/src/serialiser/rsconfigitems.h b/libretroshare/src/serialiser/rsconfigitems.h index 0e47bc6bd..2d736bfe2 100644 --- a/libretroshare/src/serialiser/rsconfigitems.h +++ b/libretroshare/src/serialiser/rsconfigitems.h @@ -207,6 +207,7 @@ class RsFileTransfer: public RsItem uint32_t ltransfer; // chunk information + uint32_t flags ; uint32_t chunk_strategy ; // strategy flags for chunks CompressedChunkMap compressed_chunk_map ; // chunk availability (bitwise) }; diff --git a/retroshare-gui/src/gui/FileTransferInfoWidget.cpp b/retroshare-gui/src/gui/FileTransferInfoWidget.cpp index 3ac252c8b..77f8072c4 100644 --- a/retroshare-gui/src/gui/FileTransferInfoWidget.cpp +++ b/retroshare-gui/src/gui/FileTransferInfoWidget.cpp @@ -221,6 +221,12 @@ void FileTransferInfoWidget::draw(const FileChunksInfo& info,QPainter *painter) y += text_height ; painter->drawText(20,y,tr("Number of chunks: ")) ; painter->drawText(tab_size,y,QString::number(info.chunks.size())) ; y += block_sep ; y += text_height ; painter->drawText(20,y,tr("Number of sources: ")) ; painter->drawText(tab_size,y,QString::number(info.compressed_peer_availability_maps.size())) ; + y += block_sep ; + y += text_height ; painter->drawText(20,y,tr("Chunk strategy: ")) ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ; + y += block_sep ; + y += text_height ; painter->drawText(20,y,tr("Transfer type: ")) ; + if(info.flags & RS_FILE_HINTS_NETWORK_WIDE) painter->drawText(tab_size,y,"Anonymous F2F") ; + if(info.flags & RS_FILE_HINTS_ASSUME_AVAILABILITY) painter->drawText(tab_size,y,"Direct friend transfer / Availability assumed") ; y += text_height ; y += block_sep ; diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index 4baed5c28..43092589c 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -258,7 +258,13 @@ void SearchDialog::download() std::cerr << "SearchDialog::download() Calling File Request"; std::cerr << std::endl; std::list srcIds; +#ifdef SUSPENDED + // I suspend this. For turtle F2F download, we dont' need sources: + // - if we put sources, they make double with some tunnels. + // - they won't transfer because ASSUME_AVAILABILITY can't be used, + // and no chunk maps are transfered except in tunnels. srcIds.push_back(item->text(SR_UID_COL).toStdString()) ; +#endif if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), (item->text(SR_HASH_COL)).toStdString(), @@ -283,7 +289,9 @@ void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString { if (!item->childCount()) { std::list srcIds; +#ifdef SUSPENDED srcIds.push_back(item->text(SR_UID_COL).toStdString()); +#endif QString path = QString::fromStdString(rsFiles->getDownloadDirectory()) + tr("/") + base + tr("/"); diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index c6a6aa6f9..4c7864e70 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -23,6 +23,7 @@ #include #endif +#include #include "rshare.h" #include "TransfersDialog.h" @@ -241,14 +242,18 @@ void TransfersDialog::keyPressEvent(QKeyEvent *e) void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) { + QMenu contextMnu( this ); + QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); - QMenu contextMnu( this ); - QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); + std::set items; + std::set::iterator it; + getIdOfSelectedItems(items); + bool single = (items.size() == 1) ; - /* check which item is selected - * - if it is completed - play should appear in menu - */ + /* check which item is selected + * - if it is completed - play should appear in menu + */ std::cerr << "TransfersDialog::downloadListCostumPopupMenu()" << std::endl; bool addPlayOption = false; @@ -266,112 +271,142 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) } } } - QAction *playAct = NULL; + QAction *playAct = NULL; if (addPlayOption) { - playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this ); - connect( playAct , SIGNAL( triggered() ), this, SLOT( playSelectedTransfer() ) ); + playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this ); + connect( playAct , SIGNAL( triggered() ), this, SLOT( playSelectedTransfer() ) ); } - QAction *detailsAct = NULL; - pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this); - connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer())); - resumeAct = new QAction(QIcon(IMAGE_RESUME), tr("Resume"), this); - connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer())); + QAction *detailsAct = NULL; + pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this); + connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer())); - cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this ); - connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) ); + resumeAct = new QAction(QIcon(IMAGE_RESUME), tr("Resume"), this); + connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer())); - openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this); - connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer())); + cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this ); + connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) ); - openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this); - connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer())); + openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this); + connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer())); - previewfileAct = new QAction(QIcon(IMAGE_PREVIEW), tr("Preview File"), this); - connect(previewfileAct, SIGNAL(triggered()), this, SLOT(previewTransfer())); - - detailsfileAct = new QAction(QIcon(IMAGE_INFO), tr("Details..."), this); - connect(detailsfileAct, SIGNAL(triggered()), this, SLOT(showDetailsDialog())); + openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this); + connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer())); - clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this ); - connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) ); + previewfileAct = new QAction(QIcon(IMAGE_PREVIEW), tr("Preview File"), this); + connect(previewfileAct, SIGNAL(triggered()), this, SLOT(previewTransfer())); - copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this ); - connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) ); + detailsfileAct = new QAction(QIcon(IMAGE_INFO), tr("Details..."), this); + connect(detailsfileAct, SIGNAL(triggered()), this, SLOT(showDetailsDialog())); - pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this ); - connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) ); + clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this ); + connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) ); - rootisnotdecoratedAct = new QAction(QIcon(), tr( "Set Root is not Decorated" ), this ); - connect( rootisnotdecoratedAct , SIGNAL( triggered() ), this, SLOT( rootisnotdecorated() ) ); +#ifndef RS_RELEASE_VERSION + copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this ); + connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) ); +#endif - rootisdecoratedAct = new QAction(QIcon(), tr( "Set Root is Decorated" ), this ); - connect( rootisdecoratedAct , SIGNAL( triggered() ), this, SLOT( rootdecorated() ) ); + pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this ); + connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) ); - QMenu *viewMenu = new QMenu( tr("View"), this ); - viewMenu->addAction(rootisnotdecoratedAct); - viewMenu->addAction(rootisdecoratedAct); + rootisnotdecoratedAct = new QAction(QIcon(), tr( "Set Root is not Decorated" ), this ); + connect( rootisnotdecoratedAct , SIGNAL( triggered() ), this, SLOT( rootisnotdecorated() ) ); - clearQueuedDwlAct = new QAction(QIcon(), tr("Clear from Queue"), this); - connect(clearQueuedDwlAct, SIGNAL(triggered()), this, SLOT(clearQueuedDwl())); - clearQueueAct = new QAction(QIcon(), tr("Clear Queue"), this); - connect(clearQueueAct, SIGNAL(triggered()), this, SLOT(clearQueue())); + rootisdecoratedAct = new QAction(QIcon(), tr( "Set Root is Decorated" ), this ); + connect( rootisdecoratedAct , SIGNAL( triggered() ), this, SLOT( rootdecorated() ) ); - priorityLowAct = new QAction(QIcon(IMAGE_PRIORITYLOW), tr("Low"), this); - connect(priorityLowAct, SIGNAL(triggered()), this, SLOT(priorityLow())); - priorityNormalAct = new QAction(QIcon(IMAGE_PRIORITYNORMAL), tr("Normal"), this); - connect(priorityNormalAct, SIGNAL(triggered()), this, SLOT(priorityNormal())); - priorityHighAct = new QAction(QIcon(IMAGE_PRIORITYHIGH), tr("High"), this); - connect(priorityHighAct, SIGNAL(triggered()), this, SLOT(priorityHigh())); - priorityAutoAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Auto"), this); - connect(priorityAutoAct, SIGNAL(triggered()), this, SLOT(priorityAuto())); + QMenu *viewMenu = new QMenu( tr("View"), this ); + viewMenu->addAction(rootisnotdecoratedAct); + viewMenu->addAction(rootisdecoratedAct); - QMenu *priorityMenu = new QMenu(tr("Priority (Download)"), this); - priorityMenu->setIcon(QIcon(IMAGE_PRIORITY)); - priorityMenu->addAction(priorityLowAct); - priorityMenu->addAction(priorityNormalAct); - priorityMenu->addAction(priorityHighAct); - priorityMenu->addAction(priorityAutoAct); + clearQueuedDwlAct = new QAction(QIcon(), tr("Clear from Queue"), this); + connect(clearQueuedDwlAct, SIGNAL(triggered()), this, SLOT(clearQueuedDwl())); + clearQueueAct = new QAction(QIcon(), tr("Clear Queue"), this); + connect(clearQueueAct, SIGNAL(triggered()), this, SLOT(clearQueue())); - chunkStreamingAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Streaming"), this); - connect(chunkStreamingAct, SIGNAL(triggered()), this, SLOT(chunkStreaming())); - chunkRandomAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Random"), this); - connect(chunkRandomAct, SIGNAL(triggered()), this, SLOT(chunkRandom())); + priorityLowAct = new QAction(QIcon(IMAGE_PRIORITYLOW), tr("Low"), this); + connect(priorityLowAct, SIGNAL(triggered()), this, SLOT(priorityLow())); + priorityNormalAct = new QAction(QIcon(IMAGE_PRIORITYNORMAL), tr("Normal"), this); + connect(priorityNormalAct, SIGNAL(triggered()), this, SLOT(priorityNormal())); + priorityHighAct = new QAction(QIcon(IMAGE_PRIORITYHIGH), tr("High"), this); + connect(priorityHighAct, SIGNAL(triggered()), this, SLOT(priorityHigh())); + priorityAutoAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Auto"), this); + connect(priorityAutoAct, SIGNAL(triggered()), this, SLOT(priorityAuto())); - QMenu *chunkMenu = new QMenu(tr("Chunk strategy"), this); - chunkMenu->setIcon(QIcon(IMAGE_PRIORITY)); - chunkMenu->addAction(chunkStreamingAct); - chunkMenu->addAction(chunkRandomAct); + QMenu *priorityMenu = new QMenu(tr("Priority (Download)"), this); + priorityMenu->setIcon(QIcon(IMAGE_PRIORITY)); + priorityMenu->addAction(priorityLowAct); + priorityMenu->addAction(priorityNormalAct); + priorityMenu->addAction(priorityHighAct); + priorityMenu->addAction(priorityAutoAct); - contextMnu.clear(); - if (addPlayOption) - { - contextMnu.addAction(playAct); - } - contextMnu.addSeparator(); - contextMnu.addMenu( priorityMenu); - contextMnu.addMenu( chunkMenu); - contextMnu.addAction( pauseAct); - contextMnu.addAction( resumeAct); - contextMnu.addAction( cancelAct); - contextMnu.addSeparator(); - contextMnu.addAction( openfileAct); - contextMnu.addAction( previewfileAct); - contextMnu.addAction( openfolderAct); - contextMnu.addAction( detailsfileAct); - contextMnu.addSeparator(); - contextMnu.addAction( clearcompletedAct); - contextMnu.addSeparator(); - contextMnu.addAction( copylinkAct); - contextMnu.addAction( pastelinkAct); - contextMnu.addSeparator(); - contextMnu.addAction( clearQueuedDwlAct); - contextMnu.addAction( clearQueueAct); - contextMnu.addSeparator(); - contextMnu.addMenu( viewMenu); + chunkStreamingAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Streaming"), this); + connect(chunkStreamingAct, SIGNAL(triggered()), this, SLOT(chunkStreaming())); + chunkRandomAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Random"), this); + connect(chunkRandomAct, SIGNAL(triggered()), this, SLOT(chunkRandom())); - contextMnu.exec( mevent->globalPos() ); + QMenu *chunkMenu = new QMenu(tr("Chunk strategy"), this); + chunkMenu->setIcon(QIcon(IMAGE_PRIORITY)); + chunkMenu->addAction(chunkStreamingAct); + chunkMenu->addAction(chunkRandomAct); + + contextMnu.clear(); + if (addPlayOption) + { + contextMnu.addAction(playAct); + } + contextMnu.addSeparator(); + + if(!items.empty()) + { + bool all_paused = true ; + bool all_downld = true ; + + QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes (); + + for (int i = 0; i < lst.count (); i++) + { + if ( lst[i].column() == 0 && lst[i].model ()->data (lst[i].model ()->index (lst[i].row (), STATUS )).toString() == "Waiting") + all_downld = false ; + if ( lst[i].column() == 0 && lst[i].model ()->data (lst[i].model ()->index (lst[i].row (), STATUS )).toString() == "Downloading") + all_paused = false ; + } + + contextMnu.addMenu( priorityMenu); + contextMnu.addMenu( chunkMenu); + + if(!all_paused) + contextMnu.addAction( pauseAct); + if(!all_downld) + contextMnu.addAction( resumeAct); + contextMnu.addAction( cancelAct); + contextMnu.addSeparator(); + } +#ifndef RS_RELEASE_VERSION + if(single) + { + contextMnu.addAction( openfileAct); + contextMnu.addAction( previewfileAct); + contextMnu.addAction( openfolderAct); + contextMnu.addAction( detailsfileAct); + contextMnu.addSeparator(); + } +#endif + contextMnu.addAction( clearcompletedAct); + contextMnu.addSeparator(); +#ifndef RS_RELEASE_VERSION + contextMnu.addAction( copylinkAct); +#endif + contextMnu.addAction( pastelinkAct); + contextMnu.addSeparator(); + contextMnu.addAction( clearQueuedDwlAct); + contextMnu.addAction( clearQueueAct); + contextMnu.addSeparator(); + contextMnu.addMenu( viewMenu); + + contextMnu.exec( mevent->globalPos() ); } void TransfersDialog::playSelectedTransfer() @@ -1201,7 +1236,7 @@ void TransfersDialog::pasteLink() } } -void TransfersDialog::getIdOfSelectedItems(QList& items) +void TransfersDialog::getIdOfSelectedItems(std::set& items) { items.clear(); @@ -1230,7 +1265,7 @@ void TransfersDialog::getIdOfSelectedItems(QList& items) /* if transfered file or it's peers are selected control it*/ if (isParentSelected || isChildSelected) { QStandardItem *id = DLListModel->item(i, ID); - items.append(id); + items.insert(id); } } } @@ -1239,8 +1274,8 @@ bool TransfersDialog::controlTransferFile(uint32_t flags) { bool result = true; - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { result &= rsFiles->FileControl((*it)->data(Qt::DisplayRole).toString().toStdString(), flags); @@ -1269,8 +1304,8 @@ void TransfersDialog::openFolderTransfer() { FileInfo info; - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue; @@ -1299,8 +1334,8 @@ void TransfersDialog::previewTransfer() { FileInfo info; - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue; @@ -1359,8 +1394,8 @@ void TransfersDialog::openTransfer() { FileInfo info; - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue; @@ -1390,8 +1425,8 @@ void TransfersDialog::openTransfer() /* clear download or all queue - for pending dwls */ void TransfersDialog::clearQueuedDwl() { - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { @@ -1414,8 +1449,8 @@ void TransfersDialog::chunkRandom() } void TransfersDialog::setChunkStrategy(FileChunksInfo::ChunkStrategy s) { - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { @@ -1443,8 +1478,8 @@ void TransfersDialog::priorityAuto() void TransfersDialog::changePriority(int priority) { - QList items; - QList::iterator it; + std::set items; + std::set::iterator it; getIdOfSelectedItems(items); for (it = items.begin(); it != items.end(); it ++) { diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index ebf5d77b2..d9b1bf371 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -22,6 +22,8 @@ #ifndef _TRANSFERSDIALOG_H #define _TRANSFERSDIALOG_H +#include + #include #include #include @@ -152,7 +154,7 @@ class TransfersDialog : public RsAutoUpdatePage QAction *chunkStreamingAct; QAction *detailsfileAct; - void getIdOfSelectedItems(QList& items); + void getIdOfSelectedItems(std::set& items); bool controlTransferFile(uint32_t flags); void changePriority(int priority); void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;