casa
$Rev:20696$
|
Abstract class for a threaded operation for plotms. More...
#include <PlotMSThread.qo.h>
Signals | |
void | finishedOperation (PlotMSThread *thread) |
This signal MUST be emitted after start() has been called, and when the operation has finished. | |
void | initializeProgress (const QString &operationName) |
These signals are used to update the QtProgressWidget across different threads. | |
void | updateProgress (unsigned int progress, const QString &status) |
void | finalizeProgress () |
Public Member Functions | |
PlotMSThread (QtProgressWidget *progress, PMSPTMethod postThreadMethod=NULL, PMSPTObject postThreadObject=NULL) | |
Constructor which takes the progress widget to use, and an optional post-thread method that should be called when the thread is finished. | |
virtual | ~PlotMSThread () |
Destructor. | |
virtual void | startOperation ()=0 |
ABSTRACT METHODS //. | |
virtual void | terminateOperation () |
IMPLEMENTED METHODS //. | |
virtual void | postThreadMethod () |
Executes the post-thread method as needed. | |
Protected Slots | |
virtual void | background ()=0 |
For when the user requests "background" for the thread. | |
virtual void | pause ()=0 |
For when the user requests "pause" for the thread. | |
virtual void | resume ()=0 |
For when the user requests "resume" for the thread. | |
virtual void | cancel ()=0 |
For when the user requests "cancel" for the thread. | |
Protected Member Functions | |
virtual bool | wasCanceled () const =0 |
void | initializeProgressWidget (const String &operationName) |
IMPLEMENTED METHODS //. | |
void | updateProgressWidget (unsigned int progress, const String &status) |
Access for subclasses to update the progress widget. | |
void | finalizeProgressWidget () |
Access for subclasses to finalize the progress widget. | |
void | setAllowedOperations (bool background, bool pauseResume, bool cancel) |
Access for subclasses to set allowed operations on the progress widget. | |
Private Attributes | |
QtProgressWidget * | itsProgressWidget_ |
Progress widget. | |
PMSPTMethod * | itsPostThreadMethod_ |
Method/Object to run when thread is finished. | |
PMSPTObject | itsPostThreadObject_ |
Abstract class for a threaded operation for plotms.
PlotMSThread does not directly inherit from QThread in case the threading is happening elsewhere in the code (such as a plotter implementation that threads its own drawing). Classes that want to run PlotMSThreads should: 1) Provide a QtProgressWidget in the main (GUI) thread. 2) Connect the finishedOperation() signal to a slot as needed. 3) Call startOperation() to start the thread. 4) Call the post-thread method after completion, if there is one.
Definition at line 59 of file PlotMSThread.qo.h.
casa::PlotMSThread::PlotMSThread | ( | QtProgressWidget * | progress, |
PMSPTMethod | postThreadMethod = NULL , |
||
PMSPTObject | postThreadObject = NULL |
||
) |
Constructor which takes the progress widget to use, and an optional post-thread method that should be called when the thread is finished.
virtual casa::PlotMSThread::~PlotMSThread | ( | ) | [virtual] |
Destructor.
virtual void casa::PlotMSThread::background | ( | ) | [protected, pure virtual, slot] |
For when the user requests "background" for the thread.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
virtual void casa::PlotMSThread::cancel | ( | ) | [protected, pure virtual, slot] |
For when the user requests "cancel" for the thread.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
Referenced by terminateOperation().
void casa::PlotMSThread::finalizeProgress | ( | ) | [signal] |
void casa::PlotMSThread::finalizeProgressWidget | ( | ) | [protected] |
Access for subclasses to finalize the progress widget.
void casa::PlotMSThread::finishedOperation | ( | PlotMSThread * | thread | ) | [signal] |
This signal MUST be emitted after start() has been called, and when the operation has finished.
The thread parameter points to the thread that has just completed.
void casa::PlotMSThread::initializeProgress | ( | const QString & | operationName | ) | [signal] |
These signals are used to update the QtProgressWidget across different threads.
They shouldn't need to be used by other classes, even children.
void casa::PlotMSThread::initializeProgressWidget | ( | const String & | operationName | ) | [protected] |
IMPLEMENTED METHODS //.
Access for subclasses to initialize the progress widget with the given operation name.
virtual void casa::PlotMSThread::pause | ( | ) | [protected, pure virtual, slot] |
For when the user requests "pause" for the thread.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
virtual void casa::PlotMSThread::postThreadMethod | ( | ) | [virtual] |
Executes the post-thread method as needed.
Does nothing if a post-thread method was not set in the constructor.
virtual void casa::PlotMSThread::resume | ( | ) | [protected, pure virtual, slot] |
For when the user requests "resume" for the thread.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
void casa::PlotMSThread::setAllowedOperations | ( | bool | background, |
bool | pauseResume, | ||
bool | cancel | ||
) | [protected] |
Access for subclasses to set allowed operations on the progress widget.
virtual void casa::PlotMSThread::startOperation | ( | ) | [pure virtual] |
ABSTRACT METHODS //.
Abstract method which does the operation. IMPORTANT: subclasses MUST emit the finished() signal when finished.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
virtual void casa::PlotMSThread::terminateOperation | ( | ) | [inline, virtual] |
IMPLEMENTED METHODS //.
Method which terminates the operation regardless of whether it has finished or not.
Definition at line 84 of file PlotMSThread.qo.h.
References cancel().
void casa::PlotMSThread::updateProgress | ( | unsigned int | progress, |
const QString & | status | ||
) | [signal] |
void casa::PlotMSThread::updateProgressWidget | ( | unsigned int | progress, |
const String & | status | ||
) | [protected] |
Access for subclasses to update the progress widget.
virtual bool casa::PlotMSThread::wasCanceled | ( | ) | const [protected, pure virtual] |
ABSTRACT METHODS //
Returns true if the threaded finished due to be canceled, false otherwise.
Implemented in casa::PlotMSCacheThread, casa::PlotMSExportThread, and casa::PlotMSDrawThread.
Method/Object to run when thread is finished.
Definition at line 147 of file PlotMSThread.qo.h.
Definition at line 148 of file PlotMSThread.qo.h.
Progress widget.
Definition at line 143 of file PlotMSThread.qo.h.