camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp
changeset 48 42ba2d16bf40
parent 21 fa6d9f75d6a6
--- a/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp	Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp	Wed Aug 18 09:37:18 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,6 +22,7 @@
 #include "cxutils.h"
 #include "cxenamespace.h"
 #include "cxestate.h"
+#include "cxeexception.h"
 
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
@@ -55,20 +56,14 @@
     initializeStates();
 
     // getting still max zoom limits from feature manager
-    featureManager.configuredValues(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
-    featureManager.configuredValues(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
+    featureManager.configuredValues(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
+    featureManager.configuredValues(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
 
     connect(&mCameraDevice,
             SIGNAL(prepareForCameraDelete()),
             this,
             SLOT(reset()));
 
-    // enabling setting value change call backs
-    connect(&mSettings,
-            SIGNAL(settingValueChanged(const QString&,QVariant)),
-            this,
-            SLOT(handleSettingValueChanged(const QString&,QVariant)));
-
     init();
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -141,23 +136,6 @@
 
 
 
-/**
- * Settings changed, needs updated
- */
-void CxeZoomControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant /*newValue*/)
-{
-    CX_DEBUG_ENTER_FUNCTION();
-
-    if (settingId == CxeSettingIds::IMAGE_QUALITY ||
-        settingId == CxeSettingIds::VIDEO_QUALITY) {
-        reset();
-    } else {
-        // do nothing
-    }
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
-
 /*!
 * slot to prepare zoom control for still mode
 */
@@ -167,7 +145,7 @@
     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPARESTILL_IN, "msg: e_CX_PREPARE_ZOOM 1");
 
     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
-        init();
+        reset();
         // For image mode
         CCamera::TFormat format = CCamera::EFormatExif;
         TBool isInfluencePossible = EFalse;
@@ -181,12 +159,14 @@
                             format,
                             isInfluencePossible));
 
-        int imageQualityIndex;
-        CxeError::Id cxErr = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQualityIndex);
-        if (cxErr == CxeError::None && mStillMaxZoomLimits.count() > 0) {
-            // fetching the zoom limit based on the image quality
-            mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
-        } else {
+
+        try {
+            int imageQualityIndex = mSettings.get<int>(CxeSettingIds::IMAGE_QUALITY);
+            if (mStillMaxZoomLimits.count() > 0 && imageQualityIndex < mStillMaxZoomLimits.count()) {
+                // fetching the zoom limit based on the image quality
+                mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
+            }
+        } catch (CxeException &e) {
             mMaxZoomLevel = NOT_DEFINED;
         }
 
@@ -207,9 +187,9 @@
     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPAREVIDEO_IN, "msg: e_CX_PREPARE_ZOOM 1");
 
     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
-        init();
+        reset();
         // if CxeCameraDeviceControl is ready, this pointer is valid
-        CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings())
+        CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings());
         int error = KErrNone;
         TRAP(error,
                 mCameraDevice.advancedSettings()->GetDigitalZoomStepsL(mDigitalZoomValues, mDigitalZoomValueInfo);
@@ -256,7 +236,7 @@
             mMaxZoomLevel = cameraInfo.iMaxDigitalZoom;
         }
         // change the state, since zoom is now ready
-        setState(Ready, KErrNone);
+        setState(Ready);
 
         mCameraDevice.advancedSettings()->SetDigitalZoom(mDigitalZoomValues[mCurrentZoomLevel]);