Commit 426e47f8 authored by Mike Kremer's avatar Mike Kremer

Added some notes on how to use the OpenFlipperThread class.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8733 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9c43a53d
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
//============================================================================= //=============================================================================
#ifndef OPENFLIPPERTHREAD_HH #ifndef OPENFLIPPERTHREAD_HH
#define OPENFLIPPERTHREAD_HH #define OPENFLIPPERTHREAD_HH
...@@ -40,6 +38,37 @@ ...@@ -40,6 +38,37 @@
#include <OpenFlipper/common/GlobalDefines.hh> #include <OpenFlipper/common/GlobalDefines.hh>
/**
\class OpenFlipperThread
Instanciate this class in order to provide a thread
to a plugin. Unless you don't need a specialized
run() or cancel() function, it won't be necessary to
reimplement this class. Just connect the signals
for the thread to work properly.
The following example shows a simple example
of how to use this class from within a plugin:
\code
OpenFlipperThread* myThread = new OpenFlipperThread("MyPluginsThread");
// Connect the appropriate signals
connect(myThread, SIGNAL(state(QString, int)), this, SIGNAL(setJobState(QString, int)));
connect(myThread, SIGNAL(finished(QString)), this, SIGNAL(finishJob(QString)));
connect(myThread, SIGNAL(function()), this, SLOT(myPluginsThreadFunction()), Qt::DirectConnection);
// Tell core about my thread
emit startJob( "MyPluginsThread", "Thread Description" , 0 , 100 , true);
// Start internal QThread
myThread->start();
// Start actual processing of job
myThread->startProcessing();
\endcode
*/
class OpenFlipperJob; class OpenFlipperJob;
class DLLEXPORT OpenFlipperThread : public QThread class DLLEXPORT OpenFlipperThread : public QThread
...@@ -58,8 +87,8 @@ class DLLEXPORT OpenFlipperThread : public QThread ...@@ -58,8 +87,8 @@ class DLLEXPORT OpenFlipperThread : public QThread
/** \brief Main processing /** \brief Main processing
* *
* Connect a function to the function() signal ( DirectConnection!!! ) * Either reimplement this function or connect the function()
* Or reimplement this function * signal.
*/ */
virtual void run(); virtual void run();
......
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