camerauis/cameraxui/cxui/src/main.cpp
changeset 46 c826656d6714
parent 42 feebad15db8c
child 52 7e18d488ac5f
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
    19 #include <QGraphicsProxyWidget>
    19 #include <QGraphicsProxyWidget>
    20 // needed for localization
    20 // needed for localization
    21 #include <QLocale>
    21 #include <QLocale>
    22 #include <HbTranslator>
    22 #include <HbTranslator>
    23 #include <hbmainwindow.h>
    23 #include <hbmainwindow.h>
       
    24 #include <xqserviceutil.h>
    24 
    25 
    25 #ifdef Q_OS_SYMBIAN
    26 #ifdef Q_OS_SYMBIAN
    26 #include <coemain.h>
    27 #include <coemain.h>
    27 #include <eikenv.h>
    28 #include <eikenv.h>
    28 #endif // Q_OS_SYMBIAN
    29 #endif // Q_OS_SYMBIAN
    39 #ifdef Q_OS_SYMBIAN
    40 #ifdef Q_OS_SYMBIAN
    40 #include "OstTraceDefinitions.h"
    41 #include "OstTraceDefinitions.h"
    41 #ifdef OST_TRACE_COMPILER_IN_USE
    42 #ifdef OST_TRACE_COMPILER_IN_USE
    42 #include "mainTraces.h"
    43 #include "mainTraces.h"
    43 #endif // OST_TRACE_COMPILER_IN_USE
    44 #endif // OST_TRACE_COMPILER_IN_USE
    44 #else
       
    45 #include "cxuimacrosdesktop.h"
       
    46 #endif // Q_OS_SYMBIAN
    45 #endif // Q_OS_SYMBIAN
    47 
    46 
    48 using namespace Cxe;
    47 using namespace Cxe;
    49 
    48 
    50 // CONSTANTS
    49 // CONSTANTS
    72     // ui construction.
    71     // ui construction.
    73     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    72     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    74     CxeEngine *engine = CxeEngine::createEngine();
    73     CxeEngine *engine = CxeEngine::createEngine();
    75     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    74     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    76 
    75 
    77     if (app.activateReason() == Hb::ActivationReasonService) {
    76     if (app.activateReason() == Hb::ActivationReasonService ||
       
    77         // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as
       
    78         // activation reason. Use XQServiceUtil to determine if starting service as
       
    79         // a workaround for now
       
    80         XQServiceUtil::isService()) {
       
    81         CX_DEBUG(("CxUI: Camera started as service"));
    78         // Embedded mode.  Engine is inited to correct mode
    82         // Embedded mode.  Engine is inited to correct mode
    79         // by service provider when request arrives
    83         // by service provider when request arrives
    80         CX_DEBUG(("CxUI: creating serviceprovider"));
    84         CX_DEBUG(("CxUI: creating serviceprovider"));
    81         CxuiServiceProvider::create(engine);
    85         CxuiServiceProvider::create(engine);
    82         CX_DEBUG(("CxUI: done"));
    86         CX_DEBUG(("CxUI: done"));
    83     } else if (app.activateReason() == Hb::ActivationReasonActivity) {
    87     } else if (app.activateReason() == Hb::ActivationReasonActivity) {
       
    88         CX_DEBUG(("CxUI: Camera started as activity"));
    84         Cxe::CameraMode mode = Cxe::ImageMode;
    89         Cxe::CameraMode mode = Cxe::ImageMode;
    85         QString activityId = app.activateId();
    90         QString activityId = app.activateId();
    86         if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
    91         if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
    87             activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
    92             activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
    88             mode = Cxe::VideoMode;
    93             mode = Cxe::VideoMode;
    96             // in post-capture don't init but set the correct mode to engine
   101             // in post-capture don't init but set the correct mode to engine
    97             // so init can be done later
   102             // so init can be done later
    98             engine->setMode(mode);
   103             engine->setMode(mode);
    99         }
   104         }
   100 	} else {
   105 	} else {
       
   106         CX_DEBUG(("CxUI: Camera started as normal app"));
   101 	    // normal start
   107 	    // normal start
   102 	    engine->initMode(engine->mode());
   108 	    engine->initMode(engine->mode());
   103 	}
   109 	}
   104 
   110 
   105 #ifdef Q_OS_SYMBIAN
   111 #ifdef Q_OS_SYMBIAN
   106     //!@todo: Yield run time to system to get enough resources released to start camera.
   112     //!@todo: Yield run time to system to get enough resources released to start camera.
   107     CX_DEBUG(("CxUI: yield control for resource freeing.."));
   113     CX_DEBUG(("CxUI: yield control for resource freeing.."));
   108     User::After(300*1000); // 300ms
   114     User::After(2*1000*1000); // 2s
   109     CX_DEBUG(("CxUI: waiting done.."));
   115     CX_DEBUG(("CxUI: waiting done.."));
   110 #endif // Q_OS_SYMBIAN
   116 #endif // Q_OS_SYMBIAN
   111 
   117 
   112     // Load language specific application localization file, e.g. "camera_en.qm"
   118     // Load language specific application localization file, e.g. "camera_en.qm"
   113     // Translations need to be loaded before any widgets are created.
   119     // Translations need to be loaded before any widgets are created.