Change UI job's process() method to be protected, as it should have been

Also add some comments to the interface of Job class
This commit is contained in:
tamasmeszaros 2021-08-20 13:43:52 +02:00
parent 883f46662d
commit 6efea25478
5 changed files with 21 additions and 17 deletions

View file

@ -49,11 +49,20 @@ protected:
// Launched just before start(), a job can use it to prepare internals
virtual void prepare() {}
// The method where the actual work of the job should be defined.
virtual void process() = 0;
// Launched when the job is finished. It refreshes the 3Dscene by def.
virtual void finalize() { m_finalized = true; }
virtual void on_exception(const std::exception_ptr &) {}
// Exceptions occuring in process() are redirected from the worker thread
// into the main (UI) thread. This method is called from the main thread and
// can be overriden to handle these exceptions.
virtual void on_exception(const std::exception_ptr &eptr)
{
if (eptr) std::rethrow_exception(eptr);
}
public:
Job(std::shared_ptr<ProgressIndicator> pri);
@ -65,8 +74,6 @@ public:
Job &operator=(const Job &) = delete;
Job &operator=(Job &&) = delete;
virtual void process() = 0;
void start();
// To wait for the running job and join the threads. False is