mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	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:
		
							parent
							
								
									883f46662d
								
							
						
					
					
						commit
						6efea25478
					
				
					 5 changed files with 21 additions and 17 deletions
				
			
		|  | @ -35,7 +35,9 @@ protected: | |||
|     void prepare() override; | ||||
| 
 | ||||
|     void on_exception(const std::exception_ptr &) override; | ||||
|      | ||||
| 
 | ||||
|     void process() override; | ||||
| 
 | ||||
| public: | ||||
|     ArrangeJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater) | ||||
|         : PlaterJob{std::move(pri), plater} | ||||
|  | @ -46,8 +48,6 @@ public: | |||
|         return int(m_selected.size() + m_unprintable.size()); | ||||
|     } | ||||
|      | ||||
|     void process() override; | ||||
|      | ||||
|     void finalize() override; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ class FillBedJob : public PlaterJob | |||
| protected: | ||||
| 
 | ||||
|     void prepare() override; | ||||
|     void process() override; | ||||
| 
 | ||||
| public: | ||||
|     FillBedJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater) | ||||
|  | @ -35,8 +36,6 @@ public: | |||
|         return m_status_range; | ||||
|     } | ||||
| 
 | ||||
|     void process() override; | ||||
| 
 | ||||
|     void finalize() override; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -48,14 +48,14 @@ class RotoptimizeJob : public PlaterJob | |||
| protected: | ||||
| 
 | ||||
|     void prepare() override; | ||||
|     void process() override; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|     RotoptimizeJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater) | ||||
|         : PlaterJob{std::move(pri), plater} | ||||
|     {} | ||||
|      | ||||
|     void process() override; | ||||
| 
 | ||||
|     void finalize() override; | ||||
| 
 | ||||
|     static constexpr size_t get_methods_count() { return std::size(Methods); } | ||||
|  |  | |||
|  | @ -10,18 +10,16 @@ class SLAImportJob : public PlaterJob { | |||
|      | ||||
|     std::unique_ptr<priv> p; | ||||
|      | ||||
| protected: | ||||
|     void prepare() override; | ||||
|     void process() override; | ||||
|     void finalize() override; | ||||
| 
 | ||||
| public: | ||||
|     SLAImportJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater); | ||||
|     ~SLAImportJob(); | ||||
| 
 | ||||
|     void process() override; | ||||
|      | ||||
|     void reset(); | ||||
|      | ||||
| protected: | ||||
|     void prepare() override; | ||||
|      | ||||
|     void finalize() override; | ||||
| }; | ||||
| 
 | ||||
| }}     // namespace Slic3r::GUI
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros