summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-05-30 09:29:22 +0200
committerMichael Meeks <michael.meeks@collabora.com>2016-05-30 22:07:29 +0000
commit0fac4acb32baf59558f46d42ce31751948f00da3 (patch)
tree7727e9d145de09f2a97809f11664eb96fa3946ed /xmloff
parent16f87e808942a88c935754c2aabef86ee379b9b7 (diff)
tdf#100134 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. Rather than a plain revert, still allow the progressbar to jump back, as that seems to be used relatively frequently. So just filter out the calls that would increment the value, but only with a small difference, compared to the shown value. (cherry picked from commit 20ad9893d5d3be13d8aa17764e483afaa083b5c0) Change-Id: I7136b20f1c64e267b0b4a35bbe2564e5163d9468 Reviewed-on: https://gerrit.libreoffice.org/25666 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/ProgressBarHelper.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
index 719ab804e3ad..2419ecf2f65d 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)