src/qvgui/qvworkerinterfacesmall.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #include <qvgui/qvworkerinterfacesmall.h>
00026 
00027 QVWorkerInterfaceSmall::QVWorkerInterfaceSmall(QVWorker *worker, QWidget *parent): QWidget(parent)
00028         {
00029         qDebug() << "QVWorkerInterfaceSmall::QVWorkerInterfaceSmall("<< worker->getName() << ")";
00030         form.setupUi(this);
00031 
00032         setWindowTitle(worker->getName());
00033         form.groupBox->setTitle(QString("Control: ")+worker->getName());
00034         this->worker = worker;
00035 
00036         #ifdef PACKAGE_QWT
00037         this->cpuPlot = new QVCpuPlot(&(this->worker->getCpuStat()));
00038         this->cpuPlotSmall = new QVCpuPlot(&(this->worker->getCpuStat()),false);
00039         form.vboxLayout->addWidget(this->cpuPlotSmall);
00040         this->cpuPlotSmall->setFixedHeight(75);
00041         connect(form.stat_button, SIGNAL(pressed()),cpuPlot,SLOT(show()));
00042         #else
00043         // for now, we don't hide the button.
00044         //form.stat_button.setVisible(false);
00045         #endif
00046 
00047         // Connect worker slots with form's buttons
00048         connect(form.pause_button,SIGNAL(pressed()),worker,SLOT(pause())/*,Qt::QueuedConnection*/);
00049         connect(form.play_button,SIGNAL(pressed()),worker,SLOT(unPause())/*,Qt::QueuedConnection*/);
00050         connect(form.next_button,SIGNAL(pressed()),worker,SLOT(step())/*,Qt::QueuedConnection*/);
00051         connect(form.stop_button, SIGNAL(pressed()),worker,SLOT(finish())/*,Qt::QueuedConnection*/);
00052 
00053         // Connecting slot with worker update signal
00054         connect(worker,SIGNAL(endIteration()),this,SLOT(newIterationSlot()),Qt::BlockingQueuedConnection);
00055         connect(worker,SIGNAL(statusUpdate(QVWorker::TWorkerStatus)),
00056                 this,SLOT(statusUpdate(QVWorker::TWorkerStatus))/*,Qt::QueuedConnection*/);
00057 
00058         show();
00059         qDebug() << "QVWorkerInterfaceSmall::QVWorkerInterfaceSmall(" << worker->getName() << ") <- return";
00060         }
00061 
00062 void QVWorkerInterfaceSmall::newIterationSlot()
00063         { form.iterationsLabel->setText(QString().setNum(worker->getIteration())); }
00064 
00065 void QVWorkerInterfaceSmall::statusUpdate(QVWorker::TWorkerStatus status)
00066         {
00067         switch(status)
00068                 {
00069                 case QVWorker::Finished:
00070                         form.stop_button->setEnabled(FALSE);
00071                         form.pause_button->setEnabled(FALSE);
00072                         form.play_button->setEnabled(FALSE);
00073                         form.next_button->setEnabled(FALSE);
00074                         break;
00075 
00076                 case QVWorker::Running:
00077                         form.pause_button->setEnabled(TRUE);
00078                         form.play_button->setEnabled(FALSE);
00079                         form.next_button->setEnabled(FALSE);
00080                         break;
00081 
00082                 case QVWorker::RunningOneStep:
00083                 case QVWorker::Paused:
00084                         form.pause_button->setEnabled(FALSE);
00085                         form.play_button->setEnabled(TRUE);
00086                         form.next_button->setEnabled(TRUE);
00087                         break;
00088 
00089                 default:
00090                         break;
00091                 }
00092         }
00093 

Generated on Wed Jan 16 18:41:29 2008 for QVision by  doxygen 1.5.3