camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp
changeset 36 b12f3922a74f
parent 32 5c1e3c6aa4ef
child 48 42ba2d16bf40
equal deleted inserted replaced
32:5c1e3c6aa4ef 36:b12f3922a74f
    38 
    38 
    39 
    39 
    40 /*
    40 /*
    41 * CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
    41 * CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
    42 */
    42 */
    43 CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice)
    43 CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice,
       
    44                                                        CxeSettings &settings)
    44     : CxeStateMachine("CxeAutoFocusControlSymbian"),
    45     : CxeStateMachine("CxeAutoFocusControlSymbian"),
    45       mCameraDevice(cameraDevice),
    46       mCameraDevice(cameraDevice),
    46       mAdvancedSettings(NULL),
    47       mAdvancedSettings(NULL),
    47       mCancelled(false)
    48       mSettings(settings),
       
    49       mCancelled(false),
       
    50       mFaceTrackingOverride(false)
    48 {
    51 {
    49     CX_DEBUG_ENTER_FUNCTION();
    52     CX_DEBUG_ENTER_FUNCTION();
    50 
    53 
    51     qRegisterMetaType<CxeAutoFocusControl::State>();
    54     qRegisterMetaType<CxeAutoFocusControl::State>();
    52 
    55 
    63                       this,SLOT(handleCameraAllocated(CxeError::Id)) );
    66                       this,SLOT(handleCameraAllocated(CxeError::Id)) );
    64 
    67 
    65     QObject::connect( &cameraDevice,
    68     QObject::connect( &cameraDevice,
    66                       SIGNAL(prepareForRelease()),
    69                       SIGNAL(prepareForRelease()),
    67                       this,SLOT(prepareForRelease()) );
    70                       this,SLOT(prepareForRelease()) );
       
    71 
       
    72     // connect scene / setting change callbacks to settings control
       
    73     QObject::connect(&mSettings,
       
    74             SIGNAL(settingValueChanged(const QString&,QVariant)),
       
    75             this,
       
    76             SLOT(handleSettingValueChanged(const QString&,QVariant)));
       
    77 
    68     OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
    78     OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
    69 
    79 
    70     initializeResources();
    80     initializeResources();
    71 
    81 
    72     CX_DEBUG_EXIT_FUNCTION();
    82     CX_DEBUG_EXIT_FUNCTION();
   474 bool CxeAutoFocusControlSymbian::isSoundEnabled() const
   484 bool CxeAutoFocusControlSymbian::isSoundEnabled() const
   475 {
   485 {
   476     return mSoundEnabled;
   486     return mSoundEnabled;
   477 }
   487 }
   478 
   488 
       
   489 /*!
       
   490 * Handle new setting value.
       
   491 * New value is set to camera.
       
   492 * \param settingId The id of the updated setting
       
   493 * \param newValue A new value for the updated setting
       
   494 */
       
   495 void CxeAutoFocusControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
       
   496 {
       
   497     CX_DEBUG_ENTER_FUNCTION();
       
   498     if (settingId == CxeSettingIds::FACE_TRACKING) {
       
   499         // Updating AF mode when face tracking is activated
       
   500         // in scene mode which doesn't support face tracking
       
   501         if (newValue.toInt()) {
       
   502             //Face tracking enabled
       
   503             if(mAfMode == CxeAutoFocusControl::Infinity ||
       
   504                mAfMode == CxeAutoFocusControl::Hyperfocal) {
       
   505                 mPreviousAFMode = mAfMode;
       
   506                 setMode(CxeAutoFocusControl::Auto);
       
   507                 mFaceTrackingOverride = true;
       
   508             }
       
   509         } else {
       
   510             //Face tracking disabled
       
   511             if (mFaceTrackingOverride) {
       
   512                 mAfMode = mPreviousAFMode;
       
   513                 setMode(mAfMode);
       
   514                 mFaceTrackingOverride = false;
       
   515             }
       
   516         }
       
   517 
       
   518     } else {
       
   519         // do nothing
       
   520     }
       
   521 
       
   522     CX_DEBUG_EXIT_FUNCTION();
       
   523 }
       
   524 
   479 // end of file
   525 // end of file