File indexing completed on 2024-05-12 16:23:32

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2008 by Bjoern Erik Nilsen & Fredrik Berg Kjoelstad*
0003  *   bjoern.nilsen@bjoernen.com & fredrikbk@hotmail.com                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 #ifndef IMAGEGRABTHREAD_H
0021 #define IMAGEGRABTHREAD_H
0022 
0023 #include <QThread>
0024 
0025 class FrameView;
0026 class ImageGrabber;
0027 
0028 /**
0029  * Thread used for polling an external program to update the camera. Only
0030  * used for polling, not for when the camera is running in daemon mode.
0031  *
0032  * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad
0033  */
0034 class ImageGrabThread : public QThread
0035 {
0036     Q_OBJECT
0037 public:
0038     /**
0039      * Constructs and initializes the object.
0040      * @param frameView the frame view to be used for displaying images
0041      * @param grabber the grabber to use be used for grabbing images
0042      */
0043     ImageGrabThread(FrameView *frameView, ImageGrabber *grabber);
0044         
0045     /**
0046      * Displays the images grabbed with the registered grabber. These
0047      * are displayed one after one and it looks like we are streaming
0048      * live from the camera.
0049      */
0050     void run();
0051     
0052     /**
0053      * Checks if last grabbing was successful.
0054      * @return true if last grabbing was success, false otherwise
0055      */
0056     bool wasGrabbingSuccess();
0057 
0058 signals:
0059     void grabbed();
0060 
0061 private:
0062     FrameView *frameView;
0063     ImageGrabber *grabber;
0064     bool wasGrabSuccess;
0065 };
0066 
0067 #endif