widgets: PROGRESS_REPORTER - make SetCurrentProgress() virtual, allow to change number of phases post-construction

This commit is contained in:
Tomasz Wlostowski 2020-08-27 00:01:30 +02:00
parent 466cbe2f00
commit 09d0aff3d6
2 changed files with 12 additions and 1 deletions

View File

@ -75,6 +75,12 @@ void PROGRESS_REPORTER::AdvanceProgress()
} }
void PROGRESS_REPORTER::SetNumPhases( int aNumPhases )
{
m_numPhases = aNumPhases;
}
int PROGRESS_REPORTER::currentProgress() const int PROGRESS_REPORTER::currentProgress() const
{ {
double current = ( 1.0 / (double) m_numPhases ) * double current = ( 1.0 / (double) m_numPhases ) *

View File

@ -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 * 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) * 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 * Fix the value thar gives the 100 precent progress bar length