camerauis/cameraxui/cxui/src/main.cpp
changeset 61 fc3ff57d09ad
parent 58 ddba9caa7f32
equal deleted inserted replaced
58:ddba9caa7f32 61:fc3ff57d09ad
    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>
       
    25 #include <afactivation.h>
    24 #include <afactivation.h>
    26 
    25 
    27 #ifdef Q_OS_SYMBIAN
    26 #ifdef Q_OS_SYMBIAN
    28 #include <coemain.h>
    27 #include <coemain.h>
    29 #include <eikenv.h>
    28 #include <eikenv.h>
    51 
    50 
    52 // CONSTANTS
    51 // CONSTANTS
    53 const QString TRANSLATIONS_PATH = "/resource/qt/translations/";
    52 const QString TRANSLATIONS_PATH = "/resource/qt/translations/";
    54 const QString TRANSLATIONS_FILE = "camera";
    53 const QString TRANSLATIONS_FILE = "camera";
    55 
    54 
    56 const long int RUNTIME_FEATURES_CENREP_UID = 0x20027018;
    55 const long int CAMERAX_USE_RASTER_PS_UID = 0x2726beef;
    57 const unsigned long int USE_RASTER_GRAPHICS_SYSTEM_KEY = 0x07;
    56 const unsigned long int CAMERAX_USE_RASTER_PS_KEY = 0;
    58 
    57 
    59 int main(int argc, char *argv[])
    58 int main(int argc, char *argv[])
    60 {
    59 {
    61     CX_DEBUG(("CxUI: entering main()"));
    60     CX_DEBUG(("CxUI: entering main()"));
    62     OstTrace0( camerax_performance, _MAIN, "msg: e_CX_STARTUP 1" );
    61     OstTrace0( camerax_performance, _MAIN, "msg: e_CX_STARTUP 1" );
    63 
    62 
    64     Q_INIT_RESOURCE(cxui);
    63     Q_INIT_RESOURCE(cxui);
    65 
    64 
    66 #ifdef Q_OS_SYMBIAN
    65 #ifdef Q_OS_SYMBIAN
    67     XQSettingsManager settingManager;
    66     XQSettingsManager settingManager;
    68     XQCentralRepositorySettingsKey useRasterGraphicsSystemKey(
    67     XQPublishAndSubscribeSettingsKey useRasterGraphicsSystemKey(
    69             RUNTIME_FEATURES_CENREP_UID, USE_RASTER_GRAPHICS_SYSTEM_KEY);
    68             CAMERAX_USE_RASTER_PS_UID, CAMERAX_USE_RASTER_PS_KEY);
    70     QVariant useRasterGraphicsSystemValue =
    69     QVariant useRasterGraphicsSystemValue =
    71             settingManager.readItemValue(useRasterGraphicsSystemKey,
    70             settingManager.readItemValue(useRasterGraphicsSystemKey,
    72                                          XQSettingsManager::TypeInt);
    71                                          XQSettingsManager::TypeInt);
    73 
    72 
    74     if (useRasterGraphicsSystemValue.isNull()
    73     if (useRasterGraphicsSystemValue.isNull()
    75         || useRasterGraphicsSystemValue.toInt()) {
    74         || !useRasterGraphicsSystemValue.toInt()) {
    76         // Either there was an error reading the value or the value was
    75         // Either there was an error reading the value or the value was
    77         // non-zero. Raster graphics system should be forced
    76         // zero. Raster graphics system should be forced
    78         CX_DEBUG(("CxUI: Take raster graphics system into use"));
    77         CX_DEBUG(("CxUI: Take raster graphics system into use"));
    79         QApplication::setGraphicsSystem("raster");
    78         QApplication::setGraphicsSystem("raster");
    80     }
    79     }
    81 #endif
    80 #endif
    82 
    81 
    90     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    89     OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
    91     CxeEngine *engine = CxeEngine::createEngine();
    90     CxeEngine *engine = CxeEngine::createEngine();
    92     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    91     OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
    93 
    92 
    94     AfActivation activation;
    93     AfActivation activation;
    95     if (activation.reason() == Hb::ActivationReasonService ||
    94     if (activation.reason() == Af::ActivationReasonService) {
    96         // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as
       
    97         // activation reason. Use XQServiceUtil to determine if starting service as
       
    98         // a workaround for now
       
    99         XQServiceUtil::isService()) {
       
   100         CX_DEBUG(("CxUI: Camera started as service"));
    95         CX_DEBUG(("CxUI: Camera started as service"));
   101         // Embedded mode.  Engine is inited to correct mode
    96         // Embedded mode.  Engine is inited to correct mode
   102         // by service provider when request arrives
    97         // by service provider when request arrives
   103         CX_DEBUG(("CxUI: creating serviceprovider"));
    98         CX_DEBUG(("CxUI: creating serviceprovider"));
   104         CxuiServiceProvider::create(engine);
    99         CxuiServiceProvider::create(engine);
   105         CX_DEBUG(("CxUI: done"));
   100         CX_DEBUG(("CxUI: done"));
   106     } else if (activation.reason() == Hb::ActivationReasonActivity) {
   101     } else if (activation.reason() == Af::ActivationReasonActivity) {
   107         CX_DEBUG(("CxUI: Camera started as activity"));
   102         CX_DEBUG(("CxUI: Camera started as activity"));
   108         Cxe::CameraMode mode = Cxe::ImageMode;
   103         Cxe::CameraMode mode = Cxe::ImageMode;
   109         QString activityId = activation.name();
   104         QString activityId = activation.name();
   110         if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
   105         if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
   111             activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
   106             activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {