00001 /*************************************************************************** 00002 ** 00003 ** This file is part of dinver. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2005-10-31 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef THREADLAUNCHER_H 00028 #define THREADLAUNCHER_H 00029 00030 #include <QQueue> 00031 00032 #include "ui_ThreadLauncher.h" 00033 00034 class ThreadLauncher : public QWidget, public Ui::ThreadLauncher 00035 { 00036 Q_OBJECT 00037 public: 00038 ThreadLauncher(QWidget* parent=0); 00039 ~ThreadLauncher(); 00040 00041 QString processBaseName(QString str); 00042 int processNameRank(QString str); 00043 QString processCompleteName(QString str, int num); 00044 bool isAnySelected(); 00045 bool isQueued() const {return !_processToStart.isEmpty();} 00046 bool assumeAllSelected(QString title, QString action); 00047 void wait(); 00048 public slots: 00049 void start(); 00050 void stop(); 00051 void clear(); 00052 void show(bool s); 00053 void remove(); 00054 void importModels(); 00055 void dequeueAll() {_processToStart.clear();} 00056 InversionThread * newThread(); 00057 void processFinished(); 00058 void applyAllSelected(); 00059 signals: 00060 void setCurrentRuns(ThreadList tList); 00061 private slots: 00062 void selectionChanged(); 00063 private: 00064 void start(InversionThread * t); 00065 void startQueued(); 00066 QQueue<InversionThread *> _processToStart; 00067 int _runningProcess; 00068 }; 00069 00070 #endif // QTBTHREADLAUNCHER_H