From 04d16f239735e192bb0c62da2e6ca33fee7a2b62 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 23 Jun 2011 18:54:49 +0000 Subject: [PATCH] corrected display of uploaded size git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4325 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/TransfersDialog.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 6da6685bf..6b8563fb3 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -1008,12 +1008,16 @@ void TransfersDialog::insertTransfers() pinfo.type = FileProgressInfo::UPLOAD_LINE ; pinfo.nb_chunks = pinfo.cmap._map.empty()?0:nb_chunks ; - if(filled_chunks > 1) { - pinfo.progress = (nb_chunks==0)?0:(filled_chunks*100.0/nb_chunks) ; - completed = std::min(info.size,((uint64_t)filled_chunks)*chunk_size) ; + if(filled_chunks > 0 && nb_chunks > 0) + { + pinfo.progress = filled_chunks*100.0/nb_chunks ; + completed = std::min(info.size,((uint64_t)filled_chunks)*chunk_size) ; // we use min, because the last chunk might be smaller than chunk_size. } else - pinfo.progress = progress ; + { + completed = pit->transfered % chunk_size ; // use the position with respect to last request. + pinfo.progress = (info.size>0)?((pit->transfered % chunk_size)*100.0/info.size):0 ; + } addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, source,QString::fromStdString(pit->peerId), status, completed, remaining);