camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp
changeset 58 ddba9caa7f32
parent 55 0da2a5b56583
equal deleted inserted replaced
55:0da2a5b56583 58:ddba9caa7f32
    45 #include "cxevideocapturecontrol.h"
    45 #include "cxevideocapturecontrol.h"
    46 #include "cxesettings.h"
    46 #include "cxesettings.h"
    47 #include "cxutils.h"
    47 #include "cxutils.h"
    48 #include "cxuienums.h"
    48 #include "cxuienums.h"
    49 #include "cxuidocumentloader.h"
    49 #include "cxuidocumentloader.h"
    50 #include "cxuidisplaypropertyhandler.h"
       
    51 #include "cxuicapturekeyhandler.h"
    50 #include "cxuicapturekeyhandler.h"
    52 #include "cxuiprecaptureview.h"
    51 #include "cxuiprecaptureview.h"
    53 #include "cxuisettingdialog.h"
    52 #include "cxuisettingdialog.h"
    54 #include "cxuisettingradiobuttonlist.h"
    53 #include "cxuisettingradiobuttonlist.h"
    55 #include "cxuisettingslider.h"
    54 #include "cxuisettingslider.h"
    81 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    82 //
    81 //
    83 CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) :
    82 CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) :
    84     CxuiView(parent),
    83     CxuiView(parent),
    85     mViewfinder(0),
    84     mViewfinder(0),
    86     mDisplayHandler(0),
       
    87     mSettingsGrid(0),
    85     mSettingsGrid(0),
    88     mWidgetsLoaded(false),
    86     mWidgetsLoaded(false),
    89     mSettingsDialog(NULL),
    87     mSettingsDialog(NULL),
    90     mSettingsDialogList(NULL),
    88     mSettingsDialogList(NULL),
    91     mQualityIcon(NULL),
    89     mQualityIcon(NULL),
    99     mSettingsInfo(NULL),
    97     mSettingsInfo(NULL),
   100     mSettingsDialogOkAction(NULL),
    98     mSettingsDialogOkAction(NULL),
   101     mSliderSettingsDialogOkAction(NULL)
    99     mSliderSettingsDialogOkAction(NULL)
   102 {
   100 {
   103     CX_DEBUG_ENTER_FUNCTION();
   101     CX_DEBUG_ENTER_FUNCTION();
   104     mDisplayHandler = new CxuiDisplayPropertyHandler();
       
   105     CX_DEBUG_EXIT_FUNCTION();
   102     CX_DEBUG_EXIT_FUNCTION();
   106 }
   103 }
   107 
   104 
   108 CxuiPrecaptureView::~CxuiPrecaptureView()
   105 CxuiPrecaptureView::~CxuiPrecaptureView()
   109 {
   106 {
   121  * @param documentLoader
   118  * @param documentLoader
   122  * @param keyHandler
   119  * @param keyHandler
   123  */
   120  */
   124 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine,
   121 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine,
   125                                    CxuiDocumentLoader *documentLoader,
   122                                    CxuiDocumentLoader *documentLoader,
   126                                    CxuiCaptureKeyHandler * keyHandler,
   123                                    CxuiCaptureKeyHandler * keyHandler)
   127                                    HbActivityManager *activityManager)
       
   128 {
   124 {
   129     CX_DEBUG_ENTER_FUNCTION();
   125     CX_DEBUG_ENTER_FUNCTION();
   130     OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1");
   126     OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1");
   131 
   127 
   132     CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager);
   128     CxuiView::construct(mainWindow, engine, documentLoader, keyHandler);
   133 
   129 
   134     mSettingsInfo = new CxuiSettingsInfo(engine);
   130     mSettingsInfo = new CxuiSettingsInfo(engine);
   135     CX_DEBUG_ASSERT(mSettingsInfo);
   131     CX_DEBUG_ASSERT(mSettingsInfo);
   136 
   132 
   137     setContentFullScreen(true);
   133     setContentFullScreen(true);
   149     connect(&mEngine->geoTaggingTrail(), SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
   145     connect(&mEngine->geoTaggingTrail(), SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
   150             this, SLOT(updateLocationIndicator(CxeGeoTaggingTrail::State, CxeError::Id)));
   146             this, SLOT(updateLocationIndicator(CxeGeoTaggingTrail::State, CxeError::Id)));
   151 
   147 
   152     connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)),
   148     connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)),
   153             this, SLOT(handleSettingValueChanged(const QString&, QVariant)));
   149             this, SLOT(handleSettingValueChanged(const QString&, QVariant)));
   154 
       
   155     // adjust the timer, and connect it to correct slot
       
   156     connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls()));
       
   157 
       
   158     mHideControlsTimeout.setSingleShot(true);
       
   159     mHideControlsTimeout.setInterval(CXUI_HIDE_CONTROLS_TIMEOUT);
       
   160 
   150 
   161     mGeoTaggingBlinkTimer = new QTimer(this);
   151     mGeoTaggingBlinkTimer = new QTimer(this);
   162     connect(mGeoTaggingBlinkTimer, SIGNAL(timeout()), this, SLOT(blinkGeoTaggingIcon()));
   152     connect(mGeoTaggingBlinkTimer, SIGNAL(timeout()), this, SLOT(blinkGeoTaggingIcon()));
   163 
   153 
   164     hideControls();
   154     hideControls();
   333 
   323 
   334     QGraphicsWidget::showEvent(event);
   324     QGraphicsWidget::showEvent(event);
   335 
   325 
   336     if (event->type() == QEvent::Show) {
   326     if (event->type() == QEvent::Show) {
   337         QCoreApplication::instance()->installEventFilter(this);
   327         QCoreApplication::instance()->installEventFilter(this);
       
   328         hideControls();
   338         event->accept();
   329         event->accept();
   339     }
   330     }
   340 
   331 
   341     CX_DEBUG_EXIT_FUNCTION();
   332     CX_DEBUG_EXIT_FUNCTION();
   342 }
   333 }
   353     QGraphicsWidget::hideEvent(event);
   344     QGraphicsWidget::hideEvent(event);
   354 
   345 
   355     if (event->type() == QEvent::Hide) {
   346     if (event->type() == QEvent::Hide) {
   356         QCoreApplication::instance()->removeEventFilter(this);
   347         QCoreApplication::instance()->removeEventFilter(this);
   357         hideZoom();
   348         hideZoom();
       
   349         hideToolbar();
   358         event->accept();
   350         event->accept();
   359     }
   351     }
   360 
   352 
   361     CX_DEBUG_EXIT_FUNCTION();
   353     CX_DEBUG_EXIT_FUNCTION();
   362 }
   354 }
   417     mEngine->initMode(mEngine->mode());
   409     mEngine->initMode(mEngine->mode());
   418     CX_DEBUG_EXIT_FUNCTION();
   410     CX_DEBUG_EXIT_FUNCTION();
   419 }
   411 }
   420 
   412 
   421 
   413 
   422 /*
   414 
   423  * viewfinder state call backs
   415 /*!
       
   416  * Handles viewfinder state changes.
       
   417  * @param newState new viewfinder state
       
   418  * @param error error code in case of error
   424  */
   419  */
   425 void CxuiPrecaptureView::handleVfStateChanged(
   420 void CxuiPrecaptureView::handleVfStateChanged(
   426     CxeViewfinderControl::State newState, CxeError::Id /*error*/)
   421     CxeViewfinderControl::State newState, CxeError::Id error)
   427 {
   422 {
   428     CX_DEBUG_ENTER_FUNCTION();
   423     CX_DEBUG_ENTER_FUNCTION();
       
   424     Q_UNUSED(error);
   429 
   425 
   430     if (newState == CxeViewfinderControl::Running) {
   426     if (newState == CxeViewfinderControl::Running) {
   431         // switch off screen saver and turn on backlight
       
   432         if(mDisplayHandler) {
       
   433             mDisplayHandler->setDisplayAlwaysVisible(true);
       
   434         }
       
   435         // start the standby timer
   427         // start the standby timer
   436         emit startStandbyTimer();
   428         emit startStandbyTimer();
   437     } else {
   429     } else {
   438         // switch on screen saver and turn off backlight
       
   439         if(mDisplayHandler) {
       
   440             mDisplayHandler->setDisplayAlwaysVisible(false);
       
   441         }
       
   442         // stop the standby timer when vf is not running.
   430         // stop the standby timer when vf is not running.
   443         emit stopStandbyTimer();
   431         emit stopStandbyTimer();
   444     }
   432     }
   445 
   433 
   446     CX_DEBUG_EXIT_FUNCTION();
   434     CX_DEBUG_EXIT_FUNCTION();