17 #include <QDebug> |
17 #include <QDebug> |
18 #include <QTimer> |
18 #include <QTimer> |
19 #include <hbmainwindow.h> |
19 #include <hbmainwindow.h> |
20 #include <QGraphicsSceneEvent> |
20 #include <QGraphicsSceneEvent> |
21 #include <hbstyleloader.h> |
21 #include <hbstyleloader.h> |
22 #include <hbactivitymanager.h> |
22 #include <afactivitystorage.h> |
|
23 #include <afactivation.h> |
23 #include <hbaction.h> |
24 #include <hbaction.h> |
24 #include <xqserviceutil.h> |
25 #include <xqserviceutil.h> |
25 |
26 |
26 #include "cxuiapplication.h" |
27 #include "cxuiapplication.h" |
27 #include "cxuiapplicationstate.h" |
28 #include "cxuiapplicationstate.h" |
274 */ |
275 */ |
275 void CxuiViewManager::initStartupView() |
276 void CxuiViewManager::initStartupView() |
276 { |
277 { |
277 CX_DEBUG_ENTER_FUNCTION(); |
278 CX_DEBUG_ENTER_FUNCTION(); |
278 |
279 |
279 if (mApplication.activateReason() == Hb::ActivationReasonService || |
280 AfActivation activation; |
|
281 AfActivityStorage activityStorage; |
|
282 if (activation.reason() == Hb::ActivationReasonService || |
280 // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as |
283 // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as |
281 // activation reason. Use XQServiceUtil to determine if starting service as |
284 // activation reason. Use XQServiceUtil to determine if starting service as |
282 // a workaround for now |
285 // a workaround for now |
283 XQServiceUtil::isService()) { |
286 XQServiceUtil::isService()) { |
284 |
287 |
287 connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), |
290 connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), |
288 this, SLOT(changeToPrecaptureView())); |
291 this, SLOT(changeToPrecaptureView())); |
289 connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), |
292 connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), |
290 this, SLOT(changeToPrecaptureView())); |
293 this, SLOT(changeToPrecaptureView())); |
291 |
294 |
292 } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) { |
295 } else if (activation.reason() == Hb::ActivationReasonActivity) { |
293 // restoring activity, read startup view from stored activity |
296 // restoring activity, read startup view from stored activity |
294 |
297 |
295 // view to start in |
298 // view to start in |
296 QString viewName = STILL_PRE_CAPTURE_VIEW; |
299 QString viewName = STILL_PRE_CAPTURE_VIEW; |
297 |
300 |
298 bool preCapture = true; |
301 bool preCapture = true; |
299 QString activityId = mApplication.activateId(); |
302 QString activityId = activation.name(); |
300 if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY) { |
303 if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY) { |
301 viewName = STILL_PRE_CAPTURE_VIEW; |
304 viewName = STILL_PRE_CAPTURE_VIEW; |
302 } else if (activityId == CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY) { |
305 } else if (activityId == CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY) { |
303 viewName = POSTCAPTURE_VIEW; |
306 viewName = POSTCAPTURE_VIEW; |
304 preCapture = false; |
307 preCapture = false; |
316 connectPostCaptureSignals(); |
319 connectPostCaptureSignals(); |
317 } |
320 } |
318 mMainWindow.setCurrentView(view, false); |
321 mMainWindow.setCurrentView(view, false); |
319 |
322 |
320 // restore view from activity |
323 // restore view from activity |
321 bool ok = mApplication.activityManager()->waitActivity(); |
324 view->restoreActivity(activityId, activityStorage.activityData(activityId)); |
322 |
|
323 view->restoreActivity(activityId, |
|
324 mApplication.activityManager()->activityData(mApplication.activateId())); |
|
325 |
325 |
326 clearAllActivities(); |
326 clearAllActivities(); |
327 } else { |
327 } else { |
328 // normal start |
328 // normal start |
329 // no activity id, get default view from engine state |
329 // no activity id, get default view from engine state |
378 view = qobject_cast<CxuiView *> (widget); |
378 view = qobject_cast<CxuiView *> (widget); |
379 CX_ASSERT_ALWAYS(view); |
379 CX_ASSERT_ALWAYS(view); |
380 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); |
380 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); |
381 |
381 |
382 // call for needed consturction methods |
382 // call for needed consturction methods |
383 view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager()); |
383 view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler); |
384 // .. and add to main window (which also takes ownership) |
384 // .. and add to main window (which also takes ownership) |
385 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1"); |
385 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1"); |
386 mMainWindow.addView(view); |
386 mMainWindow.addView(view); |
387 mViews.insert(viewName, view); |
387 mViews.insert(viewName, view); |
388 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0"); |
388 OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0"); |
757 /*! |
757 /*! |
758 * Clears all camera activities from activity manager. |
758 * Clears all camera activities from activity manager. |
759 */ |
759 */ |
760 void CxuiViewManager::clearAllActivities() |
760 void CxuiViewManager::clearAllActivities() |
761 { |
761 { |
762 HbActivityManager *activityManager = mApplication.activityManager(); |
762 AfActivityStorage activityStorage; |
763 activityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); |
763 activityStorage.removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); |
764 activityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); |
764 activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); |
765 activityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); |
765 activityStorage.removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); |
766 activityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); |
766 activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); |
767 } |
767 } |
768 |
768 |
769 /*! |
769 /*! |
770 * Raise application to foreground if it's currently (fully) in background. |
770 * Raise application to foreground if it's currently (fully) in background. |
771 */ |
771 */ |