camerauis/cameraxui/cxui/src/main.cpp
changeset 37 64817133cd1d
parent 36 b12f3922a74f
child 48 42ba2d16bf40
equal deleted inserted replaced
36:b12f3922a74f 37:64817133cd1d
    21 #include <QGraphicsProxyWidget>
    21 #include <QGraphicsProxyWidget>
    22 // needed for localization
    22 // needed for localization
    23 #include <HbTranslator>
    23 #include <HbTranslator>
    24 #include <QLocale>
    24 #include <QLocale>
    25 #include <hbmainwindow.h>
    25 #include <hbmainwindow.h>
    26 #include <xqserviceutil.h>
       
    27 
    26 
    28 #include "cxeengine.h"
    27 #include "cxeengine.h"
    29 #include "cxecameradevicecontrol.h"
    28 #include "cxecameradevicecontrol.h"
    30 #include "cxuiapplication.h"
    29 #include "cxuiapplication.h"
    31 #include "cxuiviewmanager.h"
    30 #include "cxuiviewmanager.h"
       
    31 #include "cxuiapplicationstate.h"
    32 #include "cxutils.h"
    32 #include "cxutils.h"
    33 #include "cxuiserviceprovider.h"
    33 #include "cxuiserviceprovider.h"
    34 
    34 
    35 #include "OstTraceDefinitions.h"
    35 #include "OstTraceDefinitions.h"
    36 #ifdef OST_TRACE_COMPILER_IN_USE
    36 #ifdef OST_TRACE_COMPILER_IN_USE
    64     // ui construction.
    64     // ui construction.
    65     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    65     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    66     CxeEngine *eng = CxeEngine::createEngine();
    66     CxeEngine *eng = CxeEngine::createEngine();
    67     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    67     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    68 
    68 
    69     if (XQServiceUtil::isService()) {
    69     if (app.activateReason() == Hb::ActivationReasonService) {
    70         // Embedded mode.  Engine is inited to correct mode
    70         // Embedded mode.  Engine is inited to correct mode
    71         // by service provider when request arrives
    71         // by service provider when request arrives
    72         CX_DEBUG(("CxUI: creating serviceprovider"));
    72         CX_DEBUG(("CxUI: creating serviceprovider"));
    73         CxuiServiceProvider::create(eng);
    73         CxuiServiceProvider::create(eng);
    74         CX_DEBUG(("CxUI: done"));
    74         CX_DEBUG(("CxUI: done"));
   107     OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
   107     OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
   108     mainWindow->showFullScreen();
   108     mainWindow->showFullScreen();
   109     OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
   109     OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
   110 
   110 
   111     OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
   111     OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
   112     viewManager->prepareWindow();
   112     eng->viewfinderControl().setWindow(mainWindow->effectiveWinId());
   113     OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
   113     OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
       
   114 
   114     //! @todo initMode call added here as a temporary hack to change the startup sequence
   115     //! @todo initMode call added here as a temporary hack to change the startup sequence
   115 	// in order to avoid GOOM issues
   116 	// in order to avoid GOOM issues.
   116 	if (viewManager->proceedStartup()) {
   117 	if (app.activateReason() != Hb::ActivationReasonService
       
   118 	 && viewManager->applicationState().currentState() == CxuiApplicationState::Normal) {
   117     	User::After(2000000);
   119     	User::After(2000000);
   118         eng->initMode(Cxe::ImageMode);
   120     	if (app.activateReason() == Hb::ActivationReasonActivity) {
       
   121     	    // when started by activity, let viewmanager init
       
   122     	    // to correct mode
       
   123     	    viewManager->initEngine();
       
   124     	} else {
       
   125     	    // normal start
       
   126     	    eng->initMode(eng->mode());
       
   127     	}
   119     }
   128     }
   120 
   129 
   121     int returnValue = app.exec();
   130     int returnValue = app.exec();
   122 
   131 
       
   132     delete viewManager;
       
   133 
   123     // delete service provider instance
   134     // delete service provider instance
   124     CxuiServiceProvider::destroy();
   135     CxuiServiceProvider::destroy();
   125 
   136 
   126     delete viewManager;
       
   127     delete mainWindow;
   137     delete mainWindow;
   128     delete trans;
   138     delete trans;
   129     delete eng;
   139     delete eng;
   130 
   140 
   131     return returnValue;
   141     return returnValue;