camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp
changeset 45 24fd82631616
parent 43 0e652f8f1fbd
equal deleted inserted replaced
43:0e652f8f1fbd 45:24fd82631616
    20 #include "cxefeaturemanager.h"
    20 #include "cxefeaturemanager.h"
    21 #include "cxesettings.h"
    21 #include "cxesettings.h"
    22 #include "cxutils.h"
    22 #include "cxutils.h"
    23 #include "cxenamespace.h"
    23 #include "cxenamespace.h"
    24 #include "cxestate.h"
    24 #include "cxestate.h"
       
    25 #include "cxeexception.h"
    25 
    26 
    26 #include "OstTraceDefinitions.h"
    27 #include "OstTraceDefinitions.h"
    27 #ifdef OST_TRACE_COMPILER_IN_USE
    28 #ifdef OST_TRACE_COMPILER_IN_USE
    28 #include "cxezoomcontrolsymbianTraces.h"
    29 #include "cxezoomcontrolsymbianTraces.h"
    29 #endif
    30 #endif
    53 
    54 
    54     // Initialize states and member variables
    55     // Initialize states and member variables
    55     initializeStates();
    56     initializeStates();
    56 
    57 
    57     // getting still max zoom limits from feature manager
    58     // getting still max zoom limits from feature manager
    58     featureManager.configuredValues(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
    59     featureManager.configuredValues(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
    59     featureManager.configuredValues(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
    60     featureManager.configuredValues(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
    60 
    61 
    61     connect(&mCameraDevice,
    62     connect(&mCameraDevice,
    62             SIGNAL(prepareForCameraDelete()),
    63             SIGNAL(prepareForCameraDelete()),
    63             this,
    64             this,
    64             SLOT(reset()));
    65             SLOT(reset()));
    65 
       
    66     // enabling setting value change call backs
       
    67     connect(&mSettings,
       
    68             SIGNAL(settingValueChanged(const QString&,QVariant)),
       
    69             this,
       
    70             SLOT(handleSettingValueChanged(const QString&,QVariant)));
       
    71 
    66 
    72     init();
    67     init();
    73 
    68 
    74     CX_DEBUG_EXIT_FUNCTION();
    69     CX_DEBUG_EXIT_FUNCTION();
    75 }
    70 }
   139     CX_DEBUG_EXIT_FUNCTION();
   134     CX_DEBUG_EXIT_FUNCTION();
   140 }
   135 }
   141 
   136 
   142 
   137 
   143 
   138 
   144 /**
       
   145  * Settings changed, needs updated
       
   146  */
       
   147 void CxeZoomControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant /*newValue*/)
       
   148 {
       
   149     CX_DEBUG_ENTER_FUNCTION();
       
   150 
       
   151     if (settingId == CxeSettingIds::IMAGE_QUALITY ||
       
   152         settingId == CxeSettingIds::VIDEO_QUALITY) {
       
   153         reset();
       
   154     } else {
       
   155         // do nothing
       
   156     }
       
   157     CX_DEBUG_EXIT_FUNCTION();
       
   158 }
       
   159 
       
   160 
       
   161 /*!
   139 /*!
   162 * slot to prepare zoom control for still mode
   140 * slot to prepare zoom control for still mode
   163 */
   141 */
   164 void CxeZoomControlSymbian::prepareZoomForStill(int ecamStillResolutionIndex)
   142 void CxeZoomControlSymbian::prepareZoomForStill(int ecamStillResolutionIndex)
   165 {
   143 {
   166     CX_DEBUG_ENTER_FUNCTION();
   144     CX_DEBUG_ENTER_FUNCTION();
   167     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPARESTILL_IN, "msg: e_CX_PREPARE_ZOOM 1");
   145     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPARESTILL_IN, "msg: e_CX_PREPARE_ZOOM 1");
   168 
   146 
   169     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
   147     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
   170         init();
   148         reset();
   171         // For image mode
   149         // For image mode
   172         CCamera::TFormat format = CCamera::EFormatExif;
   150         CCamera::TFormat format = CCamera::EFormatExif;
   173         TBool isInfluencePossible = EFalse;
   151         TBool isInfluencePossible = EFalse;
   174         int error = KErrNone;
   152         int error = KErrNone;
   175 
   153 
   179                             mDigitalZoomValueInfo,
   157                             mDigitalZoomValueInfo,
   180                             ecamStillResolutionIndex,
   158                             ecamStillResolutionIndex,
   181                             format,
   159                             format,
   182                             isInfluencePossible));
   160                             isInfluencePossible));
   183 
   161 
   184         int imageQualityIndex;
   162 
   185         CxeError::Id cxErr = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQualityIndex);
   163         try {
   186         if (cxErr == CxeError::None && mStillMaxZoomLimits.count() > 0) {
   164             int imageQualityIndex = mSettings.get<int>(CxeSettingIds::IMAGE_QUALITY);
   187             // fetching the zoom limit based on the image quality
   165             if (mStillMaxZoomLimits.count() > 0 && imageQualityIndex < mStillMaxZoomLimits.count()) {
   188             mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
   166                 // fetching the zoom limit based on the image quality
   189         } else {
   167                 mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
       
   168             }
       
   169         } catch (CxeException &e) {
   190             mMaxZoomLevel = NOT_DEFINED;
   170             mMaxZoomLevel = NOT_DEFINED;
   191         }
   171         }
   192 
   172 
   193         finalizeZoomPreparation(error);
   173         finalizeZoomPreparation(error);
   194     }
   174     }
   205 {
   185 {
   206     CX_DEBUG_ENTER_FUNCTION();
   186     CX_DEBUG_ENTER_FUNCTION();
   207     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPAREVIDEO_IN, "msg: e_CX_PREPARE_ZOOM 1");
   187     OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPAREVIDEO_IN, "msg: e_CX_PREPARE_ZOOM 1");
   208 
   188 
   209     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
   189     if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
   210         init();
   190         reset();
   211         // if CxeCameraDeviceControl is ready, this pointer is valid
   191         // if CxeCameraDeviceControl is ready, this pointer is valid
   212         CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings());
   192         CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings());
   213         int error = KErrNone;
   193         int error = KErrNone;
   214         TRAP(error,
   194         TRAP(error,
   215                 mCameraDevice.advancedSettings()->GetDigitalZoomStepsL(mDigitalZoomValues, mDigitalZoomValueInfo);
   195                 mCameraDevice.advancedSettings()->GetDigitalZoomStepsL(mDigitalZoomValues, mDigitalZoomValueInfo);