From 5c30bcb691729b52c8456f57b42d6514a9325cf8 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 9 Nov 2011 03:48:07 +0100 Subject: bugfix: Fix problem with progress bar sometimes jumping backwards diff --git a/src/ProgressWidget.cc b/src/ProgressWidget.cc index a386192..112e239 100644 --- a/src/ProgressWidget.cc +++ b/src/ProgressWidget.cc @@ -29,3 +29,8 @@ void ProgressWidget::setValue(int progress) { this->progressBar->setValue(progress); } + +int ProgressWidget::value() const +{ + return this->progressBar->value(); +} diff --git a/src/ProgressWidget.h b/src/ProgressWidget.h index 715272b..83e4d40 100644 --- a/src/ProgressWidget.h +++ b/src/ProgressWidget.h @@ -15,6 +15,7 @@ public: public slots: void setRange(int minimum, int maximum); void setValue(int progress); + int value() const; void cancel(); signals: diff --git a/src/mainwin.cc b/src/mainwin.cc index a6f5be6..22fb82c 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -433,7 +433,8 @@ static void report_func(const class AbstractNode*, void *vp, int mark) #ifdef USE_PROGRESSWIDGET ProgressWidget *pw = static_cast(vp); int v = (int)((mark*100.0) / progress_report_count); - pw->setValue(v < 100 ? v : 99); + int percent = v < 100 ? v : 99; + if (percent > pw->value()) pw->setValue(percent); QApplication::processEvents(); if (pw->wasCanceled()) throw ProgressCancelException(); #else -- cgit v0.10.1