camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp
changeset 43 0e652f8f1fbd
parent 28 3075d9b614e6
child 45 24fd82631616
--- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp	Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp	Thu Jul 15 01:55:05 2010 +0300
@@ -18,6 +18,7 @@
 #include <e32keys.h>
 
 #include <QApplication>
+#include <QGraphicsLayout>
 
 #include <hbmainwindow.h>
 #include <hbaction.h>
@@ -31,6 +32,7 @@
 #include <hbnotificationdialog.h>
 #include <hbfeedbacksettings.h>
 #include <hbfeedbacknamespace.h>
+#include <hbactivitymanager.h>
 
 #include "cxuivideoprecaptureview.h"
 #include "cxeengine.h"
@@ -44,11 +46,12 @@
 #include "cxuizoomslider.h"
 #include "cxuicapturekeyhandler.h"
 #include "cxuidocumentloader.h"
+#include "cxuiserviceprovider.h"
+
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cxuivideoprecaptureviewTraces.h"
 #endif
-#include "cxuiserviceprovider.h"
 
 
 using namespace Cxe;
@@ -75,9 +78,9 @@
     mRemainingTimeText(NULL),
     mRecordingIcon(NULL),
     mGoToStillAction(NULL),
-    mToolBarIdle(NULL),
-    mToolBarRec(NULL),
-    mToolBarPaused(NULL),
+    mToolbarIdle(NULL),
+    mToolbarRec(NULL),
+    mToolbarPaused(NULL),
     mVideoScenePopup(NULL),
     mVideoCaptureControl(NULL),
     mMenu(NULL),
@@ -94,22 +97,32 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+ * Construct-method handles initialisation tasks for this class.
+ * @param mainwindow
+ * @param engine
+ * @param documentLoader
+ * @param keyHandler
+ */
 void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
                                         CxuiDocumentLoader *documentLoader,
-                                        CxuiCaptureKeyHandler *keyHandler)
+                                        CxuiCaptureKeyHandler *keyHandler,
+                                        HbActivityManager *activityManager)
 {
     CX_DEBUG_ENTER_FUNCTION();
 
-    CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
-    mKeyHandler = keyHandler;
+    CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
+    mCaptureKeyHandler = keyHandler;
 
     mVideoCaptureControl = &(engine->videoCaptureControl());
 
     connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
-    connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
+    connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)),
             this, SLOT(handleSnapshot(CxeError::Id)));
     connect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)),
             this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id)));
+    connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)),
+            this, SLOT(handleSceneChanged(CxeScene&)));
     connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()),
             this, SLOT(updateTimeLabels()));
 
@@ -129,34 +142,105 @@
 
 }
 
+/*!
+ * Loads widgets that are needed right from the start.
+ */
 void CxuiVideoPrecaptureView::loadDefaultWidgets()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    CX_DEBUG_ASSERT(mDocumentLoader);
+    CX_ASSERT_ALWAYS(mDocumentLoader);
 
     // get pointers to ui components from the layout data
     QGraphicsWidget *widget = NULL;
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIEWFINDER);
     mViewfinder = qobject_cast<HbTransparentWindow *> (widget);
-    CX_DEBUG_ASSERT(mViewfinder);
-
-    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON);
-    mQualityIcon = qobject_cast<HbLabel *> (widget);
-    CX_DEBUG_ASSERT(mQualityIcon);
+    CX_ASSERT_ALWAYS(mViewfinder);
 
-    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP);
-    mIndicators = qobject_cast<HbWidget *>(widget);
-    CX_DEBUG_ASSERT(mIndicators);
-    // Create background graphics for indicator container
-    createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
+    reloadIndicatorWidgets();
 
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+ * Loads default indicators from docml and modifies the visibility 
+ * according to current settings.
+ */
+void CxuiVideoPrecaptureView::reloadIndicatorWidgets()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    CX_ASSERT_ALWAYS(mDocumentLoader);
+
+    bool ok = false;
+    mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_INDICATORS_SECTION, &ok);
+    CX_ASSERT_ALWAYS(ok);
+
+    QGraphicsWidget *widget = NULL;
+    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON);
+    mQualityIcon = qobject_cast<HbLabel *> (widget);
+    CX_ASSERT_ALWAYS(mQualityIcon);
+
+    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON);
+    HbLabel *videoaudiomuteIndicatorIcon = qobject_cast<HbLabel *>(widget);
+    CX_ASSERT_ALWAYS(videoaudiomuteIndicatorIcon);
+
+    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON);
+    HbLabel *videoStabilityIndicatorIcon = qobject_cast<HbLabel *>(widget);
+    CX_ASSERT_ALWAYS(videoStabilityIndicatorIcon);
+
+    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP);
+    mIndicators = qobject_cast<HbWidget *>(widget);
+    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 == videoaudiomuteIndicatorIcon) {
+                key = CxeSettingIds::VIDEO_MUTE_SETTING;
+                mEngine->settings().get(key, currentSettingValue);
+                // video mute 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 == videoStabilityIndicatorIcon) {
+                // remove video stability indicator.
+                isSettingOff = true;
+            }
+            if (isSettingOff) {
+                layout->removeAt(i);
+            }
+        }
+    }
+
+    // Create background graphics 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 CxuiVideoPrecaptureView::loadWidgets()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    CX_DEBUG_ASSERT(mDocumentLoader);
+    CX_ASSERT_ALWAYS(mDocumentLoader);
 
     if (mWidgetsLoaded) {
         CX_DEBUG(("Widgets already loaded"));
@@ -172,34 +256,34 @@
 
     // load widgets section (creates the widgets)
     mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_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(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
     } else {
         mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_STANDALONE_SECTION, &ok);
     }
-    Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+    CX_ASSERT_ALWAYS(ok);
     // get needed pointers to some of the widgets
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER);
     mSlider = qobject_cast<CxuiZoomSlider *> (widget);
-    CX_DEBUG_ASSERT(mSlider);
+    CX_ASSERT_ALWAYS(mSlider);
 
     //Let's add a plus and minus buttons to the slider
-    addIncreaseDecreaseButtons(mSlider);
+    mSlider->addZoomButtons();
     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
 
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR);
-    mToolBarIdle = qobject_cast<HbToolBar *> (widget);
+    mToolbarIdle = qobject_cast<HbToolBar *> (widget);
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_REC);
-    mToolBarRec = qobject_cast<HbToolBar *> (widget);
+    mToolbarRec = qobject_cast<HbToolBar *> (widget);
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED);
-    mToolBarPaused = qobject_cast<HbToolBar *> (widget);
+    mToolbarPaused = qobject_cast<HbToolBar *> (widget);
 
-    mToolBar = mToolBarIdle;
+    mToolbar = mToolbarIdle;
 
-    CX_DEBUG_ASSERT(mToolBarIdle);
-    CX_DEBUG_ASSERT(mToolBarRec);
-    CX_DEBUG_ASSERT(mToolBarPaused);
+    CX_ASSERT_ALWAYS(mToolbarIdle);
+    CX_ASSERT_ALWAYS(mToolbarRec);
+    CX_ASSERT_ALWAYS(mToolbarPaused);
 
     hideControls();
 
@@ -236,20 +320,20 @@
     HbWidget *indicatorContainer;
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_BOTTOM);
     indicatorContainer = qobject_cast<HbWidget *>(widget);
-    CX_DEBUG_ASSERT(indicatorContainer);
+    CX_ASSERT_ALWAYS(indicatorContainer);
     createWidgetBackgroundGraphic(indicatorContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
 
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ELAPSED_TIME_LABEL);
     mElapsedTimeText = qobject_cast<HbLabel *> (widget);
-    CX_DEBUG_ASSERT(mElapsedTimeText);
+    CX_ASSERT_ALWAYS(mElapsedTimeText);
 
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_REMAINING_TIME_LABEL);
     mRemainingTimeText = qobject_cast<HbLabel *> (widget);
-    CX_DEBUG_ASSERT(mRemainingTimeText);
+    CX_ASSERT_ALWAYS(mRemainingTimeText);
 
     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_RECORDING_ICON);
     mRecordingIcon = qobject_cast<HbLabel *> (widget);
-    CX_DEBUG_ASSERT(mRecordingIcon);
+    CX_ASSERT_ALWAYS(mRecordingIcon);
 
     mWidgetsLoaded = true;
 
@@ -262,9 +346,56 @@
     mRecordingAnimation->setLoopCount(-1);
     mRecordingAnimation->setEasingCurve(QEasingCurve::OutInQuad);
 
+
+    // Update toolbar scene mode icon.
+    QString sceneId;
+    if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) {
+        updateSceneIcon(sceneId);
+    }
+
     // Initialize the video time counters.
     updateTimeLabels();
 
+    // View is ready. Needed for startup performance automated testing.
+    emit viewReady();
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Restore view state from activity.
+ */
+void CxuiVideoPrecaptureView::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 CxuiVideoPrecaptureView::saveActivity()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    QVariantMap data;
+    QVariantHash params;
+    //@todo: add pre-capture icon as screenshot
+    mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+    mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params);
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Clear activity from activity manager.
+ */
+void CxuiVideoPrecaptureView::clearActivity()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -278,20 +409,96 @@
 
         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_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);
 
-        connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
+        connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
+    }
+}
+
+/**
+* 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 CxuiVideoPrecaptureView::isPostcaptureOn() const
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    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::VIDEO_SHOWCAPTURED, showPostcapture);
     }
+
+    CX_DEBUG_EXIT_FUNCTION();
+    return showPostcapture != 0; // 0 == no postcapture
+}
+
+/*!
+* Update the scene mode icon.
+* @param sceneId The new scene id.
+*/
+void CxuiVideoPrecaptureView::updateSceneIcon(const QString& sceneId)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mEngine->mode() == Cxe::VideoMode) {
+        CX_DEBUG(("CxuiPrecaptureView - 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 = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION;
+            QString icon = getSettingItemIcon(CxeSettingIds::VIDEO_SCENE, sceneId);
+
+            CX_DEBUG(("CxuiVideoPrecaptureView - 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(("CxuiVideoPrecaptureView - widgets not loaded yet, ignored!"));
+        }
+    }
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+    Update the quality indicator
+*/
+void CxuiVideoPrecaptureView::updateQualityIcon()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mQualityIcon && mEngine) {
+        QString icon = "";
+        int currentValue = -1;
+
+        mEngine->settings().get(CxeSettingIds::VIDEO_QUALITY, currentValue);
+        icon = getSettingItemIcon(CxeSettingIds::VIDEO_QUALITY, currentValue);
+
+        mQualityIcon->setIcon(HbIcon(icon));
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
 }
 
 void CxuiVideoPrecaptureView::handleSnapshot(CxeError::Id /*error*/)
@@ -312,7 +519,7 @@
         mMenu = takeMenu();
         mVideoCaptureControl->record();
     } else {
-        launchDiskFullNotification();
+        emit errorEncountered(CxeError::DiskFull);
     }
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -335,44 +542,47 @@
 void CxuiVideoPrecaptureView::stop()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    if (isPostcaptureOn()) {
-        CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
-        if (state == CxeVideoCaptureControl::Recording ||
-            state == CxeVideoCaptureControl::Paused) {
-            mVideoCaptureControl->stop();
-            // Continue in handleVideoStateChanged().
-        }
-    } else {
-        // no postcapture
-        stopAndPrepareNewVideo();
+
+    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
+    if (state == CxeVideoCaptureControl::Recording ||
+        state == CxeVideoCaptureControl::Paused) {
+        mVideoCaptureControl->stop();
+        // Continue in handleVideoStateChanged().
     }
 
-
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-// CxuiVideoPrecaptureView::stopAndPrepareNewVideo()
-// A version of stop that doesn't go to post-capture. When
-// not going to post-capture, we need to prepare new video
-void CxuiVideoPrecaptureView::stopAndPrepareNewVideo()
-{
-    CX_DEBUG_ENTER_FUNCTION();
-    mVideoCaptureControl->stop();
-    mElapsedTimer.stop();
-    hideControls();
 
-    if (mMenu) {
-        setMenu(mMenu);
-        mMenu = NULL;
-    }
+/*!
+* Allow showing UI controls?
+*/
+bool CxuiVideoPrecaptureView::allowShowControls() const
+{
+    bool show(false);
+    if (mEngine) {
+        CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
 
-    // prepare new video when old one is ready
-    connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
-            this, SLOT(prepareNewVideo(CxeError::Id)));
-
-    CX_DEBUG_EXIT_FUNCTION();
+        show = (mEngine->isEngineReady()
+             || state == CxeVideoCaptureControl::Recording
+             || state == CxeVideoCaptureControl::Paused);
+    }
+    return show;
 }
 
+/*!
+ * Play feedback when touching view outside of any widget?
+ * If video is paused feedback is off.  Otherwise on.
+ */
+bool CxuiVideoPrecaptureView::isFeedbackEnabled() const
+{
+    CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
+    if (state == CxeVideoCaptureControl::Paused) {
+        return false;
+    } else {
+        return true;
+    }
+}
 
 // CxuiPrecaptureView::showToolbar()
 // Shows toolbar. Calls the base class implementation if not recording
@@ -381,19 +591,19 @@
 {
     CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
     if (state == CxeVideoCaptureControl::Recording) {
-        if (mToolBar != mToolBarRec) {
-            mToolBar->hide();
-            mToolBar = mToolBarRec;
+        if (mToolbar != mToolbarRec) {
+            mToolbar->hide();
+            mToolbar = mToolbarRec;
         }
     } else if (state ==CxeVideoCaptureControl::Ready) {
-        if (mToolBar != mToolBarIdle) {
-            mToolBar->hide();
-            mToolBar = mToolBarIdle;
+        if (mToolbar != mToolbarIdle) {
+            mToolbar->hide();
+            mToolbar = mToolbarIdle;
         }
     } else if (state == CxeVideoCaptureControl::Paused) {
-        if (mToolBar != mToolBarPaused) {
-            mToolBar->hide();
-            mToolBar = mToolBarPaused;
+        if (mToolbar != mToolbarPaused) {
+            mToolbar->hide();
+            mToolbar = mToolbarPaused;
         }
     }
 
@@ -426,13 +636,12 @@
 void CxuiVideoPrecaptureView::goToStill()
 {
     CX_DEBUG_ENTER_FUNCTION();
-    OstTrace0( camerax_performance, DUP1_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" );
+    OstTrace0( camerax_performance, CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" );
 
     hideControls();
     mEngine->initMode(ImageMode);
     emit changeToPrecaptureView();
 
-    OstTrace0( camerax_performance, DUP2_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0" );
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -516,7 +725,7 @@
 {
     CX_DEBUG_ENTER_FUNCTION();
 
-    TBool status = mVideoCaptureControl->elapsedTime(mTimeElapsed);
+    bool status = mVideoCaptureControl->elapsedTime(mTimeElapsed);
     CX_DEBUG(("Elapsed time: %d", mTimeElapsed));
     CX_DEBUG(("status: %d", status));
 
@@ -571,25 +780,25 @@
         break;
     case CxeVideoCaptureControl::Recording:
         hideControls();
+        emit stopStandbyTimer();
         if (mDocumentLoader){
             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_RECORDING);
         }
         mElapsedTimer.start(CXUI_ELAPSED_TIME_TIMEOUT);
         disableFeedback();
-        if (mRecordingAnimation && mRecordingIcon) {
-            mRecordingAnimation->start();
-        }
+
+        // commented out the activation of the recording animation because
+        // it is causing issues when using SW rendering
+        //if (mRecordingAnimation && mRecordingIcon) {
+        //  mRecordingAnimation->start();
+        //}
+
         break;
     case CxeVideoCaptureControl::Paused:
         mElapsedTimer.stop();
-
         if (mDocumentLoader){
             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
         }
-
-        if (mRecordingAnimation && mRecordingIcon) {
-            mRecordingAnimation->stop();
-        }
         showControls();
         enableFeedback();
         mPauseTimer.start();
@@ -599,27 +808,34 @@
             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
         }
 
-        if (mRecordingAnimation && mRecordingIcon) {
-            mRecordingAnimation->stop();
+        // commented out the stopping of the recording animation since the activation
+        // is commented out also couple lines earlier
+        //if (mRecordingAnimation && mRecordingIcon) {
+        //    mRecordingAnimation->stop();
+        //}
+
+        enableFeedback();
+        emit startStandbyTimer();
+        mElapsedTimer.stop();
+        hideControls();
+
+        if (mMenu) {
+            setMenu(mMenu);
+            mMenu = NULL;
         }
-        enableFeedback();
 
         if (isPostcaptureOn()) {
-            mElapsedTimer.stop();
-            hideControls();
-
-            if (mRecordingAnimation && mRecordingIcon) {
-                mRecordingAnimation->stop();
-                mRecordingIcon->setOpacity(0);
-            }
-            if (mMenu) {
-                setMenu(mMenu);
-                mMenu = NULL;
-            }
-
             emit changeToPostcaptureView();
+        } else {
+            // post capture off, we need prepare new video
+            // do the prepare when the previous video is ready
+            connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
+                    this, SLOT(prepareNewVideo(CxeError::Id)));
         }
         break;
+    case CxeVideoCaptureControl::PlayingStartSound:
+        // don't change anything
+        break;
     default:
         // in any other state, just hide the controls
         setRecordingItemsVisibility(false);
@@ -629,24 +845,6 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-void CxuiVideoPrecaptureView::updateOrientation(Qt::Orientation orientation)
-{
-    CX_DEBUG_ENTER_FUNCTION();
-
-    hideControls();
-    mMainWindow->setOrientation(orientation);
-
-    if (mToolBar) {
-        if (orientation == Qt::Horizontal) {
-            mToolBar->setOrientation(Qt::Vertical);
-        } else {
-            mToolBar->setOrientation(Qt::Horizontal);
-        }
-    }
-
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
 void CxuiVideoPrecaptureView::handleCaptureKeyPressed()
 {
     CX_DEBUG_ENTER_FUNCTION();
@@ -677,19 +875,11 @@
         disconnect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
                    this, SLOT(prepareNewVideo(CxeError::Id)));
     } else {
-        emit reportError(error);
+        emit errorEncountered(error);
     }
 
 }
 
-/**
-* Toggle video light on / off.
-*/
-void CxuiVideoPrecaptureView::toggleLight()
-{
-    launchNotSupportedNotification();
-}
-
 void CxuiVideoPrecaptureView::handleQuitClicked()
 {
     CX_DEBUG_ENTER_FUNCTION();
@@ -709,25 +899,6 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-void CxuiVideoPrecaptureView::handleFocusLost()
-{
-    CX_DEBUG_IN_FUNCTION();
-    // Release camera. Stopping possibly ongoing recording is handled by engine.
-    releaseCamera();
-}
-
-void CxuiVideoPrecaptureView::handleBatteryEmpty()
-{
-    CX_DEBUG_ENTER_FUNCTION();
-
-    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
-    if (state == CxeVideoCaptureControl::Recording){
-        stop(); // delete recording icon
-    }
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
-
 void CxuiVideoPrecaptureView::launchVideoScenePopup()
 {
     CX_DEBUG_ENTER_FUNCTION();
@@ -771,6 +942,10 @@
 
             // update video remaining time counter when video quality is changed
             updateTimeLabels();
+        } else if (key == CxeSettingIds::GEOTAGGING) {
+            reloadIndicatorWidgets();
+        } else if (key == CxeSettingIds::VIDEO_MUTE_SETTING) {
+            reloadIndicatorWidgets();
         }
     }
 
@@ -778,6 +953,24 @@
 }
 
 /*!
+* Handle scene mode change.
+* @param scene The new active scene mode.
+*/
+void CxuiVideoPrecaptureView::handleSceneChanged(CxeScene &scene)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    // Ignore if not in video mode.
+    if (mEngine->mode() == Cxe::VideoMode) {
+        // Update toolbar scene mode icon.
+        updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString());
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
     Sets the visibility of recording icon and elapsed time text.
     \param visible True if widgets are to be shown, false if not.
 */
@@ -816,6 +1009,5 @@
     return CxuiPrecaptureView::eventFilter(object, event);
 }
 
-
+//end of file
 
-//end of file