From 09d0aff3d6f8325871604a4891e9fbe616669f2f Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Thu, 27 Aug 2020 00:01:30 +0200 Subject: [PATCH] widgets: PROGRESS_REPORTER - make SetCurrentProgress() virtual, allow to change number of phases post-construction --- common/widgets/progress_reporter.cpp | 6 ++++++ include/widgets/progress_reporter.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/widgets/progress_reporter.cpp b/common/widgets/progress_reporter.cpp index 5ac6a745ea..aa937db019 100644 --- a/common/widgets/progress_reporter.cpp +++ b/common/widgets/progress_reporter.cpp @@ -75,6 +75,12 @@ void PROGRESS_REPORTER::AdvanceProgress() } +void PROGRESS_REPORTER::SetNumPhases( int aNumPhases ) +{ + m_numPhases = aNumPhases; +} + + int PROGRESS_REPORTER::currentProgress() const { double current = ( 1.0 / (double) m_numPhases ) * diff --git a/include/widgets/progress_reporter.h b/include/widgets/progress_reporter.h index 99e7af3a5c..e304485b02 100644 --- a/include/widgets/progress_reporter.h +++ b/include/widgets/progress_reporter.h @@ -51,6 +51,11 @@ class PROGRESS_REPORTER { } + /** + * sets the number of phases + */ + void SetNumPhases( int aNumPhases ); + /** * initialize the aPhase virtual zone of the dialog progress bar */ @@ -69,7 +74,7 @@ class PROGRESS_REPORTER /** * Set the progress value to aProgress (0..1) */ - void SetCurrentProgress( double aProgress ); + virtual void SetCurrentProgress( double aProgress ); /** * Fix the value thar gives the 100 precent progress bar length