53 #include "cxuisettingdialog.h" |
52 #include "cxuisettingdialog.h" |
54 #include "cxuisettingradiobuttonlist.h" |
53 #include "cxuisettingradiobuttonlist.h" |
55 #include "cxuisettingslider.h" |
54 #include "cxuisettingslider.h" |
56 #include "cxuisettingsinfo.h" |
55 #include "cxuisettingsinfo.h" |
57 #include "OstTraceDefinitions.h" |
56 #include "OstTraceDefinitions.h" |
|
57 #include "cxuiserviceprovider.h" |
|
58 #include "cxuizoomslider.h" |
|
59 #include "cxuifullscreenpopup.h" |
|
60 |
58 #ifdef OST_TRACE_COMPILER_IN_USE |
61 #ifdef OST_TRACE_COMPILER_IN_USE |
59 #include "cxuiprecaptureviewTraces.h" |
62 #include "cxuiprecaptureviewTraces.h" |
60 #endif |
63 #endif |
61 #include "cxuiserviceprovider.h" |
64 #include "cxegeotaggingtrail.h" |
62 #include "cxuizoomslider.h" |
|
63 |
|
64 |
|
65 // CONSTANTS |
|
66 const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds |
|
67 const QString PhotosAppExe = "photos.exe"; |
|
68 const QString VideosAppExe = "videoplayer.exe"; |
|
69 |
65 |
70 using namespace CxUiLayout; |
66 using namespace CxUiLayout; |
71 using namespace CxUiSettings; |
67 using namespace CxUiSettings; |
72 using namespace CxUiInternal; |
68 using namespace CxUiInternal; |
73 |
69 |
74 |
70 |
75 |
|
76 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
77 // CxuiPrecaptureView::CxuiPrecaptureView |
72 // CxuiPrecaptureView::CxuiPrecaptureView |
78 // Constructor |
73 // Constructor |
79 // --------------------------------------------------------------------------- |
74 // --------------------------------------------------------------------------- |
80 // |
75 // |
81 CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) : |
76 CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) : |
82 HbView(parent), |
77 CxuiView(parent), |
83 mEngine(0), |
|
84 mViewfinder(0), |
78 mViewfinder(0), |
85 mMainWindow(0), |
|
86 mDocumentLoader(0), |
|
87 mDisplayHandler(0), |
79 mDisplayHandler(0), |
88 mControlsVisible(false), |
|
89 mHideControlsTimeout(this), |
|
90 mSlider(0), |
|
91 mToolBar(0), |
|
92 mSettingsGrid(0), |
80 mSettingsGrid(0), |
93 mZoomVisible(false), |
|
94 mWidgetsLoaded(false), |
81 mWidgetsLoaded(false), |
95 mSettingsDialog(NULL), |
82 mSettingsDialog(NULL), |
96 mSettingsDialogList(NULL), |
83 mSettingsDialogList(NULL), |
97 mKeyHandler(NULL), |
|
98 mQualityIcon(NULL), |
84 mQualityIcon(NULL), |
99 mIndicators(NULL), |
85 mGeoTaggingIndicatorIcon(NULL), |
|
86 mFaceTrackingIcon(NULL), |
|
87 mStandbyPopup(NULL), |
100 mSettingsDialogHeading(NULL), |
88 mSettingsDialogHeading(NULL), |
101 mSliderSettingsDialog(NULL), |
89 mSliderSettingsDialog(NULL), |
102 mSliderSettingsDialogHeading(NULL), |
90 mSliderSettingsDialogHeading(NULL), |
103 mSettingsSlider(NULL), |
91 mSettingsSlider(NULL), |
104 mSettingsInfo(NULL), |
92 mSettingsInfo(NULL), |
116 QCoreApplication::instance()->removeEventFilter(this); |
104 QCoreApplication::instance()->removeEventFilter(this); |
117 delete mSettingsGrid; |
105 delete mSettingsGrid; |
118 CX_DEBUG_EXIT_FUNCTION(); |
106 CX_DEBUG_EXIT_FUNCTION(); |
119 } |
107 } |
120 |
108 |
121 |
109 /** |
|
110 * CxuiPrecaptureView::construct |
|
111 * Construct-method handles initialisation tasks for this class. |
|
112 * @param mainwindow |
|
113 * @param engine |
|
114 * @param documentLoader |
|
115 * @param keyHandler |
|
116 */ |
122 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, |
117 void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, |
123 CxuiDocumentLoader *documentLoader, |
118 CxuiDocumentLoader *documentLoader, |
124 CxuiCaptureKeyHandler * keyHandler) |
119 CxuiCaptureKeyHandler * keyHandler, |
125 { |
120 HbActivityManager *activityManager) |
126 CX_DEBUG_ENTER_FUNCTION(); |
121 { |
127 OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" ); |
122 CX_DEBUG_ENTER_FUNCTION(); |
128 |
123 OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1"); |
129 CX_ASSERT_ALWAYS(mainWindow); |
124 |
130 CX_ASSERT_ALWAYS(engine); |
125 CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager); |
131 CX_ASSERT_ALWAYS(documentLoader); |
|
132 |
|
133 mMainWindow = mainWindow; |
|
134 mEngine = engine; |
|
135 mDocumentLoader = documentLoader; |
|
136 mKeyHandler = keyHandler; |
|
137 |
126 |
138 mSettingsInfo = new CxuiSettingsInfo(engine); |
127 mSettingsInfo = new CxuiSettingsInfo(engine); |
139 CX_DEBUG_ASSERT(mSettingsInfo); |
128 CX_DEBUG_ASSERT(mSettingsInfo); |
140 |
129 |
141 setContentFullScreen(true); |
130 setContentFullScreen(true); |
147 SLOT(handleZoomLevelChange(int))); |
136 SLOT(handleZoomLevelChange(int))); |
148 |
137 |
149 |
138 |
150 connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), |
139 connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), |
151 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))); |
152 |
144 |
153 connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)), |
145 connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)), |
154 this, SLOT(handleSettingValueChanged(const QString&, QVariant))); |
146 this, SLOT(handleSettingValueChanged(const QString&, QVariant))); |
155 |
147 |
156 // adjust the timer, and connect it to correct slot |
148 // adjust the timer, and connect it to correct slot |
165 // override exit with action that completes the request before exiting |
157 // override exit with action that completes the request before exiting |
166 HbAction* exitAction = new HbAction(Hb::QuitNaviAction, this); |
158 HbAction* exitAction = new HbAction(Hb::QuitNaviAction, this); |
167 connect(exitAction, SIGNAL(triggered()), CxuiServiceProvider::instance(), SLOT(sendFilenameToClientAndExit())); |
159 connect(exitAction, SIGNAL(triggered()), CxuiServiceProvider::instance(), SLOT(sendFilenameToClientAndExit())); |
168 setNavigationAction(exitAction); |
160 setNavigationAction(exitAction); |
169 } |
161 } |
170 OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" ); |
162 |
|
163 OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_2, "msg: e_CX_PRECAPVIEW_CONSTRUCT 0"); |
171 |
164 |
172 QCoreApplication::instance()->installEventFilter(this); |
165 QCoreApplication::instance()->installEventFilter(this); |
173 CX_DEBUG_EXIT_FUNCTION(); |
166 CX_DEBUG_EXIT_FUNCTION(); |
174 } |
167 } |
175 |
168 |
176 |
169 /*! |
177 // --------------------------------------------------------------------------- |
170 * Is standby mode supported / needed by this view. |
178 // CxuiPrecaptureView::prepareWindow |
171 * Pre-capture views implement / need standby mode and return true. |
179 // |
172 * @return True if standby mode is supported, false otherwise. |
180 // --------------------------------------------------------------------------- |
173 */ |
181 // |
174 bool CxuiPrecaptureView::isStandbyModeSupported() const |
182 void CxuiPrecaptureView::prepareWindow() |
175 { |
183 { |
176 return true; |
184 CX_DEBUG_ENTER_FUNCTION(); |
|
185 |
|
186 if (mMainWindow) { |
|
187 mEngine->viewfinderControl().setWindow(mMainWindow->effectiveWinId()); |
|
188 setFlag(QGraphicsItem::ItemIsFocusable); |
|
189 setFocusPolicy(Qt::StrongFocus); |
|
190 setFocus(); |
|
191 } |
|
192 |
|
193 CX_DEBUG_EXIT_FUNCTION(); |
|
194 } |
177 } |
195 |
178 |
196 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
197 // CxuiPrecaptureView::handleEngineZoomStateChange |
180 // CxuiPrecaptureView::handleEngineZoomStateChange |
198 // Slot for the initModeComplete signal from device control. |
181 // Slot for the initModeComplete signal from device control. |
238 |
221 |
239 CX_DEBUG_EXIT_FUNCTION(); |
222 CX_DEBUG_EXIT_FUNCTION(); |
240 } |
223 } |
241 |
224 |
242 // --------------------------------------------------------------------------- |
225 // --------------------------------------------------------------------------- |
243 // CxuiPrecaptureView::hideControls |
|
244 // |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 void CxuiPrecaptureView::hideControls() |
|
248 { |
|
249 CX_DEBUG_ENTER_FUNCTION(); |
|
250 |
|
251 hideItems(Hb::AllItems); |
|
252 hideZoom(); |
|
253 mControlsVisible = false; |
|
254 if (mHideControlsTimeout.isActive()) { |
|
255 mHideControlsTimeout.stop(); |
|
256 } |
|
257 hideToolbar(); |
|
258 |
|
259 // show indicators when controls are hidden |
|
260 showIndicators(); |
|
261 |
|
262 // give the keyboard focus back to the view |
|
263 // for the view to receive key events |
|
264 setFocus(); |
|
265 |
|
266 CX_DEBUG_EXIT_FUNCTION(); |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------------------------- |
|
270 // CxuiPrecaptureView::hideToolbar |
|
271 // |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 void CxuiPrecaptureView::hideToolbar() |
|
275 { |
|
276 CX_DEBUG_ENTER_FUNCTION(); |
|
277 if (mToolBar) { |
|
278 mToolBar->hide(); |
|
279 } |
|
280 CX_DEBUG_EXIT_FUNCTION(); |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------------------------- |
|
284 // CxuiPrecaptureView::hideZoom |
|
285 // |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 void CxuiPrecaptureView::hideZoom() |
|
289 { |
|
290 if (mSlider) { |
|
291 mSlider->hide(); |
|
292 } |
|
293 mZoomVisible = false; |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // CxuiPrecaptureView::showZoom |
|
298 // |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 void CxuiPrecaptureView::showZoom() |
|
302 { |
|
303 CX_DEBUG_ENTER_FUNCTION(); |
|
304 if (mSlider) { |
|
305 |
|
306 // if maxVal has not been set yet, ask for new parameters from engine |
|
307 if (mSlider->maximum() <= 0) { |
|
308 |
|
309 // get the zoom range |
|
310 int min = mEngine->zoomControl().min(); |
|
311 int max = mEngine->zoomControl().max(); |
|
312 |
|
313 // only change values if they are acceptable and have changed |
|
314 if ((max - min > 0) && ((mSlider->maximum() != max) || (mSlider->minimum() != min))) { |
|
315 mSlider->setRange(min, max); |
|
316 } |
|
317 } |
|
318 |
|
319 // show zoom only if the slider has acceptable value |
|
320 if (mSlider->maximum() > 0) { |
|
321 mSlider->show(); |
|
322 } |
|
323 } |
|
324 |
|
325 mZoomVisible = true; |
|
326 CX_DEBUG_EXIT_FUNCTION(); |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // CxuiPrecaptureView::toggleZoom |
226 // CxuiPrecaptureView::toggleZoom |
331 // |
227 // |
332 // --------------------------------------------------------------------------- |
228 // --------------------------------------------------------------------------- |
333 // |
229 // |
334 void CxuiPrecaptureView::toggleZoom() |
230 void CxuiPrecaptureView::toggleZoom() |
338 } else { |
234 } else { |
339 showZoom(); |
235 showZoom(); |
340 } |
236 } |
341 } |
237 } |
342 |
238 |
343 // --------------------------------------------------------------------------- |
|
344 // CxuiPrecaptureView::hideIndicators |
|
345 // |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 void CxuiPrecaptureView::hideIndicators() |
|
349 { |
|
350 if (mIndicators) { |
|
351 mIndicators->hide(); |
|
352 } |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // CxuiPrecaptureView::showIndicators |
|
357 // |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CxuiPrecaptureView::showIndicators() |
|
361 { |
|
362 if (mIndicators) { |
|
363 mIndicators->show(); |
|
364 } |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // CxuiPrecaptureView::showControls |
|
369 // |
|
370 // --------------------------------------------------------------------------- |
|
371 // |
|
372 void CxuiPrecaptureView::showControls() |
|
373 { |
|
374 if (mEngine) { |
|
375 bool videoCases = (mEngine->videoCaptureControl().state() == CxeVideoCaptureControl::Recording || |
|
376 mEngine->videoCaptureControl().state() == CxeVideoCaptureControl::Paused); |
|
377 |
|
378 if (mEngine->isEngineReady() || videoCases) { |
|
379 // show toolbar |
|
380 showToolbar(); |
|
381 // show zoom |
|
382 showZoom(); |
|
383 // show titlepane |
|
384 showItems(Hb::AllItems); |
|
385 |
|
386 // hide indicators when controls are shown |
|
387 hideIndicators(); |
|
388 |
|
389 mHideControlsTimeout.start(); |
|
390 mControlsVisible = true; |
|
391 } |
|
392 } |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------------------------- |
|
396 // CxuiPrecaptureView::showToolbar |
|
397 // shows toolbar |
|
398 // --------------------------------------------------------------------------- |
|
399 // |
|
400 void CxuiPrecaptureView::showToolbar() |
|
401 { |
|
402 |
|
403 CX_DEBUG_ENTER_FUNCTION(); |
|
404 |
|
405 // toolbar pointer is missing if widgets for the view have not been loaded |
|
406 // from the DocML |
|
407 if (mToolBar) { |
|
408 mToolBar->show(); |
|
409 } |
|
410 |
|
411 CX_DEBUG_EXIT_FUNCTION(); |
|
412 } |
|
413 |
|
414 |
239 |
415 /* |
240 /* |
416 * Event filter which filters tool bar mouse events and |
241 * Event filter which filters tool bar mouse events and |
417 * application wide mouse events. |
242 * application wide mouse events. |
418 */ |
243 */ |
419 |
244 |
420 bool CxuiPrecaptureView::eventFilter(QObject *object, QEvent *event) |
245 bool CxuiPrecaptureView::eventFilter(QObject *object, QEvent *event) |
421 { |
246 { |
422 Q_UNUSED(object) |
|
423 |
|
424 bool eventWasConsumed = false; |
247 bool eventWasConsumed = false; |
425 |
248 |
426 switch (event->type()) |
249 switch (event->type()) |
427 { |
250 { |
428 case QEvent::GraphicsSceneMouseRelease: |
251 case QEvent::GraphicsSceneMouseRelease: |
429 mHideControlsTimeout.start(); |
252 if (mStandbyPopup) { |
|
253 mStandbyPopup->handleMouseRelease(); |
|
254 } else { |
|
255 mHideControlsTimeout.start(); |
|
256 } |
430 break; |
257 break; |
431 case QEvent::GraphicsSceneMousePress: |
258 case QEvent::GraphicsSceneMousePress: |
432 mHideControlsTimeout.stop(); |
259 if (object == mStandbyPopup) { |
|
260 mStandbyPopup->handleMousePress(); |
|
261 } else { |
|
262 mHideControlsTimeout.stop(); |
|
263 } |
433 break; |
264 break; |
434 default: |
265 default: |
435 break; |
266 break; |
436 } |
267 } |
437 |
268 |
450 // be postponed using sections in layout xml |
281 // be postponed using sections in layout xml |
451 if (!mWidgetsLoaded) { |
282 if (!mWidgetsLoaded) { |
452 // call load widgets to load app DocML and get the pointers to needed widgets |
283 // call load widgets to load app DocML and get the pointers to needed widgets |
453 loadWidgets(); |
284 loadWidgets(); |
454 } |
285 } |
455 |
286 CxuiView::toggleControls(); |
456 if (mControlsVisible) { |
|
457 hideControls(); |
|
458 } else { |
|
459 showControls(); |
|
460 } |
|
461 } |
|
462 |
|
463 |
|
464 // --------------------------------------------------------------------------- |
|
465 // CxuiPrecaptureView::mousePressEvent |
|
466 // |
|
467 // --------------------------------------------------------------------------- |
|
468 // |
|
469 void CxuiPrecaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
470 { |
|
471 //! @todo temporary workaround for title bar mouse event handling bug |
|
472 if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) { |
|
473 toggleControls(); |
|
474 event->accept(); |
|
475 } |
|
476 } |
287 } |
477 |
288 |
478 // --------------------------------------------------------------------------- |
289 // --------------------------------------------------------------------------- |
479 // CxuiPrecaptureView::handleZoomLevelChange |
290 // CxuiPrecaptureView::handleZoomLevelChange |
480 // Slot to handle zoom level change signal from zoom control. |
291 // Slot to handle zoom level change signal from zoom control. |
577 { |
388 { |
578 CX_DEBUG_ENTER_FUNCTION(); |
389 CX_DEBUG_ENTER_FUNCTION(); |
579 if (mHideControlsTimeout.isActive()) { |
390 if (mHideControlsTimeout.isActive()) { |
580 mHideControlsTimeout.stop(); |
391 mHideControlsTimeout.stop(); |
581 } |
392 } |
582 CX_DEBUG_EXIT_FUNCTION(); |
|
583 } |
|
584 |
|
585 // --------------------------------------------------------------------------- |
|
586 // CxuiPrecaptureView::releaseCamera |
|
587 // --------------------------------------------------------------------------- |
|
588 void CxuiPrecaptureView::releaseCamera() |
|
589 { |
|
590 CX_DEBUG_ENTER_FUNCTION(); |
|
591 mEngine->cameraDeviceControl().release(); |
|
592 CX_DEBUG_EXIT_FUNCTION(); |
393 CX_DEBUG_EXIT_FUNCTION(); |
593 } |
394 } |
594 |
395 |
595 |
396 |
596 // --------------------------------------------------------------------------- |
397 // --------------------------------------------------------------------------- |
629 } |
430 } |
630 |
431 |
631 CX_DEBUG_EXIT_FUNCTION(); |
432 CX_DEBUG_EXIT_FUNCTION(); |
632 } |
433 } |
633 |
434 |
634 |
435 /*! |
635 /* |
436 * Slot for entering standby mode. |
636 * CxuiPrecaptureView::handleFocusGained |
437 * Show standby canvas in addition to base class implementation. |
637 */ |
438 * @sa CxuiView::enterStandby() |
638 void CxuiPrecaptureView::handleFocusGained() |
439 */ |
639 { |
440 void CxuiPrecaptureView::enterStandby() |
640 CX_DEBUG_ENTER_FUNCTION(); |
441 { |
641 |
442 CX_DEBUG_ENTER_FUNCTION(); |
642 // Set the window size and handle again. |
443 |
643 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 |
644 initCamera(); |
476 initCamera(); |
645 |
|
646 CX_DEBUG_EXIT_FUNCTION(); |
477 CX_DEBUG_EXIT_FUNCTION(); |
647 } |
478 } |
648 |
479 |
649 /*! |
480 /*! |
650 * Handle setting dialog showing up. |
481 * Handle setting dialog showing up. |
669 * If the setting dialog was launched from the setting grid, show grid again now. |
500 * If the setting dialog was launched from the setting grid, show grid again now. |
670 * @param action Action that launched the dialog. |
501 * @param action Action that launched the dialog. |
671 */ |
502 */ |
672 void CxuiPrecaptureView::prepareToCloseDialog(HbAction *action) |
503 void CxuiPrecaptureView::prepareToCloseDialog(HbAction *action) |
673 { |
504 { |
674 if (!action) { |
|
675 return; |
|
676 } |
|
677 |
|
678 // Check if the dialog was started from grid, and show the grid now if needed. |
505 // Check if the dialog was started from grid, and show the grid now if needed. |
679 // Autofocus key-press will clear the action to disable showing the grid. |
506 // Autofocus key-press will clear the action to disable showing the grid. |
680 QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString(); |
507 if (action) { |
681 if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) { |
508 QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString(); |
682 showSettingsGrid(); |
509 if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) { |
|
510 showSettingsGrid(); |
|
511 } |
|
512 // disable geotagging disclaimer after geotagging setting is triggered from FirstTimeUse dialog |
|
513 QString settingId = action->property(PROPERTY_KEY_SETTING_ID).toString(); |
|
514 int value = Cxe::GeoTaggingDisclaimerDisabled; |
|
515 mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value); |
|
516 if (settingId == CxeSettingIds::GEOTAGGING && value == Cxe::GeoTaggingDisclaimerEnabled) { |
|
517 // disable geotagging first-time-use dialog |
|
518 disableGeotaggingDisclaimer(); |
|
519 } |
683 } |
520 } |
684 |
521 |
685 // Clear the starter actions to be sure they are not reused. |
522 // Clear the starter actions to be sure they are not reused. |
686 if (mSettingsDialog) { |
523 if (mSettingsDialog) { |
687 mSettingsDialog->setStarterAction(NULL); |
524 mSettingsDialog->setStarterAction(NULL); |
688 } |
525 } |
689 if (mSliderSettingsDialog) { |
526 if (mSliderSettingsDialog) { |
690 mSliderSettingsDialog->setStarterAction(NULL); |
527 mSliderSettingsDialog->setStarterAction(NULL); |
691 } |
528 } |
|
529 |
|
530 // Dialog will be deleted automatically when closed |
|
531 // The pointers may become invalid at any time |
|
532 mSettingsDialog = NULL; |
|
533 mSettingsDialogList = NULL; |
|
534 mSettingsDialogHeading = NULL; |
|
535 |
|
536 mSliderSettingsDialog = NULL; |
|
537 mSliderSettingsDialogHeading = NULL; |
|
538 mSettingsSlider = NULL; |
692 } |
539 } |
693 |
540 |
694 |
541 |
695 |
542 |
696 /*! |
543 /*! |
792 connect(mSettingsDialog, SIGNAL(aboutToClose()), mSettingsDialogList, SLOT(handleClose())); |
641 connect(mSettingsDialog, SIGNAL(aboutToClose()), mSettingsDialogList, SLOT(handleClose())); |
793 } |
642 } |
794 |
643 |
795 // Adjust position and show the dialog. |
644 // Adjust position and show the dialog. |
796 mSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); |
645 mSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); |
|
646 mSettingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
797 mSettingsDialog->show(); |
647 mSettingsDialog->show(); |
|
648 |
798 } |
649 } |
799 } else { |
650 } else { |
800 launchNotSupportedNotification(); |
651 launchNotSupportedNotification(); |
801 } |
652 } |
802 |
653 |
901 } |
754 } |
902 |
755 |
903 // Adjust position and show the dialog. |
756 // Adjust position and show the dialog. |
904 mSliderSettingsDialog->setFrameType(HbPopup::Weak); |
757 mSliderSettingsDialog->setFrameType(HbPopup::Weak); |
905 mSliderSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); |
758 mSliderSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); |
|
759 mSliderSettingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
906 mSliderSettingsDialog->show(); |
760 mSliderSettingsDialog->show(); |
|
761 |
907 } |
762 } |
908 } else { |
763 } else { |
909 launchNotSupportedNotification(); |
764 launchNotSupportedNotification(); |
910 } |
765 } |
911 |
766 |
912 CX_DEBUG_EXIT_FUNCTION(); |
|
913 } |
|
914 |
|
915 void CxuiPrecaptureView::launchPhotosApp() |
|
916 { |
|
917 QProcess::startDetached(PhotosAppExe); |
|
918 } |
|
919 |
|
920 /*! |
|
921 * Launching Videos application as a separate process |
|
922 */ |
|
923 void CxuiPrecaptureView::launchVideosApp() |
|
924 { |
|
925 //Releasing cameda device in order to free |
|
926 //graphical memory |
|
927 releaseCamera(); |
|
928 QProcess::startDetached(VideosAppExe); |
|
929 } |
|
930 |
|
931 /*! |
|
932 * Show "not supported" notification. |
|
933 */ |
|
934 void CxuiPrecaptureView::launchNotSupportedNotification() |
|
935 { |
|
936 CX_DEBUG_ENTER_FUNCTION(); |
|
937 HbNotificationDialog::launchDialog("Notification", "Not supported yet"); |
|
938 CX_DEBUG_EXIT_FUNCTION(); |
|
939 } |
|
940 |
|
941 /*! |
|
942 * Show "Disk full" notification. |
|
943 */ |
|
944 void CxuiPrecaptureView::launchDiskFullNotification() |
|
945 { |
|
946 CX_DEBUG_ENTER_FUNCTION(); |
|
947 HbMessageBox::warning(hbTrId("txt_cam_info_memory_full")); |
|
948 CX_DEBUG_EXIT_FUNCTION(); |
767 CX_DEBUG_EXIT_FUNCTION(); |
949 } |
768 } |
950 |
769 |
951 /** |
770 /** |
952 * Show settings grid. |
771 * Show settings grid. |
976 CX_DEBUG_ENTER_FUNCTION(); |
795 CX_DEBUG_ENTER_FUNCTION(); |
977 if (mSettingsGrid) { |
796 if (mSettingsGrid) { |
978 mSettingsGrid->hide(); |
797 mSettingsGrid->hide(); |
979 } |
798 } |
980 CX_DEBUG_EXIT_FUNCTION(); |
799 CX_DEBUG_EXIT_FUNCTION(); |
981 } |
|
982 |
|
983 /** |
|
984 * Get if postcapture view should be shown or not. |
|
985 * Postcapture view may be shown for a predefined time or |
|
986 * until user dismisses it, or it may be completely disabled. |
|
987 */ |
|
988 bool CxuiPrecaptureView::isPostcaptureOn() const |
|
989 { |
|
990 CX_DEBUG_ENTER_FUNCTION(); |
|
991 if (CxuiServiceProvider::isCameraEmbedded()) { |
|
992 // always show post capture in embedded mode |
|
993 return true; |
|
994 } |
|
995 |
|
996 // Read the value from settings. Ignoring reading error. |
|
997 // On error (missing settings) default to "postcapture on". |
|
998 int showPostcapture(-1); |
|
999 QString key; |
|
1000 if(mEngine) { |
|
1001 if (mEngine->mode() == Cxe::ImageMode) { |
|
1002 key = CxeSettingIds::STILL_SHOWCAPTURED; |
|
1003 } else { |
|
1004 key = CxeSettingIds::VIDEO_SHOWCAPTURED; |
|
1005 } |
|
1006 mEngine->settings().get(key, showPostcapture); |
|
1007 } |
|
1008 |
|
1009 CX_DEBUG_EXIT_FUNCTION(); |
|
1010 return showPostcapture != 0; // 0 == no postcapture |
|
1011 } |
|
1012 |
|
1013 /*! |
|
1014 * Adding zoom buttons to the slider |
|
1015 * \param slider Pointer to the slider object, where the buttons will be added |
|
1016 */ |
|
1017 void CxuiPrecaptureView::addIncreaseDecreaseButtons(CxuiZoomSlider *slider) |
|
1018 { |
|
1019 // get current slider elements |
|
1020 QList<QVariant> elements = slider->sliderElements(); |
|
1021 |
|
1022 // add increase and decrease elements to the slider |
|
1023 elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement; |
|
1024 slider->setSliderElements(elements); |
|
1025 |
|
1026 // set icons for the increase and decrease element |
|
1027 slider->setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus")); |
|
1028 slider->setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus")); |
|
1029 } |
|
1030 |
|
1031 |
|
1032 /*! |
|
1033 * Function can be used to create a graphics item and setting it as a background |
|
1034 * item for HbWidget. graphicName refers to system wide graphic name. Given graphic |
|
1035 * can consist of one, three or nine pieces. Nine piece graphics are used by default. |
|
1036 * See HbFrameDrawer documentation for graphic naming. |
|
1037 */ |
|
1038 void CxuiPrecaptureView::createWidgetBackgroundGraphic(HbWidget *widget, |
|
1039 const QString &graphicName, |
|
1040 HbFrameDrawer::FrameType frameType) |
|
1041 { |
|
1042 if (widget) { |
|
1043 HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType); |
|
1044 |
|
1045 if (drawer) { |
|
1046 HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget); |
|
1047 if (backgroundItem) { |
|
1048 // set item to fill the whole widget |
|
1049 backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size())); |
|
1050 backgroundItem->setZValue(0); |
|
1051 widget->setBackgroundItem(backgroundItem); |
|
1052 } |
|
1053 } |
|
1054 } |
|
1055 } |
800 } |
1056 |
801 |
1057 /*! |
802 /*! |
1058 * Returns dialogs bottom right corner |
803 * Returns dialogs bottom right corner |
1059 */ |
804 */ |
1101 CX_DEBUG((("Setting icon name [%s]"), icon.toAscii().constData())); |
846 CX_DEBUG((("Setting icon name [%s]"), icon.toAscii().constData())); |
1102 CX_DEBUG_EXIT_FUNCTION(); |
847 CX_DEBUG_EXIT_FUNCTION(); |
1103 return icon; |
848 return icon; |
1104 } |
849 } |
1105 |
850 |
1106 /*! |
|
1107 Update the quality indicator |
|
1108 */ |
|
1109 void CxuiPrecaptureView::updateQualityIcon() |
|
1110 { |
|
1111 CX_DEBUG_ENTER_FUNCTION(); |
|
1112 |
|
1113 if (mQualityIcon && mEngine) { |
|
1114 QString key = ""; |
|
1115 QString icon = ""; |
|
1116 int currentValue = -1; |
|
1117 |
|
1118 if (mEngine->mode() == Cxe::VideoMode) { |
|
1119 key = CxeSettingIds::VIDEO_QUALITY; |
|
1120 } else { |
|
1121 key = CxeSettingIds::IMAGE_QUALITY; |
|
1122 } |
|
1123 |
|
1124 mEngine->settings().get(key, currentValue); |
|
1125 icon = getSettingItemIcon(key, currentValue); |
|
1126 |
|
1127 mQualityIcon->setIcon(HbIcon(icon)); |
|
1128 } |
|
1129 |
|
1130 CX_DEBUG_EXIT_FUNCTION(); |
|
1131 } |
|
1132 |
|
1133 void CxuiPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue) |
851 void CxuiPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue) |
1134 { |
852 { |
1135 CX_DEBUG_ENTER_FUNCTION(); |
853 CX_DEBUG_ENTER_FUNCTION(); |
1136 Q_UNUSED(key); |
854 Q_UNUSED(key); |
1137 Q_UNUSED(newValue); |
855 Q_UNUSED(newValue); |
1138 CX_DEBUG_EXIT_FUNCTION(); |
856 CX_DEBUG_EXIT_FUNCTION(); |
1139 } |
857 } |
1140 |
858 |
|
859 /*! |
|
860 * Slot to keep track of state changes in GeotaggingLocation trail. We use these states to update |
|
861 * the UI by enabling right icon. |
|
862 */ |
|
863 void CxuiPrecaptureView::updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error) |
|
864 { |
|
865 CX_DEBUG( ("CxuiPrecaptureView::updateLocationIndicator <> error: %d ", error)); |
|
866 |
|
867 if (mGeoTaggingIndicatorIcon) { |
|
868 if (newState == CxeGeoTaggingTrail::DataAvailable && error == CxeError::None) { |
|
869 CX_DEBUG(("CxuiPrecaptureView::updateLocationIndicator GPS data available, showing icon")); |
|
870 mGeoTaggingIndicatorIcon->setIcon(HbIcon("qtg_mono_geotag")); |
|
871 mGeoTaggingIndicatorIcon->show(); |
|
872 } else { |
|
873 CX_DEBUG(("CxuiPrecaptureView::handleIconChanged GPS data not available")); |
|
874 mGeoTaggingIndicatorIcon->hide(); |
|
875 } |
|
876 } |
|
877 |
|
878 CX_DEBUG_EXIT_FUNCTION(); |
|
879 } |
|
880 |
|
881 |
|
882 /*! |
|
883 * Lauches "Geotagging first-time use" notification to the user |
|
884 */ |
|
885 void CxuiPrecaptureView::launchGeoTaggingDisclaimerDialog() |
|
886 { |
|
887 CX_DEBUG_ENTER_FUNCTION(); |
|
888 |
|
889 HbMessageBox *ftuMessageBox = new HbMessageBox(hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta"), |
|
890 HbMessageBox::MessageTypeInformation); |
|
891 |
|
892 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
|
893 HbAction *settingsAction = new HbAction(hbTrId("txt_cam_opt_general_settings")); |
|
894 |
|
895 // connecting signals for dialog's actions |
|
896 connect(okAction, |
|
897 SIGNAL(triggered()), |
|
898 this, |
|
899 SLOT(disableGeotaggingDisclaimer())); |
|
900 |
|
901 connect(settingsAction, |
|
902 SIGNAL(triggered()), |
|
903 this, |
|
904 SLOT(launchGeoTaggingSetting())); |
|
905 |
|
906 // adding buttons to the information message |
|
907 ftuMessageBox->setStandardButtons(HbMessageBox::NoButton); |
|
908 ftuMessageBox->addAction(okAction); |
|
909 ftuMessageBox->addAction(settingsAction); |
|
910 |
|
911 ftuMessageBox->setAttribute(Qt::WA_DeleteOnClose, true); |
|
912 ftuMessageBox->show(); |
|
913 |
|
914 CX_DEBUG_EXIT_FUNCTION(); |
|
915 } |
|
916 |
|
917 /*! |
|
918 * Slot that disables Geotagging first-time use notification. |
|
919 */ |
|
920 void CxuiPrecaptureView::disableGeotaggingDisclaimer() |
|
921 { |
|
922 CX_DEBUG_ENTER_FUNCTION(); |
|
923 |
|
924 // disable geotagging first-time-use dialog |
|
925 mEngine->settings().set(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled); |
|
926 |
|
927 CX_DEBUG_EXIT_FUNCTION(); |
|
928 } |
|
929 |
|
930 |
|
931 /*! |
|
932 * Slot that launches geotagging setting dialog. |
|
933 */ |
|
934 void CxuiPrecaptureView::launchGeoTaggingSetting() |
|
935 { |
|
936 CX_DEBUG_ENTER_FUNCTION(); |
|
937 |
|
938 QObject *action = sender(); |
|
939 action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::GEOTAGGING); |
|
940 launchSettingsDialog(action); |
|
941 |
|
942 CX_DEBUG_EXIT_FUNCTION(); |
|
943 } |
|
944 |
1141 // end of file |
945 // end of file |
|
946 |