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&)), |
110 this, SLOT(handleSnapshot(CxeError::Id))); |
110 this, SLOT(handleSnapshot(CxeError::Id))); |
111 connect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)), |
111 connect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)), |
112 this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id))); |
112 this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id))); |
|
113 connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)), |
|
114 this, SLOT(handleSceneChanged(CxeScene&))); |
113 connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()), |
115 connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()), |
114 this, SLOT(updateTimeLabels())); |
116 this, SLOT(updateTimeLabels())); |
115 |
117 |
116 mPauseTimer.setSingleShot(true); |
118 mPauseTimer.setSingleShot(true); |
117 connect(&mPauseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
119 connect(&mPauseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
260 mRecordingAnimation->setEndValue(0.2); |
262 mRecordingAnimation->setEndValue(0.2); |
261 mRecordingAnimation->setDuration(CXUI_RECORD_ANIMATION_DURATION); |
263 mRecordingAnimation->setDuration(CXUI_RECORD_ANIMATION_DURATION); |
262 mRecordingAnimation->setLoopCount(-1); |
264 mRecordingAnimation->setLoopCount(-1); |
263 mRecordingAnimation->setEasingCurve(QEasingCurve::OutInQuad); |
265 mRecordingAnimation->setEasingCurve(QEasingCurve::OutInQuad); |
264 |
266 |
|
267 |
|
268 // Update toolbar scene mode icon. |
|
269 QString sceneId; |
|
270 if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) { |
|
271 updateSceneIcon(sceneId); |
|
272 } |
|
273 |
265 // Initialize the video time counters. |
274 // Initialize the video time counters. |
266 updateTimeLabels(); |
275 updateTimeLabels(); |
267 |
276 |
|
277 |
268 CX_DEBUG_EXIT_FUNCTION(); |
278 CX_DEBUG_EXIT_FUNCTION(); |
269 } |
279 } |
270 |
280 |
271 /*! |
281 /*! |
272 * Initialize settings grid. |
282 * Initialize settings grid. |
276 if(!mSettingsGrid) { |
286 if(!mSettingsGrid) { |
277 HbAction* action(NULL); |
287 HbAction* action(NULL); |
278 |
288 |
279 mSettingsGrid = new HbToolBarExtension; |
289 mSettingsGrid = new HbToolBarExtension; |
280 |
290 |
281 action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure.svg"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting())); |
291 action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting())); |
282 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE); |
292 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE); |
283 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
293 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
284 |
294 |
285 action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb.svg"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting())); |
295 action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting())); |
286 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE); |
296 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE); |
287 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
297 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
288 |
298 |
289 action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance.svg"), 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())); |
290 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE); |
300 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE); |
291 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
301 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
292 |
302 |
293 connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); |
303 connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); |
294 } |
304 } |
333 } |
343 } |
334 |
344 |
335 void CxuiVideoPrecaptureView::stop() |
345 void CxuiVideoPrecaptureView::stop() |
336 { |
346 { |
337 CX_DEBUG_ENTER_FUNCTION(); |
347 CX_DEBUG_ENTER_FUNCTION(); |
338 if (isPostcaptureOn()) { |
348 |
339 CxeVideoCaptureControl::State state = mVideoCaptureControl->state(); |
349 CxeVideoCaptureControl::State state = mVideoCaptureControl->state(); |
340 if (state == CxeVideoCaptureControl::Recording || |
350 if (state == CxeVideoCaptureControl::Recording || |
341 state == CxeVideoCaptureControl::Paused) { |
351 state == CxeVideoCaptureControl::Paused) { |
342 mVideoCaptureControl->stop(); |
352 mVideoCaptureControl->stop(); |
343 // Continue in handleVideoStateChanged(). |
353 // Continue in handleVideoStateChanged(). |
344 } |
354 } |
345 } else { |
355 |
346 // no postcapture |
356 CX_DEBUG_EXIT_FUNCTION(); |
347 stopAndPrepareNewVideo(); |
357 } |
348 } |
|
349 |
|
350 |
|
351 CX_DEBUG_EXIT_FUNCTION(); |
|
352 } |
|
353 |
|
354 // CxuiVideoPrecaptureView::stopAndPrepareNewVideo() |
|
355 // A version of stop that doesn't go to post-capture. When |
|
356 // not going to post-capture, we need to prepare new video |
|
357 void CxuiVideoPrecaptureView::stopAndPrepareNewVideo() |
|
358 { |
|
359 CX_DEBUG_ENTER_FUNCTION(); |
|
360 mVideoCaptureControl->stop(); |
|
361 mElapsedTimer.stop(); |
|
362 hideControls(); |
|
363 |
|
364 if (mMenu) { |
|
365 setMenu(mMenu); |
|
366 mMenu = NULL; |
|
367 } |
|
368 |
|
369 // prepare new video when old one is ready |
|
370 connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)), |
|
371 this, SLOT(prepareNewVideo(CxeError::Id))); |
|
372 |
|
373 CX_DEBUG_EXIT_FUNCTION(); |
|
374 } |
|
375 |
|
376 |
358 |
377 // CxuiPrecaptureView::showToolbar() |
359 // CxuiPrecaptureView::showToolbar() |
378 // Shows toolbar. Calls the base class implementation if not recording |
360 // Shows toolbar. Calls the base class implementation if not recording |
379 // since toolbar is not shown during recording |
361 // since toolbar is not shown during recording |
380 void CxuiVideoPrecaptureView::showToolbar() |
362 void CxuiVideoPrecaptureView::showToolbar() |
602 if (mRecordingAnimation && mRecordingIcon) { |
584 if (mRecordingAnimation && mRecordingIcon) { |
603 mRecordingAnimation->stop(); |
585 mRecordingAnimation->stop(); |
604 } |
586 } |
605 enableFeedback(); |
587 enableFeedback(); |
606 |
588 |
|
589 mElapsedTimer.stop(); |
|
590 hideControls(); |
|
591 |
|
592 if (mMenu) { |
|
593 setMenu(mMenu); |
|
594 mMenu = NULL; |
|
595 } |
|
596 |
607 if (isPostcaptureOn()) { |
597 if (isPostcaptureOn()) { |
608 mElapsedTimer.stop(); |
|
609 hideControls(); |
|
610 |
|
611 if (mRecordingAnimation && mRecordingIcon) { |
|
612 mRecordingAnimation->stop(); |
|
613 mRecordingIcon->setOpacity(0); |
|
614 } |
|
615 if (mMenu) { |
|
616 setMenu(mMenu); |
|
617 mMenu = NULL; |
|
618 } |
|
619 |
|
620 emit changeToPostcaptureView(); |
598 emit changeToPostcaptureView(); |
|
599 } else { |
|
600 // post capture off, we need prepare new video |
|
601 // do the prepare when the previous video is ready |
|
602 connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)), |
|
603 this, SLOT(prepareNewVideo(CxeError::Id))); |
621 } |
604 } |
622 break; |
605 break; |
623 default: |
606 default: |
624 // in any other state, just hide the controls |
607 // in any other state, just hide the controls |
625 setRecordingItemsVisibility(false); |
608 setRecordingItemsVisibility(false); |
776 |
759 |
777 CX_DEBUG_EXIT_FUNCTION(); |
760 CX_DEBUG_EXIT_FUNCTION(); |
778 } |
761 } |
779 |
762 |
780 /*! |
763 /*! |
|
764 * Handle scene mode change. |
|
765 * @param scene The new active scene mode. |
|
766 */ |
|
767 void CxuiVideoPrecaptureView::handleSceneChanged(CxeScene &scene) |
|
768 { |
|
769 CX_DEBUG_ENTER_FUNCTION(); |
|
770 // Ignore if not in video mode. |
|
771 if (mEngine->mode() == Cxe::VideoMode) { |
|
772 // Update toolbar scene mode icon. |
|
773 updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString()); |
|
774 } |
|
775 |
|
776 CX_DEBUG_EXIT_FUNCTION(); |
|
777 } |
|
778 |
|
779 |
|
780 |
|
781 /*! |
781 Sets the visibility of recording icon and elapsed time text. |
782 Sets the visibility of recording icon and elapsed time text. |
782 \param visible True if widgets are to be shown, false if not. |
783 \param visible True if widgets are to be shown, false if not. |
783 */ |
784 */ |
784 void CxuiVideoPrecaptureView::setRecordingItemsVisibility(bool visible) { |
785 void CxuiVideoPrecaptureView::setRecordingItemsVisibility(bool visible) { |
785 |
786 |