27#ifndef GENERIC_PROGRESS_REPORTER_H
28#define GENERIC_PROGRESS_REPORTER_H
52 void AddPhases(
int aNumPhases )
override;
57 virtual void BeginPhase(
int aPhase )
override;
67 virtual void AdvancePhase(
const wxString& aMessage )
override;
72 virtual void Report(
const wxString& aMessage )
override;
106 void SetTitle(
const wxString& aTitle )
override { }
110 int CurrentProgress()
const;
This implements all the tricky bits for thread safety, but the GUI is left to derived classes.
virtual bool updateUI()=0
std::atomic_bool m_messageChanged
void SetTitle(const wxString &aTitle) override
Change the title displayed on the window caption.
std::atomic_int m_numPhases
PROGRESS_REPORTER_BASE(const PROGRESS_REPORTER_BASE &)=delete
std::atomic_bool m_cancelled
virtual ~PROGRESS_REPORTER_BASE()
std::atomic_int m_progress
bool IsCancelled() const override
std::atomic_int m_maxProgress
A progress reporter interface for use in multi-threaded environments.
virtual void AddPhases(int aNumPhases)=0
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
virtual void SetNumPhases(int aNumPhases)=0
Set the number of phases.
virtual void Report(const wxString &aMessage)=0
Display aMessage in the progress bar dialog.
virtual void BeginPhase(int aPhase)=0
Initialize the aPhase virtual zone of the dialog progress bar.
virtual void AdvancePhase()=0
Use the next available virtual zone of the dialog progress bar.
virtual void AdvanceProgress()=0
Increment the progress bar length (inside the current virtual zone).
virtual void SetCurrentProgress(double aProgress)=0
Set the progress value to aProgress (0..1).
virtual void SetMaxProgress(int aMaxProgress)=0
Fix the value that gives the 100 percent progress bar length (inside the current virtual zone).