[Libreoffice-commits] core.git: Branch 'feature/fixes22' - include/xmloff xmloff/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri May 27 12:01:12 UTC 2016
include/xmloff/ProgressBarHelper.hxx | 1 +
xmloff/source/core/ProgressBarHelper.cxx | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
New commits:
commit b79cecdb51832e2bc40d45a8bc5155cb44c3ec95
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri May 27 14:00:23 2016 +0200
xmloff: only update the progressbar twice for every percent
This restores the state before commit
e1b78d36008d1fd188ca8dc154ad069d3476520c (#95181#; call the setValue
method of the XStatusIndicator as often as possible to enable
reschedule, 2001-11-26), which doesn't seem to be necessary anymore,
perhaps due to the current scheduler that has priorities.
Change-Id: I7136b20f1c64e267b0b4a35bbe2564e5163d9468
diff --git a/include/xmloff/ProgressBarHelper.hxx b/include/xmloff/ProgressBarHelper.hxx
index 7eeed4e..6af3603 100644
--- a/include/xmloff/ProgressBarHelper.hxx
+++ b/include/xmloff/ProgressBarHelper.hxx
@@ -36,6 +36,7 @@ class XMLOFF_DLLPUBLIC ProgressBarHelper
sal_Int32 nRange;
sal_Int32 nReference;
sal_Int32 nValue;
+ double fOldPercent;
bool bStrict;
// #96469#; if the value goes over the Range the progressbar starts again
bool bRepeat;
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
index 719ab80..2419ecf2 100644
--- a/xmloff/source/core/ProgressBarHelper.cxx
+++ b/xmloff/source/core/ProgressBarHelper.cxx
@@ -25,6 +25,7 @@
using namespace ::com::sun::star;
static const sal_Int32 nDefaultProgressBarRange = 1000000;
+static const float fProgressStep = 0.5;
ProgressBarHelper::ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator>& xTempStatusIndicator,
const bool bTempStrict)
@@ -32,6 +33,7 @@ ProgressBarHelper::ProgressBarHelper(const ::com::sun::star::uno::Reference < ::
, nRange(nDefaultProgressBarRange)
, nReference(100)
, nValue(0)
+, fOldPercent(0.0)
, bStrict(bTempStrict)
, bRepeat(true)
#ifdef DBG_UTIL
@@ -87,9 +89,12 @@ void ProgressBarHelper::SetValue(sal_Int32 nTempValue)
double fValue(nValue);
double fNewValue ((fValue * nRange) / nReference);
- xStatusIndicator->setValue((sal_Int32)fNewValue);
-
- // #95181# disabled, because we want to call setValue very often to enable a good reschedule
+ double fPercent((fNewValue * 100) / nRange);
+ if (fPercent >= (fOldPercent + fProgressStep) || fPercent < fOldPercent)
+ {
+ xStatusIndicator->setValue((sal_Int32)fNewValue);
+ fOldPercent = fPercent;
+ }
}
#ifdef DBG_UTIL
else if (!bFailure)
More information about the Libreoffice-commits
mailing list