author | hgs |
Thu, 15 Jul 2010 01:49:11 +0300 | |
changeset 40 | 2922f70fca82 |
parent 39 | c5025ea871a1 |
child 41 | 67457b2ffb33 |
permissions | -rw-r--r-- |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
28 | 17 |
|
18 |
#include <coemain.h> |
|
19 |
#include <eikenv.h> |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QApplication> |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <QGraphicsProxyWidget> |
28 | 22 |
// needed for localization |
40 | 23 |
#include <HbTranslator> |
28 | 24 |
#include <QLocale> |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <hbmainwindow.h> |
28 | 26 |
#include <xqserviceutil.h> |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include "cxeengine.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include "cxecameradevicecontrol.h" |
28 | 30 |
#include "cxuiapplication.h" |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include "cxuiviewmanager.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include "cxutils.h" |
28 | 33 |
#include "cxuiserviceprovider.h" |
34 |
||
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include "OstTraceDefinitions.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#ifdef OST_TRACE_COMPILER_IN_USE |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include "mainTraces.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#endif |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
28 | 40 |
using namespace Cxe; |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
|
28 | 42 |
// CONSTANTS |
40 | 43 |
const QString TRANSLATIONS_PATH = "/resource/qt/translations/"; |
44 |
const QString TRANSLATIONS_FILE = "camera"; |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
int main(int argc, char *argv[]) |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
{ |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
CX_DEBUG(("CxUI: entering main()")); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
OstTrace0( camerax_performance, _MAIN, "msg: e_CX_STARTUP 1" ); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
Q_INIT_RESOURCE(cxui); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
|
39 | 53 |
// Use software rendering / raster graphics system to save GPU memory. |
54 |
CX_DEBUG(("CxUI: Take raster graphics system into use..")); |
|
55 |
QApplication::setGraphicsSystem("raster"); |
|
56 |
CX_DEBUG(("CxUI: ..raster graphics system in use")); |
|
57 |
||
28 | 58 |
OstTrace0( camerax_performance, DUP1__MAIN, "msg: e_CX_HBAPP_CREATION 1" ); |
59 |
CxuiApplication app(argc, argv); |
|
60 |
OstTrace0( camerax_performance, DUP2__MAIN, "msg: e_CX_HBAPP_CREATION 0" ); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
// Creating and initializing engine as early as possible. |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// Reserve and power on can then proceed in parallel with |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
// ui construction. |
28 | 65 |
OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" ); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
CxeEngine *eng = CxeEngine::createEngine(); |
28 | 67 |
OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" ); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
if (XQServiceUtil::isService()) { |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
// Embedded mode. Engine is inited to correct mode |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
// by service provider when request arrives |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
CX_DEBUG(("CxUI: creating serviceprovider")); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
CxuiServiceProvider::create(eng); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
CX_DEBUG(("CxUI: done")); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
} else { |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
// Normal mode. Init engine now. |
28 | 77 |
OstTrace0( camerax_performance, DUP9__MAIN, "msg: e_CX_INIT_ENGINE 1" ); |
78 |
//! @todo temporarily commented as part of a hack to change the startup sequence |
|
79 |
// to avoid GOOM issues |
|
80 |
//eng->initMode(Cxe::ImageMode); |
|
81 |
OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" ); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
} |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
|
40 | 84 |
// Load language specific application localization file, e.g. "camera_en.qm" |
85 |
CX_DEBUG(("CxUI: Load translations..")); |
|
28 | 86 |
OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" ); |
40 | 87 |
HbTranslator* trans = new HbTranslator(TRANSLATIONS_PATH, TRANSLATIONS_FILE); |
88 |
// Load language specific common localization file |
|
89 |
trans->loadCommon(); |
|
28 | 90 |
OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" ); |
40 | 91 |
CX_DEBUG(("CxUI: ..translations loaded")); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
|
28 | 93 |
OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" ); |
94 |
HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent | |
|
95 |
Hb::WindowFlagNoBackground); |
|
96 |
mainWindow->setAttribute(Qt::WA_NoBackground); |
|
97 |
OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 0" ); |
|
98 |
||
99 |
OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" ); |
|
100 |
CxuiViewManager *viewManager = new CxuiViewManager(app, *mainWindow, *eng); |
|
101 |
OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" ); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
|
28 | 103 |
OstTrace0( camerax_performance, DUP13__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 1" ); |
104 |
mainWindow->setOrientation(Qt::Horizontal); |
|
105 |
OstTrace0( camerax_performance, DUP14__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 0" ); |
|
106 |
||
107 |
OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" ); |
|
108 |
mainWindow->showFullScreen(); |
|
109 |
OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" ); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
|
28 | 111 |
OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" ); |
112 |
viewManager->prepareWindow(); |
|
113 |
OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" ); |
|
114 |
//! @todo initMode call added here as a temporary hack to change the startup sequence |
|
115 |
// in order to avoid GOOM issues |
|
40 | 116 |
if (viewManager->proceedStartup()) { |
117 |
User::After(2000000); |
|
118 |
eng->initMode(Cxe::ImageMode); |
|
119 |
} |
|
120 |
||
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
int returnValue = app.exec(); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
// delete service provider instance |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
CxuiServiceProvider::destroy(); |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
|
28 | 126 |
delete viewManager; |
127 |
delete mainWindow; |
|
40 | 128 |
delete trans; |
28 | 129 |
delete eng; |
130 |
||
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
return returnValue; |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
} |