ProgressManager: Give individual tasks same range in summary bar

The total range was sum of individual ranges so far, so e.g. parsing/
2).

Change-Id: Ia9133376be3219c12101435ba2e2ae27c32df6f8
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2013-05-24 14:14:35 +02:00
parent 2d3a7d432b
commit aee00cfad7

View File

@@ -494,16 +494,17 @@ void ProgressManagerPrivate::updateSummaryProgressBar()
m_summaryProgressBar->setFinished(false);
QMapIterator<QFutureWatcher<void> *, QString> it(m_runningTasks);
int range = 0;
static const int TASK_RANGE = 100;
int value = 0;
while (it.hasNext()) {
it.next();
QFutureWatcher<void> *watcher = it.key();
int min = watcher->progressMinimum();
range += watcher->progressMaximum() - min;
value += watcher->progressValue() - min;
int range = watcher->progressMaximum() - min;
if (range > 0)
value += TASK_RANGE * (watcher->progressValue() - min) / range;
}
m_summaryProgressBar->setRange(0, range);
m_summaryProgressBar->setRange(0, TASK_RANGE * m_runningTasks.size());
m_summaryProgressBar->setValue(value);
}