From 230caadb8974576bd2e5ac8cecdbb6879e028389 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 19 Oct 2013 12:59:24 +0000 Subject: [PATCH] patch from lmanuel to beautify the DL progressbar git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6848 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/FileTransfer/xprogressbar.cpp | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) 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