208 MpEngine::~MpEngine() |
201 MpEngine::~MpEngine() |
209 { |
202 { |
210 TX_ENTRY |
203 TX_ENTRY |
211 delete mMediaKeyHandler; |
204 delete mMediaKeyHandler; |
212 delete mMpxPlaybackWrapper; |
205 delete mMpxPlaybackWrapper; |
213 delete mMpxDetailsWrapper; |
|
214 delete mMpxHarvesterWrapper; |
206 delete mMpxHarvesterWrapper; |
215 delete mMpxCollectionWrapper; |
207 delete mMpxCollectionWrapper; |
216 delete mAudioEffectsWrapper; |
208 delete mAudioEffectsWrapper; |
217 delete mEqualizerWrapper; |
209 delete mEqualizerWrapper; |
218 delete mSongScanner; |
210 delete mSongScanner; |
|
211 delete mSongData; |
219 TX_EXIT |
212 TX_EXIT |
220 } |
213 } |
221 |
214 |
222 /*! |
215 /*! |
223 Initialize engine |
216 Initialize engine |
224 */ |
217 */ |
225 void MpEngine::initialize( TUid hostUid, EngineMode mode ) |
218 void MpEngine::initialize( TUid hostUid, EngineMode mode ) |
226 { |
219 { |
227 TX_ENTRY |
220 TX_ENTRY_ARGS("hostUid=" << hostUid.iUid << ", mode=" << mode); |
228 mHostUid = hostUid; |
221 mHostUid = hostUid; |
229 |
222 mMediaKeyHandler = new MpMediaKeyHandler(); |
230 if( mode == StandAlone || mode == Fetch ){ |
223 |
|
224 if ( StandAlone == mode ) { |
|
225 mSongData = new MpSongData(); |
|
226 |
231 // Harvesting Wrapper |
227 // Harvesting Wrapper |
232 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
228 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
233 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
229 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
234 this, SLOT( handleScanStarted() ), Qt::QueuedConnection ); |
230 this, SLOT( handleScanStarted() ), |
235 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
231 Qt::QueuedConnection ); |
236 this, SLOT( handleScanEnded(int, int) ), Qt::QueuedConnection ); |
232 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
|
233 this, SLOT( handleScanEnded(int, int) ), |
|
234 Qt::QueuedConnection ); |
237 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
235 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
238 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
236 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
239 this, SLOT( handleDiskEvent(MpxDiskEvents) ), Qt::QueuedConnection ); |
237 this, SLOT( handleDiskEvent(MpxDiskEvents) ), |
|
238 Qt::QueuedConnection ); |
240 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
239 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
241 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
240 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
242 this, SLOT( handleUsbEvent(MpxUsbEvents) ), Qt::QueuedConnection ); |
241 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
243 mMediaKeyHandler = new MpMediaKeyHandler(); |
242 Qt::QueuedConnection ); |
244 } |
243 |
245 |
|
246 if ( mode == StandAlone || mode == Fetch || mode == MediaBrowsing) { |
|
247 |
|
248 // Collection Wrapper |
244 // Collection Wrapper |
249 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid ); |
245 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, mSongData ); |
250 |
|
251 //disabling these since fetch mode plays only one song at a time. |
|
252 mMpxCollectionWrapper->setRepeatFeatureEnabled( mode != Fetch ); |
|
253 mMpxCollectionWrapper->setShuffleFeatureEnabled( mode != Fetch ); |
|
254 |
|
255 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
246 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
256 this, SIGNAL( collectionPlaylistOpened() ), |
247 this, SIGNAL( collectionPlaylistOpened() ), |
257 Qt::QueuedConnection ); |
248 Qt::QueuedConnection ); |
258 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs( int ) ), |
249 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ), |
259 this, SIGNAL( aboutToAddSongs( int ) ) ); |
250 this, SIGNAL( aboutToAddSongs(int) ) ); |
260 connect( mMpxCollectionWrapper, SIGNAL( playlistSaved( bool ) ), |
251 connect( mMpxCollectionWrapper, SIGNAL( playlistSaved(bool) ), |
261 this, SIGNAL( playlistSaved( bool ) ), |
252 this, SIGNAL( playlistSaved(bool) ), |
262 Qt::QueuedConnection ); |
253 Qt::QueuedConnection ); |
263 connect( mMpxCollectionWrapper, SIGNAL( playlistsRenamed( bool ) ), |
254 connect( mMpxCollectionWrapper, SIGNAL( playlistsRenamed(bool) ), |
264 this, SIGNAL( playlistsRenamed( bool ) ), |
255 this, SIGNAL( playlistsRenamed(bool) ), |
265 Qt::QueuedConnection ); |
256 Qt::QueuedConnection ); |
266 connect( mMpxCollectionWrapper, SIGNAL( isolatedCollectionOpened( MpMpxCollectionData* ) ), |
257 connect( mMpxCollectionWrapper, SIGNAL( isolatedCollectionOpened(MpMpxCollectionData*) ), |
267 this, SIGNAL( isolatedCollectionOpened( MpMpxCollectionData* ) ), |
258 this, SIGNAL( isolatedCollectionOpened(MpMpxCollectionData*) ), |
268 Qt::QueuedConnection ); |
259 Qt::QueuedConnection ); |
269 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
260 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
270 this, SIGNAL( containerContentsChanged() ), |
261 this, SIGNAL( containerContentsChanged() ), |
271 Qt::QueuedConnection ); |
262 Qt::QueuedConnection ); |
272 connect( mMpxCollectionWrapper, SIGNAL( deleteStarted( TCollectionContext, int ) ), |
263 connect( mMpxCollectionWrapper, SIGNAL( deleteStarted(TCollectionContext, int) ), |
273 this, SLOT( handleDeleteStarted( TCollectionContext, int ) ) ); |
264 this, SLOT( handleDeleteStarted(TCollectionContext, int) ) ); |
274 connect( mMpxCollectionWrapper, SIGNAL( songsDeleted( bool ) ), |
265 connect( mMpxCollectionWrapper, SIGNAL( songsDeleted(bool) ), |
275 this, SLOT( handleDeleteEnded( bool ) ), |
266 this, SLOT( handleDeleteEnded(bool) ), |
276 Qt::QueuedConnection ); |
267 Qt::QueuedConnection ); |
277 connect( mMpxCollectionWrapper, SIGNAL( restorePathFailed() ), |
268 connect( mMpxCollectionWrapper, SIGNAL( restorePathFailed() ), |
278 this, SIGNAL( restorePathFailed() ), |
269 this, SIGNAL( restorePathFailed() ), |
279 Qt::QueuedConnection ); |
270 Qt::QueuedConnection ); |
280 } |
271 // Equalizer wrapper; this needs to be created before playback wrapper. |
281 |
|
282 if( mode == StandAlone ){ |
|
283 // Equalizer wrapper , this needs to be created before playback wrapper. |
|
284 mEqualizerWrapper = new MpEqualizerFrameworkWrapper(); |
272 mEqualizerWrapper = new MpEqualizerFrameworkWrapper(); |
285 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
273 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
286 this, SLOT( handleEqualizerReady() ), Qt::QueuedConnection ); |
274 this, SLOT( handleEqualizerReady() ), |
287 } |
275 Qt::QueuedConnection ); |
288 |
276 |
289 if ( mode == StandAlone || mode == Fetch || mode == Embedded ) { |
277 // Playback Wrapper |
290 // Playback Wrapper |
278 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
291 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid ); |
279 |
292 |
|
293 // Details Wrapper |
|
294 mMpxDetailsWrapper = new MpMpxDetailsFrameworkWrapper( mHostUid ); |
|
295 } |
|
296 |
|
297 if( mode == StandAlone ){ |
|
298 // AudioEffects wrapper |
280 // AudioEffects wrapper |
299 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
281 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
|
282 } |
|
283 else if ( Fetch == mode ) { |
|
284 // Harvesting Wrapper |
|
285 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
|
286 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
|
287 this, SLOT( handleScanStarted() ), |
|
288 Qt::QueuedConnection ); |
|
289 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
|
290 this, SLOT( handleScanEnded(int, int) ), |
|
291 Qt::QueuedConnection ); |
|
292 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
|
293 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
|
294 this, SLOT( handleDiskEvent(MpxDiskEvents) ), |
|
295 Qt::QueuedConnection ); |
|
296 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
|
297 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
|
298 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
|
299 Qt::QueuedConnection ); |
|
300 |
|
301 // Collection Wrapper |
|
302 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
|
303 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
|
304 this, SIGNAL( collectionPlaylistOpened() ), |
|
305 Qt::QueuedConnection ); |
|
306 // Disabling these since fetch mode plays only one song at a time. |
|
307 mMpxCollectionWrapper->setRepeatFeatureEnabled( false ); |
|
308 mMpxCollectionWrapper->setShuffleFeatureEnabled( false ); |
|
309 |
|
310 // Playback Wrapper |
|
311 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, 0 ); |
|
312 } |
|
313 else if ( MediaBrowsing == mode ) { |
|
314 // Collection Wrapper |
|
315 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
|
316 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
|
317 this, SIGNAL( collectionPlaylistOpened() ), |
|
318 Qt::QueuedConnection ); |
|
319 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
|
320 this, SIGNAL( containerContentsChanged() ), |
|
321 Qt::QueuedConnection ); |
|
322 } |
|
323 else if ( Embedded == mode ) { |
|
324 mSongData = new MpSongData(); |
|
325 // Playback Wrapper |
|
326 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
300 } |
327 } |
301 TX_EXIT |
328 TX_EXIT |
302 } |
329 } |
303 |
330 |
304 /*! |
331 /*! |