Overview     Modules     Class Hierarchy     Classes     Members  
tlp::PluginProgress Class Reference

Interface to notify and control the progression of a process. More...

#include <PluginProgress.h>

Inheritance diagram for tlp::PluginProgress:

List of all members.

Public Member Functions

  • virtual ~PluginProgress ()
  • virtual ProgressState progress (int step, int max_step)=0
    Notify the progression of the process.
  • virtual void cancel ()=0
    Sets the state flag to cancel, notifying to the process that the user wants to cancel it. Canceling a process must stop it and revert all the changes performed since its start.
  • virtual void stop ()=0
    Sets the state flag to stop, notifying to the process that the user wants to stop it. Stopping a process does not revert changes.
  • virtual bool isPreviewMode () const =0
    The preview mode redraws the graph while applying the algorithm, making it slower.
  • virtual void setPreviewMode (bool drawPreview)=0
    The preview mode redraws the graph while applying the algorithm, making it slower.
  • virtual void showPreview (bool showPreview)=0
    This tells the widget if it should show a preview checkbox, allowing the user to decide if the algorithm should draw a preview or not.
  • virtual ProgressState state () const =0
    Gets the current internal state of the PluginProgress.
  • virtual std::string getError ()=0
    Returns a message describing the error encountered during the process. If no error has been encountered, an empty string is returned.
  • virtual void setError (std::string error)=0
    Sets the message describing the error encountered during the process.
  • virtual void setComment (std::string comment)=0
    Changes the comment about the process progression.

Detailed Description

Interface to notify and control the progression of a process.

To notify the progression use the progress function. You can ask

 PluginProgress *progress = new QtProgress(parentWidget, \"Awesome task #1\");
 progress->setComment("First step");
 for(int i = 0 ; i<50 ;++i){
 //Perform some actions
 //.....

 //Check internal state
 if(progress->state()!=TLP_CONTINUE){
 //User want to stop the process
 break;
 }

 //Notify progression.
 progress->progress(i,50);
 }

 //Delete the progress once you're done with it
 delete progress;

Constructor & Destructor Documentation

virtual tlp::PluginProgress::~PluginProgress ( ) [inline, virtual]

Member Function Documentation

virtual void tlp::PluginProgress::cancel ( ) [pure virtual]

Sets the state flag to cancel, notifying to the process that the user wants to cancel it. Canceling a process must stop it and revert all the changes performed since its start.

Returns:
void

Implemented in tlp::SimplePluginProgress.

virtual std::string tlp::PluginProgress::getError ( ) [pure virtual]

Returns a message describing the error encountered during the process. If no error has been encountered, an empty string is returned.

Returns:
:string A description of the encountered error, if any.

Implemented in tlp::SimplePluginProgress.

virtual bool tlp::PluginProgress::isPreviewMode ( ) const [pure virtual]

The preview mode redraws the graph while applying the algorithm, making it slower.

Returns:
bool Whether the preview mode is activated.

Implemented in tlp::SimplePluginProgress.

virtual ProgressState tlp::PluginProgress::progress ( int  step,
int  max_step 
) [pure virtual]

Notify the progression of the process.

Parameters:
stepThe current step number.
max_stepThe total number of steps.
Returns:
:ProgressState a value indicating whether the progress has been stopped, cancelled, or will continue.

Implemented in tlp::SimplePluginProgress.

virtual void tlp::PluginProgress::setComment ( std::string  comment) [pure virtual]

Changes the comment about the process progression.

Parameters:
commentA description of what the plugin is currently doing, displayed to inform the user.
Returns:
void

Implemented in tlp::SimplePluginProgress.

virtual void tlp::PluginProgress::setError ( std::string  error) [pure virtual]

Sets the message describing the error encountered during the process.

Parameters:
errorThe description of the encountered error.
Returns:
void

Implemented in tlp::SimplePluginProgress.

virtual void tlp::PluginProgress::setPreviewMode ( bool  drawPreview) [pure virtual]

The preview mode redraws the graph while applying the algorithm, making it slower.

Parameters:
drawPreviewWhether the preview should be drawn.
Returns:
void

Implemented in tlp::SimplePluginProgress.

virtual void tlp::PluginProgress::showPreview ( bool  showPreview) [pure virtual]

This tells the widget if it should show a preview checkbox, allowing the user to decide if the algorithm should draw a preview or not.

Parameters:
showPreviewWhether the progress widget should contain a preview checkbox or not.
Returns:
void

Implemented in tlp::SimplePluginProgress.

virtual ProgressState tlp::PluginProgress::state ( ) const [pure virtual]

Gets the current internal state of the PluginProgress.

Returns:
:ProgressState The current state.

Implemented in tlp::SimplePluginProgress.

virtual void tlp::PluginProgress::stop ( ) [pure virtual]

Sets the state flag to stop, notifying to the process that the user wants to stop it. Stopping a process does not revert changes.

Returns:
void

Implemented in tlp::SimplePluginProgress.



Tulip Software by LaBRI Visualization Team    2001 - 2012