camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp
changeset 32 5c1e3c6aa4ef
parent 29 699651f2666f
child 36 b12f3922a74f
--- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Thu May 27 12:43:29 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Fri Jun 11 13:26:48 2010 +0300
@@ -173,7 +173,7 @@
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER);
     mSlider = qobject_cast<CxuiZoomSlider *>(widget);
     CX_DEBUG_ASSERT(mSlider);
-    addIncreaseDecreaseButtons(mSlider);
+    mSlider->addZoomButtons();
     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
 
     if (mSelfTimer) {
@@ -196,8 +196,8 @@
     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_DEBUG_ASSERT(mToolbar);
 
     object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION);
     mFlashSetting = qobject_cast<HbAction *>(object);
@@ -299,18 +299,10 @@
         mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification()));
         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()
-{
-    CX_DEBUG_ENTER_FUNCTION();
-    hideControls();
-    emit showScenesView();
-    CX_DEBUG_EXIT_FUNCTION();
-}
-
 
 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error)
 {
@@ -462,24 +454,6 @@
 }
 
 
-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.
 */
@@ -593,21 +567,30 @@
     // 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*/)
 {
@@ -622,7 +605,7 @@
         }
 
         if(mMainWindow->currentView() == this &&
-            mKeyHandler->isAutofocusKeyPressed()) {
+            mCaptureKeyHandler->isAutofocusKeyPressed()) {
             // Viewfinder just started and the user is pressing the auto-focus key.
             // Start focusing.
 
@@ -654,17 +637,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.
 */
@@ -684,13 +656,6 @@
     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
@@ -792,6 +757,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)));
         }