mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 00:19:30 -05:00
-when a file is downloaded through different peers, all peers are put together
under a single root line. line is click-able, when collapsed it displays all download peers -sources column shows number of peers as online (offline) -name column for root/peer shows filename/peername git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1261 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4694ff22d5
commit
3d37a0c242
@ -15,7 +15,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
@ -72,35 +72,37 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
ui.downloadList->hideColumn(ID);
|
||||
DLDelegate = new DLListDelegate();
|
||||
ui.downloadList->setItemDelegate(DLDelegate);
|
||||
|
||||
|
||||
ui.downloadList->setAutoScroll(false) ;
|
||||
|
||||
|
||||
//Selection Setup
|
||||
selection = ui.downloadList->selectionModel();
|
||||
|
||||
|
||||
ui.downloadList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
|
||||
ui.downloadList->setRootIsDecorated(true);
|
||||
|
||||
|
||||
/* Set header resize modes and initial section sizes Downloads TreeView*/
|
||||
QHeaderView * _header = ui.downloadList->header () ;
|
||||
_header->setResizeMode (NAME, QHeaderView::Interactive);
|
||||
_header->setResizeMode (SIZE, QHeaderView::Interactive);
|
||||
_header->setResizeMode (COMPLETED, QHeaderView::Interactive);
|
||||
_header->setResizeMode (DLSPEED, QHeaderView::Interactive);
|
||||
_header->setResizeMode (PROGRESS, QHeaderView::Interactive);
|
||||
_header->setResizeMode (SOURCES, QHeaderView::Interactive);
|
||||
_header->setResizeMode (STATUS, QHeaderView::Interactive);
|
||||
_header->setResizeMode (REMAINING, QHeaderView::Interactive);
|
||||
|
||||
_header->resizeSection ( NAME, 170 );
|
||||
_header->resizeSection ( SIZE, 70 );
|
||||
_header->resizeSection ( COMPLETED, 75 );
|
||||
_header->resizeSection ( DLSPEED, 75 );
|
||||
_header->setResizeMode (NAME, QHeaderView::Interactive);
|
||||
_header->setResizeMode (SIZE, QHeaderView::Interactive);
|
||||
_header->setResizeMode (COMPLETED, QHeaderView::Interactive);
|
||||
_header->setResizeMode (DLSPEED, QHeaderView::Interactive);
|
||||
_header->setResizeMode (PROGRESS, QHeaderView::Interactive);
|
||||
_header->setResizeMode (SOURCES, QHeaderView::Interactive);
|
||||
_header->setResizeMode (STATUS, QHeaderView::Interactive);
|
||||
_header->setResizeMode (REMAINING, QHeaderView::Interactive);
|
||||
|
||||
_header->resizeSection ( NAME, 170 );
|
||||
_header->resizeSection ( SIZE, 70 );
|
||||
_header->resizeSection ( COMPLETED, 75 );
|
||||
_header->resizeSection ( DLSPEED, 75 );
|
||||
_header->resizeSection ( PROGRESS, 170 );
|
||||
_header->resizeSection ( SOURCES, 90 );
|
||||
_header->resizeSection ( STATUS, 100 );
|
||||
_header->resizeSection ( REMAINING, 100 );
|
||||
|
||||
_header->resizeSection ( SOURCES, 90 );
|
||||
_header->resizeSection ( STATUS, 100 );
|
||||
_header->resizeSection ( REMAINING, 100 );
|
||||
|
||||
// Set Upload list model
|
||||
ULListModel = new QStandardItemModel(0,7);
|
||||
ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
||||
@ -113,13 +115,16 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
ui.uploadsList->setModel(ULListModel);
|
||||
ULDelegate = new ULListDelegate();
|
||||
ui.uploadsList->setItemDelegate(ULDelegate);
|
||||
|
||||
|
||||
ui.uploadsList->setAutoScroll(false) ;
|
||||
|
||||
ui.uploadsList->setRootIsDecorated(false);
|
||||
|
||||
|
||||
|
||||
|
||||
//Selection Setup
|
||||
//selection = ui.uploadsList->selectionModel();
|
||||
|
||||
|
||||
/* Set header resize modes and initial section sizes Uploads TreeView*/
|
||||
// QHeaderView * upheader = ui.uploadsList->header () ;
|
||||
// upheader->setResizeMode (0, QHeaderView::Interactive); /*Name */
|
||||
@ -129,7 +134,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
// upheader->setResizeMode (4, QHeaderView::Interactive); /*Speed */
|
||||
// upheader->setResizeMode (5, QHeaderView::Interactive); /*Status*/
|
||||
// upheader->setResizeMode (6, QHeaderView::Interactive); /*Transferred*/
|
||||
//
|
||||
//
|
||||
// upheader->resizeSection ( 0, 100 ); /*Name */
|
||||
// upheader->resizeSection ( 1, 75 ); /*Size */
|
||||
// upheader->resizeSection ( 2, 100 ); /*User Name*/
|
||||
@ -164,8 +169,8 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
//showdowninfoAct = new QAction(QIcon(IMAGE_INFO), tr( "Details..." ), this );
|
||||
//connect( showdowninfoAct , SIGNAL( triggered() ), this, SLOT( showDownInfoWindow() ) );
|
||||
|
||||
/* 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;
|
||||
|
||||
@ -193,13 +198,13 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
|
||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||
|
||||
|
||||
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
||||
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
||||
|
||||
|
||||
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() ) );
|
||||
|
||||
@ -208,7 +213,7 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
{
|
||||
contextMnu.addAction(playAct);
|
||||
}
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addSeparator();
|
||||
|
||||
contextMnu.addAction( cancelAct);
|
||||
contextMnu.addSeparator();
|
||||
@ -279,16 +284,51 @@ int TransfersDialog::addItem(QString symbol, QString name, QString coreID, qlong
|
||||
//DLListModel->setData(DLListModel->index(row, NAME), QVariant((QIcon)icon), Qt::DecorationRole);
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant((QString)name), Qt::DisplayRole);
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)fileSize));
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)progress));
|
||||
DLListModel->setData(DLListModel->index(row, COMPLETED), QVariant((qlonglong)completed));
|
||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)dlspeed));
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)progress));
|
||||
DLListModel->setData(DLListModel->index(row, SOURCES), QVariant((QString)sources));
|
||||
DLListModel->setData(DLListModel->index(row, STATUS), QVariant((QString)status));
|
||||
DLListModel->setData(DLListModel->index(row, COMPLETED), QVariant((qlonglong)completed));
|
||||
DLListModel->setData(DLListModel->index(row, REMAINING), QVariant((qlonglong)remaining));
|
||||
DLListModel->setData(DLListModel->index(row, ID), QVariant((QString)coreID));
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
bool TransfersDialog::addPeerToItem(int row, QString symbol, QString name, QString coreID, qlonglong fileSize, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining)
|
||||
{
|
||||
QStandardItem *dlItem = DLListModel->item(row);
|
||||
if (!dlItem) return false;
|
||||
|
||||
//set this false if you want to expand on double click
|
||||
dlItem->setEditable(false);
|
||||
|
||||
QList<QStandardItem *> items;
|
||||
QStandardItem *i1 = new QStandardItem(); i1->setData(QVariant((QString)name), Qt::DisplayRole);
|
||||
QStandardItem *i2 = new QStandardItem(); i2->setData(QVariant((qlonglong)fileSize), Qt::DisplayRole);
|
||||
QStandardItem *i3 = new QStandardItem(); i3->setData(QVariant((qlonglong)completed), Qt::DisplayRole);
|
||||
QStandardItem *i4 = new QStandardItem(); i4->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
||||
QStandardItem *i5 = new QStandardItem(); i5->setData(QVariant((double)progress), Qt::DisplayRole);
|
||||
QStandardItem *i6 = new QStandardItem(); i6->setData(QVariant((QString)sources), Qt::DisplayRole);
|
||||
QStandardItem *i7 = new QStandardItem(); i7->setData(QVariant((QString)status), Qt::DisplayRole);
|
||||
QStandardItem *i8 = new QStandardItem(); i8->setData(QVariant((qlonglong)remaining), Qt::DisplayRole);
|
||||
QStandardItem *i9 = new QStandardItem(); i9->setData(QVariant((QString)coreID), Qt::DisplayRole);
|
||||
|
||||
items.append(i1);
|
||||
items.append(i2);
|
||||
items.append(i3);
|
||||
items.append(i4);
|
||||
items.append(i5);
|
||||
items.append(i6);
|
||||
items.append(i7);
|
||||
items.append(i8);
|
||||
items.append(i9);
|
||||
|
||||
dlItem->appendRow(items);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int TransfersDialog::addUploadItem(QString symbol, QString name, QString coreID, qlonglong fileSize, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining)
|
||||
{
|
||||
@ -310,6 +350,7 @@ int TransfersDialog::addUploadItem(QString symbol, QString name, QString coreID,
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
void TransfersDialog::delItem(int row)
|
||||
{
|
||||
DLListModel->removeRow(row, QModelIndex());
|
||||
@ -364,30 +405,55 @@ void TransfersDialog::insertTransfers()
|
||||
{
|
||||
QString symbol, name, sources, status, coreId;
|
||||
qlonglong fileSize, completed, remaining;
|
||||
double progress, dlspeed;
|
||||
double progress, dlspeed;
|
||||
|
||||
|
||||
/* get current selection */
|
||||
std::list<std::string> selectedIds;
|
||||
|
||||
for(int i = 0; i <= DLListModel->rowCount(); i++) {
|
||||
if(selection->isRowSelected(i, QModelIndex())) {
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
selectedIds.push_back(id);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < DLListModel->rowCount(); i++) {
|
||||
if (selection->isRowSelected(i, QModelIndex())) {
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
selectedIds.push_back(id);
|
||||
}
|
||||
|
||||
//remove all Items
|
||||
for(int i = DLListModel->rowCount(); i >= 0; i--)
|
||||
QStandardItem *parent = DLListModel->item(i);
|
||||
//if (!parent) continue;
|
||||
int childs = parent->rowCount();
|
||||
for (int j = 0; j < childs; j++) {
|
||||
QModelIndex parentIndex = DLListModel->indexFromItem(parent);
|
||||
if (selection->isRowSelected(j, parentIndex)) {
|
||||
QStandardItem *child = parent->child(j, ID);
|
||||
std::string id = child->data(Qt::DisplayRole).toString().toStdString();
|
||||
selectedIds.push_back(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* get expanded donwload items */
|
||||
std::list<std::string> expandedIds;
|
||||
|
||||
for (int i = 0; i < DLListModel->rowCount(); i++) {
|
||||
QStandardItem *item = DLListModel->item(i);
|
||||
QModelIndex index = DLListModel->indexFromItem(item);
|
||||
if (ui.downloadList->isExpanded(index)) {
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
expandedIds.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
//remove all Items
|
||||
for(int i = DLListModel->rowCount(); i >= 0; i--)
|
||||
{
|
||||
delItem(i);
|
||||
}
|
||||
|
||||
for(int i = ULListModel->rowCount(); i >= 0; i--)
|
||||
for(int i = ULListModel->rowCount(); i >= 0; i--)
|
||||
{
|
||||
delUploadItem(i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the download and upload lists */
|
||||
std::list<std::string> downHashes;
|
||||
@ -399,121 +465,115 @@ void TransfersDialog::insertTransfers()
|
||||
uint32_t dlCount = 0;
|
||||
uint32_t ulCount = 0;
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = downHashes.begin(); it != downHashes.end(); it++)
|
||||
{
|
||||
FileInfo info;
|
||||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, info))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::list<std::string>::iterator it;
|
||||
for (it = downHashes.begin(); it != downHashes.end(); it++) {
|
||||
FileInfo info;
|
||||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, info)) continue;
|
||||
//if file transfer is a cache file index file, don't show it
|
||||
if (info.flags & CB_CODE_CACHE) continue;
|
||||
|
||||
//if file transfer is a cache file index file, don't show it
|
||||
if (info.flags & CB_CODE_CACHE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
symbol = "";
|
||||
name = QString::fromStdString(info.fname);
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
fileSize = info.size;
|
||||
progress = (info.transfered * 100.0) / info.size;
|
||||
dlspeed = info.tfRate * 1024.0;
|
||||
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
for(pit = info.peers.begin(); pit != info.peers.end(); pit++)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||
/* get number of online peers */
|
||||
int online = 0;
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
for (pit = info.peers.begin(); pit != info.peers.end(); pit++) {
|
||||
if (rsPeers->isOnline(pit->peerId)) {
|
||||
online++;
|
||||
}
|
||||
}
|
||||
|
||||
switch(pit->status)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed");
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay");
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
status = tr("Waiting");
|
||||
break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Downloading");
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = tr("Complete");
|
||||
break;
|
||||
|
||||
}
|
||||
sources = QString("%1 (%2)").arg(online).arg(info.peers.size() - online);
|
||||
|
||||
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||
{
|
||||
status = tr("Complete");
|
||||
}
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
switch (info.downloadStatus) {
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed"); break;
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay"); break;
|
||||
case FT_STATE_WAITING:
|
||||
status = tr("Waiting"); break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Downloading"); break;
|
||||
case FT_STATE_COMPLETE:
|
||||
status = tr("Complete"); break;
|
||||
default:
|
||||
status = tr("Unknown"); break;
|
||||
}
|
||||
|
||||
/* if found in selectedIds -> select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
||||
{
|
||||
selection->select(DLListModel->index(dlCount, 0),
|
||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||
completed = info.transfered;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
}
|
||||
dlCount++;
|
||||
}
|
||||
/* alternative ... if no peers there stick it in anyway */
|
||||
if (info.peers.size() == 0)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = tr("Unknown");
|
||||
int addedRow = addItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining);
|
||||
|
||||
switch(info.downloadStatus)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed");
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay");
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
status = tr("Waiting");
|
||||
break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Downloading");
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = tr("Complete");
|
||||
break;
|
||||
|
||||
}
|
||||
/* if found in selectedIds -> select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash)) {
|
||||
selection->select(DLListModel->index(dlCount, 0),
|
||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
|
||||
dlspeed = info.tfRate * 1024.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
/* expand last expanded items */
|
||||
if (expandedIds.end() != std::find(expandedIds.begin(), expandedIds.end(), info.hash)) {
|
||||
QStandardItem *item = DLListModel->item(dlCount);
|
||||
QModelIndex index = DLListModel->indexFromItem(item);
|
||||
ui.downloadList->setExpanded(index, true);
|
||||
}
|
||||
|
||||
/* if found in selectedIds -> select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
||||
{
|
||||
selection->select(DLListModel->index(dlCount, 0),
|
||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||
dlCount++;
|
||||
|
||||
/* continue to next download item if no peers to add */
|
||||
if (!info.peers.size()) continue;
|
||||
|
||||
int dlPeers = 0;
|
||||
for (pit = info.peers.begin(); pit != info.peers.end(); pit++) {
|
||||
symbol = "";
|
||||
name = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||
//unique combination: fileName + peerName, variant: hash + peerName (too long)
|
||||
coreId = QString::fromStdString(info.fname + rsPeers->getPeerName(pit->peerId));
|
||||
fileSize = info.size;
|
||||
progress = (info.transfered * 100.0) / info.size;
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
//sources = QString("rShare v %1").arg(tr("0.4.13a"));//TODO: take it from somewhere
|
||||
sources = "";
|
||||
|
||||
if (info.downloadStatus == FT_STATE_COMPLETE) {
|
||||
status = tr("Complete");
|
||||
} else {
|
||||
status = tr("Unknown");
|
||||
switch (pit->status) {
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed"); break;
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay"); break;
|
||||
case FT_STATE_WAITING:
|
||||
status = tr("Waiting"); break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Downloading"); break;
|
||||
case FT_STATE_COMPLETE:
|
||||
status = tr("Complete"); break;
|
||||
}
|
||||
}
|
||||
|
||||
completed = info.transfered;
|
||||
remaining = (info.size - info.transfered) / (pit->tfRate * 1024.0);
|
||||
|
||||
if (!addPeerToItem(addedRow, symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining))
|
||||
continue;
|
||||
|
||||
/* if peers found in selectedIds, select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.fname + rsPeers->getPeerName(pit->peerId))) {
|
||||
QStandardItem *dlItem = DLListModel->item(addedRow);
|
||||
QModelIndex childIndex = DLListModel->indexFromItem(dlItem).child(dlPeers, 0);
|
||||
selection->select(childIndex, QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
dlPeers++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
dlCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for(it = upHashes.begin(); it != upHashes.end(); it++)
|
||||
{
|
||||
@ -533,10 +593,10 @@ void TransfersDialog::insertTransfers()
|
||||
|
||||
switch(pit->status)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed");
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay");
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
@ -545,25 +605,25 @@ void TransfersDialog::insertTransfers()
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Uploading");
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = tr("Complete");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||
// {
|
||||
// status = "Complete";
|
||||
// }
|
||||
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
ulCount++;
|
||||
}
|
||||
@ -577,10 +637,10 @@ void TransfersDialog::insertTransfers()
|
||||
|
||||
switch(info.downloadStatus)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
case FT_STATE_FAILED:
|
||||
status = tr("Failed");
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
case FT_STATE_OKAY:
|
||||
status = tr("Okay");
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
@ -589,11 +649,11 @@ void TransfersDialog::insertTransfers()
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = tr("Uploading");
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = tr("Complete");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
dlspeed = info.tfRate * 1024.0;
|
||||
@ -601,8 +661,8 @@ void TransfersDialog::insertTransfers()
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
ulCount++;
|
||||
}
|
||||
@ -617,11 +677,11 @@ void TransfersDialog::cancel()
|
||||
|
||||
if ((QMessageBox::question(this, tr("RetroShare"),queryWrn2,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok)
|
||||
{
|
||||
|
||||
|
||||
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
||||
|
||||
|
||||
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
||||
{
|
||||
if(selection->isRowSelected(i, QModelIndex()))
|
||||
if(selection->isRowSelected(i, QModelIndex()))
|
||||
{
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
QString qname = getFileName(i, DLListModel);
|
||||
@ -633,7 +693,7 @@ void TransfersDialog::cancel()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -692,7 +752,7 @@ void TransfersDialog::pasteLink()
|
||||
|
||||
QVector<RetroShareLinkData> linkList;
|
||||
analyzer.getFileInformation (linkList);
|
||||
|
||||
|
||||
std::list<std::string> srcIds;
|
||||
|
||||
for (int i = 0, n = linkList.size (); i < n; ++i)
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
@ -46,12 +46,12 @@ class TransfersDialog : public MainPage
|
||||
TransfersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~TransfersDialog();
|
||||
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent *) ;
|
||||
|
||||
public slots:
|
||||
void insertTransfers();
|
||||
|
||||
|
||||
void handleDownloadRequest(const QString& url);
|
||||
|
||||
private slots:
|
||||
@ -62,8 +62,8 @@ class TransfersDialog : public MainPage
|
||||
void cancel();
|
||||
/** removes finished Downloads**/
|
||||
void clearcompleted();
|
||||
void playSelectedTransfer();
|
||||
|
||||
void playSelectedTransfer();
|
||||
|
||||
void copyLink();
|
||||
void pasteLink();
|
||||
|
||||
@ -104,7 +104,8 @@ class TransfersDialog : public MainPage
|
||||
Ui::TransfersDialog ui;
|
||||
|
||||
public slots:
|
||||
int addItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
int addItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
bool addPeerToItem(int row, QString symbol, QString name, QString coreID, qlonglong fileSize, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
void delItem(int row);
|
||||
|
||||
int addUploadItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
|
Loading…
Reference in New Issue
Block a user