00001 /*************************************************************************** 00002 * Copyright (c) 2009 Werner Mayer <wmayer@users.sourceforge.net> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef SANDBOX_DOCUMENTTHREAD_H 00025 #define SANDBOX_DOCUMENTTHREAD_H 00026 00027 #include <QThread> 00028 #include <QMutex> 00029 #include <Base/Handle.h> 00030 #include <App/DocumentObject.h> 00031 00032 namespace Mesh { 00033 class MeshObject; 00034 } 00035 00036 namespace Sandbox { 00037 00038 class SandboxAppExport DocumentThread : public QThread 00039 { 00040 public: 00041 DocumentThread(QObject* parent=0); 00042 ~DocumentThread(); 00043 00044 protected: 00045 void run(); 00046 }; 00047 00048 class SandboxAppExport WorkerThread : public QThread 00049 { 00050 public: 00051 WorkerThread(QObject* parent=0); 00052 ~WorkerThread(); 00053 00054 protected: 00055 void run(); 00056 }; 00057 00058 class SandboxAppExport PythonThread : public QThread 00059 { 00060 public: 00061 PythonThread(QObject* parent=0); 00062 ~PythonThread(); 00063 00064 protected: 00065 void run(); 00066 static QMutex mutex; 00067 }; 00068 00069 class SandboxAppExport MeshLoaderThread : public QThread 00070 { 00071 public: 00072 MeshLoaderThread(const QString&, QObject* parent=0); 00073 ~MeshLoaderThread(); 00074 00075 Base::Reference<Mesh::MeshObject> getMesh() const; 00076 00077 protected: 00078 void run(); 00079 00080 private: 00081 QString filename; 00082 Base::Reference<Mesh::MeshObject> mesh; 00083 }; 00084 00085 class SandboxObject : public App::DocumentObject 00086 { 00087 PROPERTY_HEADER(SandboxObject); 00088 00089 public: 00090 SandboxObject(); 00091 ~SandboxObject(); 00092 00093 App::PropertyInteger Integer; 00094 00095 short mustExecute(void) const; 00096 App::DocumentObjectExecReturn *execute(void); 00097 void onChanged(const App::Property* prop); 00098 const char* getViewProviderName(void) const { 00099 return "Gui::ViewProviderDocumentObject"; 00100 } 00101 00102 void setIntValue(int); 00103 void resetValue(); 00104 }; 00105 00106 class SandboxAppExport DocumentTestThread : public QThread 00107 { 00108 public: 00109 DocumentTestThread(QObject* parent=0); 00110 ~DocumentTestThread(); 00111 00112 protected: 00113 void run(); 00114 }; 00115 00116 } 00117 00118 #endif // SANDBOX_DOCUMENTTHREAD_H 00119