BlockingWidget.hh

00001 #ifndef BLOCKINGWIDGET_HH
00002 #define BLOCKINGWIDGET_HH
00003 
00004 #include "processManagerWidget.hh"
00005 
00006 class BlockingWidget : public QWidget {
00007 Q_OBJECT
00008 
00009 signals:
00010         void cancelRequested(QString _jobId);
00011 
00012 private slots:
00013 
00014         void cancelPressed() {
00015                 JobCancelButton* button = 0;
00016                 button = dynamic_cast<JobCancelButton*>(QObject::sender());
00017                 if(button != 0) {
00018                         emit cancelRequested(button->jobId());
00019                 }
00020         };
00021 
00022 public:
00023         BlockingWidget(QString _jobId, QString _description,
00024                         int _minSteps, int _maxSteps, QWidget* _parent = 0) : QWidget(_parent),
00025                         layout_(0),
00026                         description_(0),
00027                         progress_(0),
00028                         cancelButton_(0) {
00029 
00030                 setWindowTitle(_jobId);
00031                 // Set window size
00032                 QSize size(300, 150);
00033                 resize(size);
00034 
00035                 layout_ = new QVBoxLayout();
00036                 description_ = new QLabel(_description);
00037                 layout_->addWidget(description_);
00038 
00039                 progress_ = new QProgressBar();
00040                 progress_->setMinimum(_minSteps);
00041                 progress_->setMaximum(_maxSteps);
00042                 progress_->setValue(0);
00043                 progress_->setTextVisible(true);
00044                 layout_->addWidget(progress_);
00045 
00046                 cancelButton_ = new JobCancelButton("Cancel", _jobId, this);
00047                 layout_->addWidget(cancelButton_);
00048 
00049                 setLayout(layout_);
00050 
00051                 // Connect cancel button
00052                 connect(cancelButton_, SIGNAL(pressed()), this, SLOT(cancelPressed()));
00053         };
00054 
00055         void updateStatus(int _value) { progress_->setValue(_value); };
00056 
00057         void setJobId(QString _jobId) { setWindowTitle(_jobId); };
00058 
00059         void setJobDescription(QString _description) { description_->setText(_description); };
00060 
00061 private:
00062         QVBoxLayout*            layout_;
00063         QLabel*                         description_;
00064         QProgressBar*           progress_;
00065         JobCancelButton*        cancelButton_;
00066 };
00067 
00068 #endif // BLOCKINGWIDGET_HH

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .