1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-25 14:04:23 +00:00

few more corrections on RealProgressBar

- removed counting incomplete pieces
- replaced few Q_ASSERT with corrective statements
This commit is contained in:
Ishan Arora 2007-11-21 21:12:03 +00:00
parent 725ef52cfe
commit 9c05148a24
2 changed files with 16 additions and 10 deletions

View File

@ -90,9 +90,14 @@ void RealProgressBar::drawPixmap()
QColor RealProgressBar::penColor(qreal x) QColor RealProgressBar::penColor(qreal x)
{ {
qreal y = 1 - x; if(x < 0.)
Q_ASSERT(x >= 0.); x = 0.;
Q_ASSERT(y >= 0.); else
if(x > 1.)
x = 1.;
qreal y = 1. - x;
// Q_ASSERT(x >= 0.);
// Q_ASSERT(y >= 0.);
qreal r1, g1, b1, a1, r2, g2, b2, a2; qreal r1, g1, b1, a1, r2, g2, b2, a2;
foreground.getRgbF(&r1, &g1, &b1, &a1); foreground.getRgbF(&r1, &g1, &b1, &a1);
background.getRgbF(&r2, &g2, &b2, &a2); background.getRgbF(&r2, &g2, &b2, &a2);

View File

@ -79,6 +79,7 @@ start:
size_type piece_length = thandle.piece_length(); size_type piece_length = thandle.piece_length();
int num_pieces = thandle.num_pieces(); int num_pieces = thandle.num_pieces();
const std::vector<bool>* pieces = thandle.pieces(); const std::vector<bool>* pieces = thandle.pieces();
//no vector returned
if (pieces == 0) if (pieces == 0)
return; return;
//empty the array //empty the array
@ -97,7 +98,7 @@ start:
if((*pieces)[i]) if((*pieces)[i])
mark(start, end); mark(start, end);
} }
/*
//fill the array with incomplete pieces (from download queue) //fill the array with incomplete pieces (from download queue)
std::vector<partial_piece_info> queue; std::vector<partial_piece_info> queue;
thandle.get_download_queue(queue); thandle.get_download_queue(queue);
@ -116,12 +117,12 @@ start:
start = end; start = end;
} }
} }
// qreal sum = 0.; qreal sum = 0.;
// locker.relock(); locker.relock();
// for(int i=0; i<size; i++) for(int i=0; i<size; i++)
// sum += array[i]; sum += array[i];
// qDebug()<<"progress:"<<sum*100./size(); qDebug()<<"progress:"<<sum*100./size;
// locker.unlock(); locker.unlock();*/
qDebug("refreshed emmitted"); qDebug("refreshed emmitted");
emit refreshed(array); emit refreshed(array);
goto wait; goto wait;