Commit d8f3c935 authored by Mike Kremer's avatar Mike Kremer

Added some comments on how to correctly use the OpenFlipperThread::state() signal.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12550 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d2a29886
...@@ -250,6 +250,17 @@ A quick example for stating a thread: ...@@ -250,6 +250,17 @@ A quick example for stating a thread:
thread->start(); // start thread thread->start(); // start thread
thread->startProcessing(); // start processing thread->startProcessing(); // start processing
\endcode \endcode
Note: If your class is derived from OpenFlipperThread and reimplements the
run() function, you might also want to connect the signal OpenFlipperThread::state()
to the plugin's signal setJobState():
\code
connect(thread, SIGNAL(state(QString, int)), this, SIGNAL(setJobState(QString, int)));
\endcode
Use signal OpenFlipperThread::state() within your run() function in order to
correctly update the job's state.
*/ */
Q_DECLARE_INTERFACE(ProcessInterface,"OpenFlipper.ProcessInterface/1.0") Q_DECLARE_INTERFACE(ProcessInterface,"OpenFlipper.ProcessInterface/1.0")
......
...@@ -90,7 +90,8 @@ class DLLEXPORT OpenFlipperThread : public QThread ...@@ -90,7 +90,8 @@ class DLLEXPORT OpenFlipperThread : public QThread
/** \brief Main processing /** \brief Main processing
* *
* Either reimplement this function or connect the function() * Either reimplement this function or connect the function()
* signal. * signal. If this function is reimplemented, use signal state()
* in order to inform the core about the job's current state.
*/ */
virtual void run(); virtual void run();
...@@ -115,11 +116,14 @@ class DLLEXPORT OpenFlipperThread : public QThread ...@@ -115,11 +116,14 @@ class DLLEXPORT OpenFlipperThread : public QThread
signals: signals:
/** \brief Tell core about job state /** \brief Tell core about job state
* *
* Emit this signal to tell the core about your job status. You have to create a new run function for * Use this signal to inform core about the job's state if and
* this. In simple mode, this signal is not emitted at all! * only if the thread class inherits from OpenFlipperThread
* and the virtual run() function is overridden. In all other cases
* this signal won't be used and does not have to be connected to from
* within the plugins.
*/ */
void state( QString _jobId, int _state ); void state( QString _jobId, int _state );
/** @} */ /** @} */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment