diff -r 0e652f8f1fbd -r 24fd82631616 camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:55:05 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Fri Jul 23 11:35:41 2010 +0300 @@ -48,10 +48,16 @@ #include "cxesettings.h" #include "cxefeaturemanager.h" // mEngine->featureManager() #include "cxuidocumentloader.h" + +#ifdef Q_OS_SYMBIAN #include "OstTraceDefinitions.h" + #ifdef OST_TRACE_COMPILER_IN_USE #include "cxuistillprecaptureviewTraces.h" #endif + +#endif //Q_OS_SYMBIAN + #include "cxuistillprecaptureview.h" #include "cxuiserviceprovider.h" #include "cxuisettingdialog.h" @@ -112,23 +118,14 @@ this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id))); connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), this, SLOT(handleViewfinderStateChanged(CxeViewfinderControl::State, CxeError::Id))); - connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)), - this, SLOT(handleSceneChanged(CxeScene&))); connect(&mEngine->stillCaptureControl(), SIGNAL(availableImagesChanged()), this, SLOT(updateImagesLeftLabel())); + mEngine->settings().listenForSetting(CxeSettingIds::IMAGE_SCENE_DATA, this, SLOT(handleSceneChanged(const QVariant&))); + loadDefaultWidgets(); hideControls(); - mSelfTimer = new CxuiSelfTimer(mEngine->settings()); - connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture())); - - int value = Cxe::GeoTaggingDisclaimerDisabled; - mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value); - if (value == Cxe::GeoTaggingDisclaimerEnabled) { - launchGeoTaggingDisclaimerDialog(); - } - OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 0" ); CX_DEBUG_EXIT_FUNCTION(); } @@ -159,7 +156,7 @@ { CX_DEBUG_ENTER_FUNCTION(); CX_ASSERT_ALWAYS(mDocumentLoader); - + bool ok = false; mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_INDICATORS_SECTION, &ok); CX_ASSERT_ALWAYS(ok); @@ -168,7 +165,7 @@ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON); mQualityIcon = qobject_cast(widget); CX_ASSERT_ALWAYS(mQualityIcon); - + widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON); HbLabel *flashBlinkingIcon = qobject_cast(widget); CX_ASSERT_ALWAYS(flashBlinkingIcon); @@ -184,7 +181,7 @@ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER); mIndicators = qobject_cast(widget); CX_ASSERT_ALWAYS(mIndicators); - + QGraphicsLayout *layout = mIndicators->layout(); QGraphicsLayoutItem *graphicsLayoutItem = NULL; QGraphicsItem *graphicsItem = NULL; @@ -202,15 +199,15 @@ currentSettingValue = -1; if (graphicsItem == mGeoTaggingIndicatorIcon) { key = CxeSettingIds::GEOTAGGING; - mEngine->settings().get(key, currentSettingValue); + currentSettingValue = mEngine->settings().get(key, currentSettingValue); if (currentSettingValue == Cxe::GeoTaggingOff) { isSettingOff = true; } } else if (graphicsItem == mFaceTrackingIcon) { key = CxeSettingIds::FACE_TRACKING; - mEngine->settings().get(key, currentSettingValue); - // facetracking implementation does not use - // enum for on/off values but instead + currentSettingValue = mEngine->settings().get(key, currentSettingValue); + // facetracking implementation does not use + // enum for on/off values but instead // 0 for off and 1 for on. if (currentSettingValue == 0) { isSettingOff = true; @@ -224,10 +221,10 @@ } } } - + // create background for indicator container createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC); - + mIndicators->setVisible(true); CX_DEBUG_EXIT_FUNCTION(); @@ -242,7 +239,7 @@ CX_DEBUG_ENTER_FUNCTION(); CX_ASSERT_ALWAYS(mDocumentLoader); - if( mWidgetsLoaded ) { + if (mWidgetsLoaded) { CX_DEBUG(("Widgets already loaded")); CX_DEBUG_EXIT_FUNCTION(); return; @@ -273,12 +270,6 @@ mSlider->addZoomButtons(); createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); - if (mSelfTimer) { - // let selftimer class get needed selftimer related widgets - // from the documentloader - mSelfTimer->loadSelftimerWidgets(mDocumentLoader); - } - // create background for selftimer containers HbWidget *container = NULL; widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER); @@ -310,6 +301,13 @@ createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC); updateImagesLeftLabel(); + // Create self timer. + // Let selftimer class get needed selftimer related widgets from the documentloader + mSelfTimer = new CxuiSelfTimer(mEngine->settings()); + CX_ASSERT_ALWAYS(mSelfTimer); + connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture())); + mSelfTimer->loadSelftimerWidgets(mDocumentLoader); + if (CxuiServiceProvider::isCameraEmbedded()) { CX_DEBUG(("EMBEDDED: camera in embedded mode")); @@ -341,19 +339,20 @@ mWidgetsLoaded = true; // Update toolbar flash mode icon - int flash; - if (mEngine->settings().get(CxeSettingIds::FLASH_MODE, flash) == CxeError::None) { - handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash); - } + int flash = mEngine->settings().get(CxeSettingIds::FLASH_MODE); + handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash); // Update toolbar scene mode icon - QString sceneId; - if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) { - updateSceneIcon(sceneId); - } + updateSceneIcon(mEngine->settings().get(CxeSettingIds::IMAGE_SCENE)); hideControls(); + // Check if we need to show the geotagging disclaimer for first time use. + Cxe::GeoTaggingDisclaimer value = mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled); + if (value == Cxe::GeoTaggingDisclaimerEnabled) { + launchGeoTaggingDisclaimerDialog(); + } + // View is ready. Needed for startup performance automated testing. emit viewReady(); @@ -459,7 +458,7 @@ // On error (missing settings) default to "postcapture on". int showPostcapture(-1); if(mEngine) { - mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, showPostcapture); + showPostcapture = mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, -1); } CX_DEBUG_EXIT_FUNCTION(); @@ -507,9 +506,7 @@ if (mQualityIcon && mEngine) { QString icon = ""; - int currentValue = -1; - - mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, currentValue); + int currentValue = mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, -1); icon = getSettingItemIcon(CxeSettingIds::IMAGE_QUALITY, currentValue); mQualityIcon->setIcon(HbIcon(icon)); @@ -562,12 +559,12 @@ // autofocus is not supported, so start capturing straight away capture(); } else { + setCapturePending(); // start focusing // Auto-focus can only work if viewfinder is running if (mEngine->viewfinderControl().state() == CxeViewfinderControl::Running) { mEngine->autoFocusControl().start(false); } - setCapturePending(); } CX_DEBUG_EXIT_FUNCTION(); @@ -864,11 +861,12 @@ Slot for handling scene mode change \param scene QVariantMap containing settings related to the new scene mode */ -void CxuiStillPrecaptureView::handleSceneChanged(CxeScene &scene) +void CxuiStillPrecaptureView::handleSceneChanged(const QVariant &newSceneData) { CX_DEBUG_ENTER_FUNCTION(); if (mEngine->mode() == Cxe::ImageMode) { + CxeScene scene = newSceneData.toMap(); // update toolbar scene mode icon updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString()); @@ -879,10 +877,10 @@ } else { // No flash mode specified within the scene. // Check from setting model what is it currently. - int flashMode(Cxe::FlashAuto); - mEngine->settings().get(CxeSettingIds::FLASH_MODE, flashMode); + Cxe::FlashMode flashMode = mEngine->settings().get(CxeSettingIds::FLASH_MODE, Cxe::FlashAuto); handleSettingValueChanged(CxeSettingIds::FLASH_MODE, QVariant(flashMode)); } + } CX_DEBUG_EXIT_FUNCTION(); @@ -984,10 +982,8 @@ launchSettingsDialog(action); // special case to get value changed event to the selftimer class if (settingsKey == CxeSettingIds::SELF_TIMER) { - // if selftimer is active remember the previously selected value - if (mSelfTimer->isEnabled()) { - mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout()); - } + // selftimer is not found in settings so set the value now + mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout()); connect(mSettingsDialogList, SIGNAL(valueSelected(int)), mSelfTimer, SLOT(changeTimeOut(int))); } @@ -1028,11 +1024,10 @@ if (mFaceTrackingIcon && mEngine) { QString key = ""; QString icon = ""; - int currentValue = -1; key = CxeSettingIds::FACE_TRACKING; - mEngine->settings().get(key, currentValue); + int currentValue = mEngine->settings().get(key, -1); icon = getSettingItemIcon(key, currentValue); mFaceTrackingIcon->setIcon(HbIcon(icon));