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("Cpu plot of: " + worker->getName(), true, false);
00038         this->cpuPlot->linkProperty(*worker);
00039         connect(form.stat_button, SIGNAL(pressed()),cpuPlot,SLOT(show()));
00040 
00041 /*      this->cpuPlotSmall = new QVCpuPlot("Small cpu plot of: " + worker->getName(), false);
00042         this->cpuPlotSmall->linkProperty(*worker);
00043         this->cpuPlotSmall->setFixedHeight(75);
00044         form.vboxLayout->addWidget(this->cpuPlotSmall);*/
00045         #else
00046         // for now, we don't hide the button.
00047         //form.stat_button.setVisible(false);
00048         #endif
00049 
00050         // Connect worker slots with form's buttons
00051         connect(form.pause_button,SIGNAL(pressed()),worker,SLOT(pause())/*,Qt::QueuedConnection*/);
00052         connect(form.play_button,SIGNAL(pressed()),worker,SLOT(unPause())/*,Qt::QueuedConnection*/);
00053         connect(form.next_button,SIGNAL(pressed()),worker,SLOT(step())/*,Qt::QueuedConnection*/);
00054         connect(form.stop_button, SIGNAL(pressed()),worker,SLOT(finish())/*,Qt::QueuedConnection*/);
00055 
00056         // Connecting slot with worker update signal
00057         connect(worker,SIGNAL(endIteration()),this,SLOT(newIterationSlot()),Qt::QueuedConnection);
00058         connect(worker,SIGNAL(statusUpdate(QVWorker::TWorkerStatus)),
00059                 this,SLOT(statusUpdate(QVWorker::TWorkerStatus))/*,Qt::QueuedConnection*/);
00060 
00061         show();
00062         qDebug() << "QVWorkerInterfaceSmall::QVWorkerInterfaceSmall(" << worker->getName() << ") <- return";
00063         }
00064 
00065 void QVWorkerInterfaceSmall::newIterationSlot()
00066         { form.iterationsLabel->setText(QString().setNum(worker->getIteration())); }
00067 
00068 void QVWorkerInterfaceSmall::statusUpdate(QVWorker::TWorkerStatus status)
00069         {
00070         switch(status)
00071                 {
00072                 case QVWorker::Finished:
00073                         form.stop_button->setEnabled(FALSE);
00074                         form.pause_button->setEnabled(FALSE);
00075                         form.play_button->setEnabled(FALSE);
00076                         form.next_button->setEnabled(FALSE);
00077                         break;
00078 
00079                 case QVWorker::Running:
00080                         form.pause_button->setEnabled(TRUE);
00081                         form.play_button->setEnabled(FALSE);
00082                         form.next_button->setEnabled(FALSE);
00083                         break;
00084 
00085                 case QVWorker::RunningOneStep:
00086                 case QVWorker::Paused:
00087                         form.pause_button->setEnabled(FALSE);
00088                         form.play_button->setEnabled(TRUE);
00089                         form.next_button->setEnabled(TRUE);
00090                         break;
00091 
00092                 default:
00093                         break;
00094                 }
00095         }
00096 

Generated on Thu Jul 17 17:23:28 2008 for QVision by  doxygen 1.5.3