camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h
branchRCL_3
changeset 53 61bc0f252b2b
equal deleted inserted replaced
50:f54ad444594d 53:61bc0f252b2b
       
     1 /*
       
     2 * Copyright (c) 2009-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 #ifndef CXESTILLCAPTURECONTROLSYMBIAN_H
       
    18 #define CXESTILLCAPTURECONTROLSYMBIAN_H
       
    19 
       
    20 #include <QList>
       
    21 #include <ecam.h>
       
    22 #include <QPixmap>
       
    23 #include <QVariant>
       
    24 
       
    25 #include "cxestillcapturecontrol.h"
       
    26 #include "cxeautofocuscontrol.h"
       
    27 #include "cxesensoreventhandler.h"
       
    28 #include "cxestatemachine.h"
       
    29 #include "cxenamespace.h"
       
    30 #include "cxeerror.h"
       
    31 
       
    32 class CxeSoundPlayerSymbian;
       
    33 class CxeFilenameGenerator;
       
    34 class CxeFileSaveThread;
       
    35 class CxeCameraDevice;
       
    36 class MCameraBuffer;
       
    37 class CxeStillImageSymbian;
       
    38 class CxeImageDataQueue;
       
    39 class CxeImageDataQueueSymbian;
       
    40 class CxeViewfinderControl;
       
    41 class CxeSnapshotControl;
       
    42 class CxeSensorEventHandler;
       
    43 class CxeCameraDeviceControl;
       
    44 class CxeAutoFocusControl;
       
    45 class CxeSettings;
       
    46 class CxeQualityPresets;
       
    47 class CxeDiskMonitor;
       
    48 
       
    49 
       
    50 /**
       
    51  * Class CxeStillCaptureControlSymbian.
       
    52  * Inherits/implements CxeStillCaptureControl.
       
    53  */
       
    54 class CxeStillCaptureControlSymbian : public CxeStillCaptureControl,
       
    55                                       public CxeStateMachine
       
    56 {
       
    57     Q_OBJECT
       
    58 
       
    59 public:  // constructors
       
    60 
       
    61     CxeStillCaptureControlSymbian(CxeCameraDevice &cameraDevice,
       
    62                                   CxeViewfinderControl &viewfinderControl,
       
    63                                   CxeSnapshotControl &snapshotControl,
       
    64                                   CxeCameraDeviceControl &cameraDeviceControl,
       
    65                                   CxeFilenameGenerator &nameGenerator,
       
    66                                   CxeSensorEventHandler &sensorEventHandler,
       
    67                                   CxeAutoFocusControl &autoFocusControl,
       
    68                                   CxeSettings &settings,
       
    69                                   CxeQualityPresets &qualityPresets,
       
    70                                   CxeFileSaveThread &fileSaveThread,
       
    71                                   CxeDiskMonitor &diskMonitor);
       
    72 
       
    73     virtual ~CxeStillCaptureControlSymbian();
       
    74 
       
    75 public:  // from CxeStillCaptureControl
       
    76 
       
    77     void capture();
       
    78     State state() const;
       
    79     int imageCount() const;
       
    80     void reset();
       
    81     void cancelAll();
       
    82     void setMode( CaptureMode mode );
       
    83     CaptureMode mode() const;
       
    84     CxeStillImage &operator[]( int index );
       
    85     CxeImageDataQueue &imageDataQueue();
       
    86     QList<CxeImageDetails> supportedImageQualities();
       
    87     int imagesLeft();
       
    88 
       
    89 public slots:
       
    90     void init();
       
    91     void deinit();
       
    92 
       
    93 signals:
       
    94     void imagePrepareComplete(CxeError::Id error);
       
    95     void prepareZoomForStill(int ecamStillResolutionIndex);
       
    96 
       
    97 protected: // from CxeStateMachine
       
    98     void handleStateChanged(int newStateId, CxeError::Id error);
       
    99 
       
   100 
       
   101 protected slots:
       
   102     // notifications when camera reference is changed
       
   103     void prepareForCameraDelete();
       
   104     void handleCameraAllocated(CxeError::Id error);
       
   105 
       
   106     // notification for when camera is released
       
   107     void prepareForRelease();
       
   108 
       
   109     // ECAM events
       
   110     void handleCameraEvent(int eventUid, int error);
       
   111 
       
   112     // Image data event
       
   113     void handleImageData(MCameraBuffer *buffer, int error);
       
   114 
       
   115     // Snapshot event
       
   116     void handleSnapshotReady(CxeError::Id status, const QImage &snapshot);
       
   117 
       
   118     // settings call back
       
   119     void handleSettingValueChanged(const QString& settingId,QVariant newValue);
       
   120 
       
   121     // Disk space change
       
   122     void handleDiskSpaceChanged();
       
   123 
       
   124     // Autofocus events
       
   125     void handleAutofocusStateChanged(CxeAutoFocusControl::State newState, CxeError::Id error);
       
   126 
       
   127     // sensor events
       
   128     void handleSensorEvent(CxeSensorEventHandler::SensorType type,QVariant data);
       
   129 
       
   130     // Use ECam Use Case Hint Custom API to inform ECam of our intended use case
       
   131     // before calling Reserve()
       
   132     void hintUseCase();
       
   133 
       
   134 private: // helper functions
       
   135 
       
   136     CxeError::Id prepareFilename(CxeStillImageSymbian *stillImage);
       
   137     void setOrientation(QVariant sensorData);
       
   138     CxeStillImageSymbian* getImageForIndex(int index);
       
   139     CCamera::TFormat supportedStillFormat(Cxe::CameraIndex cameraIndex);
       
   140     void prepareSnapshot();
       
   141     void updateStillCaptureParameters();
       
   142     void handleSnapshotEvent(CxeError::Id error);
       
   143     void initializeStates();
       
   144     void prepare();
       
   145     void updateRemainingImagesCounter();
       
   146     int calculateRemainingImages(int estimatedImagesize);
       
   147 
       
   148 private: // private data
       
   149 
       
   150     CxeImageDataQueueSymbian *mImageDataQueue;  // own
       
   151     CxeCameraDevice &mCameraDevice;
       
   152     CxeViewfinderControl &mViewfinderControl;
       
   153     CxeSnapshotControl &mSnapshotControl;
       
   154     CxeCameraDeviceControl &mCameraDeviceControl;
       
   155     CxeFilenameGenerator &mFilenameGenerator; //! @todo could be shared with video capture control?
       
   156     CxeSensorEventHandler &mSensorEventHandler;
       
   157     CxeAutoFocusControl &mAutoFocusControl;
       
   158     CxeSettings &mSettings;
       
   159     CxeQualityPresets &mQualityPresets;
       
   160     CxeFileSaveThread &mFileSaveThread;
       
   161     CxeDiskMonitor &mDiskMonitor;
       
   162     CxeSoundPlayerSymbian *mCaptureSoundPlayer;
       
   163     CxeSoundPlayerSymbian *mAutoFocusSoundPlayer;
       
   164     CaptureMode mMode;
       
   165     CxeAutoFocusControl::State mAfState;
       
   166     QList<CxeStillImageSymbian*> mImages;
       
   167     int mNextSnapshotIndex;
       
   168     int mNextImageDataIndex;
       
   169     //still resolutions supported by ICM
       
   170     QList<CxeImageDetails> mIcmSupportedImageResolutions;
       
   171     //still resolutions supported by ecam
       
   172     QList<TSize> mECamSupportedImageResolutions;
       
   173     //current image quality details in use
       
   174     CxeImageDetails mCurrentImageDetails;
       
   175     CCamera::TFormat mCaptureFormat;
       
   176     int mSizeIndex; //!< ECam still capture size index
       
   177 };
       
   178 
       
   179 #endif // CXESTILLCAPTURECONTROLSYMBIAN_H