camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp
changeset 39 c5025ea871a1
parent 38 0f0b4c1d7744
child 40 2922f70fca82
equal deleted inserted replaced
38:0f0b4c1d7744 39:c5025ea871a1
    73     mTimeRemaining(0),
    73     mTimeRemaining(0),
    74     mElapsedTimeText(NULL),
    74     mElapsedTimeText(NULL),
    75     mRemainingTimeText(NULL),
    75     mRemainingTimeText(NULL),
    76     mRecordingIcon(NULL),
    76     mRecordingIcon(NULL),
    77     mGoToStillAction(NULL),
    77     mGoToStillAction(NULL),
    78     mToolBarIdle(NULL),
    78     mToolbarIdle(NULL),
    79     mToolBarRec(NULL),
    79     mToolbarRec(NULL),
    80     mToolBarPaused(NULL),
    80     mToolbarPaused(NULL),
    81     mVideoScenePopup(NULL),
    81     mVideoScenePopup(NULL),
    82     mVideoCaptureControl(NULL),
    82     mVideoCaptureControl(NULL),
    83     mMenu(NULL),
    83     mMenu(NULL),
    84     mCapturePending(false)
    84     mCapturePending(false)
    85 {
    85 {
    99                                         CxuiCaptureKeyHandler *keyHandler)
    99                                         CxuiCaptureKeyHandler *keyHandler)
   100 {
   100 {
   101     CX_DEBUG_ENTER_FUNCTION();
   101     CX_DEBUG_ENTER_FUNCTION();
   102 
   102 
   103     CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
   103     CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
   104     mKeyHandler = keyHandler;
   104     mCaptureKeyHandler = keyHandler;
   105 
   105 
   106     mVideoCaptureControl = &(engine->videoCaptureControl());
   106     mVideoCaptureControl = &(engine->videoCaptureControl());
   107 
   107 
   108     connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
   108     connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
   109     connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
   109     connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
   185     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER);
   185     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER);
   186     mSlider = qobject_cast<CxuiZoomSlider *> (widget);
   186     mSlider = qobject_cast<CxuiZoomSlider *> (widget);
   187     CX_DEBUG_ASSERT(mSlider);
   187     CX_DEBUG_ASSERT(mSlider);
   188 
   188 
   189     //Let's add a plus and minus buttons to the slider
   189     //Let's add a plus and minus buttons to the slider
   190     addIncreaseDecreaseButtons(mSlider);
   190     mSlider->addZoomButtons();
   191     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
   191     createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
   192 
   192 
   193     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR);
   193     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR);
   194     mToolBarIdle = qobject_cast<HbToolBar *> (widget);
   194     mToolbarIdle = qobject_cast<HbToolBar *> (widget);
   195     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_REC);
   195     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_REC);
   196     mToolBarRec = qobject_cast<HbToolBar *> (widget);
   196     mToolbarRec = qobject_cast<HbToolBar *> (widget);
   197     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED);
   197     widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED);
   198     mToolBarPaused = qobject_cast<HbToolBar *> (widget);
   198     mToolbarPaused = qobject_cast<HbToolBar *> (widget);
   199 
   199 
   200     mToolBar = mToolBarIdle;
   200     mToolbar = mToolbarIdle;
   201 
   201 
   202     CX_DEBUG_ASSERT(mToolBarIdle);
   202     CX_DEBUG_ASSERT(mToolbarIdle);
   203     CX_DEBUG_ASSERT(mToolBarRec);
   203     CX_DEBUG_ASSERT(mToolbarRec);
   204     CX_DEBUG_ASSERT(mToolBarPaused);
   204     CX_DEBUG_ASSERT(mToolbarPaused);
   205 
   205 
   206     hideControls();
   206     hideControls();
   207 
   207 
   208     if (CxuiServiceProvider::isCameraEmbedded()) {
   208     if (CxuiServiceProvider::isCameraEmbedded()) {
   209         CX_DEBUG(("EMBEDDED: camera in embedded mode"));
   209         CX_DEBUG(("EMBEDDED: camera in embedded mode"));
   298 
   298 
   299         action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
   299         action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
   300         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
   300         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
   301         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   301         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
   302 
   302 
   303         connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
   303         connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
   304     }
   304     }
   305 }
   305 }
   306 
   306 
   307 void CxuiVideoPrecaptureView::handleSnapshot(CxeError::Id /*error*/)
   307 void CxuiVideoPrecaptureView::handleSnapshot(CxeError::Id /*error*/)
   308 {
   308 {
   354     }
   354     }
   355 
   355 
   356     CX_DEBUG_EXIT_FUNCTION();
   356     CX_DEBUG_EXIT_FUNCTION();
   357 }
   357 }
   358 
   358 
       
   359 
       
   360 /*!
       
   361 * Allow showing UI controls?
       
   362 */
       
   363 bool CxuiVideoPrecaptureView::allowShowControls() const
       
   364 {
       
   365     bool show(false);
       
   366     if (mEngine) {
       
   367         CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
       
   368 
       
   369         show = (mEngine->isEngineReady()
       
   370              || state == CxeVideoCaptureControl::Recording
       
   371              || state == CxeVideoCaptureControl::Paused);
       
   372     }
       
   373     return show;
       
   374 }
       
   375 
   359 // CxuiPrecaptureView::showToolbar()
   376 // CxuiPrecaptureView::showToolbar()
   360 // Shows toolbar. Calls the base class implementation if not recording
   377 // Shows toolbar. Calls the base class implementation if not recording
   361 // since toolbar is not shown during recording
   378 // since toolbar is not shown during recording
   362 void CxuiVideoPrecaptureView::showToolbar()
   379 void CxuiVideoPrecaptureView::showToolbar()
   363 {
   380 {
   364     CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
   381     CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
   365     if (state == CxeVideoCaptureControl::Recording) {
   382     if (state == CxeVideoCaptureControl::Recording) {
   366         if (mToolBar != mToolBarRec) {
   383         if (mToolbar != mToolbarRec) {
   367             mToolBar->hide();
   384             mToolbar->hide();
   368             mToolBar = mToolBarRec;
   385             mToolbar = mToolbarRec;
   369         }
   386         }
   370     } else if (state ==CxeVideoCaptureControl::Ready) {
   387     } else if (state ==CxeVideoCaptureControl::Ready) {
   371         if (mToolBar != mToolBarIdle) {
   388         if (mToolbar != mToolbarIdle) {
   372             mToolBar->hide();
   389             mToolbar->hide();
   373             mToolBar = mToolBarIdle;
   390             mToolbar = mToolbarIdle;
   374         }
   391         }
   375     } else if (state == CxeVideoCaptureControl::Paused) {
   392     } else if (state == CxeVideoCaptureControl::Paused) {
   376         if (mToolBar != mToolBarPaused) {
   393         if (mToolbar != mToolbarPaused) {
   377             mToolBar->hide();
   394             mToolbar->hide();
   378             mToolBar = mToolBarPaused;
   395             mToolbar = mToolbarPaused;
   379         }
   396         }
   380     }
   397     }
   381 
   398 
   382     CxuiPrecaptureView::showToolbar();
   399     CxuiPrecaptureView::showToolbar();
   383 }
   400 }
   562             mRecordingAnimation->start();
   579             mRecordingAnimation->start();
   563         }
   580         }
   564         break;
   581         break;
   565     case CxeVideoCaptureControl::Paused:
   582     case CxeVideoCaptureControl::Paused:
   566         mElapsedTimer.stop();
   583         mElapsedTimer.stop();
   567 
       
   568         if (mDocumentLoader){
   584         if (mDocumentLoader){
   569             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
   585             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
   570         }
       
   571 
       
   572         if (mRecordingAnimation && mRecordingIcon) {
       
   573             mRecordingAnimation->stop();
       
   574         }
   586         }
   575         showControls();
   587         showControls();
   576         enableFeedback();
   588         enableFeedback();
   577         mPauseTimer.start();
   589         mPauseTimer.start();
   578         break;
   590         break;
   601             // do the prepare when the previous video is ready
   613             // do the prepare when the previous video is ready
   602             connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
   614             connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
   603                     this, SLOT(prepareNewVideo(CxeError::Id)));
   615                     this, SLOT(prepareNewVideo(CxeError::Id)));
   604         }
   616         }
   605         break;
   617         break;
       
   618     case CxeVideoCaptureControl::PlayingStartSound:
       
   619         // don't change anything
       
   620         break;
   606     default:
   621     default:
   607         // in any other state, just hide the controls
   622         // in any other state, just hide the controls
   608         setRecordingItemsVisibility(false);
   623         setRecordingItemsVisibility(false);
   609         break;
   624         break;
   610     }
       
   611 
       
   612     CX_DEBUG_EXIT_FUNCTION();
       
   613 }
       
   614 
       
   615 void CxuiVideoPrecaptureView::updateOrientation(Qt::Orientation orientation)
       
   616 {
       
   617     CX_DEBUG_ENTER_FUNCTION();
       
   618 
       
   619     hideControls();
       
   620     mMainWindow->setOrientation(orientation);
       
   621 
       
   622     if (mToolBar) {
       
   623         if (orientation == Qt::Horizontal) {
       
   624             mToolBar->setOrientation(Qt::Vertical);
       
   625         } else {
       
   626             mToolBar->setOrientation(Qt::Horizontal);
       
   627         }
       
   628     }
   625     }
   629 
   626 
   630     CX_DEBUG_EXIT_FUNCTION();
   627     CX_DEBUG_EXIT_FUNCTION();
   631 }
   628 }
   632 
   629