GrabQtMainForm.ui.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00028 if (manager.parseCommandLine(argc, argv, "", 0, 0) == false)
00029 exit( 1 );
00030
00031
00032 bool dorun = false;
00033 mmc.init( manager, &dorun );
00034 mmc.show();
00035
00036
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 }