PARP Research Group University of Murcia, Spain


src/qvgui/qvcameraworkerwidgetsmall.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008, 2009. 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/qvcameraworkerwidgetsmall.h>
00026 
00027 QVCameraWorkerWidgetSmall::QVCameraWorkerWidgetSmall(QVCameraWorker *camera, QWidget *parent): QWidget(parent)
00028         {
00029         form.setupUi(this);
00030         this->camera = camera;
00031         //FIXME quedarĂ¡ this->cameraWidget = new QVCameraWidget(camera);
00032 
00033         form.groupBox->setTitle(camera->getName());
00034 
00035 /*      this->sliderActive = true;
00036 
00037         if (this->camera->isLiveCamera())
00038                 form.seekSlider->setEnabled(false);
00039 
00040         // Connection of signals in camera control widget to private slots...
00041         connect(form.pause_button,SIGNAL(pressed()),camera,SLOT(pauseCam()));
00042         connect(form.play_button,SIGNAL(pressed()),camera,SLOT(unpauseCam()));
00043         connect(form.next_button,SIGNAL(pressed()),camera,SLOT(nextFrameCam()));
00044         connect(form.stop_button, SIGNAL(pressed()),camera,SLOT(closeCam()));
00045 
00046         connect(form.expand_button, SIGNAL(pressed()), cameraWidget,SLOT(show()));
00048 
00049         connect(form.seekSlider,SIGNAL(sliderPressed()),this,SLOT(seekPressedSlot()));
00050         connect(form.seekSlider,SIGNAL(sliderReleased()),this,SLOT(seekReleasedSlot()));
00051         connect(form.seekSlider,SIGNAL(valueChanged(int)),this,SLOT(seekMovedSlot()));
00052         connect(form.seekSlider,SIGNAL(sliderMoved(int)),this,SLOT(seekMovedSlot()));
00053 
00054         // ...and from private signals to public camera slots...
00055         connect(this,SIGNAL(speedPressed(double)), camera,SLOT(setSpeedCam(double)));
00056         connect(this,SIGNAL(seekPressed(QVCamera::TSeekType,double)), camera, SLOT(seekCam(QVCamera::TSeekType,double)));
00057         
00058         // ... and, finally, of camera newGrab and newRead signals to the
00059         // updateVisibleInfo slot...
00060         connect(camera,SIGNAL(newGrab()),this,SLOT(updateCameraVisibleInfoSlot()));
00061         connect(camera,SIGNAL(newRead()),this,SLOT(updateCameraVisibleInfoSlot()));
00062         connect(camera,SIGNAL(statusChange(QVCamera::TCameraStatus)),
00063                 this,SLOT(updateCameraStateSlot(QVCamera::TCameraStatus)));
00064 
00065         // ... and the closed signal of the camera, also to the closePressed slot:
00066         //connect(camera,SIGNAL(camClosed()),this,SLOT(closePressedSlot()));
00067 
00068 */
00069         }
00070 
00071 QVCameraWorkerWidgetSmall::~QVCameraWorkerWidgetSmall()
00072         {
00073                 //FIXME quedarĂ¡... delete this->cameraWidget;
00074         }
00075 
00076 /*void QVCameraWidgetSmall::seekPressedSlot()
00077         {
00078         sliderActive = false;
00079         }
00080 
00081 void QVCameraWidgetSmall::seekReleasedSlot()
00082         {
00083         sliderActive = true;
00084         emit seekPressed((QVCamera::TSeekType)1,form.seekSlider->value());
00085         }
00086 
00087 void QVCameraWidgetSmall::seekMovedSlot()
00088         {
00089         //emit seekPressed((QVCamera::TSeekType)1,form.seekSlider->value());
00090         }
00091 
00092 void QVCameraWidgetSmall::updateCameraVisibleInfoSlot()
00093         {
00094         int percen = (int)((100*camera->getTimePos())/camera->getTimeLength());
00095         if (sliderActive) form.seekSlider->setValue(percen);
00096         }
00097 
00098 void QVCameraWidgetSmall::updateCameraStateSlot(QVCamera::TCameraStatus status)
00099         {
00100         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot()";
00101         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot(): new state id:" << status;
00102         switch(status)
00103                 {
00104                 case QVCamera::Closed:
00105                         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot(): new state: Closed";
00106                         form.stop_button->setEnabled(FALSE);
00107                         form.pause_button->setEnabled(FALSE);
00108                         form.play_button->setEnabled(FALSE);
00109                         form.next_button->setEnabled(FALSE);
00110                         form.expand_button->setEnabled(FALSE);
00111                         break;
00112 
00113                 case QVCamera::Running:
00114                         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot(): new state: Running";
00115                         form.stop_button->setEnabled(TRUE);
00116                         form.pause_button->setEnabled(TRUE);
00117                         form.play_button->setEnabled(FALSE);
00118                         form.next_button->setEnabled(FALSE);
00119                         form.expand_button->setEnabled(TRUE);
00120                         break;
00121 
00122                 case QVCamera::RunningOneStep:
00123                         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot(): new state: Running one step";
00124 
00125                 case QVCamera::Paused:
00126                         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot(): new state: Paused";
00127                         form.stop_button->setEnabled(TRUE);
00128                         form.pause_button->setEnabled(FALSE);
00129                         form.play_button->setEnabled(TRUE);
00130                         form.next_button->setEnabled(TRUE);
00131                         form.expand_button->setEnabled(TRUE);
00132                         break;
00133 
00134                 default:
00135                         break;
00136                 }
00137 
00138         qDebug() << "QVCameraWidgetSmall::updateCameraStateSlot() <~ return";
00139         }
00140 */



QVision framework. PARP research group, copyright 2007, 2008.