|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 // User includes |
|
19 #include "radioapplication.h" |
|
20 #include "radiomainwindow.h" |
|
21 #include "radiouiengine.h" |
|
22 #include "radiolocalization.h" |
|
23 #include "radio_global.h" |
|
24 #include "radiologger.h" |
|
25 |
|
26 #ifdef BUILD_WIN32 |
|
27 # include "testwindow_win32.h" |
|
28 # define CREATE_WIN32_TEST_WINDOW \ |
|
29 mWin32Window.reset( new Win32Window() ); \ |
|
30 mMainWindow->setParent( mWin32Window.data() ); \ |
|
31 mWin32Window->addHbWindow( mMainWindow.data() ); \ |
|
32 mWin32Window->show(); |
|
33 # define INIT_WIN32_TEST_WINDOW \ |
|
34 mWin32Window->init(); |
|
35 #else |
|
36 # define CREATE_WIN32_TEST_WINDOW |
|
37 # define INIT_WIN32_TEST_WINDOW |
|
38 #endif // BUILD_WIN32 |
|
39 |
|
40 /*! |
|
41 * Constructor |
|
42 */ |
|
43 RadioApplication::RadioApplication( int argc, char* argv[] ) : |
|
44 HbApplication( argc, argv ), |
|
45 mUiEngine( 0 ) |
|
46 { |
|
47 // Initializes the radio engine utils if UI logs are entered into the engine log |
|
48 INIT_COMBINED_LOGGER |
|
49 |
|
50 LOG_TIMESTAMP( "Start radio" ); |
|
51 setApplicationName( TRANSLATE( KApplicationName ) ); |
|
52 |
|
53 // MainWindow needs to be alive to be able to show the offline query dialog. |
|
54 // The window is only constructed half-way at this point because we may need to shut down if |
|
55 // offline usage is not allowed |
|
56 mMainWindow = RadioMainWindowPtr( new RadioMainWindow() ); |
|
57 |
|
58 CREATE_WIN32_TEST_WINDOW |
|
59 |
|
60 if ( RadioUiEngine::isOfflineProfile() && !mMainWindow->isOfflineUsageAllowed() ) { |
|
61 quit(); |
|
62 return; |
|
63 } |
|
64 |
|
65 // Start the engine |
|
66 mUiEngine = new RadioUiEngine( this ); |
|
67 if ( !mUiEngine->startRadio() ) { |
|
68 mMainWindow->showErrorMessage( TRANSLATE( KErrorEngineStartFailed ) ); |
|
69 quit(); |
|
70 return; |
|
71 } |
|
72 |
|
73 INIT_WIN32_TEST_WINDOW |
|
74 |
|
75 // Construct the real views |
|
76 mMainWindow->init( mUiEngine ); |
|
77 |
|
78 mMainWindow->show(); |
|
79 } |
|
80 |
|
81 /*! |
|
82 * |
|
83 */ |
|
84 RadioApplication::~RadioApplication() |
|
85 { |
|
86 // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor. |
|
87 |
|
88 // Releases the radio engine utils if it was initialized in the beginning |
|
89 RELEASE_COMBINED_LOGGER |
|
90 } |