camerauis/cameraxui/cxui/src/main.cpp
changeset 24 2094593137f5
parent 21 fa6d9f75d6a6
child 32 5c1e3c6aa4ef
equal deleted inserted replaced
21:fa6d9f75d6a6 24:2094593137f5
    69         CxuiServiceProvider::create(eng);
    69         CxuiServiceProvider::create(eng);
    70         CX_DEBUG(("CxUI: done"));
    70         CX_DEBUG(("CxUI: done"));
    71     } else {
    71     } else {
    72         // Normal mode. Init engine now.
    72         // Normal mode. Init engine now.
    73         OstTrace0( camerax_performance, DUP9__MAIN, "msg: e_CX_INIT_ENGINE 1" );
    73         OstTrace0( camerax_performance, DUP9__MAIN, "msg: e_CX_INIT_ENGINE 1" );
    74         eng->initMode(Cxe::ImageMode);
    74 		 //! @todo temporarily commented as part of a hack to change the startup sequence
       
    75          // to avoid GOOM issues
       
    76         //eng->initMode(Cxe::ImageMode);
    75         OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" );
    77         OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" );
    76     }
    78     }
    77 
    79 
    78     // Load the language specific localization files: application + common
    80     // Load the language specific localization files: application + common
    79     OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" );
    81     OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" );
    92     ret = commonTranslator.load(TRANSLATIONS_PATH + COMMON_TRANSLATIONS_FILE_NAME + lang);
    94     ret = commonTranslator.load(TRANSLATIONS_PATH + COMMON_TRANSLATIONS_FILE_NAME + lang);
    93     CX_DEBUG(("load ok=%d", ret));
    95     CX_DEBUG(("load ok=%d", ret));
    94     app.installTranslator(&commonTranslator);
    96     app.installTranslator(&commonTranslator);
    95     OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" );
    97     OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" );
    96 
    98 
    97     // If the parent of the engine is set to be the
       
    98     // HbApplication, then for some reason the engine won't be deleted
       
    99     // on shutdown (or at least there will be no traces visible of it)
       
   100     //eng->setParent(&app); // HbApplication will now own the engine
       
   101 
       
   102     OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" );
    99     OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" );
   103     HbMainWindow mainWindow(0, Hb::WindowFlagTransparent |
   100     HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent |
   104                                Hb::WindowFlagNoBackground);
   101                                                    Hb::WindowFlagNoBackground);
   105     mainWindow.setAttribute(Qt::WA_NoBackground);
   102     mainWindow->setAttribute(Qt::WA_NoBackground);
   106     OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 0" );
   103     OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 0" );
   107 
   104 
   108     OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" );
   105     OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" );
   109     CxuiViewManager viewManager(app, mainWindow, *eng);
   106     CxuiViewManager *viewManager = new CxuiViewManager(app, *mainWindow, *eng);
   110     OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" );
   107     OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" );
   111 
   108 
   112     // Setting the viewmanager as the parent of the engine fixes the deletion issue
       
   113     eng->setParent(&viewManager);
       
   114 
       
   115     OstTrace0( camerax_performance, DUP13__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 1" );
   109     OstTrace0( camerax_performance, DUP13__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 1" );
   116     mainWindow.setOrientation(Qt::Horizontal);
   110     mainWindow->setOrientation(Qt::Horizontal);
   117     OstTrace0( camerax_performance, DUP14__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 0" );
   111     OstTrace0( camerax_performance, DUP14__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 0" );
   118 
   112 
   119     OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
   113     OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
   120     mainWindow.showFullScreen();
   114     mainWindow->showFullScreen();
   121     OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
   115     OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
   122 
   116 
   123     OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
   117     OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
   124     viewManager.prepareWindow();
   118     viewManager->prepareWindow();
   125     OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
   119     OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
   126 
   120     //! @todo initMode call added here as a temporary hack to change the startup sequence
       
   121 	// in order to avoid GOOM issues
       
   122 	  User::After(2000000);
       
   123     eng->initMode(Cxe::ImageMode);
   127     int returnValue = app.exec();
   124     int returnValue = app.exec();
   128 
   125 
   129     // delete service provider instance
   126     // delete service provider instance
   130     CxuiServiceProvider::destroy();
   127     CxuiServiceProvider::destroy();
   131 
   128 
       
   129     delete viewManager;
       
   130     delete mainWindow;
       
   131     delete eng;
       
   132 
   132     return returnValue;
   133     return returnValue;
   133 }
   134 }