GrabQtMainForm.ui.h

Go to the documentation of this file.
00001 /*! @file Qt/GrabQtMainForm.ui.h main window for test-GrabQt */
00002 
00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Qt/GrabQtMainForm.ui.h $
00004 // $Id: GrabQtMainForm.ui.h 10993 2009-03-06 06:05:33Z itti $
00005 
00006 /****************************************************************************
00007 ** ui.h extension file, included from the uic-generated form implementation.
00008 **
00009 ** If you want to add, delete, or rename functions or slots, use
00010 ** Qt Designer to update this file, preserving your code.
00011 **
00012 ** You should not define a constructor or destructor in this file.
00013 ** Instead, write your code in functions called init() and destroy().
00014 ** These will automatically be called by the form's constructor and
00015 ** destructor.
00016 *****************************************************************************/
00017 
00018 #include "Image/Image.H"
00019 #include "Image/Pixels.H"
00020 
00021 void GrabQtMainForm::init( int argc, const char **argv )
00022 {
00023   grabbing = false;
00024   gbc.reset( new FrameGrabberConfigurator( manager ) );
00025   manager.addSubComponent( gbc );
00026 
00027   // parse command-line:
00028   if (manager.parseCommandLine(argc, argv, "", 0, 0) == false)
00029     exit( 1 );
00030 
00031   // use configuration dialog
00032   bool dorun = false;
00033   mmc.init( manager, &dorun );
00034   mmc.show();
00035 
00036   // post-config configs (!!!)
00037   gb = gbc->getFrameGrabber();
00038   if( gb.get() == NULL )
00039     {
00040       QMessageBox::warning( this, "Warning",
00041                             "You need to select a valid frame grabber for this program to be useful.",
00042                             QMessageBox::Ok, QMessageBox::NoButton,
00043                             QMessageBox::NoButton );
00044     }
00045 }
00046 
00047 void GrabQtMainForm::handlePauseButton()
00048 {
00049   display = new QDialog( this );
00050   display->setFixedSize( gb->readRGB().getWidth(),
00051                          gb->readRGB().getHeight() );
00052   display->show();
00053   startTimer( 33 );
00054 }
00055 
00056 void GrabQtMainForm::handlePanSlider( int pos )
00057 {
00058   QMessageBox::warning( this, "Warning",
00059                         "This has not been implemented yet!!",
00060                         QMessageBox::Ok, QMessageBox::NoButton,
00061                         QMessageBox::NoButton );
00062 }
00063 
00064 void GrabQtMainForm::handleTiltSlider( int pos )
00065 {
00066   QMessageBox::warning( this, "Warning",
00067                         "This has not been implemented yet!!",
00068                         QMessageBox::Ok, QMessageBox::NoButton,
00069                         QMessageBox::NoButton );
00070 }
00071 
00072 void GrabQtMainForm::saveImage()
00073 {
00074   QString file = QFileDialog::getSaveFileName( QString::null,
00075                                                "Images (*.pgm *.ppm)",
00076                                                this, "OpenImageDialog",
00077                                                "Choose Image" );
00078   if( !file.isEmpty() )
00079     Raster::WriteRGB( gb->readRGB(), file.latin1() );
00080   else
00081     QMessageBox::critical( this, "Error",
00082                            "Error: No image file specified!",
00083                            QMessageBox::Ok, QMessageBox::NoButton,
00084                            QMessageBox::NoButton );
00085 }
00086 
00087 void GrabQtMainForm::timerEvent( QTimerEvent *qte )
00088 {
00089   grabImage();
00090 }
00091 
00092 void GrabQtMainForm::grabImage()
00093 {
00094   QPixmap qpixm = convertToQPixmap( gb->readRGB() );
00095   display->setPaletteBackgroundPixmap( qpixm );
00096 }
Generated on Sun May 8 08:41:15 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3