camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp
changeset 43 0e652f8f1fbd
parent 28 3075d9b614e6
child 45 24fd82631616
--- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Thu Jul 15 01:55:05 2010 +0300
@@ -14,14 +14,16 @@
 * Description:
 *
 */
+#include <QVariant>
+#include <QMetaType>
+#include <QGraphicsLayout>
+
 #include <hbpushbutton.h>
 #include <hblabel.h>
 #include <hbtoolbar.h>
 #include <hbaction.h>
 #include <hbmainwindow.h>
 #include <hbtransparentwindow.h>
-#include <QVariant>
-#include <QMetaType>
 #include <hbslider.h>
 #include <hblistwidget.h>
 #include <hbdialog.h>
@@ -31,6 +33,7 @@
 #include <hbdeviceprofile.h> // HbDeviceProfile
 #include <hbmenu.h>
 #include <hbicon.h>
+#include <hbactivitymanager.h>
 
 #include "cxuiselftimer.h"
 #include "cxeengine.h"
@@ -82,19 +85,28 @@
     delete mSelfTimer;
 }
 
+/*!
+ * Construct-method handles initialisation tasks for this class. Needs to be called
+ * before the instance of this class is used.
+ * @param mainwindow
+ * @param engine
+ * @param documentLoader
+ * @param keyHandler
+ */
 void CxuiStillPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
                                         CxuiDocumentLoader *documentLoader,
-                                        CxuiCaptureKeyHandler *keyHandler)
+                                        CxuiCaptureKeyHandler *keyHandler,
+                                        HbActivityManager *activityManager)
 {
     CX_DEBUG_ENTER_FUNCTION();
     OstTrace0( camerax_performance, CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 1" );
 
     // constuct base class
-    CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
+    CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
 
     connect(&mEngine->autoFocusControl(), SIGNAL(stateChanged(CxeAutoFocusControl::State,CxeError::Id)),
             this, SLOT(handleAutoFocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
-    connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, int)),
+    connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QImage&, int)),
             this, SLOT(handleSnapshot(CxeError::Id)));
     connect(&mEngine->stillCaptureControl(), SIGNAL(stateChanged(CxeStillCaptureControl::State, CxeError::Id)),
             this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id)));
@@ -111,39 +123,124 @@
     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();
 }
 
+/*!
+ * Loads default widgets in layouts xml.
+ */
 void CxuiStillPrecaptureView::loadDefaultWidgets()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    CX_DEBUG_ASSERT(mDocumentLoader);
+    CX_ASSERT_ALWAYS(mDocumentLoader);
 
     // get pointer to the viewfinder
     QGraphicsWidget *widget = NULL;
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEWFINDER);
     mViewfinder = qobject_cast<HbTransparentWindow *>(widget);
-    CX_DEBUG_ASSERT(mViewfinder);
+    CX_ASSERT_ALWAYS(mViewfinder);
+
+    reloadIndicatorWidgets();
+    CX_DEBUG_EXIT_FUNCTION();
+}
 
+/*!
+ * Loads default indicators from docml and modifies the visibility
+ * according to current settings.
+ */
+void CxuiStillPrecaptureView::reloadIndicatorWidgets()
+{
+    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);
+
+    QGraphicsWidget *widget = NULL;
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON);
     mQualityIcon = qobject_cast<HbLabel *>(widget);
-    CX_DEBUG_ASSERT(mQualityIcon);
+    CX_ASSERT_ALWAYS(mQualityIcon);
+    
+    widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON);
+    HbLabel *flashBlinkingIcon = qobject_cast<HbLabel *>(widget);
+    CX_ASSERT_ALWAYS(flashBlinkingIcon);
+
+    widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON);
+    mGeoTaggingIndicatorIcon = qobject_cast<HbLabel *>(widget);
+    CX_ASSERT_ALWAYS(mGeoTaggingIndicatorIcon);
+
+    widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON);
+    mFaceTrackingIcon = qobject_cast<HbLabel *>(widget);
+    CX_ASSERT_ALWAYS(mFaceTrackingIcon);
 
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER);
     mIndicators = qobject_cast<HbWidget *>(widget);
-    CX_DEBUG_ASSERT(mIndicators);
+    CX_ASSERT_ALWAYS(mIndicators);
+    
+    QGraphicsLayout *layout = mIndicators->layout();
+    QGraphicsLayoutItem *graphicsLayoutItem = NULL;
+    QGraphicsItem *graphicsItem = NULL;
+    QString key = "";
+    int currentSettingValue = -1;
+    bool isSettingOff = false;
+    // Go through the items in the layout to check whether they should be
+    // shown or not in the indicator pane. Start from the last towards
+    // the first, so that removing items from between works correctly.
+    for (int i = layout->count() - 1; i >= 0; i--) {
+        graphicsLayoutItem = layout->itemAt(i);
+        isSettingOff = false;
+        if (graphicsLayoutItem) {
+            graphicsItem = graphicsLayoutItem->graphicsItem();
+            currentSettingValue = -1;
+            if (graphicsItem == mGeoTaggingIndicatorIcon) {
+                key = CxeSettingIds::GEOTAGGING;
+                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 
+                // 0 for off and 1 for on.
+                if (currentSettingValue == 0) {
+                    isSettingOff = true;
+                }
+            } else if (graphicsItem == flashBlinkingIcon) {
+                //remove flash indicator
+                isSettingOff = true;
+            }
+            if (isSettingOff) {
+                layout->removeAt(i);
+            }
+        }
+    }
+    
     // create background for indicator container
     createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
+    
+    mIndicators->setVisible(true);
 
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-
+/*!
+ * Loads widgets that are not part of the default section in layouts xml.
+ * Widgets are created at the time they are first loaded.
+ */
 void CxuiStillPrecaptureView::loadWidgets()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    CX_DEBUG_ASSERT(mDocumentLoader);
+    CX_ASSERT_ALWAYS(mDocumentLoader);
 
     if( mWidgetsLoaded ) {
         CX_DEBUG(("Widgets already loaded"));
@@ -157,14 +254,14 @@
 
     OstTrace0( camerax_performance, DUP4_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 1" );
     mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_WIDGETS_SECTION, &ok);
-    Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+    CX_ASSERT_ALWAYS(ok);
     if (CxuiServiceProvider::isCameraEmbedded()) {
         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
     } else {
         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_STANDALONE_SECTION, &ok);
     }
     OstTrace0( camerax_performance, DUP5_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 0" );
-    Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+    CX_ASSERT_ALWAYS(ok);
 
     // get pointers to ui components from the layout data
     QGraphicsWidget *widget = NULL;
@@ -172,8 +269,8 @@
 
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER);
     mSlider = qobject_cast<CxuiZoomSlider *>(widget);
-    CX_DEBUG_ASSERT(mSlider);
-    addIncreaseDecreaseButtons(mSlider);
+    CX_ASSERT_ALWAYS(mSlider);
+    mSlider->addZoomButtons();
     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
 
     if (mSelfTimer) {
@@ -186,30 +283,30 @@
     HbWidget *container = NULL;
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER);
     container = qobject_cast<HbWidget *>(widget);
-    CX_DEBUG_ASSERT(container);
+    CX_ASSERT_ALWAYS(container);
     createWidgetBackgroundGraphic(container, TRANSPARENT_BACKGROUND_GRAPHIC);
 
     // connect selftimer start button to hide controls
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_START_BUTTON);
     HbPushButton *startButton = qobject_cast<HbPushButton *>(widget);
-    CX_DEBUG_ASSERT(startButton);
+    CX_ASSERT_ALWAYS(startButton);
     connect(startButton, SIGNAL(released()), this, SLOT(hideControls()));
 
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR);
-    mToolBar = qobject_cast<HbToolBar *>(widget);
-    CX_DEBUG_ASSERT(mToolBar);
+    mToolbar = qobject_cast<HbToolBar *>(widget);
+    CX_ASSERT_ALWAYS(mToolbar);
 
     object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION);
     mFlashSetting = qobject_cast<HbAction *>(object);
-    CX_DEBUG_ASSERT(mFlashSetting);
+    CX_ASSERT_ALWAYS(mFlashSetting);
 
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL);
     mImagesLeft = qobject_cast<HbLabel *>(widget);
-    CX_DEBUG_ASSERT(mImagesLeft);
+    CX_ASSERT_ALWAYS(mImagesLeft);
 
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER);
     mImagesLeftContainer = qobject_cast<HbWidget *>(widget);
-    CX_DEBUG_ASSERT(mImagesLeftContainer);
+    CX_ASSERT_ALWAYS(mImagesLeftContainer);
     createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
     updateImagesLeftLabel();
 
@@ -240,27 +337,68 @@
 
     }
 
-    // update toolbar flash icon
+    // Setting widgets loaded here so updating icons works.
+    mWidgetsLoaded = true;
+
+    // Update toolbar flash mode icon
     int flash;
     if (mEngine->settings().get(CxeSettingIds::FLASH_MODE, flash) == CxeError::None) {
         handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash);
     }
 
-    // update toolbar scene mode
-    QString scene;
-    if (mEngine->settings().get(CxeSettingIds::IMAGE_SCENE, scene) == CxeError::None) {
-        handleSettingValueChanged(CxeSettingIds::IMAGE_SCENE, scene);
+    // Update toolbar scene mode icon
+    QString sceneId;
+    if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) {
+        updateSceneIcon(sceneId);
     }
 
     hideControls();
 
-    mWidgetsLoaded = true;
+    // View is ready. Needed for startup performance automated testing.
+    emit viewReady();
 
     OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_STILLPRECAPTUREVIEW_LOADWIDGETS 0" );
     CX_DEBUG_EXIT_FUNCTION();
 }
 
 /*!
+ * Restore view state from activity.
+ */
+void CxuiStillPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+    Q_UNUSED(activityId);
+    Q_UNUSED(data);
+
+    CX_DEBUG_ENTER_FUNCTION();
+    // no need to restore any state
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Save view state to activity.
+ */
+void CxuiStillPrecaptureView::saveActivity()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    QVariantMap data;
+    QVariantHash params;
+    //@todo: add pre-capture icon as screenshot
+    mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+    mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params);
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Clear activity from activity manager.
+ */
+void CxuiStillPrecaptureView::clearActivity()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
 * Initializing settings grid
 */
 void CxuiStillPrecaptureView::initializeSettingsGrid()
@@ -271,45 +409,114 @@
         // Initialize settings grid
         mSettingsGrid = new HbToolBarExtension;
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure.svg"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_mono_iso.svg"), hbTrId("txt_cam_button_iso"), this, SLOT(launchSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_iso"), hbTrId("txt_cam_button_iso"), this, SLOT(launchSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::LIGHT_SENSITIVITY);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb.svg"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance.svg"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_mono_sharpness.svg"), hbTrId("txt_cam_grid_sharpness"), this, SLOT(launchSliderSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_sharpness"), hbTrId("txt_cam_grid_sharpness"), this, SLOT(launchSliderSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::SHARPNESS);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        action = mSettingsGrid->addAction(HbIcon("qtg_mono_contrast.svg"), hbTrId("txt_cam_button_contrast"), this, SLOT(launchSliderSetting()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_contrast"), hbTrId("txt_cam_button_contrast"), this, SLOT(launchSliderSetting()));
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::CONTRAST);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking.svg"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchSetting()));
+        action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::FACE_TRACKING);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
+        connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
     }
 }
 
-void CxuiStillPrecaptureView::launchSceneModesPopup()
+/**
+* Get if postcapture view should be shown or not.
+* Postcapture view may be shown for a predefined time or
+* until user dismisses it, or it may be completely disabled.
+*/
+bool CxuiStillPrecaptureView::isPostcaptureOn() const
 {
     CX_DEBUG_ENTER_FUNCTION();
-    hideControls();
-    emit showScenesView();
+    if (CxuiServiceProvider::isCameraEmbedded()) {
+        // always show post capture in embedded mode
+        CX_DEBUG_EXIT_FUNCTION();
+        return true;
+    }
+
+    // Read the value from settings. Ignoring reading error.
+    // On error (missing settings) default to "postcapture on".
+    int showPostcapture(-1);
+    if(mEngine) {
+        mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, showPostcapture);
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+    return showPostcapture != 0; // 0 == no postcapture
+}
+
+/*!
+* Update the scene mode icon.
+* @param sceneId The new scene id.
+*/
+void CxuiStillPrecaptureView::updateSceneIcon(const QString& sceneId)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mEngine->mode() == Cxe::ImageMode) {
+        CX_DEBUG(("CxuiStillPrecaptureView - scene: %s", sceneId.toAscii().constData()));
+
+        // No need to update icon, if widgets are not even loaded yet.
+        // We'll update the icon once the widgets are loaded.
+        if (mWidgetsLoaded) {
+
+            QString iconObjectName = STILL_PRE_CAPTURE_SCENE_MODE_ACTION;
+            QString icon = getSettingItemIcon(CxeSettingIds::IMAGE_SCENE, sceneId);
+
+            CX_DEBUG(("CxuiStillPrecaptureView - icon: %s", icon.toAscii().constData()));
+
+            if (mDocumentLoader) {
+                QObject *obj = mDocumentLoader->findObject(iconObjectName);
+                CX_ASSERT_ALWAYS(obj);
+                qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
+            }
+        } else {
+            CX_DEBUG(("CxuiStillPrecaptureView - widgets not loaded yet, ignored!"));
+        }
+    }
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+    Update the quality indicator
+*/
+void CxuiStillPrecaptureView::updateQualityIcon()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mQualityIcon && mEngine) {
+        QString icon = "";
+        int currentValue = -1;
+
+        mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, currentValue);
+        icon = getSettingItemIcon(CxeSettingIds::IMAGE_QUALITY, currentValue);
+
+        mQualityIcon->setIcon(HbIcon(icon));
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
 
 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error)
 {
@@ -330,7 +537,7 @@
             }
         }
     } else {
-        emit reportError(error);
+        emit errorEncountered(error);
     }
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -387,7 +594,9 @@
                     mEngine->stillCaptureControl().reset();  //! @todo: Do not delete snapshots before images are really saved
                     mEngine->stillCaptureControl().capture();
                 } else {
-                    launchDiskFullNotification();
+                    // Inform that error was encountered.
+                    // Error manager will show necessary message to user.
+                    emit errorEncountered(CxeError::DiskFull);
                 }
             }
         } else {
@@ -455,30 +664,11 @@
     default:
         break;
     }
-    //}
 
     CX_DEBUG_EXIT_FUNCTION();
 }
 
 
-void CxuiStillPrecaptureView::updateOrientation(Qt::Orientation orientation)
-{
-    CX_DEBUG_ENTER_FUNCTION();
-
-    hideControls();
-    mMainWindow->setOrientation(orientation);
-
-    if (orientation == Qt::Horizontal) {
-        CX_DEBUG(("New screen orientation is horizontal"));
-        mToolBar->setOrientation(Qt::Vertical);
-    } else {
-        CX_DEBUG(("New screen orientation is vertical"));
-        mToolBar->setOrientation(Qt::Horizontal);
-    }
-
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
 /*!
 * Handle capture key full press.
 */
@@ -580,6 +770,7 @@
 
     updateImagesLeftLabel();
     updateQualityIcon();
+    updateFaceTrackingIcon();
 
     // cancel selftimer when returning to precapture
     // since selftimer needs to be turned off after capturing an image
@@ -592,25 +783,36 @@
     // in post-capture view, we need to start auto-focusing when entering
     // the still precapture view.
     if (event->type() == QEvent::Show &&
-            mKeyHandler && mKeyHandler->isAutofocusKeyPressed()) {
+            mCaptureKeyHandler && mCaptureKeyHandler->isAutofocusKeyPressed()) {
 
         CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF"));
         handleAutofocusKeyPressed();
     }
 }
 
-void CxuiStillPrecaptureView::showToolbar()
+/*!
+* Allow showing UI controls?
+*/
+bool CxuiStillPrecaptureView::allowShowControls() const
 {
-    if (mEngine && mEngine->isEngineReady()) {
-        CxuiPrecaptureView::showToolbar();
-    }
+    // show controls when selftimer counter is not active
+    // and when autofocus key is not being pressed
+    bool engineOk(mEngine && mEngine->isEngineReady());
+    bool selfTimerOk(!mSelfTimer || !mSelfTimer->isOngoing());
+    bool keysOk(!mCaptureKeyHandler || !mCaptureKeyHandler->isAutofocusKeyPressed());
+
+    return engineOk && selfTimerOk && keysOk;
 }
 
-
+/*!
+* Handle change in viewfinder state.
+*/
 void CxuiStillPrecaptureView::handleViewfinderStateChanged(
-    CxeViewfinderControl::State newState, CxeError::Id /*error*/)
+    CxeViewfinderControl::State newState, CxeError::Id error)
 {
     CX_DEBUG_ENTER_FUNCTION();
+    // Call base class to get standby timer and display always visible when needed.
+    CxuiPrecaptureView::handleVfStateChanged(newState, error);
 
     if (newState == CxeViewfinderControl::Running) {
 
@@ -621,7 +823,7 @@
         }
 
         if(mMainWindow->currentView() == this &&
-            mKeyHandler->isAutofocusKeyPressed()) {
+            mCaptureKeyHandler->isAutofocusKeyPressed()) {
             // Viewfinder just started and the user is pressing the auto-focus key.
             // Start focusing.
 
@@ -646,6 +848,11 @@
     }
 }
 
+/*!
+ * Signal used to reset mCapturePending after a short timeout. If the image
+ * cannot be captured within a given time of the key press, it is better to cancel
+ * the whole operation.
+ */
 void CxuiStillPrecaptureView::resetCapturePendingFlag()
 {
     CX_DEBUG_IN_FUNCTION();
@@ -653,43 +860,6 @@
     mCapturePending = false;
 }
 
-void CxuiStillPrecaptureView::showControls()
-{
-    // show controls when selftimer counter is not active
-    // and when autofocus key is not being pressed
-    if ( !(mSelfTimer && mSelfTimer->isOngoing())  &&
-         (!mKeyHandler || !mKeyHandler->isAutofocusKeyPressed()) ) {
-        CxuiPrecaptureView::showControls();
-    }
-
-}
-
-/*!
-* Slot to handle application being sent to background.
-*/
-void CxuiStillPrecaptureView::handleFocusLost()
-{
-    CX_DEBUG_ENTER_FUNCTION();
-
-    if (mSelfTimer && mSelfTimer->isOngoing()) {
-        // If self-timer is running, stop and reset the delay now.
-        mSelfTimer->reset();
-    }
-
-    // Release camera as we are going to background.
-    // If taking image is just ongoing, it will be cancelled by engine.
-    releaseCamera();
-
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
-void CxuiStillPrecaptureView::handleFocusGained()
-{
-    CX_DEBUG_ENTER_FUNCTION();
-    CxuiPrecaptureView::handleFocusGained();
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
 /*
     Slot for handling scene mode change
     \param scene QVariantMap containing settings related to the new scene mode
@@ -700,13 +870,7 @@
     if (mEngine->mode() == Cxe::ImageMode) {
 
         // update toolbar scene mode icon
-        QString icon = getSettingItemIcon(CxeSettingIds::IMAGE_SCENE, scene[CxeSettingIds::SCENE_ID]);
-        CX_DEBUG((("New scene mode icon: %s"), icon.toAscii().constData()));
-        if (mDocumentLoader) {
-            QObject *obj = mDocumentLoader->findObject(STILL_PRE_CAPTURE_SCENE_MODE_ACTION);
-            CX_DEBUG_ASSERT(obj);
-            qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
-        }
+        updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString());
 
         // for now, we are only interested in flashmode change
         if (scene.contains(CxeSettingIds::FLASH_MODE)) {
@@ -724,6 +888,24 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+* Enter standby mode.
+*/
+void CxuiStillPrecaptureView::enterStandby()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mSelfTimer && mSelfTimer->isOngoing()) {
+        // If self-timer is running, stop and reset the delay now.
+        mSelfTimer->reset();
+    }
+
+    // Base class handles releasing camera.
+    CxuiPrecaptureView::enterStandby();
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 /*
     Slot for handling setting value changes. Notice that changing the scene mode
     does not emit settingValueChanged signal.
@@ -744,6 +926,11 @@
             updateQualityIcon();
             // update images left when quality values are changed
             updateImagesLeftLabel();
+        } else if (key == CxeSettingIds::FACE_TRACKING) {
+            reloadIndicatorWidgets();
+            updateFaceTrackingIcon();
+        } else if (key == CxeSettingIds::GEOTAGGING) {
+            reloadIndicatorWidgets();
         }
 
         // update toolbar flash icon
@@ -797,6 +984,10 @@
         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());
+            }
             connect(mSettingsDialogList, SIGNAL(valueSelected(int)),
                     mSelfTimer, SLOT(changeTimeOut(int)));
         }
@@ -828,4 +1019,26 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+    Update the face tracking icon
+*/
+void CxuiStillPrecaptureView::updateFaceTrackingIcon()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (mFaceTrackingIcon && mEngine) {
+        QString key = "";
+        QString icon = "";
+        int currentValue = -1;
+
+        key = CxeSettingIds::FACE_TRACKING;
+
+        mEngine->settings().get(key, currentValue);
+        icon = getSettingItemIcon(key, currentValue);
+
+        mFaceTrackingIcon->setIcon(HbIcon(icon));
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // end of file