Warning, file /multimedia/stopmotion/src/application/camerahandler.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2014 by Linuxstopmotion contributors;              *
0003  *   see the AUTHORS file for details.                                     *
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 CAMERAHANDLER_H
0021 #define CAMERAHANDLER_H
0022 
0023 #include <QObject>
0024 #include "src/domain/animation/workspacefile.h"
0025 
0026 class FrameView;
0027 class ModelHandler;
0028 
0029 class QPushButton;
0030 class QStatusBar;
0031 class QTimer;
0032 
0033 /**
0034  *
0035  *@author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad
0036  */
0037 class CameraHandler : public QObject
0038 {
0039     Q_OBJECT
0040 public:
0041     /**
0042      * Constructor for setting up the camerahandler.
0043      * @param parent the parent widget
0044      * @param sb the statusbar for updates
0045      * @param modelHandler for adding frames when capturing.
0046      * @param name the name of the object
0047      */
0048     CameraHandler ( QObject *parent = 0, QStatusBar *sb = 0, 
0049             ModelHandler* modelHandler = 0, const char *name = 0);
0050     
0051     ~CameraHandler();
0052 
0053     void setCameraButton( QPushButton *cameraButton );
0054     void setFrameView(FrameView *frameView);
0055     
0056     /**
0057      * Sets the viewing mode which is the type of effect used when running the camera.
0058      * @param mode the type of effect to be showed on the video. The modes are:
0059      *             0: Image mixing/onion skinning
0060      *             1: Image differentiating
0061      *             2: Playback
0062      * @return true if the change was successful
0063      */
0064     bool setViewMode(int mode);
0065     
0066     /**
0067      * Checks if the camera is on.
0068      * @return true if the camera is on.
0069      */
0070     bool isCameraRunning();
0071 
0072 public slots:
0073     void toggleCamera();
0074     void captureFrame();
0075     
0076     /**
0077      * Slot to receive a message when the videoView are finished setting up the
0078      * camera.
0079      */
0080     void switchToVideoView();
0081     
0082 private:
0083     QStatusBar *statusBar;
0084     QPushButton *cameraButton;
0085     QTimer *timer;
0086     WorkspaceFile capturedFile;
0087     bool isCameraOn;
0088     ModelHandler *modelHandler;
0089     
0090     FrameView *frameView;
0091     
0092     void cameraOn();
0093     void cameraOff();
0094 
0095 private slots:
0096     /**
0097      * Slot called by the timer which checks if the frame has been fully captured.
0098      */
0099     void storeFrame();
0100     
0101     void setMixCount(int mixCount);
0102     
0103     void setPlaybackSpeed(int playBackSpeed);
0104     
0105 signals:
0106     void capturedFrame();
0107     
0108     /**
0109      * This signal is emitted when the state of the camera is changed.
0110      * @param isActivated true if the camera has been activated.
0111      */
0112     void cameraStateChanged(bool isActivated);
0113     
0114 };
0115 
0116 #endif