diff --git a/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp b/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp index f9828626a..dd1dc86c6 100644 --- a/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp +++ b/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp @@ -235,6 +235,52 @@ void xProgressBar::paint() if(ss > 1) // for small files we use a more progressive display { if(!_pinfo.cmap._map.empty()) + { + if (ss > width) + for(uint32_t i=0;i last_chunk_in_pixel + //II: if not, c < last_chunk_in_pixel-first_chunk_in_pixel + + if (c==0) // not even a single chunk found + continue; + + //we now check for case I. + //if the loop above has checked more than 1 pixel, increment i as long as j is in its range + int x0 = i; + while (j >= rint(ss*(i+2)/width)-1) + ++i; + + //case I.: c >= last_chunk_in_pixel - first_chunk_in_pixel ===> o = 1 + //case II.: c <= last_chunk_in_pixel - first_chunk_in_pixel ===> o <= 1 + float o = std::min(1.0f,(float)c / (last_chunk_in_pixel - first_chunk_in_pixel + 1)); + + if (o>0) + { + painter->setOpacity(o); + painter->drawRect(rect.x() + hSpan + x0, rect.y() + vSpan, i - x0 + 1, rect.height() - 1 - vSpan * 2); + } + } + else for(uint32_t i=0;i