camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp
changeset 42 feebad15db8c
parent 41 67457b2ffb33
child 46 c826656d6714
equal deleted inserted replaced
41:67457b2ffb33 42:feebad15db8c
    96 {
    96 {
    97     CX_DEBUG_ENTER_FUNCTION();
    97     CX_DEBUG_ENTER_FUNCTION();
    98 
    98 
    99     // Check we do this only once.
    99     // Check we do this only once.
   100     if (!mSettingsModel) {
   100     if (!mSettingsModel) {
   101         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1");
   101         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "msg: e_CX_ENGINE_CREATE_CONTROLS 1");
   102 
   102 
   103         CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
   103         CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
   104         mCameraDeviceControl = deviceControl;
   104         mCameraDeviceControl = deviceControl;
   105         mCameraDevice = deviceControl->cameraDevice();
   105         mCameraDevice = deviceControl->cameraDevice();
   106 
   106 
   120         // assert if settings model fails to intialize
   120         // assert if settings model fails to intialize
   121         CX_DEBUG_ASSERT(mSettingsModel);
   121         CX_DEBUG_ASSERT(mSettingsModel);
   122 
   122 
   123         mSettings = new CxeSettingsImp(*mSettingsModel);
   123         mSettings = new CxeSettingsImp(*mSettingsModel);
   124 
   124 
   125         // Loading current camera mode value from settings store and updating 
   125         // Loading current camera mode value from settings store and updating
   126 		// devicecontrol        
   126 		// devicecontrol
   127         Cxe::CameraMode cameraMode = Cxe::ImageMode;
   127         Cxe::CameraMode cameraMode = Cxe::ImageMode;
   128         int value;
   128         int value;
   129         CxeError::Id err = mSettings->get(CxeSettingIds::CAMERA_MODE, value);
   129         CxeError::Id err = mSettings->get(CxeSettingIds::CAMERA_MODE, value);
   130         if (!err) {
   130         if (!err) {
   131             cameraMode = static_cast<Cxe::CameraMode>(value);
   131             cameraMode = static_cast<Cxe::CameraMode>(value);
   132         }
   132         }
   133         // set current camera mode to devicecontrol.
   133         // set current camera mode to devicecontrol.
   134         mCameraDeviceControl->setMode(cameraMode);
   134         mCameraDeviceControl->setMode(cameraMode);
   135         
   135 
   136         //! @todo a temporary hack to change the startup sequence to avoid GOOM problems
   136         //! @todo a temporary hack to change the startup sequence to avoid GOOM problems
   137         static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
   137         static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
   138 
   138 
   139 
   139 
   140         // Connect P&S key updates to settings signal.
   140         // Connect P&S key updates to settings signal.
   161         mViewfinderControl = new CxeViewfinderControlSymbian(*mCameraDevice,
   161         mViewfinderControl = new CxeViewfinderControlSymbian(*mCameraDevice,
   162             *mCameraDeviceControl);
   162             *mCameraDeviceControl);
   163 
   163 
   164         mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
   164         mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
   165 
   165 
   166         mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, 
   166         mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice,
   167 		                            *mSettings);
   167 		                            *mSettings);
   168 
   168 
   169         mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
   169         mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
   170 
   170 
   171         mStillCaptureControl = new CxeStillCaptureControlSymbian(
   171         mStillCaptureControl = new CxeStillCaptureControlSymbian(
   184 
   184 
   185         mGeoTaggingTrail = new CxeGeoTaggingTrail(*mStillCaptureControl,
   185         mGeoTaggingTrail = new CxeGeoTaggingTrail(*mStillCaptureControl,
   186                                                   *mVideoCaptureControl,
   186                                                   *mVideoCaptureControl,
   187                                                   *mSettings);
   187                                                   *mSettings);
   188 
   188 
   189         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
   189         OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "msg: e_CX_ENGINE_CREATE_CONTROLS 0");
   190     }
   190     }
   191 
   191 
   192     CX_DEBUG_EXIT_FUNCTION();
   192     CX_DEBUG_EXIT_FUNCTION();
   193 }
   193 }
   194 
   194 
   196     Connect internal signals for control classes
   196     Connect internal signals for control classes
   197 */
   197 */
   198 void CxeEngineSymbian::connectSignals()
   198 void CxeEngineSymbian::connectSignals()
   199 {
   199 {
   200     CX_DEBUG_ENTER_FUNCTION();
   200     CX_DEBUG_ENTER_FUNCTION();
   201     OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "e_CX_ENGINE_CONNECT_SIGNALS 1");
   201     OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "msg: e_CX_ENGINE_CONNECT_SIGNALS 1");
   202 
   202 
   203     // enabling scene setting change callbacks to Autofocus control
   203     // enabling scene setting change callbacks to Autofocus control
   204     connect(mSettings,
   204     connect(mSettings,
   205             SIGNAL(sceneChanged(CxeScene&)),
   205             SIGNAL(sceneChanged(CxeScene&)),
   206             mAutoFocusControl,
   206             mAutoFocusControl,
   278             SIGNAL(prepareForRelease()),
   278             SIGNAL(prepareForRelease()),
   279             mGeoTaggingTrail,
   279             mGeoTaggingTrail,
   280             SLOT(stop()),
   280             SLOT(stop()),
   281             Qt::UniqueConnection);
   281             Qt::UniqueConnection);
   282 
   282 
   283     OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "e_CX_ENGINE_CONNECT_SIGNALS 0");
   283     OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
   284 
   284 
   285     CX_DEBUG_EXIT_FUNCTION();
   285     CX_DEBUG_EXIT_FUNCTION();
   286 }
   286 }
   287 
   287 
   288 CxeEngineSymbian::~CxeEngineSymbian()
   288 CxeEngineSymbian::~CxeEngineSymbian()
   289 {
   289 {
   290     CX_DEBUG_ENTER_FUNCTION();
   290     CX_DEBUG_ENTER_FUNCTION();
   291     
   291 
   292     // Saving current camera mode to cenrep
   292     // Saving current camera mode to cenrep
   293     saveMode();
   293     saveMode();
   294     
   294 
   295     delete mGeoTaggingTrail;
   295     delete mGeoTaggingTrail;
   296     delete mAutoFocusControl;
   296     delete mAutoFocusControl;
   297     delete mZoomControl;
   297     delete mZoomControl;
   298     delete mSettingsControl;
   298     delete mSettingsControl;
   299     delete mStillCaptureControl;
   299     delete mStillCaptureControl;
   354 CxeSettings &CxeEngineSymbian::settings()
   354 CxeSettings &CxeEngineSymbian::settings()
   355 {
   355 {
   356     return *mSettings;
   356     return *mSettings;
   357 }
   357 }
   358 
   358 
   359 /*! 
   359 /*!
   360 Returns the sensor event  handle
   360 Returns the sensor event  handle
   361 */
   361 */
   362 CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler()
   362 CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler()
   363 {
   363 {
   364     return *mSensorEventHandler;
   364     return *mSensorEventHandler;
   413     CxeStillCaptureControl in still image mode).
   413     CxeStillCaptureControl in still image mode).
   414 */
   414 */
   415 void CxeEngineSymbian::doInit()
   415 void CxeEngineSymbian::doInit()
   416 {
   416 {
   417     CX_DEBUG_ENTER_FUNCTION();
   417     CX_DEBUG_ENTER_FUNCTION();
   418     OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "e_CX_ENGINE_DO_INIT 1");
   418     OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "msg: e_CX_ENGINE_DO_INIT 1");
   419 
   419 
   420     mFilenameGenerator->init(mode());
   420     mFilenameGenerator->init(mode());
   421     // load settings whenever we change mode or start camera or switch camera
   421     // load settings whenever we change mode or start camera or switch camera
   422     CxeSettingsImp *settingsImp = qobject_cast<CxeSettingsImp*>(mSettings);
   422     CxeSettingsImp *settingsImp = qobject_cast<CxeSettingsImp*>(mSettings);
   423     if (settingsImp) {
   423     if (settingsImp) {
   436             mGeoTaggingTrail->stop();
   436             mGeoTaggingTrail->stop();
   437         }
   437         }
   438         mVideoCaptureControl->init();
   438         mVideoCaptureControl->init();
   439     }
   439     }
   440 
   440 
   441     OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "e_CX_ENGINE_DO_INIT 0");
   441     OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "msg: e_CX_ENGINE_DO_INIT 0");
   442 
   442 
   443     CX_DEBUG_EXIT_FUNCTION();
   443     CX_DEBUG_EXIT_FUNCTION();
   444 }
   444 }
   445 
   445 
   446 /*!
   446 /*!
   524 }
   524 }
   525 
   525 
   526 void CxeEngineSymbian::initMode(Cxe::CameraMode cameraMode)
   526 void CxeEngineSymbian::initMode(Cxe::CameraMode cameraMode)
   527 {
   527 {
   528     CX_DEBUG_ENTER_FUNCTION();
   528     CX_DEBUG_ENTER_FUNCTION();
       
   529     OstTrace0(camerax_performance, CXEENGINE_INITMODE_IN, "msg: e_CX_ENGINE_INIT_MODE 1");
   529 
   530 
   530     if (mode() == cameraMode) {
   531     if (mode() == cameraMode) {
   531         CX_DEBUG(("initMode() called for current mode"));
   532         CX_DEBUG(("initMode() called for current mode"));
   532 
   533 
   533         // We're already in the requested mode. However, it is possible
   534         // We're already in the requested mode. However, it is possible
   575             // Camera device control is in Initializing state. Initialization will continue
   576             // Camera device control is in Initializing state. Initialization will continue
   576             // when we get the deviceReady() callback.
   577             // when we get the deviceReady() callback.
   577         }
   578         }
   578     }
   579     }
   579 
   580 
       
   581     OstTrace0(camerax_performance, CXEENGINE_INITMODE_OUT, "msg: e_CX_ENGINE_INIT_MODE 0");
   580     CX_DEBUG_EXIT_FUNCTION();
   582     CX_DEBUG_EXIT_FUNCTION();
   581 }
   583 }
   582 
   584 
   583 void CxeEngineSymbian::reserve()
   585 void CxeEngineSymbian::reserve()
   584 {
   586 {
   609 * Start geotagging trail.
   611 * Start geotagging trail.
   610 */
   612 */
   611 void CxeEngineSymbian::startGeotaggingTrail()
   613 void CxeEngineSymbian::startGeotaggingTrail()
   612 {
   614 {
   613     CX_DEBUG_ENTER_FUNCTION();
   615     CX_DEBUG_ENTER_FUNCTION();
   614     
   616     OstTrace0(camerax_performance, CXEENGINE_START_GEO_IN, "msg: e_CX_ENGINE_START_GEOTAGGING 1");
       
   617 
   615     if (mGeoTaggingTrail && mSettings) {
   618     if (mGeoTaggingTrail && mSettings) {
   616         // location trail is limited to image mode only for now.
   619         // location trail is limited to image mode only for now.
   617         int value = Cxe::GeoTaggingDisclaimerDisabled;
   620         int value = Cxe::GeoTaggingDisclaimerDisabled;
   618         mSettings->get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
   621         mSettings->get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
   619 
   622 
   620         // we start location trail only when Geotagging First-time-use note is accepted by user.
   623         // we start location trail only when Geotagging First-time-use note is accepted by user.
   621         if (value == Cxe::GeoTaggingDisclaimerDisabled) {
   624         if (value == Cxe::GeoTaggingDisclaimerDisabled) {
   622             mGeoTaggingTrail->start();
   625             mGeoTaggingTrail->start();
   623         }
   626         }
   624     }
   627     }
   625     
   628 
       
   629     OstTrace0(camerax_performance, CXEENGINE_START_GEO_OUT, "msg: e_CX_ENGINE_START_GEOTAGGING 0");
   626     CX_DEBUG_EXIT_FUNCTION();
   630     CX_DEBUG_EXIT_FUNCTION();
   627 }
   631 }
   628 
   632 
   629 // End of file
   633 // End of file