25#ifndef BACKGROUND_JOBS_MONITOR_H
26#define BACKGROUND_JOBS_MONITOR_H
31#include <shared_mutex>
48 std::shared_ptr<BACKGROUND_JOB> aJob );
50 void SetTitle(
const wxString& aTitle )
override
54 void Report(
const wxString& aMessage )
override;
66 std::shared_ptr<BACKGROUND_JOB>
m_job;
97 std::shared_ptr<BACKGROUND_JOB>
Create(
const wxString& aName );
102 void Remove( std::shared_ptr<BACKGROUND_JOB> job );
107 void ShowList( wxWindow* aParent, wxPoint aPos );
128 void jobUpdated( std::shared_ptr<BACKGROUND_JOB> aJob );
137 std::vector<std::shared_ptr<BACKGROUND_JOB>>
m_jobs;
BACKGROUND_JOB_LIST * m_jobListDialog
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Removes status bar from handling.
std::vector< std::shared_ptr< BACKGROUND_JOB > > m_jobs
Holds a reference to all active background jobs Access to this vector should be protected by locks si...
BACKGROUND_JOBS_MONITOR()
void ShowList(wxWindow *aParent, wxPoint aPos)
Shows the background job list.
std::shared_mutex m_mutex
Mutex to protect access to the m_jobs vector.
std::shared_ptr< BACKGROUND_JOB > Create(const wxString &aName)
Creates a background job with the given name.
void jobUpdated(std::shared_ptr< BACKGROUND_JOB > aJob)
Handles job status updates, intended to be called by BACKGROUND_JOB_REPORTER only.
void Remove(std::shared_ptr< BACKGROUND_JOB > job)
Removes the given background job from any lists and frees it.
void onListWindowClosed(wxCloseEvent &aEvent)
Handles removing the shown list window from our list of shown windows.
std::vector< KISTATUSBAR * > m_statusBars
std::vector< BACKGROUND_JOB_LIST * > m_shownDialogs
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
void SetNumPhases(int aNumPhases) override
Set the number of phases.
void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
std::shared_ptr< BACKGROUND_JOB > m_job
void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
BACKGROUND_JOBS_MONITOR * m_monitor
void SetTitle(const wxString &aTitle) override
Change the title displayed on the window caption.
This implements all the tricky bits for thread safety, but the GUI is left to derived classes.
std::atomic_bool m_cancelled
A progress reporter interface for use in multi-threaded environments.
std::shared_ptr< BACKGROUND_JOB_REPORTER > m_reporter