00001 //============================================================================= 00002 // 00003 // OpenFlipper 00004 // Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen 00005 // www.openflipper.org 00006 // 00007 //----------------------------------------------------------------------------- 00008 // 00009 // License 00010 // 00011 // OpenFlipper is free software: you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as published by 00013 // the Free Software Foundation, either version 3 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // OpenFlipper is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public License 00022 // along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>. 00023 // 00024 //----------------------------------------------------------------------------- 00025 // 00026 // $Revision: 8734 $ 00027 // $Author: kremer $ 00028 // $Date: 2010-03-16 16:19:02 +0100 (Di, 16. Mär 2010) $ 00029 // 00030 //============================================================================= 00031 00032 00033 #ifndef OPENFLIPPERTHREAD_HH 00034 #define OPENFLIPPERTHREAD_HH 00035 00036 #include <QThread> 00037 #include <QMutex> 00038 00039 #include <OpenFlipper/common/GlobalDefines.hh> 00040 00072 class OpenFlipperJob; 00073 00074 class DLLEXPORT OpenFlipperThread : public QThread 00075 { 00076 Q_OBJECT 00077 00078 public: 00079 OpenFlipperThread( QString _jobId ); 00080 ~OpenFlipperThread(); 00081 00082 //=========================================================================== 00085 //=========================================================================== 00086 public: 00087 00093 virtual void run(); 00094 00101 virtual void cancel(); 00102 00103 public slots: 00108 void slotCancel( QString _jobId); 00109 00110 signals: 00116 void state( QString _jobId, int _state ); 00117 00121 //=========================================================================== 00124 //=========================================================================== 00125 00126 signals: 00143 void function(); 00144 00150 void finished( QString _jobId ); 00151 00152 00153 00154 public slots: 00159 void startProcessing(); 00160 00164 private slots: 00169 void slotJobFinished(); 00170 00171 signals: 00177 void startProcessingInternal(); 00178 00179 private: 00188 OpenFlipperJob* job_; 00189 00195 QString jobId_; 00196 00197 QMutex startup_; 00198 00199 00200 }; 00201 00202 00203 // ================================================================================ 00204 // Job wrapper 00205 // ================================================================================ 00206 00217 class DLLEXPORT OpenFlipperJob : public QObject 00218 { 00219 Q_OBJECT 00220 00221 public: 00222 OpenFlipperJob() {} 00223 ~OpenFlipperJob(); 00224 00225 signals: 00233 void process(); 00234 00239 void finished(); 00240 00241 public slots: 00247 void startJobProcessing(); 00248 00249 }; 00250 00251 00252 00253 #endif //OPENFLIPPERTHREAD_HH