camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp
changeset 36 b12f3922a74f
parent 32 5c1e3c6aa4ef
child 48 42ba2d16bf40
--- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -40,11 +40,14 @@
 /*
 * CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
 */
-CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice)
+CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice,
+                                                       CxeSettings &settings)
     : CxeStateMachine("CxeAutoFocusControlSymbian"),
       mCameraDevice(cameraDevice),
       mAdvancedSettings(NULL),
-      mCancelled(false)
+      mSettings(settings),
+      mCancelled(false),
+      mFaceTrackingOverride(false)
 {
     CX_DEBUG_ENTER_FUNCTION();
 
@@ -65,6 +68,13 @@
     QObject::connect( &cameraDevice,
                       SIGNAL(prepareForRelease()),
                       this,SLOT(prepareForRelease()) );
+
+    // connect scene / setting change callbacks to settings control
+    QObject::connect(&mSettings,
+            SIGNAL(settingValueChanged(const QString&,QVariant)),
+            this,
+            SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
     OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
 
     initializeResources();
@@ -476,4 +486,40 @@
     return mSoundEnabled;
 }
 
+/*!
+* Handle new setting value.
+* New value is set to camera.
+* \param settingId The id of the updated setting
+* \param newValue A new value for the updated setting
+*/
+void CxeAutoFocusControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (settingId == CxeSettingIds::FACE_TRACKING) {
+        // Updating AF mode when face tracking is activated
+        // in scene mode which doesn't support face tracking
+        if (newValue.toInt()) {
+            //Face tracking enabled
+            if(mAfMode == CxeAutoFocusControl::Infinity ||
+               mAfMode == CxeAutoFocusControl::Hyperfocal) {
+                mPreviousAFMode = mAfMode;
+                setMode(CxeAutoFocusControl::Auto);
+                mFaceTrackingOverride = true;
+            }
+        } else {
+            //Face tracking disabled
+            if (mFaceTrackingOverride) {
+                mAfMode = mPreviousAFMode;
+                setMode(mAfMode);
+                mFaceTrackingOverride = false;
+            }
+        }
+
+    } else {
+        // do nothing
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // end of file