52 #include "cxuisettingdialog.h" |
52 #include "cxuisettingdialog.h" |
53 #include "cxuisettingradiobuttonlist.h" |
53 #include "cxuisettingradiobuttonlist.h" |
54 #include "cxuisettingslider.h" |
54 #include "cxuisettingslider.h" |
55 #include "cxuisettingsinfo.h" |
55 #include "cxuisettingsinfo.h" |
56 #include "OstTraceDefinitions.h" |
56 #include "OstTraceDefinitions.h" |
|
57 #include "cxuiserviceprovider.h" |
|
58 #include "cxuizoomslider.h" |
|
59 #include "cxuifullscreenpopup.h" |
|
60 |
57 #ifdef OST_TRACE_COMPILER_IN_USE |
61 #ifdef OST_TRACE_COMPILER_IN_USE |
58 #include "cxuiprecaptureviewTraces.h" |
62 #include "cxuiprecaptureviewTraces.h" |
59 #endif |
63 #endif |
60 #include "cxuiserviceprovider.h" |
64 #include "cxegeotaggingtrail.h" |
61 #include "cxuizoomslider.h" |
|
62 |
65 |
63 using namespace CxUiLayout; |
66 using namespace CxUiLayout; |
64 using namespace CxUiSettings; |
67 using namespace CxUiSettings; |
65 using namespace CxUiInternal; |
68 using namespace CxUiInternal; |
66 |
|
67 |
69 |
68 |
70 |
69 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
70 // CxuiPrecaptureView::CxuiPrecaptureView |
72 // CxuiPrecaptureView::CxuiPrecaptureView |
71 // Constructor |
73 // Constructor |
78 mSettingsGrid(0), |
80 mSettingsGrid(0), |
79 mWidgetsLoaded(false), |
81 mWidgetsLoaded(false), |
80 mSettingsDialog(NULL), |
82 mSettingsDialog(NULL), |
81 mSettingsDialogList(NULL), |
83 mSettingsDialogList(NULL), |
82 mQualityIcon(NULL), |
84 mQualityIcon(NULL), |
|
85 mGeoTaggingIndicatorIcon(NULL), |
|
86 mFaceTrackingIcon(NULL), |
|
87 mStandbyPopup(NULL), |
83 mSettingsDialogHeading(NULL), |
88 mSettingsDialogHeading(NULL), |
84 mSliderSettingsDialog(NULL), |
89 mSliderSettingsDialog(NULL), |
85 mSliderSettingsDialogHeading(NULL), |
90 mSliderSettingsDialogHeading(NULL), |
86 mSettingsSlider(NULL), |
91 mSettingsSlider(NULL), |
87 mSettingsInfo(NULL), |
92 mSettingsInfo(NULL), |
109 * @param documentLoader |
114 * @param documentLoader |
110 * @param keyHandler |
115 * @param keyHandler |
111 */ |
116 */ |
112 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, |
117 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, |
113 CxuiDocumentLoader *documentLoader, |
118 CxuiDocumentLoader *documentLoader, |
114 CxuiCaptureKeyHandler * keyHandler) |
119 CxuiCaptureKeyHandler * keyHandler, |
|
120 HbActivityManager *activityManager) |
115 { |
121 { |
116 CX_DEBUG_ENTER_FUNCTION(); |
122 CX_DEBUG_ENTER_FUNCTION(); |
117 OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" ); |
123 OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" ); |
118 |
124 |
119 CxuiView::construct(mainWindow, engine, documentLoader, keyHandler); |
125 CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager); |
120 |
126 |
121 mSettingsInfo = new CxuiSettingsInfo(engine); |
127 mSettingsInfo = new CxuiSettingsInfo(engine); |
122 CX_DEBUG_ASSERT(mSettingsInfo); |
128 CX_DEBUG_ASSERT(mSettingsInfo); |
123 |
129 |
124 setContentFullScreen(true); |
130 setContentFullScreen(true); |
130 SLOT(handleZoomLevelChange(int))); |
136 SLOT(handleZoomLevelChange(int))); |
131 |
137 |
132 |
138 |
133 connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), |
139 connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), |
134 this, SLOT(handleVfStateChanged(CxeViewfinderControl::State, CxeError::Id))); |
140 this, SLOT(handleVfStateChanged(CxeViewfinderControl::State, CxeError::Id))); |
|
141 |
|
142 connect(&mEngine->geoTaggingTrail(), SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)), |
|
143 this, SLOT(updateLocationIndicator(CxeGeoTaggingTrail::State, CxeError::Id))); |
135 |
144 |
136 connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)), |
145 connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)), |
137 this, SLOT(handleSettingValueChanged(const QString&, QVariant))); |
146 this, SLOT(handleSettingValueChanged(const QString&, QVariant))); |
138 |
147 |
139 // adjust the timer, and connect it to correct slot |
148 // adjust the timer, and connect it to correct slot |
148 // override exit with action that completes the request before exiting |
157 // override exit with action that completes the request before exiting |
149 HbAction* exitAction = new HbAction(Hb::QuitNaviAction, this); |
158 HbAction* exitAction = new HbAction(Hb::QuitNaviAction, this); |
150 connect(exitAction, SIGNAL(triggered()), CxuiServiceProvider::instance(), SLOT(sendFilenameToClientAndExit())); |
159 connect(exitAction, SIGNAL(triggered()), CxuiServiceProvider::instance(), SLOT(sendFilenameToClientAndExit())); |
151 setNavigationAction(exitAction); |
160 setNavigationAction(exitAction); |
152 } |
161 } |
|
162 |
153 OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" ); |
163 OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" ); |
154 |
164 |
155 QCoreApplication::instance()->installEventFilter(this); |
165 QCoreApplication::instance()->installEventFilter(this); |
156 CX_DEBUG_EXIT_FUNCTION(); |
166 CX_DEBUG_EXIT_FUNCTION(); |
157 } |
167 } |
158 |
168 |
159 |
169 /*! |
160 // --------------------------------------------------------------------------- |
170 * Is standby mode supported / needed by this view. |
161 // CxuiPrecaptureView::prepareWindow |
171 * Pre-capture views implement / need standby mode and return true. |
162 // |
172 * @return True if standby mode is supported, false otherwise. |
163 // --------------------------------------------------------------------------- |
173 */ |
164 // |
174 bool CxuiPrecaptureView::isStandbyModeSupported() const |
165 void CxuiPrecaptureView::prepareWindow() |
175 { |
166 { |
176 return true; |
167 CX_DEBUG_ENTER_FUNCTION(); |
|
168 |
|
169 if (mMainWindow) { |
|
170 mEngine->viewfinderControl().setWindow(mMainWindow->effectiveWinId()); |
|
171 } |
|
172 |
|
173 CX_DEBUG_EXIT_FUNCTION(); |
|
174 } |
177 } |
175 |
178 |
176 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
177 // CxuiPrecaptureView::handleEngineZoomStateChange |
180 // CxuiPrecaptureView::handleEngineZoomStateChange |
178 // Slot for the initModeComplete signal from device control. |
181 // Slot for the initModeComplete signal from device control. |
421 } |
430 } |
422 |
431 |
423 CX_DEBUG_EXIT_FUNCTION(); |
432 CX_DEBUG_EXIT_FUNCTION(); |
424 } |
433 } |
425 |
434 |
426 |
435 /*! |
427 /* |
436 * Slot for entering standby mode. |
428 * CxuiPrecaptureView::handleFocusGained |
437 * Show standby canvas in addition to base class implementation. |
429 */ |
438 * @sa CxuiView::enterStandby() |
430 void CxuiPrecaptureView::handleFocusGained() |
439 */ |
431 { |
440 void CxuiPrecaptureView::enterStandby() |
432 CX_DEBUG_ENTER_FUNCTION(); |
441 { |
433 |
442 CX_DEBUG_ENTER_FUNCTION(); |
434 // Set the window size and handle again. |
443 |
435 prepareWindow(); |
444 // Release camera right away to avoid any problems with GPU memory. |
|
445 CxuiView::enterStandby(); |
|
446 |
|
447 // If this view is still the current view, show popup. |
|
448 // If we moved to precapture view because (error) standby during capturing, |
|
449 // don't try show the popup. |
|
450 if (mMainWindow->currentView() == this) { |
|
451 // Show standby canvas / popup. |
|
452 if (!mStandbyPopup) { |
|
453 mStandbyPopup = CxuiFullScreenPopup::create(scene(), hbTrId("txt_cam_info_camera_in_standby_mode")); |
|
454 } |
|
455 mStandbyPopup->show(); |
|
456 } |
|
457 CX_DEBUG_EXIT_FUNCTION(); |
|
458 } |
|
459 |
|
460 /*! |
|
461 * Slot for exiting standby mode. |
|
462 * Hide the standby canvas and re-prepare camera. |
|
463 * @sa CxuiView::exitStandby() |
|
464 */ |
|
465 void CxuiPrecaptureView::exitStandby() |
|
466 { |
|
467 CX_DEBUG_ENTER_FUNCTION(); |
|
468 CxuiView::exitStandby(); |
|
469 |
|
470 if (mStandbyPopup) { |
|
471 mStandbyPopup->hide(); |
|
472 delete mStandbyPopup; |
|
473 mStandbyPopup = NULL; |
|
474 } |
|
475 |
436 initCamera(); |
476 initCamera(); |
437 |
|
438 CX_DEBUG_EXIT_FUNCTION(); |
477 CX_DEBUG_EXIT_FUNCTION(); |
439 } |
478 } |
440 |
479 |
441 /*! |
480 /*! |
442 * Handle setting dialog showing up. |
481 * Handle setting dialog showing up. |
758 CX_DEBUG_ENTER_FUNCTION(); |
795 CX_DEBUG_ENTER_FUNCTION(); |
759 if (mSettingsGrid) { |
796 if (mSettingsGrid) { |
760 mSettingsGrid->hide(); |
797 mSettingsGrid->hide(); |
761 } |
798 } |
762 CX_DEBUG_EXIT_FUNCTION(); |
799 CX_DEBUG_EXIT_FUNCTION(); |
763 } |
|
764 |
|
765 /** |
|
766 * Get if postcapture view should be shown or not. |
|
767 * Postcapture view may be shown for a predefined time or |
|
768 * until user dismisses it, or it may be completely disabled. |
|
769 */ |
|
770 bool CxuiPrecaptureView::isPostcaptureOn() const |
|
771 { |
|
772 CX_DEBUG_ENTER_FUNCTION(); |
|
773 if (CxuiServiceProvider::isCameraEmbedded()) { |
|
774 // always show post capture in embedded mode |
|
775 return true; |
|
776 } |
|
777 |
|
778 // Read the value from settings. Ignoring reading error. |
|
779 // On error (missing settings) default to "postcapture on". |
|
780 int showPostcapture(-1); |
|
781 QString key; |
|
782 if(mEngine) { |
|
783 if (mEngine->mode() == Cxe::ImageMode) { |
|
784 key = CxeSettingIds::STILL_SHOWCAPTURED; |
|
785 } else { |
|
786 key = CxeSettingIds::VIDEO_SHOWCAPTURED; |
|
787 } |
|
788 mEngine->settings().get(key, showPostcapture); |
|
789 } |
|
790 |
|
791 CX_DEBUG_EXIT_FUNCTION(); |
|
792 return showPostcapture != 0; // 0 == no postcapture |
|
793 } |
800 } |
794 |
801 |
795 /*! |
802 /*! |
796 * Returns dialogs bottom right corner |
803 * Returns dialogs bottom right corner |
797 */ |
804 */ |
839 CX_DEBUG((("Setting icon name [%s]"), icon.toAscii().constData())); |
846 CX_DEBUG((("Setting icon name [%s]"), icon.toAscii().constData())); |
840 CX_DEBUG_EXIT_FUNCTION(); |
847 CX_DEBUG_EXIT_FUNCTION(); |
841 return icon; |
848 return icon; |
842 } |
849 } |
843 |
850 |
844 /*! |
|
845 Update the quality indicator |
|
846 */ |
|
847 void CxuiPrecaptureView::updateQualityIcon() |
|
848 { |
|
849 CX_DEBUG_ENTER_FUNCTION(); |
|
850 |
|
851 if (mQualityIcon && mEngine) { |
|
852 QString key = ""; |
|
853 QString icon = ""; |
|
854 int currentValue = -1; |
|
855 |
|
856 if (mEngine->mode() == Cxe::VideoMode) { |
|
857 key = CxeSettingIds::VIDEO_QUALITY; |
|
858 } else { |
|
859 key = CxeSettingIds::IMAGE_QUALITY; |
|
860 } |
|
861 |
|
862 mEngine->settings().get(key, currentValue); |
|
863 icon = getSettingItemIcon(key, currentValue); |
|
864 |
|
865 mQualityIcon->setIcon(HbIcon(icon)); |
|
866 } |
|
867 |
|
868 CX_DEBUG_EXIT_FUNCTION(); |
|
869 } |
|
870 |
|
871 void CxuiPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue) |
851 void CxuiPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue) |
872 { |
852 { |
873 CX_DEBUG_ENTER_FUNCTION(); |
853 CX_DEBUG_ENTER_FUNCTION(); |
874 Q_UNUSED(key); |
854 Q_UNUSED(key); |
875 Q_UNUSED(newValue); |
855 Q_UNUSED(newValue); |
876 CX_DEBUG_EXIT_FUNCTION(); |
856 CX_DEBUG_EXIT_FUNCTION(); |
877 } |
857 } |
878 |
858 |
879 /*! |
859 /*! |
880 * Update the scene mode icon. |
860 * Slot to keep track of state changes in GeotaggingLocation trail. We use these states to update |
881 * @param sceneId The new scene id. |
861 * the UI by enabling right icon. |
882 */ |
862 */ |
883 void CxuiPrecaptureView::updateSceneIcon(const QString& sceneId) |
863 void CxuiPrecaptureView::updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error) |
884 { |
864 { |
885 CX_DEBUG_ENTER_FUNCTION(); |
865 CX_DEBUG( ("CxuiPrecaptureView::updateLocationIndicator <> error: %d ", error)); |
886 CX_DEBUG(("CxuiPrecaptureView - scene: %s", sceneId.toAscii().constData())); |
866 |
887 |
867 if (mGeoTaggingIndicatorIcon) { |
888 // No need to update icon, if widgets are not even loaded yet. |
868 if (newState == CxeGeoTaggingTrail::DataAvailable && error == CxeError::None) { |
889 // We'll update the icon once the widgets are loaded. |
869 CX_DEBUG(("CxuiPrecaptureView::updateLocationIndicator GPS data available, showing icon")); |
890 if (mWidgetsLoaded) { |
870 mGeoTaggingIndicatorIcon->setIcon(HbIcon("qtg_mono_geotag")); |
891 |
871 mGeoTaggingIndicatorIcon->show(); |
892 QString key; |
|
893 QString iconObjectName; |
|
894 if (mEngine->mode() == Cxe::VideoMode) { |
|
895 key = CxeSettingIds::VIDEO_SCENE; |
|
896 iconObjectName = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION; |
|
897 } else { |
872 } else { |
898 key = CxeSettingIds::IMAGE_SCENE; |
873 CX_DEBUG(("CxuiPrecaptureView::handleIconChanged GPS data not available")); |
899 iconObjectName = STILL_PRE_CAPTURE_SCENE_MODE_ACTION; |
874 mGeoTaggingIndicatorIcon->hide(); |
900 } |
875 } |
901 |
876 } |
902 QString icon = getSettingItemIcon(key, sceneId); |
877 |
903 CX_DEBUG(("CxuiPrecaptureView - icon: %s", icon.toAscii().constData())); |
878 CX_DEBUG_EXIT_FUNCTION(); |
904 |
879 } |
905 if (mDocumentLoader) { |
880 |
906 QObject *obj = mDocumentLoader->findObject(iconObjectName); |
881 |
907 CX_DEBUG_ASSERT(obj); |
882 /*! |
908 qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon)); |
883 * Lauches "Geotagging first-time use" notification to the user |
909 } |
884 */ |
910 } else { |
885 void CxuiPrecaptureView::launchGeoTaggingDisclaimerDialog() |
911 CX_DEBUG(("CxuiPrecaptureView - widgets not loaded yet, ignored!")); |
886 { |
912 } |
887 CX_DEBUG_ENTER_FUNCTION(); |
|
888 |
|
889 QString ftuMsg = hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta"); |
|
890 QString actionOkTxt = hbTrId("txt_common_button_ok"); |
|
891 QString actionSettingsTxt = hbTrId("txt_cam_opt_general_settings"); |
|
892 |
|
893 HbDialog *dialog = new HbDialog(); |
|
894 HbLabel *label = new HbLabel(); |
|
895 |
|
896 // initializing dialog's content widget |
|
897 label->setPlainText(ftuMsg); |
|
898 label->setTextWrapping(Hb::TextWordWrap); |
|
899 label->setElideMode(Qt::ElideNone); |
|
900 label->setMaximumWidth(350); |
|
901 dialog->setContentWidget(label); |
|
902 |
|
903 // initializing dialog's actions |
|
904 HbAction *okAction = new HbAction(actionOkTxt, dialog); |
|
905 HbAction *settingsAction = new HbAction(actionSettingsTxt, dialog); |
|
906 dialog->addAction(okAction); |
|
907 dialog->addAction(settingsAction); |
|
908 |
|
909 // connecting signals for dialog's actions |
|
910 connect(okAction, |
|
911 SIGNAL(triggered()), |
|
912 this, |
|
913 SLOT(disableGeotaggingDisclaimer())); |
|
914 |
|
915 connect(settingsAction, |
|
916 SIGNAL(triggered()), |
|
917 this, |
|
918 SLOT(launchGeoTaggingSetting())); |
|
919 |
|
920 // initializing dialog's properties |
|
921 dialog->setTimeout(HbDialog::NoTimeout); |
|
922 dialog->setDismissPolicy(HbPopup::NoDismiss); |
|
923 dialog->setAttribute(Qt::WA_DeleteOnClose, true); |
|
924 dialog->show(); |
|
925 |
|
926 CX_DEBUG_EXIT_FUNCTION(); |
|
927 } |
|
928 |
|
929 /*! |
|
930 * Slot that disables Geotagging first-time use notification. |
|
931 */ |
|
932 void CxuiPrecaptureView::disableGeotaggingDisclaimer() |
|
933 { |
|
934 CX_DEBUG_ENTER_FUNCTION(); |
|
935 |
|
936 // disable geotagging first-time-use dialog |
|
937 mEngine->settings().set(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled); |
|
938 |
|
939 CX_DEBUG_EXIT_FUNCTION(); |
|
940 } |
|
941 |
|
942 |
|
943 /*! |
|
944 * Slot that accepts "Geotagging first-time use" note and launches geotagging setting dialog. |
|
945 */ |
|
946 void CxuiPrecaptureView::launchGeoTaggingSetting() |
|
947 { |
|
948 CX_DEBUG_ENTER_FUNCTION(); |
|
949 |
|
950 QObject *action = sender(); |
|
951 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::GEOTAGGING); |
|
952 launchSettingsDialog(action); |
|
953 |
913 CX_DEBUG_EXIT_FUNCTION(); |
954 CX_DEBUG_EXIT_FUNCTION(); |
914 } |
955 } |
915 |
956 |
916 // end of file |
957 // end of file |
|
958 |