00001 /*===========================================================================*\ 00002 * * 00003 * OpenFlipper * 00004 * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * 00005 * www.openflipper.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenFlipper. * 00009 * * 00010 * OpenFlipper is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenFlipper is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenFlipper. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 83 $ * 00038 * $Author: kremer $ * 00039 * $Date: 2009-02-27 17:31:45 +0100 (Fr, 27. Feb 2009) $ * 00040 * * 00041 \*===========================================================================*/ 00042 00043 00044 /* 00045 * processManagerWidget.hh 00046 * 00047 * Created on: Apr 7, 2009 00048 * Author: kremer 00049 */ 00050 00051 #ifndef PROCESSMANAGERWIDGET_HH_ 00052 #define PROCESSMANAGERWIDGET_HH_ 00053 00054 #include <QtGui> 00055 #include <QWidget> 00056 00057 #include "ui_processManagerWidget.hh" 00058 00059 // A button class that additionally stores 00060 // an attached job's id. 00061 class JobCancelButton : public QPushButton { 00062 Q_OBJECT 00063 00064 public: 00065 JobCancelButton(QString _caption, QString _jobId, QWidget* _parent = 0) : 00066 QPushButton(_caption, _parent), 00067 jobId_(_jobId) {}; 00068 00069 // Set job's id 00070 void setJobId(const QString& _jobId) { jobId_ = _jobId; }; 00071 00072 // Get job's id 00073 QString jobId() { return jobId_; } 00074 00075 private: 00076 QString jobId_; 00077 }; 00078 00079 class ProcessManagerWidget : public QWidget, public Ui::ProcessManagerWidget 00080 { 00081 Q_OBJECT 00082 00083 signals: 00084 00085 void cancelJobRequested(QString _jobId); 00086 00087 public: 00088 00089 ProcessManagerWidget(QWidget* parent = 0) : QWidget(parent) { 00090 00091 setupUi(this); 00092 }; 00093 00094 virtual ~ProcessManagerWidget() {}; 00095 00096 void updateStatus(QString _id, int _status); 00097 00098 void setJobName(QString _id, QString _desc); 00099 00100 void setJobDescription(QString _id, QString _desc); 00101 00102 void addJob(QString _id, QString _description = "", 00103 int _minSteps = 0, int _maxSteps = 100); 00104 00105 void removeJob(QString _jobName); 00106 00107 private slots: 00108 00109 void cancelButtonPressed(); 00110 00111 private: 00112 00113 // A container to hold the widget items 00114 struct JobContainer { 00115 int row; 00116 QTableWidgetItem* id; 00117 QTableWidgetItem* description; 00118 QProgressBar* progress; 00119 JobCancelButton* button; 00120 }; 00121 00122 std::map<QString, JobContainer> processMap_; 00123 }; 00124 00125 00126 #endif /* PROCESSMANAGERWIDGET_HH_ */