camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp
changeset 42 feebad15db8c
parent 41 67457b2ffb33
child 46 c826656d6714
equal deleted inserted replaced
41:67457b2ffb33 42:feebad15db8c
    15 *
    15 *
    16 */
    16 */
    17 #include <QDebug>
    17 #include <QDebug>
    18 #include <QTimer>
    18 #include <QTimer>
    19 #include <hbmainwindow.h>
    19 #include <hbmainwindow.h>
    20 #include <coemain.h>
       
    21 #include <QGraphicsSceneEvent>
    20 #include <QGraphicsSceneEvent>
    22 #include <hbstyleloader.h>
    21 #include <hbstyleloader.h>
    23 #include <hbactivitymanager.h>
    22 #include <hbactivitymanager.h>
    24 #include <hbaction.h>
    23 #include <hbaction.h>
    25 
    24 
    41 #include "cxesettings.h"
    40 #include "cxesettings.h"
    42 #include "cxememorymonitor.h"
    41 #include "cxememorymonitor.h"
    43 #include "cxuiserviceprovider.h"
    42 #include "cxuiserviceprovider.h"
    44 #include "cxuiscenemodeview.h"
    43 #include "cxuiscenemodeview.h"
    45 
    44 
       
    45 
       
    46 #ifdef Q_OS_SYMBIAN
    46 #include "OstTraceDefinitions.h"
    47 #include "OstTraceDefinitions.h"
       
    48 
    47 #ifdef OST_TRACE_COMPILER_IN_USE
    49 #ifdef OST_TRACE_COMPILER_IN_USE
    48 #include "cxuiviewmanagerTraces.h"
    50 #include "cxuiviewmanagerTraces.h"
    49 #endif
    51 #endif
       
    52 
       
    53 #endif //Q_OS_SYMBIAN
    50 
    54 
    51 
    55 
    52 using namespace Cxe;
    56 using namespace Cxe;
    53 using namespace CxUiLayout;
    57 using namespace CxUiLayout;
    54 
    58 
    66     mMainWindow(mainWindow),
    70     mMainWindow(mainWindow),
    67     mEngine(engine),
    71     mEngine(engine),
    68     mKeyHandler(NULL),
    72     mKeyHandler(NULL),
    69     mCameraDocumentLoader(NULL),
    73     mCameraDocumentLoader(NULL),
    70     mApplicationState(NULL),
    74     mApplicationState(NULL),
    71     mErrorManager(NULL),
    75     mErrorManager(NULL)
    72     mSceneModeView(NULL)
       
    73 {
    76 {
    74     CX_DEBUG_ENTER_FUNCTION();
    77     CX_DEBUG_ENTER_FUNCTION();
    75 
    78 
    76     // create mappings to map view name to correct docml file
    79     // create mappings to map view name to correct docml file
    77     mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML);
    80     mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML);
    78     mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML);
    81     mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML);
    79     mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML);
    82     mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML);
    80     mDocmlFilesByView.insert(STILL_SCENES_VIEW, SCENEMODE_SETTING_XML);
    83     mDocmlFilesByView.insert(SCENE_MODE_VIEW, SCENEMODE_SETTING_XML);
    81 
    84 
    82     // Key handler
    85     // Key handler
    83     mKeyHandler = new CxuiCaptureKeyHandler(mEngine);
    86     mKeyHandler = new CxuiCaptureKeyHandler(mEngine);
    84 
    87 
    85     // Document loader
    88     // Document loader
    86     OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" );
    89     OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_1, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1");
    87     mCameraDocumentLoader = new CxuiDocumentLoader(&engine);
    90     mCameraDocumentLoader = new CxuiDocumentLoader(&engine);
    88     OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" );
    91     OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_2, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0");
    89 
    92 
    90     // Application state
    93     // Application state
    91     mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader);
    94     mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), mCameraDocumentLoader);
    92     CX_ASSERT_ALWAYS(mApplicationState);
    95     CX_ASSERT_ALWAYS(mApplicationState);
    93     bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)),
    96     bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)),
    94                       this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State)));
    97                       this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State)));
    95     Q_ASSERT_X(ok, "CxuiViewManager", "Application state change signal connect failed.");
    98     Q_ASSERT_X(ok, "CxuiViewManager", "Application state change signal connect failed.");
    96     connect(this, SIGNAL(standbyExitRequested()), mApplicationState, SLOT(exitStandby()), Qt::QueuedConnection);
    99     connect(this, SIGNAL(standbyExitRequested()), mApplicationState, SLOT(exitStandby()), Qt::QueuedConnection);
   215     // Using the view before normalStateExited() signal was emitted,
   218     // Using the view before normalStateExited() signal was emitted,
   216     // just in case it caused view switch.
   219     // just in case it caused view switch.
   217     disconnectSignals(view);
   220     disconnectSignals(view);
   218     // Make sure standby timer is not running.
   221     // Make sure standby timer is not running.
   219     stopStandbyTimer();
   222     stopStandbyTimer();
       
   223 
   220     CX_DEBUG_EXIT_FUNCTION();
   224     CX_DEBUG_EXIT_FUNCTION();
   221 }
   225 }
   222 
   226 
   223 /*!
   227 /*!
   224 * Slot for starting standby timer.
   228 * Slot for starting standby timer.
   236 void CxuiViewManager::stopStandbyTimer()
   240 void CxuiViewManager::stopStandbyTimer()
   237 {
   241 {
   238     CX_DEBUG_ENTER_FUNCTION();
   242     CX_DEBUG_ENTER_FUNCTION();
   239     mStandbyTimer.stop();
   243     mStandbyTimer.stop();
   240     CX_DEBUG_EXIT_FUNCTION();
   244     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 }
   245 }
   264 
   246 
   265 /*!
   247 /*!
   266  * Helper function to return current view cast to CxuiView.
   248  * Helper function to return current view cast to CxuiView.
   267  */
   249  */
   285         connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
   267         connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
   286                 this, SLOT(changeToPrecaptureView()));
   268                 this, SLOT(changeToPrecaptureView()));
   287         connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
   269         connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
   288                 this, SLOT(changeToPrecaptureView()));
   270                 this, SLOT(changeToPrecaptureView()));
   289 
   271 
   290     } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) {
   272     } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) {
   291         // restoring activity, read startup view from stored activity
   273         // restoring activity, read startup view from stored activity
   292 
   274 
   293         // view to start in
   275         // view to start in
   294         QString viewName = STILL_PRE_CAPTURE_VIEW;
   276         QString viewName = STILL_PRE_CAPTURE_VIEW;
   295 
   277 
   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
   423 {
   387 {
   424     CX_DEBUG_ENTER_FUNCTION();
   388     CX_DEBUG_ENTER_FUNCTION();
   425     // Disconnect signals from old view.
   389     // Disconnect signals from old view.
   426     disconnectSignals();
   390     disconnectSignals();
   427 
   391 
   428     if (!mSceneModeView) {
   392     CxuiSceneModeView *view = qobject_cast<CxuiSceneModeView*>(createView(SCENE_MODE_VIEW));
   429         createSceneModesView();
   393     CX_ASSERT_ALWAYS(view);
   430     }
   394     view->loadBackgroundImages();
   431     else {
   395 
   432         mSceneModeView->loadBackgroundImages();
   396     mMainWindow.setCurrentView(view, false);
   433     }
       
   434     CX_DEBUG_ASSERT(mSceneModeView);
       
   435     mMainWindow.setCurrentView(mSceneModeView, false);
       
   436     stopStandbyTimer();
   397     stopStandbyTimer();
   437     connectSceneModeSignals();
   398     connectSceneModeSignals();
   438 
   399 
   439     CX_DEBUG_EXIT_FUNCTION();
   400     CX_DEBUG_EXIT_FUNCTION();
   440 }
   401 }
   460     } else {
   421     } else {
   461         CX_DEBUG(("CxuiViewManager::getPrecaptureView - video mode"));
   422         CX_DEBUG(("CxuiViewManager::getPrecaptureView - video mode"));
   462         return qobject_cast<CxuiPrecaptureView*>(createView(VIDEO_PRE_CAPTURE_VIEW));
   423         return qobject_cast<CxuiPrecaptureView*>(createView(VIDEO_PRE_CAPTURE_VIEW));
   463     }
   424     }
   464 }
   425 }
   465 
       
   466 /*!
       
   467 * Get a pointer to the document loader instance.
       
   468 */
       
   469 CxuiDocumentLoader *CxuiViewManager::documentLoader()
       
   470 {
       
   471     return mCameraDocumentLoader;
       
   472 }
       
   473 
       
   474 /*!
       
   475 * Get reference to application state instance.
       
   476 */
       
   477 CxuiApplicationState &CxuiViewManager::applicationState()
       
   478 {
       
   479     return *mApplicationState;
       
   480 }
       
   481 
       
   482 
   426 
   483 /*!
   427 /*!
   484 * Move to post-capture view.
   428 * Move to post-capture view.
   485 */
   429 */
   486 void CxuiViewManager::changeToPostcaptureView()
   430 void CxuiViewManager::changeToPostcaptureView()
   528 
   472 
   529         HbView *view = getPrecaptureView(mEngine.mode(),
   473         HbView *view = getPrecaptureView(mEngine.mode(),
   530             mEngine.cameraDeviceControl().cameraIndex());
   474             mEngine.cameraDeviceControl().cameraIndex());
   531         mMainWindow.setCurrentView(view, false);
   475         mMainWindow.setCurrentView(view, false);
   532 
   476 
   533         if (mSceneModeView){
   477         // Release resources needed by scene view.
   534             mViews.remove(STILL_SCENES_VIEW);
   478         HbView *sceneView = mViews.take(SCENE_MODE_VIEW);
   535             delete mSceneModeView;
   479         if (sceneView) {
   536             mSceneModeView = NULL;
   480             // This will not delete the view.
   537         }
   481             mMainWindow.removeView(sceneView);
       
   482             // We can get to this slot from scene view, so don't delete the object too early.
       
   483             sceneView->deleteLater();
       
   484             sceneView = NULL;
       
   485         }
       
   486 
   538         // connecting necessary pre-capture view signals
   487         // connecting necessary pre-capture view signals
   539         connectPreCaptureSignals();
   488         connectPreCaptureSignals();
   540 
   489 
   541         // Make sure engine prepares for new image/video if necessary
   490         // Make sure engine prepares for new image/video if necessary
   542         mEngine.initMode(mEngine.mode());
   491         mEngine.initMode(mEngine.mode());
   629 * Connect signals specific to given view.
   578 * Connect signals specific to given view.
   630 */
   579 */
   631 void CxuiViewManager::connectSignals(QObject *view)
   580 void CxuiViewManager::connectSignals(QObject *view)
   632 {
   581 {
   633     CX_DEBUG_ENTER_FUNCTION();
   582     CX_DEBUG_ENTER_FUNCTION();
       
   583     OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_1, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 1");
       
   584 
   634     if (view) {
   585     if (view) {
   635         if (view == mViews[POSTCAPTURE_VIEW]) {
   586         if (view == mViews[POSTCAPTURE_VIEW]) {
   636             connectPostCaptureSignals();
   587             connectPostCaptureSignals();
   637         } else if (view == mSceneModeView) {
   588         } else if (view == mViews[SCENE_MODE_VIEW]) {
   638             connectSceneModeSignals();
   589             connectSceneModeSignals();
   639         } else {
   590         } else {
   640             connectPreCaptureSignals();
   591             connectPreCaptureSignals();
   641         }
   592         }
   642     }
   593     }
       
   594 
       
   595     OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_2, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 0");
   643     CX_DEBUG_EXIT_FUNCTION();
   596     CX_DEBUG_EXIT_FUNCTION();
   644 }
   597 }
   645 
   598 
   646 /*!
   599 /*!
   647 * Disconnect signals.
   600 * Disconnect signals.
   649 * @param view View object from which signals are disconnected. If NULL is given, current view is used.
   602 * @param view View object from which signals are disconnected. If NULL is given, current view is used.
   650 */
   603 */
   651 void CxuiViewManager::disconnectSignals(QObject *view)
   604 void CxuiViewManager::disconnectSignals(QObject *view)
   652 {
   605 {
   653     CX_DEBUG_ENTER_FUNCTION();
   606     CX_DEBUG_ENTER_FUNCTION();
       
   607     OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_1, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 1");
   654 
   608 
   655     // Disconnect all existing capture key signals
   609     // Disconnect all existing capture key signals
   656     mKeyHandler->disconnect();
   610     mKeyHandler->disconnect();
   657 
   611 
   658     if (!view) {
   612     if (!view) {
   666         disconnect(view, 0, this, 0);
   620         disconnect(view, 0, this, 0);
   667         // Disconnect all signals from us to current view.
   621         // Disconnect all signals from us to current view.
   668         disconnect(this, 0, view, 0);
   622         disconnect(this, 0, view, 0);
   669     }
   623     }
   670 
   624 
       
   625     OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_2, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 0");
   671     CX_DEBUG_EXIT_FUNCTION();
   626     CX_DEBUG_EXIT_FUNCTION();
   672 }
   627 }
   673 
   628 
   674 /*!
   629 /*!
   675 * Connect signals to pre-capture view.
   630 * Connect signals to pre-capture view.
   722     CX_DEBUG_ENTER_FUNCTION();
   677     CX_DEBUG_ENTER_FUNCTION();
   723 
   678 
   724     disconnectSignals();
   679     disconnectSignals();
   725     QObject *currentView = mMainWindow.currentView();
   680     QObject *currentView = mMainWindow.currentView();
   726     if (currentView == mViews[POSTCAPTURE_VIEW]) {
   681     if (currentView == mViews[POSTCAPTURE_VIEW]) {
       
   682 
   727         connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
   683         connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
   728 
   684 
   729         // Standby signals
   685         // Standby signals
   730         connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
   686         connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
   731         connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
   687         connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
   743 void CxuiViewManager::connectSceneModeSignals()
   699 void CxuiViewManager::connectSceneModeSignals()
   744 {
   700 {
   745     CX_DEBUG_ENTER_FUNCTION();
   701     CX_DEBUG_ENTER_FUNCTION();
   746     disconnectSignals();
   702     disconnectSignals();
   747 
   703 
   748     connectCaptureKeySignals();
   704     HbView *currentView = mMainWindow.currentView();
   749 
   705 
   750     // Standby signals for releasing camera
   706     if (currentView == mViews[SCENE_MODE_VIEW]) {
   751     connect(this, SIGNAL(normalStateEntered()), mSceneModeView, SLOT(exitStandby()));
   707 
   752     connect(this, SIGNAL(normalStateExited()), mSceneModeView, SLOT(enterStandby()));
   708         connectCaptureKeySignals();
   753 
   709 
   754     // Moving back to pre-capture view
   710         // Standby signals for releasing camera
   755     connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
   711         connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()));
   756 
   712         connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()));
       
   713 
       
   714         // Moving back to pre-capture view
       
   715         connect(currentView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
       
   716     }
   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.