added chunk request info, and chunk download info. Corrected bug displaying speed for stalled transfers. Warning: needs full recompilation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3935 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-12-26 10:58:02 +00:00
parent 304bbf55cf
commit 40efe19efa
7 changed files with 69 additions and 29 deletions

View file

@ -170,9 +170,30 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
int size_of_this_chunk = ( info.active_chunks[i].first == info.chunks.size()-1 && ((info.file_size % blockSize)>0) )?(info.file_size % blockSize):blockSize ;
uint32_t s = (uint32_t)rint(sizeX*(size_of_this_chunk - info.active_chunks[i].second)/(float)size_of_this_chunk) ;
std::cerr << "chunk " << info.active_chunks[i].first << ": Last received byte: " << size_of_this_chunk - info.active_chunks[i].second << std::endl;
// Already Downloaded.
//
painter->fillRect(ch_num_size,y,s,sizeY,QColor::fromHsv(200,200,255)) ;
// Remains to download
//
painter->fillRect(ch_num_size+s,y,sizeX-s,sizeY,QColor::fromHsv(200,50,255)) ;
// now draw the slices under pending requests
//
std::map<uint32_t,std::vector<FileChunksInfo::SliceInfo> >::const_iterator it(info.pending_slices.find(info.active_chunks[i].first)) ;
if(it != info.pending_slices.end())
for(uint k=0;k<it->second.size();++k)
{
uint32_t s1 = (uint32_t)floor(sizeX*(it->second[k].start)/(float)size_of_this_chunk) ;
uint32_t ss = (uint32_t)ceil(sizeX*(it->second[k].size )/(float)size_of_this_chunk) ;
painter->fillRect(ch_num_size+s1,y,ss,sizeY,QColor::fromHsv(50,250,250)) ;
}
painter->setPen(QColor::fromRgb(0,0,0)) ;
float percent = (size_of_this_chunk - info.active_chunks[i].second)*100.0/size_of_this_chunk ;

View file

@ -775,7 +775,7 @@ void TransfersDialog::insertTransfers()
QString fileName = QString::fromUtf8(info.fname.c_str());
QString fileHash = QString::fromStdString(info.hash);
qlonglong fileSize = info.size;
double fileDlspeed = (info.downloadStatus==FT_STATE_PAUSED)?0.0:(info.tfRate * 1024.0);
double fileDlspeed = (info.downloadStatus==FT_STATE_DOWNLOADING)?(info.tfRate * 1024.0):0.0;
/* get the sources (number of online peers) */
int online = 0;
@ -827,6 +827,9 @@ void TransfersDialog::insertTransfers()
pinfo.progress = (info.size==0)?0:(completed*100.0/info.size) ;
pinfo.nb_chunks = pinfo.cmap._map.empty()?0:fcinfo.chunks.size() ;
for(uint32_t i=0;i<fcinfo.active_chunks.size();++i)
pinfo.chunks_in_progress.push_back(fcinfo.active_chunks[i].first) ;
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
used_hashes.insert(info.hash) ;

View file

@ -219,6 +219,17 @@ void xProgressBar::paint()
i += j ;
}
QColor gradColor_a1, gradColor_a2 ;
gradColor_a1.setRgb(223, 134, 6);
gradColor_a2.setRgb(248, 170, 59);
linearGrad.setColorAt(0.00, gradColor_a1);
linearGrad.setColorAt(0.16, gradColor_a2);
linearGrad.setColorAt(1.00, gradColor_a1);
painter->setBrush(linearGrad);
for(uint32_t i=0;i<_pinfo.chunks_in_progress.size();++i)
painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_progress[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2);
}
else
{

View file

@ -46,6 +46,8 @@ class FileProgressInfo
float progress ;
uint32_t nb_chunks ;
std::vector<uint32_t> chunks_in_progress ;
bool operator<(const FileProgressInfo &other) const;
};
//