66 mMainWindow(mainWindow), |
71 mMainWindow(mainWindow), |
67 mEngine(engine), |
72 mEngine(engine), |
68 mKeyHandler(NULL), |
73 mKeyHandler(NULL), |
69 mCameraDocumentLoader(NULL), |
74 mCameraDocumentLoader(NULL), |
70 mApplicationState(NULL), |
75 mApplicationState(NULL), |
71 mErrorManager(NULL), |
76 mErrorManager(NULL) |
72 mSceneModeView(NULL) |
|
73 { |
77 { |
74 CX_DEBUG_ENTER_FUNCTION(); |
78 CX_DEBUG_ENTER_FUNCTION(); |
75 |
79 |
76 // create mappings to map view name to correct docml file |
80 // create mappings to map view name to correct docml file |
77 mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML); |
81 mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML); |
78 mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML); |
82 mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML); |
79 mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML); |
83 mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML); |
80 mDocmlFilesByView.insert(STILL_SCENES_VIEW, SCENEMODE_SETTING_XML); |
84 mDocmlFilesByView.insert(SCENE_MODE_VIEW, SCENEMODE_SETTING_XML); |
81 |
85 |
82 // Key handler |
86 // Key handler |
83 mKeyHandler = new CxuiCaptureKeyHandler(mEngine); |
87 mKeyHandler = new CxuiCaptureKeyHandler(mEngine); |
84 |
88 |
85 // Document loader |
89 // Document loader |
86 OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" ); |
90 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_1, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1"); |
87 mCameraDocumentLoader = new CxuiDocumentLoader(&engine); |
91 mCameraDocumentLoader = new CxuiDocumentLoader(&engine); |
88 OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" ); |
92 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_2, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0"); |
89 |
93 |
90 // Application state |
94 // Application state |
91 mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader); |
95 mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), mCameraDocumentLoader); |
92 CX_ASSERT_ALWAYS(mApplicationState); |
96 CX_ASSERT_ALWAYS(mApplicationState); |
93 bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)), |
97 bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)), |
94 this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State))); |
98 this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State))); |
95 Q_ASSERT_X(ok, "CxuiViewManager", "Application state change signal connect failed."); |
99 Q_ASSERT_X(ok, "CxuiViewManager", "Application state change signal connect failed."); |
96 connect(this, SIGNAL(standbyExitRequested()), mApplicationState, SLOT(exitStandby()), Qt::QueuedConnection); |
100 connect(this, SIGNAL(standbyExitRequested()), mApplicationState, SLOT(exitStandby()), Qt::QueuedConnection); |
236 void CxuiViewManager::stopStandbyTimer() |
241 void CxuiViewManager::stopStandbyTimer() |
237 { |
242 { |
238 CX_DEBUG_ENTER_FUNCTION(); |
243 CX_DEBUG_ENTER_FUNCTION(); |
239 mStandbyTimer.stop(); |
244 mStandbyTimer.stop(); |
240 CX_DEBUG_EXIT_FUNCTION(); |
245 CX_DEBUG_EXIT_FUNCTION(); |
241 } |
|
242 |
|
243 /** |
|
244 * Init engine to correct mode based on activity being restored. |
|
245 */ |
|
246 void CxuiViewManager::initEngine() |
|
247 { |
|
248 Cxe::CameraMode mode = Cxe::ImageMode; |
|
249 QString activityId = mApplication.activateId(); |
|
250 if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY || |
|
251 activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) { |
|
252 mode = Cxe::VideoMode; |
|
253 } |
|
254 if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY || |
|
255 activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) { |
|
256 // init engine only if going to pre-capture |
|
257 mEngine.initMode(mode); |
|
258 } else { |
|
259 // in post-capture don't init but set the correct mode to engine |
|
260 // so init can be done later |
|
261 mEngine.setMode(mode); |
|
262 } |
|
263 } |
246 } |
264 |
247 |
265 /*! |
248 /*! |
266 * Helper function to return current view cast to CxuiView. |
249 * Helper function to return current view cast to CxuiView. |
267 */ |
250 */ |
268 CxuiView* CxuiViewManager::currentView() const |
251 CxuiView* CxuiViewManager::currentView() const |
269 { |
252 { |
270 CxuiView *view = qobject_cast<CxuiView*> (mMainWindow.currentView()); |
253 CxuiView *view = qobject_cast<CxuiView*> (mMainWindow.currentView()); |
271 CX_ASSERT_ALWAYS(view); |
|
272 return view; |
254 return view; |
273 } |
255 } |
274 |
256 |
275 /*! |
257 /*! |
276 * Select and initialize the view we need to start into. |
258 * Select and initialize the view we need to start into. |
277 */ |
259 */ |
278 void CxuiViewManager::initStartupView() |
260 void CxuiViewManager::initStartupView() |
279 { |
261 { |
280 CX_DEBUG_ENTER_FUNCTION(); |
262 CX_DEBUG_ENTER_FUNCTION(); |
281 |
263 |
282 if (mApplication.activateReason() == Hb::ActivationReasonService) { |
264 if (mApplication.activateReason() == Hb::ActivationReasonService || |
|
265 // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as |
|
266 // activation reason. Use XQServiceUtil to determine if starting service as |
|
267 // a workaround for now |
|
268 XQServiceUtil::isService()) { |
|
269 |
283 // For embedded mode: don't create view yet, create when engine inits to correct mode. |
270 // For embedded mode: don't create view yet, create when engine inits to correct mode. |
284 // Connect signals to set up the view after image/video prepare |
271 // Connect signals to set up the view after image/video prepare |
285 connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), |
272 connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), |
286 this, SLOT(changeToPrecaptureView())); |
273 this, SLOT(changeToPrecaptureView())); |
287 connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), |
274 connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), |
288 this, SLOT(changeToPrecaptureView())); |
275 this, SLOT(changeToPrecaptureView())); |
289 |
276 |
290 } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) { |
277 } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) { |
291 // restoring activity, read startup view from stored activity |
278 // restoring activity, read startup view from stored activity |
292 |
279 |
293 // view to start in |
280 // view to start in |
294 QString viewName = STILL_PRE_CAPTURE_VIEW; |
281 QString viewName = STILL_PRE_CAPTURE_VIEW; |
295 |
282 |
333 if (mEngine.mode() == Cxe::VideoMode) { |
316 if (mEngine.mode() == Cxe::VideoMode) { |
334 view = createView(VIDEO_PRE_CAPTURE_VIEW); |
317 view = createView(VIDEO_PRE_CAPTURE_VIEW); |
335 } else { |
318 } else { |
336 view = createView(STILL_PRE_CAPTURE_VIEW); |
319 view = createView(STILL_PRE_CAPTURE_VIEW); |
337 } |
320 } |
338 |
321 connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view)); |
339 mMainWindow.setCurrentView(view, false); |
322 mMainWindow.setCurrentView(view, false); |
340 connectPreCaptureSignals(); |
|
341 |
|
342 // Check the current application state, signalled to handleApplicationStateChanged. |
|
343 mApplicationState->startMonitoring(); |
|
344 |
323 |
345 clearAllActivities(); |
324 clearAllActivities(); |
346 } |
325 } |
347 |
326 |
|
327 // Check the current application state, signalled to handleApplicationStateChanged. |
|
328 mApplicationState->startMonitoring(); |
|
329 |
348 CX_DEBUG_EXIT_FUNCTION(); |
330 CX_DEBUG_EXIT_FUNCTION(); |
349 } |
331 } |
350 |
332 |
351 /*! |
333 /*! |
352 * Create view and add it to main window. |
334 * Create view and add it to main window. |
353 */ |
335 */ |
354 CxuiView* CxuiViewManager::createView(const QString &viewName) |
336 CxuiView* CxuiViewManager::createView(const QString &viewName) |
355 { |
337 { |
356 CX_DEBUG_ENTER_FUNCTION(); |
338 CX_DEBUG_ENTER_FUNCTION(); |
357 |
339 |
358 OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_VIEW 1" ); |
340 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_IN, "msg: e_CX_CREATE_VIEW 1"); |
359 |
341 |
360 CX_DEBUG(("View name: %s", viewName.toAscii().data())); |
342 CX_DEBUG(("View name: %s", viewName.toAscii().data())); |
361 |
343 |
362 CxuiView* view = mViews[viewName]; |
344 CxuiView* view = mViews[viewName]; |
363 if (view == NULL) { |
345 if (view == NULL) { |
364 CX_DEBUG(("View not loaded yet, loading now")); |
346 CX_DEBUG(("View not loaded yet, loading now")); |
365 bool ok = false; |
347 bool ok = false; |
366 // Use document loader to create widgets and layouts |
348 // Use document loader to create widgets and layouts |
367 // (non-sectioned parts are parsed and loaded) |
349 // (non-sectioned parts are parsed and loaded) |
368 QString docmlFile = mDocmlFilesByView[viewName]; |
350 QString docmlFile = mDocmlFilesByView[viewName]; |
369 CX_DEBUG_ASSERT(mCameraDocumentLoader); |
351 CX_ASSERT_ALWAYS(mCameraDocumentLoader); |
370 CX_ASSERT_ALWAYS(!docmlFile.isNull()); |
352 CX_ASSERT_ALWAYS(!docmlFile.isNull()); |
371 |
353 |
372 OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" ); |
354 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_2, "msg: e_CX_DOCUMENTLOADER_LOAD 1"); |
373 |
|
374 mCameraDocumentLoader->load(docmlFile, &ok); |
355 mCameraDocumentLoader->load(docmlFile, &ok); |
375 |
356 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_4, "msg: e_CX_DOCUMENTLOADER_LOAD 0"); |
376 Q_ASSERT_X(ok, "createView", "error in xml file parsing"); |
357 Q_ASSERT_X(ok, "createView", "error in xml file parsing"); |
377 |
358 |
378 OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_DOCLOADER_LOAD 0" ); |
359 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_6, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); |
379 |
|
380 OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 1" ); |
|
381 QGraphicsWidget *widget = NULL; |
360 QGraphicsWidget *widget = NULL; |
382 // ask for the view widget pointer |
361 // ask for the view widget pointer |
383 widget = mCameraDocumentLoader->findWidget(viewName); |
362 widget = mCameraDocumentLoader->findWidget(viewName); |
384 view = qobject_cast<CxuiView *> (widget); |
363 view = qobject_cast<CxuiView *> (widget); |
385 CX_DEBUG_ASSERT(view); |
364 CX_ASSERT_ALWAYS(view); |
386 OstTrace0( camerax_performance, DUP5_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 0" ); |
365 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); |
387 |
366 |
388 // call for needed consturction methods |
367 // call for needed consturction methods |
389 view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager()); |
368 view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager()); |
390 // .. and add to main window (which also takes ownership) |
369 // .. and add to main window (which also takes ownership) |
391 OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" ); |
370 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1"); |
392 mMainWindow.addView(view); |
371 mMainWindow.addView(view); |
393 mViews.insert(viewName, view); |
372 mViews.insert(viewName, view); |
394 |
373 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0"); |
395 OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" ); |
374 } |
396 OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 0" ); |
375 |
397 |
376 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_OUT, "msg: e_CX_CREATE_VIEW 0"); |
398 } |
|
399 |
377 |
400 CX_DEBUG_EXIT_FUNCTION(); |
378 CX_DEBUG_EXIT_FUNCTION(); |
401 return view; |
379 return view; |
402 } |
|
403 |
|
404 /*! |
|
405 * Create scene mode view. |
|
406 */ |
|
407 CxuiView* CxuiViewManager::createSceneModesView() |
|
408 { |
|
409 CX_DEBUG_ENTER_FUNCTION(); |
|
410 |
|
411 mSceneModeView = qobject_cast<CxuiSceneModeView*>(createView(STILL_SCENES_VIEW)); |
|
412 mSceneModeView->loadBackgroundImages(); |
|
413 |
|
414 CX_DEBUG_EXIT_FUNCTION(); |
|
415 return mSceneModeView; |
|
416 } |
380 } |
417 |
381 |
418 /*! |
382 /*! |
419 * CxuiViewManager::showScenesView |
383 * CxuiViewManager::showScenesView |
420 * A private method for displaying Scene Modes selection view |
384 * A private method for displaying Scene Modes selection view |
626 } |
578 } |
627 |
579 |
628 /*! |
580 /*! |
629 * Connect signals specific to given view. |
581 * Connect signals specific to given view. |
630 */ |
582 */ |
631 void CxuiViewManager::connectSignals(QObject *view) |
583 void CxuiViewManager::connectSignals(CxuiView *view) |
632 { |
584 { |
633 CX_DEBUG_ENTER_FUNCTION(); |
585 CX_DEBUG_ENTER_FUNCTION(); |
|
586 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_1, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 1"); |
|
587 |
634 if (view) { |
588 if (view) { |
635 if (view == mViews[POSTCAPTURE_VIEW]) { |
589 if (view == mViews[POSTCAPTURE_VIEW]) { |
636 connectPostCaptureSignals(); |
590 connectPostCaptureSignals(); |
637 } else if (view == mSceneModeView) { |
591 } else if (view == mViews[SCENE_MODE_VIEW]) { |
638 connectSceneModeSignals(); |
592 connectSceneModeSignals(); |
639 } else { |
593 } else { |
640 connectPreCaptureSignals(); |
594 connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view)); |
641 } |
595 } |
642 } |
596 } |
|
597 |
|
598 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_2, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 0"); |
643 CX_DEBUG_EXIT_FUNCTION(); |
599 CX_DEBUG_EXIT_FUNCTION(); |
644 } |
600 } |
645 |
601 |
646 /*! |
602 /*! |
647 * Disconnect signals. |
603 * Disconnect signals. |
648 * We don't want to send or receive signals with inactive views, so this is done every time changing a view. |
604 * We don't want to send or receive signals with inactive views, so this is done every time changing a view. |
649 * @param view View object from which signals are disconnected. If NULL is given, current view is used. |
605 * @param view View object from which signals are disconnected. If NULL is given, current view is used. |
650 */ |
606 */ |
651 void CxuiViewManager::disconnectSignals(QObject *view) |
607 void CxuiViewManager::disconnectSignals(CxuiView *view) |
652 { |
608 { |
653 CX_DEBUG_ENTER_FUNCTION(); |
609 CX_DEBUG_ENTER_FUNCTION(); |
|
610 OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_1, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 1"); |
654 |
611 |
655 // Disconnect all existing capture key signals |
612 // Disconnect all existing capture key signals |
656 mKeyHandler->disconnect(); |
613 mKeyHandler->disconnect(); |
657 |
614 |
658 if (!view) { |
615 if (!view) { |
659 // If view is not given, take current view. |
616 // If view is not given, take current view. |
660 view = mMainWindow.currentView(); |
617 view = currentView(); |
661 } |
618 } |
662 |
619 |
663 CX_DEBUG(("CxuiViewManager - disconnecting from view %d", view)); |
620 CX_DEBUG(("CxuiViewManager - disconnecting from view %d", view)); |
664 if (view) { |
621 if (view) { |
665 // Disconnect all signals from current view to us. |
622 // Disconnect all signals from current view to us. |
666 disconnect(view, 0, this, 0); |
623 disconnect(view, 0, this, 0); |
667 // Disconnect all signals from us to current view. |
624 // Disconnect all signals from us to current view. |
668 disconnect(this, 0, view, 0); |
625 disconnect(this, 0, view, 0); |
669 } |
626 } |
670 |
627 |
|
628 OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_2, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 0"); |
671 CX_DEBUG_EXIT_FUNCTION(); |
629 CX_DEBUG_EXIT_FUNCTION(); |
672 } |
630 } |
673 |
631 |
674 /*! |
632 /*! |
675 * Connect signals to pre-capture view. |
633 * Connect signals to pre-capture view. |
676 */ |
634 */ |
677 void CxuiViewManager::connectPreCaptureSignals() |
635 void CxuiViewManager::connectPreCaptureSignals(CxuiPrecaptureView *view) |
678 { |
636 { |
679 CX_DEBUG_ENTER_FUNCTION(); |
637 CX_DEBUG_ENTER_FUNCTION(); |
680 |
638 |
|
639 // Disconnect from the current, "old" view |
681 disconnectSignals(); |
640 disconnectSignals(); |
682 |
641 |
683 HbView *currentView = mMainWindow.currentView(); |
642 // connecting pre-capture view signals to standby timer. |
684 |
643 connect(view, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection); |
685 if (currentView != mViews[POSTCAPTURE_VIEW]) { |
644 connect(view, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection); |
686 // connects all capture key signals. |
645 connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection); |
687 connectCaptureKeySignals(); |
646 connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection); |
688 |
647 |
689 // connecting pre-capture view signals to standby timer. |
648 // connecting pre-capture view signals to viewmanager slots |
690 connect(currentView, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection); |
649 connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection); |
691 connect(currentView, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection); |
650 connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection); |
692 connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection); |
651 |
693 connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection); |
652 //connecting scene modes signal |
694 |
653 connect(view, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection); |
695 // connecting pre-capture view signals to viewmanager slots |
654 |
696 connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection); |
655 connect(view, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection); |
697 connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection); |
656 |
698 |
657 // connecting error signals from precapture view to application state. |
699 //connecting scene modes signal |
658 connect(view, SIGNAL(errorEncountered(CxeError::Id)), |
700 connect(currentView, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection); |
659 mApplicationState, SLOT(handleApplicationError(CxeError::Id)), |
701 |
660 Qt::UniqueConnection); |
702 connect(currentView, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection); |
661 |
703 |
662 // Standby signals |
704 // connecting error signals from precapture view to application state. |
663 connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection); |
705 connect(currentView, SIGNAL(errorEncountered(CxeError::Id)), |
664 connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection); |
706 mApplicationState, SLOT(handleApplicationError(CxeError::Id)), |
665 |
707 Qt::UniqueConnection); |
666 // connects all capture key signals. |
|
667 connectCaptureKeySignals(view); |
|
668 |
|
669 CX_DEBUG_EXIT_FUNCTION(); |
|
670 } |
|
671 |
|
672 /*! |
|
673 * Connect signals to post-capture view. |
|
674 */ |
|
675 void CxuiViewManager::connectPostCaptureSignals() |
|
676 { |
|
677 CX_DEBUG_ENTER_FUNCTION(); |
|
678 |
|
679 // Disconnect from the current, "old" view |
|
680 disconnectSignals(); |
|
681 |
|
682 CxuiView *view = mViews[POSTCAPTURE_VIEW]; |
|
683 if (view) { |
|
684 connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection); |
708 |
685 |
709 // Standby signals |
686 // Standby signals |
710 connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection); |
687 connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection); |
711 connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection); |
688 connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection); |
712 } |
689 |
713 |
690 // connect necessary capturekey signals |
714 CX_DEBUG_EXIT_FUNCTION(); |
691 connectCaptureKeySignals(view); |
715 } |
692 } |
716 |
693 CX_DEBUG_EXIT_FUNCTION(); |
717 /*! |
694 } |
718 * Connect signals to post-capture view. |
695 |
719 */ |
696 /*! |
720 void CxuiViewManager::connectPostCaptureSignals() |
697 * Connect signals to scene mode view. |
721 { |
698 */ |
722 CX_DEBUG_ENTER_FUNCTION(); |
699 void CxuiViewManager::connectSceneModeSignals() |
723 |
700 { |
|
701 CX_DEBUG_ENTER_FUNCTION(); |
|
702 |
|
703 // Disconnect from the current, "old" view |
724 disconnectSignals(); |
704 disconnectSignals(); |
725 QObject *currentView = mMainWindow.currentView(); |
705 |
726 if (currentView == mViews[POSTCAPTURE_VIEW]) { |
706 CxuiView *view = mViews[SCENE_MODE_VIEW]; |
727 connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection); |
707 if (view) { |
728 |
708 // Standby signals for releasing camera |
729 // Standby signals |
709 connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby())); |
730 connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection); |
710 connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby())); |
731 connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection); |
711 |
732 |
712 // Moving back to pre-capture view |
733 // connect necessary capturekey signals |
713 connect(view, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView())); |
734 connectCaptureKeySignals(); |
714 |
735 } |
715 connectCaptureKeySignals(view); |
736 |
716 } |
737 CX_DEBUG_EXIT_FUNCTION(); |
|
738 } |
|
739 |
|
740 /*! |
|
741 * Connect signals to scene mode view. |
|
742 */ |
|
743 void CxuiViewManager::connectSceneModeSignals() |
|
744 { |
|
745 CX_DEBUG_ENTER_FUNCTION(); |
|
746 disconnectSignals(); |
|
747 |
|
748 connectCaptureKeySignals(); |
|
749 |
|
750 // Standby signals for releasing camera |
|
751 connect(this, SIGNAL(normalStateEntered()), mSceneModeView, SLOT(exitStandby())); |
|
752 connect(this, SIGNAL(normalStateExited()), mSceneModeView, SLOT(enterStandby())); |
|
753 |
|
754 // Moving back to pre-capture view |
|
755 connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView())); |
|
756 |
|
757 CX_DEBUG_EXIT_FUNCTION(); |
717 CX_DEBUG_EXIT_FUNCTION(); |
758 } |
718 } |
759 |
719 |
760 /*! |
720 /*! |
761 * Connect key handler capture key signals. |
721 * Connect key handler capture key signals. |
762 */ |
722 */ |
763 void CxuiViewManager::connectCaptureKeySignals() |
723 void CxuiViewManager::connectCaptureKeySignals(CxuiView *view) |
764 { |
724 { |
765 CX_DEBUG_ENTER_FUNCTION(); |
725 CX_DEBUG_ENTER_FUNCTION(); |
766 |
726 |
767 // Disconnect all existing capture key signals |
727 // Disconnect all existing capture key signals |
768 mKeyHandler->disconnect(); |
728 mKeyHandler->disconnect(); |
769 |
729 |
770 QObject *currentView = mMainWindow.currentView(); |
730 if (view) { |
771 |
|
772 if (currentView) { |
|
773 // If the view class does not implement the named slot, the connect will fail |
731 // If the view class does not implement the named slot, the connect will fail |
774 // and output some warnings as debug prints. This is by design. |
732 // and output some warnings as debug prints. This is by design. |
775 connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), currentView, SLOT(handleAutofocusKeyPressed())); |
733 connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), view, SLOT(handleAutofocusKeyPressed())); |
776 connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), currentView, SLOT(handleAutofocusKeyReleased())); |
734 connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), view, SLOT(handleAutofocusKeyReleased())); |
777 connect(mKeyHandler, SIGNAL(captureKeyPressed()), currentView, SLOT(handleCaptureKeyPressed())); |
735 connect(mKeyHandler, SIGNAL(captureKeyPressed()), view, SLOT(handleCaptureKeyPressed())); |
778 connect(mKeyHandler, SIGNAL(captureKeyReleased()), currentView, SLOT(handleCaptureKeyReleased())); |
736 connect(mKeyHandler, SIGNAL(captureKeyReleased()), view, SLOT(handleCaptureKeyReleased())); |
779 } |
737 } |
780 |
738 |
781 CX_DEBUG_EXIT_FUNCTION(); |
739 CX_DEBUG_EXIT_FUNCTION(); |
782 } |
740 } |
783 |
741 |