171 QObject *object = NULL; |
171 QObject *object = NULL; |
172 |
172 |
173 widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER); |
173 widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER); |
174 mSlider = qobject_cast<CxuiZoomSlider *>(widget); |
174 mSlider = qobject_cast<CxuiZoomSlider *>(widget); |
175 CX_DEBUG_ASSERT(mSlider); |
175 CX_DEBUG_ASSERT(mSlider); |
176 addIncreaseDecreaseButtons(mSlider); |
176 mSlider->addZoomButtons(); |
177 createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); |
177 createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); |
178 |
178 |
179 if (mSelfTimer) { |
179 if (mSelfTimer) { |
180 // let selftimer class get needed selftimer related widgets |
180 // let selftimer class get needed selftimer related widgets |
181 // from the documentloader |
181 // from the documentloader |
194 HbPushButton *startButton = qobject_cast<HbPushButton *>(widget); |
194 HbPushButton *startButton = qobject_cast<HbPushButton *>(widget); |
195 CX_DEBUG_ASSERT(startButton); |
195 CX_DEBUG_ASSERT(startButton); |
196 connect(startButton, SIGNAL(released()), this, SLOT(hideControls())); |
196 connect(startButton, SIGNAL(released()), this, SLOT(hideControls())); |
197 |
197 |
198 widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR); |
198 widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR); |
199 mToolBar = qobject_cast<HbToolBar *>(widget); |
199 mToolbar = qobject_cast<HbToolBar *>(widget); |
200 CX_DEBUG_ASSERT(mToolBar); |
200 CX_DEBUG_ASSERT(mToolbar); |
201 |
201 |
202 object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION); |
202 object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION); |
203 mFlashSetting = qobject_cast<HbAction *>(object); |
203 mFlashSetting = qobject_cast<HbAction *>(object); |
204 CX_DEBUG_ASSERT(mFlashSetting); |
204 CX_DEBUG_ASSERT(mFlashSetting); |
205 |
205 |
297 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
297 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
298 |
298 |
299 mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification())); |
299 mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification())); |
300 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
300 action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); |
301 |
301 |
302 connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); |
302 connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); |
303 } |
303 } |
304 } |
|
305 |
|
306 void CxuiStillPrecaptureView::launchSceneModesPopup() |
|
307 { |
|
308 CX_DEBUG_ENTER_FUNCTION(); |
|
309 hideControls(); |
|
310 emit showScenesView(); |
|
311 CX_DEBUG_EXIT_FUNCTION(); |
|
312 } |
304 } |
313 |
305 |
314 |
306 |
315 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error) |
307 void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error) |
316 { |
308 { |
460 |
452 |
461 CX_DEBUG_EXIT_FUNCTION(); |
453 CX_DEBUG_EXIT_FUNCTION(); |
462 } |
454 } |
463 |
455 |
464 |
456 |
465 void CxuiStillPrecaptureView::updateOrientation(Qt::Orientation orientation) |
|
466 { |
|
467 CX_DEBUG_ENTER_FUNCTION(); |
|
468 |
|
469 hideControls(); |
|
470 mMainWindow->setOrientation(orientation); |
|
471 |
|
472 if (orientation == Qt::Horizontal) { |
|
473 CX_DEBUG(("New screen orientation is horizontal")); |
|
474 mToolBar->setOrientation(Qt::Vertical); |
|
475 } else { |
|
476 CX_DEBUG(("New screen orientation is vertical")); |
|
477 mToolBar->setOrientation(Qt::Horizontal); |
|
478 } |
|
479 |
|
480 CX_DEBUG_EXIT_FUNCTION(); |
|
481 } |
|
482 |
|
483 /*! |
457 /*! |
484 * Handle capture key full press. |
458 * Handle capture key full press. |
485 */ |
459 */ |
486 void CxuiStillPrecaptureView::handleCaptureKeyPressed() |
460 void CxuiStillPrecaptureView::handleCaptureKeyPressed() |
487 { |
461 { |
591 |
565 |
592 // In case the user presses and holds the auto-focus key (ie. half-press) |
566 // In case the user presses and holds the auto-focus key (ie. half-press) |
593 // in post-capture view, we need to start auto-focusing when entering |
567 // in post-capture view, we need to start auto-focusing when entering |
594 // the still precapture view. |
568 // the still precapture view. |
595 if (event->type() == QEvent::Show && |
569 if (event->type() == QEvent::Show && |
596 mKeyHandler && mKeyHandler->isAutofocusKeyPressed()) { |
570 mCaptureKeyHandler && mCaptureKeyHandler->isAutofocusKeyPressed()) { |
597 |
571 |
598 CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF")); |
572 CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF")); |
599 handleAutofocusKeyPressed(); |
573 handleAutofocusKeyPressed(); |
600 } |
574 } |
601 } |
575 } |
602 |
576 |
603 void CxuiStillPrecaptureView::showToolbar() |
577 /*! |
604 { |
578 * Allow showing UI controls? |
605 if (mEngine && mEngine->isEngineReady()) { |
579 */ |
606 CxuiPrecaptureView::showToolbar(); |
580 bool CxuiStillPrecaptureView::allowShowControls() const |
607 } |
581 { |
608 } |
582 // show controls when selftimer counter is not active |
609 |
583 // and when autofocus key is not being pressed |
610 |
584 bool engineOk(mEngine && mEngine->isEngineReady()); |
|
585 bool selfTimerOk(!mSelfTimer || !mSelfTimer->isOngoing()); |
|
586 bool keysOk(!mCaptureKeyHandler || !mCaptureKeyHandler->isAutofocusKeyPressed()); |
|
587 |
|
588 return engineOk && selfTimerOk && keysOk; |
|
589 } |
|
590 |
|
591 /*! |
|
592 * Handle change in viewfinder state. |
|
593 */ |
611 void CxuiStillPrecaptureView::handleViewfinderStateChanged( |
594 void CxuiStillPrecaptureView::handleViewfinderStateChanged( |
612 CxeViewfinderControl::State newState, CxeError::Id /*error*/) |
595 CxeViewfinderControl::State newState, CxeError::Id /*error*/) |
613 { |
596 { |
614 CX_DEBUG_ENTER_FUNCTION(); |
597 CX_DEBUG_ENTER_FUNCTION(); |
615 |
598 |
620 if(!mWidgetsLoaded) { |
603 if(!mWidgetsLoaded) { |
621 loadWidgets(); |
604 loadWidgets(); |
622 } |
605 } |
623 |
606 |
624 if(mMainWindow->currentView() == this && |
607 if(mMainWindow->currentView() == this && |
625 mKeyHandler->isAutofocusKeyPressed()) { |
608 mCaptureKeyHandler->isAutofocusKeyPressed()) { |
626 // Viewfinder just started and the user is pressing the auto-focus key. |
609 // Viewfinder just started and the user is pressing the auto-focus key. |
627 // Start focusing. |
610 // Start focusing. |
628 |
611 |
629 CX_DEBUG(("Viewfinder starting and auto-focus key pressed -> starting AF")); |
612 CX_DEBUG(("Viewfinder starting and auto-focus key pressed -> starting AF")); |
630 handleAutofocusKeyPressed(); |
613 handleAutofocusKeyPressed(); |
652 CX_DEBUG_IN_FUNCTION(); |
635 CX_DEBUG_IN_FUNCTION(); |
653 |
636 |
654 mCapturePending = false; |
637 mCapturePending = false; |
655 } |
638 } |
656 |
639 |
657 void CxuiStillPrecaptureView::showControls() |
|
658 { |
|
659 // show controls when selftimer counter is not active |
|
660 // and when autofocus key is not being pressed |
|
661 if ( !(mSelfTimer && mSelfTimer->isOngoing()) && |
|
662 (!mKeyHandler || !mKeyHandler->isAutofocusKeyPressed()) ) { |
|
663 CxuiPrecaptureView::showControls(); |
|
664 } |
|
665 |
|
666 } |
|
667 |
|
668 /*! |
640 /*! |
669 * Slot to handle application being sent to background. |
641 * Slot to handle application being sent to background. |
670 */ |
642 */ |
671 void CxuiStillPrecaptureView::handleFocusLost() |
643 void CxuiStillPrecaptureView::handleFocusLost() |
672 { |
644 { |
679 |
651 |
680 // Release camera as we are going to background. |
652 // Release camera as we are going to background. |
681 // If taking image is just ongoing, it will be cancelled by engine. |
653 // If taking image is just ongoing, it will be cancelled by engine. |
682 releaseCamera(); |
654 releaseCamera(); |
683 |
655 |
684 CX_DEBUG_EXIT_FUNCTION(); |
|
685 } |
|
686 |
|
687 void CxuiStillPrecaptureView::handleFocusGained() |
|
688 { |
|
689 CX_DEBUG_ENTER_FUNCTION(); |
|
690 CxuiPrecaptureView::handleFocusGained(); |
|
691 CX_DEBUG_EXIT_FUNCTION(); |
656 CX_DEBUG_EXIT_FUNCTION(); |
692 } |
657 } |
693 |
658 |
694 /* |
659 /* |
695 Slot for handling scene mode change |
660 Slot for handling scene mode change |
790 QString settingsKey = action->property(PROPERTY_KEY_SETTING_ID).toString(); |
755 QString settingsKey = action->property(PROPERTY_KEY_SETTING_ID).toString(); |
791 CX_DEBUG(("settingsKey=%s", settingsKey.toAscii().constData())); |
756 CX_DEBUG(("settingsKey=%s", settingsKey.toAscii().constData())); |
792 launchSettingsDialog(action); |
757 launchSettingsDialog(action); |
793 // special case to get value changed event to the selftimer class |
758 // special case to get value changed event to the selftimer class |
794 if (settingsKey == CxeSettingIds::SELF_TIMER) { |
759 if (settingsKey == CxeSettingIds::SELF_TIMER) { |
|
760 // if selftimer is active remember the previously selected value |
|
761 if (mSelfTimer->isEnabled()) { |
|
762 mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout()); |
|
763 } |
795 connect(mSettingsDialogList, SIGNAL(valueSelected(int)), |
764 connect(mSettingsDialogList, SIGNAL(valueSelected(int)), |
796 mSelfTimer, SLOT(changeTimeOut(int))); |
765 mSelfTimer, SLOT(changeTimeOut(int))); |
797 } |
766 } |
798 } |
767 } |
799 |
768 |