camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp
changeset 38 0f0b4c1d7744
parent 28 3075d9b614e6
child 40 2922f70fca82
equal deleted inserted replaced
28:3075d9b614e6 38:0f0b4c1d7744
    21 #include "cxecameradevicecontrolsymbian.h"
    21 #include "cxecameradevicecontrolsymbian.h"
    22 #include "cxestillcapturecontrolsymbian.h"
    22 #include "cxestillcapturecontrolsymbian.h"
    23 #include "cxevideocapturecontrolsymbian.h"
    23 #include "cxevideocapturecontrolsymbian.h"
    24 #include "cxesettingscontrolsymbian.h"
    24 #include "cxesettingscontrolsymbian.h"
    25 #include "cxeviewfindercontrolsymbian.h"
    25 #include "cxeviewfindercontrolsymbian.h"
       
    26 #include "cxesnapshotcontrol.h"
    26 #include "cxefilenamegeneratorsymbian.h"
    27 #include "cxefilenamegeneratorsymbian.h"
    27 #include "cxeautofocuscontrolsymbian.h"
    28 #include "cxeautofocuscontrolsymbian.h"
    28 #include "cxezoomcontrolsymbian.h"
    29 #include "cxezoomcontrolsymbian.h"
    29 #include "cxequalitypresetssymbian.h"
    30 #include "cxequalitypresetssymbian.h"
    30 #include "cxutils.h"
    31 #include "cxutils.h"
    49 
    50 
    50 CxeEngineSymbian::CxeEngineSymbian()
    51 CxeEngineSymbian::CxeEngineSymbian()
    51     : mCameraDeviceControl(NULL),
    52     : mCameraDeviceControl(NULL),
    52       mCameraDevice(NULL),
    53       mCameraDevice(NULL),
    53       mViewfinderControl(NULL),
    54       mViewfinderControl(NULL),
       
    55       mSnapshotControl(NULL),
    54       mStillCaptureControl(NULL),
    56       mStillCaptureControl(NULL),
    55       mVideoCaptureControl(NULL),
    57       mVideoCaptureControl(NULL),
    56       mSettingsControl(NULL),
    58       mSettingsControl(NULL),
    57       mAutoFocusControl(NULL),
    59       mAutoFocusControl(NULL),
    58       mZoomControl(NULL),
    60       mZoomControl(NULL),
    60       mFeatureManager(NULL),
    62       mFeatureManager(NULL),
    61       mSettingsModel(NULL),
    63       mSettingsModel(NULL),
    62       mFilenameGenerator(NULL),
    64       mFilenameGenerator(NULL),
    63       mSensorEventHandler(NULL),
    65       mSensorEventHandler(NULL),
    64       mQualityPresets(NULL),
    66       mQualityPresets(NULL),
    65       mFileSaveThread(NULL)
    67       mFileSaveThread(NULL),
    66 {
    68       mDiskMonitor(NULL),
    67     CX_DEBUG_ENTER_FUNCTION();
    69       mMemoryMonitor(NULL)
    68 
    70 {
    69     // Do secondary construction during reserve call.
    71     CX_DEBUG_IN_FUNCTION();
    70     //! @todo temporarily commented as part of a hack to change the startup sequence
       
    71     // to avoid GOOM issues
       
    72    // connect(this, SIGNAL(reserveStarted()), this, SLOT(construct()));
       
    73 
       
    74     CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
       
    75     mCameraDeviceControl = deviceControl;
       
    76     mCameraDevice = deviceControl->cameraDevice();
       
    77     CX_ASSERT_ALWAYS(mCameraDeviceControl);
       
    78     CX_ASSERT_ALWAYS(mCameraDevice);
       
    79 
       
    80     mCameraDeviceControl->init();
       
    81     //! @todo calling construct here is a hack to change the startup sequence
       
    82     // to avoid GOOM issues
       
    83     construct();
       
    84     
       
    85     CX_DEBUG_EXIT_FUNCTION();
       
    86 }
    72 }
    87 
    73 
    88 
    74 
    89 /*!
    75 /*!
    90     Create all control classes and connect relevant signals
    76     Create all control classes and connect relevant signals
   109     CX_DEBUG_ENTER_FUNCTION();
    95     CX_DEBUG_ENTER_FUNCTION();
   110 
    96 
   111     // Check we do this only once.
    97     // Check we do this only once.
   112     if (!mSettingsModel) {
    98     if (!mSettingsModel) {
   113         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1");
    99         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1");
       
   100 
       
   101         CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
       
   102         mCameraDeviceControl = deviceControl;
       
   103         mCameraDevice = deviceControl->cameraDevice();
       
   104 
       
   105         CX_ASSERT_ALWAYS(mCameraDeviceControl);
       
   106         CX_ASSERT_ALWAYS(mCameraDevice);
       
   107 
       
   108         mCameraDeviceControl->init();
   114 
   109 
   115         CxeSettingsCenRepStore *settingsStore(NULL);
   110         CxeSettingsCenRepStore *settingsStore(NULL);
   116         if (XQServiceUtil::isService()) {
   111         if (XQServiceUtil::isService()) {
   117             settingsStore = new CxeSettingsLocalStore();
   112             settingsStore = new CxeSettingsLocalStore();
   118         } else {
   113         } else {
   151             mode());
   146             mode());
   152 
   147 
   153         mViewfinderControl = new CxeViewfinderControlSymbian(*mCameraDevice,
   148         mViewfinderControl = new CxeViewfinderControlSymbian(*mCameraDevice,
   154             *mCameraDeviceControl);
   149             *mCameraDeviceControl);
   155 
   150 
       
   151         mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
       
   152 
   156         mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
   153         mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
   157 
   154 
   158         mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
   155         mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
   159 
   156 
   160         mStillCaptureControl = new CxeStillCaptureControlSymbian(
   157         mStillCaptureControl = new CxeStillCaptureControlSymbian(
   161             *mCameraDevice, *mViewfinderControl, *mCameraDeviceControl,
   158             *mCameraDevice, *mViewfinderControl, *mSnapshotControl, *mCameraDeviceControl,
   162             *mFilenameGenerator, *mSensorEventHandler, *mAutoFocusControl,
   159             *mFilenameGenerator, *mSensorEventHandler, *mAutoFocusControl,
   163             *mSettings, *mQualityPresets, *mFileSaveThread, *mDiskMonitor);
   160             *mSettings, *mQualityPresets, *mFileSaveThread, *mDiskMonitor);
   164 
   161 
   165         mZoomControl = new CxeZoomControlSymbian( *mCameraDevice,
   162         mZoomControl = new CxeZoomControlSymbian(
   166             *mCameraDeviceControl, *mSettings, *mFeatureManager);
   163             *mCameraDevice, *mCameraDeviceControl, *mSettings, *mFeatureManager);
   167 
   164 
   168         mVideoCaptureControl = new CxeVideoCaptureControlSymbian(
   165         mVideoCaptureControl = new CxeVideoCaptureControlSymbian(
   169             *mCameraDevice, *mViewfinderControl, *mCameraDeviceControl,
   166             *mCameraDevice, *mViewfinderControl, *mSnapshotControl, *mCameraDeviceControl,
   170             *mFilenameGenerator, *mSettings, *mQualityPresets, *mDiskMonitor);
   167             *mFilenameGenerator, *mSettings, *mQualityPresets, *mDiskMonitor);
   171 
   168 
   172         mSettingsControl = new CxeSettingsControlSymbian(*mCameraDevice, *mSettings);
   169         mSettingsControl = new CxeSettingsControlSymbian(*mCameraDevice, *mSettings);
   173 
   170 
   174         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
   171         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
   198             SLOT(handleAutofocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
   195             SLOT(handleAutofocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
   199 
   196 
   200     // Connect signals for ECam events
   197     // Connect signals for ECam events
   201     connect(mCameraDeviceControl,
   198     connect(mCameraDeviceControl,
   202             SIGNAL(cameraEvent(int,int)),
   199             SIGNAL(cameraEvent(int,int)),
   203             mVideoCaptureControl,
   200             mSnapshotControl,
   204             SLOT(handleCameraEvent(int,int)));
   201             SLOT(handleCameraEvent(int,int)));
   205 
   202 
   206     connect(mCameraDeviceControl,
   203     connect(mCameraDeviceControl,
   207             SIGNAL(cameraEvent(int,int)),
   204             SIGNAL(cameraEvent(int,int)),
   208             mAutoFocusControl,
   205             mAutoFocusControl,
   264     delete mAutoFocusControl;
   261     delete mAutoFocusControl;
   265     delete mZoomControl;
   262     delete mZoomControl;
   266     delete mSettingsControl;
   263     delete mSettingsControl;
   267     delete mStillCaptureControl;
   264     delete mStillCaptureControl;
   268     delete mVideoCaptureControl;
   265     delete mVideoCaptureControl;
       
   266     delete mSnapshotControl;
   269     delete mViewfinderControl;
   267     delete mViewfinderControl;
   270     delete mFilenameGenerator;
   268     delete mFilenameGenerator;
   271     delete mDiskMonitor;
   269     delete mDiskMonitor;
   272     delete mMemoryMonitor;
   270     delete mMemoryMonitor;
   273     delete mFeatureManager;
   271     delete mFeatureManager;
   286 }
   284 }
   287 
   285 
   288 CxeViewfinderControl &CxeEngineSymbian::viewfinderControl()
   286 CxeViewfinderControl &CxeEngineSymbian::viewfinderControl()
   289 {
   287 {
   290     return *mViewfinderControl;
   288     return *mViewfinderControl;
       
   289 }
       
   290 
       
   291 CxeSnapshotControl &CxeEngineSymbian::snapshotControl()
       
   292 {
       
   293     return *mSnapshotControl;
   291 }
   294 }
   292 
   295 
   293 CxeStillCaptureControl &CxeEngineSymbian::stillCaptureControl()
   296 CxeStillCaptureControl &CxeEngineSymbian::stillCaptureControl()
   294 {
   297 {
   295     return *mStillCaptureControl;
   298     return *mStillCaptureControl;