camerauis/cameraxui/cxengine/inc/cxevideocapturecontroldesktop.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CXEVIDEOCAPTURECONTROLDESKTOP_H_
       
    19 #define CXEVIDEOCAPTURECONTROLDESKTOP_H_
       
    20 
       
    21 #include <QTime>
       
    22 #include <QPixmap>
       
    23 #include <QTimer>
       
    24 
       
    25 #include "cxesettings.h"
       
    26 #include "cxevideocapturecontrol.h"
       
    27 #include "cxestatemachine.h"
       
    28 #include "cxenamespace.h"
       
    29 
       
    30 
       
    31 // Custom command for setting a new filename without closing & reopening the controller
       
    32 enum TCamCControllerCustomCommands
       
    33     {
       
    34     ECamCControllerCCNewFilename = 0,
       
    35     ECamCControllerCCVideoStopAsync
       
    36     };
       
    37 
       
    38 
       
    39 // forward declarations
       
    40 class CxeCameraDeviceDesktop;
       
    41 class CxeQualityPresets;
       
    42 class CxeFilenameGenerator;
       
    43 class CxeViewfinderControl;
       
    44 class CxeCameraDeviceControl;
       
    45 
       
    46 
       
    47 class CxeVideoCaptureControlDesktop : public CxeVideoCaptureControl
       
    48 {
       
    49     Q_OBJECT
       
    50 
       
    51 public:  // constructors
       
    52 
       
    53     CxeVideoCaptureControlDesktop( CxeCameraDeviceDesktop &cameraDevice,
       
    54                                    CxeViewfinderControl &viewfinderControl,
       
    55                                    CxeCameraDeviceControl &cameraDeviceControl,
       
    56                                    CxeFilenameGenerator &nameGenerator,
       
    57                                    CxeQualityPresets &qualityPresets);
       
    58 
       
    59     virtual ~CxeVideoCaptureControlDesktop();
       
    60 
       
    61 public:  // functions from CxeVideoCaptureControl
       
    62     CxeVideoCaptureControl::State state() const;
       
    63     void record();
       
    64     void pause();
       
    65     void stop();
       
    66     void remainingTime(int &time);
       
    67     bool elapsedTime(int &time);
       
    68     void reset();
       
    69     QString filename() const;
       
    70     QPixmap snapshot() const;
       
    71     QList<CxeVideoDetails> supportedVideoQualities();
       
    72 
       
    73 public:  // public member functions, not in client API
       
    74     void handleSnapshotEvent(CxeError::Id error);
       
    75 
       
    76 signals:
       
    77     void videoPrepareComplete(CxeError::Id error);
       
    78     void prepareZoomForVideo();
       
    79 
       
    80 public slots:
       
    81     //! Notification for when camera device is ready and we're entering video mode
       
    82     void init();
       
    83     //! Notification for when we're exiting video mode
       
    84     void deinit();
       
    85     //! Notification that videocapture sound has been played
       
    86     void handleSoundPlayed();
       
    87 
       
    88 protected slots:
       
    89     // notifications when ECam reference is changed
       
    90     void prepareForCameraDelete();
       
    91     void handleCameraAllocated(CxeError::Id error);
       
    92     void prepareForRelease();
       
    93     // ECam events
       
    94     void handleCameraEvent(int eventUid, int error);
       
    95     // settings call back
       
    96     void handleSettingValueChanged(const QString &settingId, QVariant newValue);
       
    97     void handleSceneChanged(CxeScene &scene);
       
    98 
       
    99 private: // helper methods
       
   100     void releaseResources();
       
   101     void initializeStates();
       
   102     int prepareVideoSnapshot();
       
   103     void initVideoRecorder();
       
   104     void open();
       
   105     void prepare();
       
   106     void createVideoRecorder();
       
   107     void setupElapseTimer();
       
   108     void setState(CxeVideoCaptureControl::State stateId, CxeError::Id error = CxeError::None);
       
   109 
       
   110 private slots:
       
   111     void handleElapseTimeout();
       
   112 
       
   113 private: // private data
       
   114 
       
   115     CxeCameraDeviceDesktop &mCameraDevice;
       
   116     CxeCameraDeviceControl &mCameraDeviceControl;
       
   117     CxeViewfinderControl &mViewfinderControl;
       
   118     CxeFilenameGenerator &mFilenameGenerator;
       
   119     CxeQualityPresets &mQualityPresets;
       
   120     //! Snapshot image.
       
   121     QPixmap mSnapshot;
       
   122     //! New file name generated for the video prepare.
       
   123     QString mNewFileName;
       
   124     //! Current video file name
       
   125     QString mCurrentFilename;
       
   126     CxeVideoCaptureControl::State mState;
       
   127     //current video quality details in use
       
   128     CxeVideoDetails mCurrentVideoDetails;
       
   129     
       
   130     //timer for simulating elapsing time
       
   131     QTimer mRecordElapseTimer;
       
   132     
       
   133     //elapsed recording time in seconds
       
   134     int mElapsedTime;
       
   135 };
       
   136 
       
   137 #endif /* CXEVIDEOCAPTURECONTROLDESKTOP_H_ */