25#ifndef BACKGROUND_JOBS_MONITOR_H
26#define BACKGROUND_JOBS_MONITOR_H
32#include <shared_mutex>
49 const std::shared_ptr<BACKGROUND_JOB>& aJob );
51 void SetTitle(
const wxString& aTitle )
override
55 void Report(
const wxString& aMessage )
override;
67 std::shared_ptr<BACKGROUND_JOB>
m_job;
98 std::shared_ptr<BACKGROUND_JOB>
Create(
const wxString& aName );
103 void Remove( std::shared_ptr<BACKGROUND_JOB> job );
108 void ShowList( wxWindow* aParent, wxPoint aPos );
129 void jobUpdated( std::shared_ptr<BACKGROUND_JOB> aJob );
136 std::vector<std::shared_ptr<BACKGROUND_JOB>>
m_jobs;
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.
friend class 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.
friend class BACKGROUND_JOB_REPORTER
std::vector< KISTATUSBAR * > m_statusBars
std::vector< BACKGROUND_JOB_LIST * > m_shownDialogs
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
std::shared_ptr< BACKGROUND_JOB > m_job
BACKGROUND_JOBS_MONITOR * m_monitor
BACKGROUND_JOB_REPORTER(BACKGROUND_JOBS_MONITOR *aMonitor, const std::shared_ptr< BACKGROUND_JOB > &aJob)
void SetTitle(const wxString &aTitle) override
Change the title displayed on the window caption.
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
virtual bool updateUI()=0
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
PROGRESS_REPORTER_BASE(int aNumPhases)
std::atomic_bool m_cancelled
virtual void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
void SetNumPhases(int aNumPhases) override
Set the number of phases.
A progress reporter interface for use in multi-threaded environments.
std::shared_ptr< BACKGROUND_JOB_REPORTER > m_reporter