camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp
changeset 43 0e652f8f1fbd
parent 28 3075d9b614e6
child 45 24fd82631616
equal deleted inserted replaced
28:3075d9b614e6 43:0e652f8f1fbd
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
       
    17 #include <QVariant>
       
    18 #include <QMetaType>
       
    19 #include <QGraphicsLayout>
       
    20 
    17 #include <hbpushbutton.h>
    21 #include <hbpushbutton.h>
    18 #include <hblabel.h>
    22 #include <hblabel.h>
    19 #include <hbtoolbar.h>
    23 #include <hbtoolbar.h>
    20 #include <hbaction.h>
    24 #include <hbaction.h>
    21 #include <hbmainwindow.h>
    25 #include <hbmainwindow.h>
    22 #include <hbtransparentwindow.h>
    26 #include <hbtransparentwindow.h>
    23 #include <QVariant>
       
    24 #include <QMetaType>
       
    25 #include <hbslider.h>
    27 #include <hbslider.h>
    26 #include <hblistwidget.h>
    28 #include <hblistwidget.h>
    27 #include <hbdialog.h>
    29 #include <hbdialog.h>
    28 #include <hblistwidgetitem.h>
    30 #include <hblistwidgetitem.h>
    29 #include <hbtoolbarextension.h>
    31 #include <hbtoolbarextension.h>
    30 #include <hbtoolbutton.h>
    32 #include <hbtoolbutton.h>
    31 #include <hbdeviceprofile.h> // HbDeviceProfile
    33 #include <hbdeviceprofile.h> // HbDeviceProfile
    32 #include <hbmenu.h>
    34 #include <hbmenu.h>
    33 #include <hbicon.h>
    35 #include <hbicon.h>
       
    36 #include <hbactivitymanager.h>
    34 
    37 
    35 #include "cxuiselftimer.h"
    38 #include "cxuiselftimer.h"
    36 #include "cxeengine.h"
    39 #include "cxeengine.h"
    37 #include "cxeviewfindercontrol.h"
    40 #include "cxeviewfindercontrol.h"
    38 #include "cxecameradevicecontrol.h"
    41 #include "cxecameradevicecontrol.h"
    80 {
    83 {
    81     CX_DEBUG_IN_FUNCTION();
    84     CX_DEBUG_IN_FUNCTION();
    82     delete mSelfTimer;
    85     delete mSelfTimer;
    83 }
    86 }
    84 
    87 
       
    88 /*!
       
    89  * Construct-method handles initialisation tasks for this class. Needs to be called
       
    90  * before the instance of this class is used.
       
    91  * @param mainwindow
       
    92  * @param engine
       
    93  * @param documentLoader
       
    94  * @param keyHandler
       
    95  */
    85 void CxuiStillPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
    96 void CxuiStillPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
    86                                         CxuiDocumentLoader *documentLoader,
    97                                         CxuiDocumentLoader *documentLoader,
    87                                         CxuiCaptureKeyHandler *keyHandler)
    98                                         CxuiCaptureKeyHandler *keyHandler,
       
    99                                         HbActivityManager *activityManager)
    88 {
   100 {
    89     CX_DEBUG_ENTER_FUNCTION();
   101     CX_DEBUG_ENTER_FUNCTION();
    90     OstTrace0( camerax_performance, CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 1" );
   102     OstTrace0( camerax_performance, CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 1" );
    91 
   103 
    92     // constuct base class
   104     // constuct base class
    93     CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
   105     CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
    94 
   106 
    95     connect(&mEngine->autoFocusControl(), SIGNAL(stateChanged(CxeAutoFocusControl::State,CxeError::Id)),
   107     connect(&mEngine->autoFocusControl(), SIGNAL(stateChanged(CxeAutoFocusControl::State,CxeError::Id)),
    96             this, SLOT(handleAutoFocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
   108             this, SLOT(handleAutoFocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
    97     connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, int)),
   109     connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QImage&, int)),
    98             this, SLOT(handleSnapshot(CxeError::Id)));
   110             this, SLOT(handleSnapshot(CxeError::Id)));
    99     connect(&mEngine->stillCaptureControl(), SIGNAL(stateChanged(CxeStillCaptureControl::State, CxeError::Id)),
   111     connect(&mEngine->stillCaptureControl(), SIGNAL(stateChanged(CxeStillCaptureControl::State, CxeError::Id)),
   100             this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id)));
   112             this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id)));
   101     connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)),
   113     connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)),
   102             this, SLOT(handleViewfinderStateChanged(CxeViewfinderControl::State, CxeError::Id)));
   114             this, SLOT(handleViewfinderStateChanged(CxeViewfinderControl::State, CxeError::Id)));
   109     hideControls();
   121     hideControls();
   110 
   122 
   111     mSelfTimer = new CxuiSelfTimer(mEngine->settings());
   123     mSelfTimer = new CxuiSelfTimer(mEngine->settings());
   112     connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture()));
   124     connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture()));
   113 
   125 
       
   126     int value = Cxe::GeoTaggingDisclaimerDisabled;
       
   127     mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
       
   128     if (value == Cxe::GeoTaggingDisclaimerEnabled) {
       
   129         launchGeoTaggingDisclaimerDialog();
       
   130     }
       
   131 
   114     OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 0" );
   132     OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 0" );
   115     CX_DEBUG_EXIT_FUNCTION();
   133     CX_DEBUG_EXIT_FUNCTION();
   116 }
   134 }
   117 
   135 
       
   136 /*!
       
   137  * Loads default widgets in layouts xml.
       
   138  */
   118 void CxuiStillPrecaptureView::loadDefaultWidgets()
   139 void CxuiStillPrecaptureView::loadDefaultWidgets()
   119 {
   140 {
   120     CX_DEBUG_ENTER_FUNCTION();
   141     CX_DEBUG_ENTER_FUNCTION();
   121     CX_DEBUG_ASSERT(mDocumentLoader);
   142     CX_ASSERT_ALWAYS(mDocumentLoader);
   122 
   143 
   123     // get pointer to the viewfinder
   144     // get pointer to the viewfinder
   124     QGraphicsWidget *widget = NULL;
   145     QGraphicsWidget *widget = NULL;
   125     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEWFINDER);
   146     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEWFINDER);
   126     mViewfinder = qobject_cast<HbTransparentWindow *>(widget);
   147     mViewfinder = qobject_cast<HbTransparentWindow *>(widget);
   127     CX_DEBUG_ASSERT(mViewfinder);
   148     CX_ASSERT_ALWAYS(mViewfinder);
   128 
   149 
       
   150     reloadIndicatorWidgets();
       
   151     CX_DEBUG_EXIT_FUNCTION();
       
   152 }
       
   153 
       
   154 /*!
       
   155  * Loads default indicators from docml and modifies the visibility
       
   156  * according to current settings.
       
   157  */
       
   158 void CxuiStillPrecaptureView::reloadIndicatorWidgets()
       
   159 {
       
   160     CX_DEBUG_ENTER_FUNCTION();
       
   161     CX_ASSERT_ALWAYS(mDocumentLoader);
       
   162     
       
   163     bool ok = false;
       
   164     mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_INDICATORS_SECTION, &ok);
       
   165     CX_ASSERT_ALWAYS(ok);
       
   166 
       
   167     QGraphicsWidget *widget = NULL;
   129     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON);
   168     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON);
   130     mQualityIcon = qobject_cast<HbLabel *>(widget);
   169     mQualityIcon = qobject_cast<HbLabel *>(widget);
   131     CX_DEBUG_ASSERT(mQualityIcon);
   170     CX_ASSERT_ALWAYS(mQualityIcon);
       
   171     
       
   172     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON);
       
   173     HbLabel *flashBlinkingIcon = qobject_cast<HbLabel *>(widget);
       
   174     CX_ASSERT_ALWAYS(flashBlinkingIcon);
       
   175 
       
   176     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON);
       
   177     mGeoTaggingIndicatorIcon = qobject_cast<HbLabel *>(widget);
       
   178     CX_ASSERT_ALWAYS(mGeoTaggingIndicatorIcon);
       
   179 
       
   180     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON);
       
   181     mFaceTrackingIcon = qobject_cast<HbLabel *>(widget);
       
   182     CX_ASSERT_ALWAYS(mFaceTrackingIcon);
   132 
   183 
   133     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER);
   184     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER);
   134     mIndicators = qobject_cast<HbWidget *>(widget);
   185     mIndicators = qobject_cast<HbWidget *>(widget);
   135     CX_DEBUG_ASSERT(mIndicators);
   186     CX_ASSERT_ALWAYS(mIndicators);
       
   187     
       
   188     QGraphicsLayout *layout = mIndicators->layout();
       
   189     QGraphicsLayoutItem *graphicsLayoutItem = NULL;
       
   190     QGraphicsItem *graphicsItem = NULL;
       
   191     QString key = "";
       
   192     int currentSettingValue = -1;
       
   193     bool isSettingOff = false;
       
   194     // Go through the items in the layout to check whether they should be
       
   195     // shown or not in the indicator pane. Start from the last towards
       
   196     // the first, so that removing items from between works correctly.
       
   197     for (int i = layout->count() - 1; i >= 0; i--) {
       
   198         graphicsLayoutItem = layout->itemAt(i);
       
   199         isSettingOff = false;
       
   200         if (graphicsLayoutItem) {
       
   201             graphicsItem = graphicsLayoutItem->graphicsItem();
       
   202             currentSettingValue = -1;
       
   203             if (graphicsItem == mGeoTaggingIndicatorIcon) {
       
   204                 key = CxeSettingIds::GEOTAGGING;
       
   205                 mEngine->settings().get(key, currentSettingValue);
       
   206                 if (currentSettingValue == Cxe::GeoTaggingOff) {
       
   207                     isSettingOff = true;
       
   208                 }
       
   209             } else if (graphicsItem == mFaceTrackingIcon) {
       
   210                 key = CxeSettingIds::FACE_TRACKING;
       
   211                 mEngine->settings().get(key, currentSettingValue);
       
   212                 // facetracking implementation does not use 
       
   213                 // enum for on/off values but instead 
       
   214                 // 0 for off and 1 for on.
       
   215                 if (currentSettingValue == 0) {
       
   216                     isSettingOff = true;
       
   217                 }
       
   218             } else if (graphicsItem == flashBlinkingIcon) {
       
   219                 //remove flash indicator
       
   220                 isSettingOff = true;
       
   221             }
       
   222             if (isSettingOff) {
       
   223                 layout->removeAt(i);
       
   224             }
       
   225         }
       
   226     }
       
   227     
   136     // create background for indicator container
   228     // create background for indicator container
   137     createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
   229     createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
   138 
   230     
   139     CX_DEBUG_EXIT_FUNCTION();
   231     mIndicators->setVisible(true);
   140 }
   232 
   141 
   233     CX_DEBUG_EXIT_FUNCTION();
   142 
   234 }
       
   235 
       
   236 /*!
       
   237  * Loads widgets that are not part of the default section in layouts xml.
       
   238  * Widgets are created at the time they are first loaded.
       
   239  */
   143 void CxuiStillPrecaptureView::loadWidgets()
   240 void CxuiStillPrecaptureView::loadWidgets()
   144 {
   241 {
   145     CX_DEBUG_ENTER_FUNCTION();
   242     CX_DEBUG_ENTER_FUNCTION();
   146     CX_DEBUG_ASSERT(mDocumentLoader);
   243     CX_ASSERT_ALWAYS(mDocumentLoader);
   147 
   244 
   148     if( mWidgetsLoaded ) {
   245     if( mWidgetsLoaded ) {
   149         CX_DEBUG(("Widgets already loaded"));
   246         CX_DEBUG(("Widgets already loaded"));
   150         CX_DEBUG_EXIT_FUNCTION();
   247         CX_DEBUG_EXIT_FUNCTION();
   151         return;
   248         return;
   155 
   252 
   156     bool ok = false;
   253     bool ok = false;
   157 
   254 
   158     OstTrace0( camerax_performance, DUP4_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 1" );
   255     OstTrace0( camerax_performance, DUP4_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 1" );
   159     mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_WIDGETS_SECTION, &ok);
   256     mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_WIDGETS_SECTION, &ok);
   160     Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
   257     CX_ASSERT_ALWAYS(ok);
   161     if (CxuiServiceProvider::isCameraEmbedded()) {
   258     if (CxuiServiceProvider::isCameraEmbedded()) {
   162         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
   259         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
   163     } else {
   260     } else {
   164         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_STANDALONE_SECTION, &ok);
   261         mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_STANDALONE_SECTION, &ok);
   165     }
   262     }
   166     OstTrace0( camerax_performance, DUP5_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 0" );
   263     OstTrace0( camerax_performance, DUP5_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 0" );
   167     Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
   264     CX_ASSERT_ALWAYS(ok);
   168 
   265 
   169     // get pointers to ui components from the layout data
   266     // get pointers to ui components from the layout data
   170     QGraphicsWidget *widget = NULL;
   267     QGraphicsWidget *widget = NULL;
   171     QObject *object = NULL;
   268     QObject *object = NULL;
   172 
   269 
   173     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER);
   270     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER);
   174     mSlider = qobject_cast<CxuiZoomSlider *>(widget);
   271     mSlider = qobject_cast<CxuiZoomSlider *>(widget);
   175     CX_DEBUG_ASSERT(mSlider);
   272     CX_ASSERT_ALWAYS(mSlider);
   176     addIncreaseDecreaseButtons(mSlider);
   273     mSlider->addZoomButtons();
   177     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
   274     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
   178 
   275 
   179     if (mSelfTimer) {
   276     if (mSelfTimer) {
   180         // let selftimer class get needed selftimer related widgets
   277         // let selftimer class get needed selftimer related widgets
   181         // from the documentloader
   278         // from the documentloader
   184 
   281 
   185     // create background for selftimer containers
   282     // create background for selftimer containers
   186     HbWidget *container = NULL;
   283     HbWidget *container = NULL;
   187     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER);
   284     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER);
   188     container = qobject_cast<HbWidget *>(widget);
   285     container = qobject_cast<HbWidget *>(widget);
   189     CX_DEBUG_ASSERT(container);
   286     CX_ASSERT_ALWAYS(container);
   190     createWidgetBackgroundGraphic(container, TRANSPARENT_BACKGROUND_GRAPHIC);
   287     createWidgetBackgroundGraphic(container, TRANSPARENT_BACKGROUND_GRAPHIC);
   191 
   288 
   192     // connect selftimer start button to hide controls
   289     // connect selftimer start button to hide controls
   193     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_START_BUTTON);
   290     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_START_BUTTON);
   194     HbPushButton *startButton = qobject_cast<HbPushButton *>(widget);
   291     HbPushButton *startButton = qobject_cast<HbPushButton *>(widget);
   195     CX_DEBUG_ASSERT(startButton);
   292     CX_ASSERT_ALWAYS(startButton);
   196     connect(startButton, SIGNAL(released()), this, SLOT(hideControls()));
   293     connect(startButton, SIGNAL(released()), this, SLOT(hideControls()));
   197 
   294 
   198     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR);
   295     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR);
   199     mToolBar = qobject_cast<HbToolBar *>(widget);
   296     mToolbar = qobject_cast<HbToolBar *>(widget);
   200     CX_DEBUG_ASSERT(mToolBar);
   297     CX_ASSERT_ALWAYS(mToolbar);
   201 
   298 
   202     object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION);
   299     object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION);
   203     mFlashSetting = qobject_cast<HbAction *>(object);
   300     mFlashSetting = qobject_cast<HbAction *>(object);
   204     CX_DEBUG_ASSERT(mFlashSetting);
   301     CX_ASSERT_ALWAYS(mFlashSetting);
   205 
   302 
   206     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL);
   303     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL);
   207     mImagesLeft = qobject_cast<HbLabel *>(widget);
   304     mImagesLeft = qobject_cast<HbLabel *>(widget);
   208     CX_DEBUG_ASSERT(mImagesLeft);
   305     CX_ASSERT_ALWAYS(mImagesLeft);
   209 
   306 
   210     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER);
   307     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER);
   211     mImagesLeftContainer = qobject_cast<HbWidget *>(widget);
   308     mImagesLeftContainer = qobject_cast<HbWidget *>(widget);
   212     CX_DEBUG_ASSERT(mImagesLeftContainer);
   309     CX_ASSERT_ALWAYS(mImagesLeftContainer);
   213     createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
   310     createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
   214     updateImagesLeftLabel();
   311     updateImagesLeftLabel();
   215 
   312 
   216     if (CxuiServiceProvider::isCameraEmbedded()) {
   313     if (CxuiServiceProvider::isCameraEmbedded()) {
   217         CX_DEBUG(("EMBEDDED: camera in embedded mode"));
   314         CX_DEBUG(("EMBEDDED: camera in embedded mode"));
   238             CX_DEBUG(("EMBEDDED: don't allow camera switching"));
   335             CX_DEBUG(("EMBEDDED: don't allow camera switching"));
   239         }
   336         }
   240 
   337 
   241     }
   338     }
   242 
   339 
   243     // update toolbar flash icon
   340     // Setting widgets loaded here so updating icons works.
       
   341     mWidgetsLoaded = true;
       
   342 
       
   343     // Update toolbar flash mode icon
   244     int flash;
   344     int flash;
   245     if (mEngine->settings().get(CxeSettingIds::FLASH_MODE, flash) == CxeError::None) {
   345     if (mEngine->settings().get(CxeSettingIds::FLASH_MODE, flash) == CxeError::None) {
   246         handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash);
   346         handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash);
   247     }
   347     }
   248 
   348 
   249     // update toolbar scene mode
   349     // Update toolbar scene mode icon
   250     QString scene;
   350     QString sceneId;
   251     if (mEngine->settings().get(CxeSettingIds::IMAGE_SCENE, scene) == CxeError::None) {
   351     if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) {
   252         handleSettingValueChanged(CxeSettingIds::IMAGE_SCENE, scene);
   352         updateSceneIcon(sceneId);
   253     }
   353     }
   254 
   354 
   255     hideControls();
   355     hideControls();
   256 
   356 
   257     mWidgetsLoaded = true;
   357     // View is ready. Needed for startup performance automated testing.
       
   358     emit viewReady();
   258 
   359 
   259     OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_STILLPRECAPTUREVIEW_LOADWIDGETS 0" );
   360     OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_STILLPRECAPTUREVIEW_LOADWIDGETS 0" );
       
   361     CX_DEBUG_EXIT_FUNCTION();
       
   362 }
       
   363 
       
   364 /*!
       
   365  * Restore view state from activity.
       
   366  */
       
   367 void CxuiStillPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data)
       
   368 {
       
   369     Q_UNUSED(activityId);
       
   370     Q_UNUSED(data);
       
   371 
       
   372     CX_DEBUG_ENTER_FUNCTION();
       
   373     // no need to restore any state
       
   374     CX_DEBUG_EXIT_FUNCTION();
       
   375 }
       
   376 
       
   377 /*!
       
   378  * Save view state to activity.
       
   379  */
       
   380 void CxuiStillPrecaptureView::saveActivity()
       
   381 {
       
   382     CX_DEBUG_ENTER_FUNCTION();
       
   383     QVariantMap data;
       
   384     QVariantHash params;
       
   385     //@todo: add pre-capture icon as screenshot
       
   386     mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
       
   387     mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params);
       
   388     CX_DEBUG_EXIT_FUNCTION();
       
   389 }
       
   390 
       
   391 /*!
       
   392  * Clear activity from activity manager.
       
   393  */
       
   394 void CxuiStillPrecaptureView::clearActivity()
       
   395 {
       
   396     CX_DEBUG_ENTER_FUNCTION();
       
   397     mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
   260     CX_DEBUG_EXIT_FUNCTION();
   398     CX_DEBUG_EXIT_FUNCTION();
   261 }
   399 }
   262 
   400 
   263 /*!
   401 /*!
   264 * Initializing settings grid
   402 * Initializing settings grid
   269         HbAction* action(NULL);
   407         HbAction* action(NULL);
   270 
   408 
   271         // Initialize settings grid
   409         // Initialize settings grid
   272         mSettingsGrid = new HbToolBarExtension;
   410         mSettingsGrid = new HbToolBarExtension;
   273 
   411 
   274         action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure.svg"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting()));
   412         action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting()));
   275         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE);
   413         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE);
   276         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   414         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   277 
   415 
   278         action = mSettingsGrid->addAction(HbIcon("qtg_mono_iso.svg"), hbTrId("txt_cam_button_iso"), this, SLOT(launchSetting()));
   416         action = mSettingsGrid->addAction(HbIcon("qtg_mono_iso"), hbTrId("txt_cam_button_iso"), this, SLOT(launchSetting()));
   279         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::LIGHT_SENSITIVITY);
   417         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::LIGHT_SENSITIVITY);
   280         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   418         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   281 
   419 
   282         action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb.svg"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting()));
   420         action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting()));
   283         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE);
   421         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE);
   284         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   422         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   285 
   423 
   286         action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance.svg"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
   424         action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
   287         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
   425         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
   288         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   426         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   289 
   427 
   290         action = mSettingsGrid->addAction(HbIcon("qtg_mono_sharpness.svg"), hbTrId("txt_cam_grid_sharpness"), this, SLOT(launchSliderSetting()));
   428         action = mSettingsGrid->addAction(HbIcon("qtg_mono_sharpness"), hbTrId("txt_cam_grid_sharpness"), this, SLOT(launchSliderSetting()));
   291         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::SHARPNESS);
   429         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::SHARPNESS);
   292         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   430         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   293 
   431 
   294         action = mSettingsGrid->addAction(HbIcon("qtg_mono_contrast.svg"), hbTrId("txt_cam_button_contrast"), this, SLOT(launchSliderSetting()));
   432         action = mSettingsGrid->addAction(HbIcon("qtg_mono_contrast"), hbTrId("txt_cam_button_contrast"), this, SLOT(launchSliderSetting()));
   295         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::CONTRAST);
   433         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::CONTRAST);
   296         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   434         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   297 
   435 
   298         mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking.svg"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification()));
   436         action = mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchSetting()));
       
   437         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::FACE_TRACKING);
   299         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   438         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   300 
   439 
   301         connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
   440         connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
   302     }
   441     }
   303 }
   442 }
   304 
   443 
   305 void CxuiStillPrecaptureView::launchSceneModesPopup()
   444 /**
   306 {
   445 * Get if postcapture view should be shown or not.
   307     CX_DEBUG_ENTER_FUNCTION();
   446 * Postcapture view may be shown for a predefined time or
   308     hideControls();
   447 * until user dismisses it, or it may be completely disabled.
   309     emit showScenesView();
   448 */
   310     CX_DEBUG_EXIT_FUNCTION();
   449 bool CxuiStillPrecaptureView::isPostcaptureOn() const
   311 }
   450 {
   312 
   451     CX_DEBUG_ENTER_FUNCTION();
       
   452     if (CxuiServiceProvider::isCameraEmbedded()) {
       
   453         // always show post capture in embedded mode
       
   454         CX_DEBUG_EXIT_FUNCTION();
       
   455         return true;
       
   456     }
       
   457 
       
   458     // Read the value from settings. Ignoring reading error.
       
   459     // On error (missing settings) default to "postcapture on".
       
   460     int showPostcapture(-1);
       
   461     if(mEngine) {
       
   462         mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, showPostcapture);
       
   463     }
       
   464 
       
   465     CX_DEBUG_EXIT_FUNCTION();
       
   466     return showPostcapture != 0; // 0 == no postcapture
       
   467 }
       
   468 
       
   469 /*!
       
   470 * Update the scene mode icon.
       
   471 * @param sceneId The new scene id.
       
   472 */
       
   473 void CxuiStillPrecaptureView::updateSceneIcon(const QString& sceneId)
       
   474 {
       
   475     CX_DEBUG_ENTER_FUNCTION();
       
   476 
       
   477     if (mEngine->mode() == Cxe::ImageMode) {
       
   478         CX_DEBUG(("CxuiStillPrecaptureView - scene: %s", sceneId.toAscii().constData()));
       
   479 
       
   480         // No need to update icon, if widgets are not even loaded yet.
       
   481         // We'll update the icon once the widgets are loaded.
       
   482         if (mWidgetsLoaded) {
       
   483 
       
   484             QString iconObjectName = STILL_PRE_CAPTURE_SCENE_MODE_ACTION;
       
   485             QString icon = getSettingItemIcon(CxeSettingIds::IMAGE_SCENE, sceneId);
       
   486 
       
   487             CX_DEBUG(("CxuiStillPrecaptureView - icon: %s", icon.toAscii().constData()));
       
   488 
       
   489             if (mDocumentLoader) {
       
   490                 QObject *obj = mDocumentLoader->findObject(iconObjectName);
       
   491                 CX_ASSERT_ALWAYS(obj);
       
   492                 qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
       
   493             }
       
   494         } else {
       
   495             CX_DEBUG(("CxuiStillPrecaptureView - widgets not loaded yet, ignored!"));
       
   496         }
       
   497     }
       
   498     CX_DEBUG_EXIT_FUNCTION();
       
   499 }
       
   500 
       
   501 /*!
       
   502     Update the quality indicator
       
   503 */
       
   504 void CxuiStillPrecaptureView::updateQualityIcon()
       
   505 {
       
   506     CX_DEBUG_ENTER_FUNCTION();
       
   507 
       
   508     if (mQualityIcon && mEngine) {
       
   509         QString icon = "";
       
   510         int currentValue = -1;
       
   511 
       
   512         mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, currentValue);
       
   513         icon = getSettingItemIcon(CxeSettingIds::IMAGE_QUALITY, currentValue);
       
   514 
       
   515         mQualityIcon->setIcon(HbIcon(icon));
       
   516     }
       
   517 
       
   518     CX_DEBUG_EXIT_FUNCTION();
       
   519 }
   313 
   520 
   314 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error)
   521 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error)
   315 {
   522 {
   316     CX_DEBUG_ENTER_FUNCTION();
   523     CX_DEBUG_ENTER_FUNCTION();
   317 
   524 
   328             if (mSlider) {
   535             if (mSlider) {
   329                 mSlider->hide();
   536                 mSlider->hide();
   330             }
   537             }
   331         }
   538         }
   332     } else {
   539     } else {
   333         emit reportError(error);
   540         emit errorEncountered(error);
   334     }
   541     }
   335 
   542 
   336     CX_DEBUG_EXIT_FUNCTION();
   543     CX_DEBUG_EXIT_FUNCTION();
   337 }
   544 }
   338 
   545 
   385                 // should not cause significant delay / additional shutter lag.
   592                 // should not cause significant delay / additional shutter lag.
   386                 if (mEngine->stillCaptureControl().imagesLeft()) {
   593                 if (mEngine->stillCaptureControl().imagesLeft()) {
   387                     mEngine->stillCaptureControl().reset();  //! @todo: Do not delete snapshots before images are really saved
   594                     mEngine->stillCaptureControl().reset();  //! @todo: Do not delete snapshots before images are really saved
   388                     mEngine->stillCaptureControl().capture();
   595                     mEngine->stillCaptureControl().capture();
   389                 } else {
   596                 } else {
   390                     launchDiskFullNotification();
   597                     // Inform that error was encountered.
       
   598                     // Error manager will show necessary message to user.
       
   599                     emit errorEncountered(CxeError::DiskFull);
   391                 }
   600                 }
   392             }
   601             }
   393         } else {
   602         } else {
   394             setCapturePending();
   603             setCapturePending();
   395         }
   604         }
   453         }
   662         }
   454         break;
   663         break;
   455     default:
   664     default:
   456         break;
   665         break;
   457     }
   666     }
   458     //}
   667 
   459 
   668     CX_DEBUG_EXIT_FUNCTION();
   460     CX_DEBUG_EXIT_FUNCTION();
   669 }
   461 }
   670 
   462 
       
   463 
       
   464 void CxuiStillPrecaptureView::updateOrientation(Qt::Orientation orientation)
       
   465 {
       
   466     CX_DEBUG_ENTER_FUNCTION();
       
   467 
       
   468     hideControls();
       
   469     mMainWindow->setOrientation(orientation);
       
   470 
       
   471     if (orientation == Qt::Horizontal) {
       
   472         CX_DEBUG(("New screen orientation is horizontal"));
       
   473         mToolBar->setOrientation(Qt::Vertical);
       
   474     } else {
       
   475         CX_DEBUG(("New screen orientation is vertical"));
       
   476         mToolBar->setOrientation(Qt::Horizontal);
       
   477     }
       
   478 
       
   479     CX_DEBUG_EXIT_FUNCTION();
       
   480 }
       
   481 
   671 
   482 /*!
   672 /*!
   483 * Handle capture key full press.
   673 * Handle capture key full press.
   484 */
   674 */
   485 void CxuiStillPrecaptureView::handleCaptureKeyPressed()
   675 void CxuiStillPrecaptureView::handleCaptureKeyPressed()
   578 {
   768 {
   579     CxuiPrecaptureView::showEvent(event);
   769     CxuiPrecaptureView::showEvent(event);
   580 
   770 
   581     updateImagesLeftLabel();
   771     updateImagesLeftLabel();
   582     updateQualityIcon();
   772     updateQualityIcon();
       
   773     updateFaceTrackingIcon();
   583 
   774 
   584     // cancel selftimer when returning to precapture
   775     // cancel selftimer when returning to precapture
   585     // since selftimer needs to be turned off after capturing an image
   776     // since selftimer needs to be turned off after capturing an image
   586     // (with selftimer postcapture is always shown)
   777     // (with selftimer postcapture is always shown)
   587     if (mSelfTimer && mSelfTimer->isEnabled()) {
   778     if (mSelfTimer && mSelfTimer->isEnabled()) {
   590 
   781 
   591     // In case the user presses and holds the auto-focus key (ie. half-press)
   782     // In case the user presses and holds the auto-focus key (ie. half-press)
   592     // in post-capture view, we need to start auto-focusing when entering
   783     // in post-capture view, we need to start auto-focusing when entering
   593     // the still precapture view.
   784     // the still precapture view.
   594     if (event->type() == QEvent::Show &&
   785     if (event->type() == QEvent::Show &&
   595             mKeyHandler && mKeyHandler->isAutofocusKeyPressed()) {
   786             mCaptureKeyHandler && mCaptureKeyHandler->isAutofocusKeyPressed()) {
   596 
   787 
   597         CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF"));
   788         CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF"));
   598         handleAutofocusKeyPressed();
   789         handleAutofocusKeyPressed();
   599     }
   790     }
   600 }
   791 }
   601 
   792 
   602 void CxuiStillPrecaptureView::showToolbar()
   793 /*!
   603 {
   794 * Allow showing UI controls?
   604     if (mEngine && mEngine->isEngineReady()) {
   795 */
   605         CxuiPrecaptureView::showToolbar();
   796 bool CxuiStillPrecaptureView::allowShowControls() const
   606     }
   797 {
   607 }
   798     // show controls when selftimer counter is not active
   608 
   799     // and when autofocus key is not being pressed
   609 
   800     bool engineOk(mEngine && mEngine->isEngineReady());
       
   801     bool selfTimerOk(!mSelfTimer || !mSelfTimer->isOngoing());
       
   802     bool keysOk(!mCaptureKeyHandler || !mCaptureKeyHandler->isAutofocusKeyPressed());
       
   803 
       
   804     return engineOk && selfTimerOk && keysOk;
       
   805 }
       
   806 
       
   807 /*!
       
   808 * Handle change in viewfinder state.
       
   809 */
   610 void CxuiStillPrecaptureView::handleViewfinderStateChanged(
   810 void CxuiStillPrecaptureView::handleViewfinderStateChanged(
   611     CxeViewfinderControl::State newState, CxeError::Id /*error*/)
   811     CxeViewfinderControl::State newState, CxeError::Id error)
   612 {
   812 {
   613     CX_DEBUG_ENTER_FUNCTION();
   813     CX_DEBUG_ENTER_FUNCTION();
       
   814     // Call base class to get standby timer and display always visible when needed.
       
   815     CxuiPrecaptureView::handleVfStateChanged(newState, error);
   614 
   816 
   615     if (newState == CxeViewfinderControl::Running) {
   817     if (newState == CxeViewfinderControl::Running) {
   616 
   818 
   617         // the toolbar is created when the viewfinder is started the first time
   819         // the toolbar is created when the viewfinder is started the first time
   618         // in order to hide the delay caused by the creation
   820         // in order to hide the delay caused by the creation
   619         if(!mWidgetsLoaded) {
   821         if(!mWidgetsLoaded) {
   620             loadWidgets();
   822             loadWidgets();
   621         }
   823         }
   622 
   824 
   623         if(mMainWindow->currentView() == this &&
   825         if(mMainWindow->currentView() == this &&
   624             mKeyHandler->isAutofocusKeyPressed()) {
   826             mCaptureKeyHandler->isAutofocusKeyPressed()) {
   625             // Viewfinder just started and the user is pressing the auto-focus key.
   827             // Viewfinder just started and the user is pressing the auto-focus key.
   626             // Start focusing.
   828             // Start focusing.
   627 
   829 
   628             CX_DEBUG(("Viewfinder starting and auto-focus key pressed -> starting AF"));
   830             CX_DEBUG(("Viewfinder starting and auto-focus key pressed -> starting AF"));
   629             handleAutofocusKeyPressed();
   831             handleAutofocusKeyPressed();
   644             capture();
   846             capture();
   645         }
   847         }
   646     }
   848     }
   647 }
   849 }
   648 
   850 
       
   851 /*!
       
   852  * Signal used to reset mCapturePending after a short timeout. If the image
       
   853  * cannot be captured within a given time of the key press, it is better to cancel
       
   854  * the whole operation.
       
   855  */
   649 void CxuiStillPrecaptureView::resetCapturePendingFlag()
   856 void CxuiStillPrecaptureView::resetCapturePendingFlag()
   650 {
   857 {
   651     CX_DEBUG_IN_FUNCTION();
   858     CX_DEBUG_IN_FUNCTION();
   652 
   859 
   653     mCapturePending = false;
   860     mCapturePending = false;
   654 }
       
   655 
       
   656 void CxuiStillPrecaptureView::showControls()
       
   657 {
       
   658     // show controls when selftimer counter is not active
       
   659     // and when autofocus key is not being pressed
       
   660     if ( !(mSelfTimer && mSelfTimer->isOngoing())  &&
       
   661          (!mKeyHandler || !mKeyHandler->isAutofocusKeyPressed()) ) {
       
   662         CxuiPrecaptureView::showControls();
       
   663     }
       
   664 
       
   665 }
       
   666 
       
   667 /*!
       
   668 * Slot to handle application being sent to background.
       
   669 */
       
   670 void CxuiStillPrecaptureView::handleFocusLost()
       
   671 {
       
   672     CX_DEBUG_ENTER_FUNCTION();
       
   673 
       
   674     if (mSelfTimer && mSelfTimer->isOngoing()) {
       
   675         // If self-timer is running, stop and reset the delay now.
       
   676         mSelfTimer->reset();
       
   677     }
       
   678 
       
   679     // Release camera as we are going to background.
       
   680     // If taking image is just ongoing, it will be cancelled by engine.
       
   681     releaseCamera();
       
   682 
       
   683     CX_DEBUG_EXIT_FUNCTION();
       
   684 }
       
   685 
       
   686 void CxuiStillPrecaptureView::handleFocusGained()
       
   687 {
       
   688     CX_DEBUG_ENTER_FUNCTION();
       
   689     CxuiPrecaptureView::handleFocusGained();
       
   690     CX_DEBUG_EXIT_FUNCTION();
       
   691 }
   861 }
   692 
   862 
   693 /*
   863 /*
   694     Slot for handling scene mode change
   864     Slot for handling scene mode change
   695     \param scene QVariantMap containing settings related to the new scene mode
   865     \param scene QVariantMap containing settings related to the new scene mode
   698 {
   868 {
   699     CX_DEBUG_ENTER_FUNCTION();
   869     CX_DEBUG_ENTER_FUNCTION();
   700     if (mEngine->mode() == Cxe::ImageMode) {
   870     if (mEngine->mode() == Cxe::ImageMode) {
   701 
   871 
   702         // update toolbar scene mode icon
   872         // update toolbar scene mode icon
   703         QString icon = getSettingItemIcon(CxeSettingIds::IMAGE_SCENE, scene[CxeSettingIds::SCENE_ID]);
   873         updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString());
   704         CX_DEBUG((("New scene mode icon: %s"), icon.toAscii().constData()));
       
   705         if (mDocumentLoader) {
       
   706             QObject *obj = mDocumentLoader->findObject(STILL_PRE_CAPTURE_SCENE_MODE_ACTION);
       
   707             CX_DEBUG_ASSERT(obj);
       
   708             qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
       
   709         }
       
   710 
   874 
   711         // for now, we are only interested in flashmode change
   875         // for now, we are only interested in flashmode change
   712         if (scene.contains(CxeSettingIds::FLASH_MODE)) {
   876         if (scene.contains(CxeSettingIds::FLASH_MODE)) {
   713             CX_DEBUG(("updating flash to: %d", scene[CxeSettingIds::FLASH_MODE].value<int>()));
   877             CX_DEBUG(("updating flash to: %d", scene[CxeSettingIds::FLASH_MODE].value<int>()));
   714             handleSettingValueChanged(CxeSettingIds::FLASH_MODE, scene[CxeSettingIds::FLASH_MODE]);
   878             handleSettingValueChanged(CxeSettingIds::FLASH_MODE, scene[CxeSettingIds::FLASH_MODE]);
   722     }
   886     }
   723 
   887 
   724     CX_DEBUG_EXIT_FUNCTION();
   888     CX_DEBUG_EXIT_FUNCTION();
   725 }
   889 }
   726 
   890 
       
   891 /*!
       
   892 * Enter standby mode.
       
   893 */
       
   894 void CxuiStillPrecaptureView::enterStandby()
       
   895 {
       
   896     CX_DEBUG_ENTER_FUNCTION();
       
   897 
       
   898     if (mSelfTimer && mSelfTimer->isOngoing()) {
       
   899         // If self-timer is running, stop and reset the delay now.
       
   900         mSelfTimer->reset();
       
   901     }
       
   902 
       
   903     // Base class handles releasing camera.
       
   904     CxuiPrecaptureView::enterStandby();
       
   905 
       
   906     CX_DEBUG_EXIT_FUNCTION();
       
   907 }
       
   908 
   727 /*
   909 /*
   728     Slot for handling setting value changes. Notice that changing the scene mode
   910     Slot for handling setting value changes. Notice that changing the scene mode
   729     does not emit settingValueChanged signal.
   911     does not emit settingValueChanged signal.
   730     \param key      CxSettingIds key defining the changed setting
   912     \param key      CxSettingIds key defining the changed setting
   731     \param newValue QVariant containing the new setting value
   913     \param newValue QVariant containing the new setting value
   742         if (key == CxeSettingIds::IMAGE_QUALITY) {
   924         if (key == CxeSettingIds::IMAGE_QUALITY) {
   743             // update the quality indicator on screen
   925             // update the quality indicator on screen
   744             updateQualityIcon();
   926             updateQualityIcon();
   745             // update images left when quality values are changed
   927             // update images left when quality values are changed
   746             updateImagesLeftLabel();
   928             updateImagesLeftLabel();
       
   929         } else if (key == CxeSettingIds::FACE_TRACKING) {
       
   930             reloadIndicatorWidgets();
       
   931             updateFaceTrackingIcon();
       
   932         } else if (key == CxeSettingIds::GEOTAGGING) {
       
   933             reloadIndicatorWidgets();
   747         }
   934         }
   748 
   935 
   749         // update toolbar flash icon
   936         // update toolbar flash icon
   750         if (mFlashSetting && key == CxeSettingIds::FLASH_MODE) {
   937         if (mFlashSetting && key == CxeSettingIds::FLASH_MODE) {
   751             CX_DEBUG((("flash mode: %d"), newValue.toInt()));
   938             CX_DEBUG((("flash mode: %d"), newValue.toInt()));
   795         QString settingsKey = action->property(PROPERTY_KEY_SETTING_ID).toString();
   982         QString settingsKey = action->property(PROPERTY_KEY_SETTING_ID).toString();
   796         CX_DEBUG(("settingsKey=%s", settingsKey.toAscii().constData()));
   983         CX_DEBUG(("settingsKey=%s", settingsKey.toAscii().constData()));
   797         launchSettingsDialog(action);
   984         launchSettingsDialog(action);
   798         // special case to get value changed event to the selftimer class
   985         // special case to get value changed event to the selftimer class
   799         if (settingsKey == CxeSettingIds::SELF_TIMER) {
   986         if (settingsKey == CxeSettingIds::SELF_TIMER) {
       
   987             // if selftimer is active remember the previously selected value
       
   988             if (mSelfTimer->isEnabled()) {
       
   989                 mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout());
       
   990             }
   800             connect(mSettingsDialogList, SIGNAL(valueSelected(int)),
   991             connect(mSettingsDialogList, SIGNAL(valueSelected(int)),
   801                     mSelfTimer, SLOT(changeTimeOut(int)));
   992                     mSelfTimer, SLOT(changeTimeOut(int)));
   802         }
   993         }
   803     }
   994     }
   804 
   995 
   826     }
  1017     }
   827 
  1018 
   828     CX_DEBUG_EXIT_FUNCTION();
  1019     CX_DEBUG_EXIT_FUNCTION();
   829 }
  1020 }
   830 
  1021 
       
  1022 /*!
       
  1023     Update the face tracking icon
       
  1024 */
       
  1025 void CxuiStillPrecaptureView::updateFaceTrackingIcon()
       
  1026 {
       
  1027     CX_DEBUG_ENTER_FUNCTION();
       
  1028     if (mFaceTrackingIcon && mEngine) {
       
  1029         QString key = "";
       
  1030         QString icon = "";
       
  1031         int currentValue = -1;
       
  1032 
       
  1033         key = CxeSettingIds::FACE_TRACKING;
       
  1034 
       
  1035         mEngine->settings().get(key, currentValue);
       
  1036         icon = getSettingItemIcon(key, currentValue);
       
  1037 
       
  1038         mFaceTrackingIcon->setIcon(HbIcon(icon));
       
  1039     }
       
  1040 
       
  1041     CX_DEBUG_EXIT_FUNCTION();
       
  1042 }
       
  1043 
   831 // end of file
  1044 // end of file