mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
- Implemented chunk-based file transfer from partial sources. This in particular means:
- exchange of chunk availability maps from different peers - correct handling of what is available to which source before asking the data - correct display of chunks in the progress bars - generalised the use of compressed chunk maps - removed the size parameters from the hash search functions - In addition: - suppressed a number of per-value transfers of std::string - improved the FileTransferInfo Widget, to show some additional info Still to be done: - chunk map exchange for non anonymous traffic (easy) - improve accuracy of completion for uploads (for now it's a integer number of chunks) - check compilation on windows git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1993 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
add5d45eeb
commit
cfaaec31c7
36 changed files with 1247 additions and 573 deletions
|
@ -62,23 +62,16 @@ void FileTransferInfoWidget::updateDisplay()
|
|||
{
|
||||
std::cout << "In TaskGraphPainterWidget::updateDisplay()" << std::endl ;
|
||||
|
||||
bool ok=true ;
|
||||
FileInfo nfo ;
|
||||
if(!rsFiles->FileDetails(_file_hash, RS_FILE_HINTS_DOWNLOAD, nfo))
|
||||
return ;
|
||||
ok = false ;
|
||||
FileChunksInfo info ;
|
||||
if(!rsFiles->FileChunksDetails(_file_hash, info))
|
||||
return ;
|
||||
if(!rsFiles->FileDownloadChunksDetails(_file_hash, info))
|
||||
ok = false ;
|
||||
|
||||
std::cout << "got details for file " << nfo.fname << std::endl ;
|
||||
|
||||
uint64_t fileSize = info.file_size;
|
||||
uint32_t blockSize = info.chunk_size ;
|
||||
int blocks = info.chunks.size() ;
|
||||
|
||||
int columns = maxWidth/chunk_square_size;
|
||||
y = blocks/columns*chunk_square_size;
|
||||
x = blocks%columns*chunk_square_size;
|
||||
maxHeight = y+150+info.active_chunks.size()*(block_sep+text_height); // warning: this should be computed from the different size parameter and the number of objects drawn, otherwise the last objects to be displayed will be truncated.
|
||||
pixmap = QPixmap(size());
|
||||
pixmap.fill(this, 0, 0);
|
||||
pixmap = QPixmap(maxWidth, maxHeight);
|
||||
|
@ -88,7 +81,16 @@ void FileTransferInfoWidget::updateDisplay()
|
|||
QPainter painter(&pixmap);
|
||||
painter.initFrom(this);
|
||||
|
||||
draw(info,&painter) ;
|
||||
if(ok)
|
||||
{
|
||||
int blocks = info.chunks.size() ;
|
||||
int columns = maxWidth/chunk_square_size;
|
||||
y = blocks/columns*chunk_square_size;
|
||||
x = blocks%columns*chunk_square_size;
|
||||
maxHeight = y+150+info.active_chunks.size()*(block_sep+text_height); // warning: this should be computed from the different size parameter and the number of objects drawn, otherwise the last objects to be displayed will be truncated.
|
||||
|
||||
draw(info,&painter) ;
|
||||
}
|
||||
|
||||
pixmap2 = pixmap;
|
||||
}
|
||||
|
@ -194,8 +196,8 @@ void FileTransferInfoWidget::draw(const FileChunksInfo& info,QPainter *painter)
|
|||
int nb_src = 0 ;
|
||||
int chunk_num = (int)floor(i/float(availability_map_size_X)*(nb_chunks-1)) ;
|
||||
|
||||
for(uint j=0;j<info.compressed_peer_availability_maps.size();++j)
|
||||
nb_src += (bool)(COMPRESSED_MAP_READ(info.compressed_peer_availability_maps[j].second, chunk_num)) ;
|
||||
for(std::map<std::string,CompressedChunkMap>::const_iterator it(info.compressed_peer_availability_maps.begin());it!=info.compressed_peer_availability_maps.end();++it)
|
||||
nb_src += it->second[chunk_num] ;
|
||||
|
||||
painter->setPen(QColor::fromHsv(200,50*nb_src,200)) ; // the more sources, the more saturated
|
||||
painter->drawLine(i,y,i,y+availability_map_size_Y) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue