38 #endif // BUILD_WIN32 |
41 #endif // BUILD_WIN32 |
39 |
42 |
40 /*! |
43 /*! |
41 * Constructor |
44 * Constructor |
42 */ |
45 */ |
43 RadioApplication::RadioApplication( int argc, char* argv[] ) : |
46 RadioApplication::RadioApplication( int &argc, char *argv[] ) : |
44 HbApplication( argc, argv ), |
47 HbApplication( argc, argv ), |
45 mUiEngine( 0 ) |
48 mUiEngine( 0 ) |
46 { |
49 { |
47 // Initializes the radio engine utils if UI logs are entered into the engine log |
50 // Initializes the radio engine utils if UI logs are entered into the engine log |
48 INIT_COMBINED_LOGGER |
51 INIT_COMBINED_LOGGER |
49 |
52 |
50 LOG_TIMESTAMP( "Start radio" ); |
53 LOG_TIMESTAMP( "Start radio" ); |
51 setApplicationName( TRANSLATE( KApplicationName ) ); |
54 setApplicationName( hbTrId( "txt_rad_title_fm_radio" ) ); |
52 |
55 |
53 // MainWindow needs to be alive to be able to show the offline query dialog. |
56 // 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 |
57 // The window is only constructed half-way at this point because we may need to shut down if |
55 // offline usage is not allowed |
58 // offline usage is not allowed |
56 mMainWindow = RadioMainWindowPtr( new RadioMainWindow() ); |
59 mMainWindow = RadioMainWindowPtr( new RadioMainWindow() ); |
57 |
60 |
58 CREATE_WIN32_TEST_WINDOW |
61 CREATE_WIN32_TEST_WINDOW |
59 |
62 |
60 if ( RadioUiEngine::isOfflineProfile() && !mMainWindow->isOfflineUsageAllowed() ) { |
63 QTimer::singleShot( 0, this, SLOT(init()) ); |
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 } |
64 } |
80 |
65 |
81 /*! |
66 /*! |
82 * |
67 * |
83 */ |
68 */ |
84 RadioApplication::~RadioApplication() |
69 RadioApplication::~RadioApplication() |
85 { |
70 { |
86 // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor. |
71 // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor. |
87 |
|
88 // Releases the radio engine utils if it was initialized in the beginning |
72 // Releases the radio engine utils if it was initialized in the beginning |
89 RELEASE_COMBINED_LOGGER |
73 RELEASE_COMBINED_LOGGER |
90 } |
74 } |
|
75 |
|
76 /*! |
|
77 *Private slot |
|
78 * |
|
79 */ |
|
80 void RadioApplication::init() |
|
81 { |
|
82 if ( RadioUiEngine::isOfflineProfile() && !mMainWindow->isOfflineUsageAllowed() ) { |
|
83 quit(); |
|
84 return; |
|
85 } |
|
86 |
|
87 // Start the engine |
|
88 mUiEngine = new RadioUiEngine( this ); |
|
89 if ( !mUiEngine->startRadio() ) { |
|
90 mMainWindow->showErrorMessage( TRANSLATE( KErrorEngineStartFailed ) ); |
|
91 quit(); |
|
92 return; |
|
93 } |
|
94 |
|
95 INIT_WIN32_TEST_WINDOW |
|
96 |
|
97 // Construct the real views |
|
98 mMainWindow->init( mUiEngine ); |
|
99 |
|
100 mMainWindow->show(); |
|
101 } |